| | |
| | | import com.zy.asrs.service.WrkMastLogService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.asrs.task.AbstractHandler; |
| | | import com.zy.asrs.task.ReturnT; |
| | | import com.zy.system.entity.Config; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | * Created by vincent on 2020/7/6 |
| | | */ |
| | | @Service |
| | | public class WorkLogHandler extends AbstractHandler { |
| | | public class WorkLogHandler extends AbstractHandler<Config> { |
| | | |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | |
| | | @Autowired |
| | | private WrkDetlLogService wrkDetlLogService; |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void start() { |
| | | public ReturnT<Config> start() { |
| | | try { |
| | | WrkMast wrkMast = wrkMastService.selectToBeHistoryData(); |
| | | if (null == wrkMast) { |
| | | return; |
| | | return SUCCESS; |
| | | } |
| | | // 保存工作主档历史档 |
| | | if (!wrkMastLogService.save(wrkMast.getWrkNo())) { |
| | | exceptionHandle(""); // todo |
| | | exceptionHandle("保存工作主档历史档失败"); // todo |
| | | } |
| | | // 删除工作主档 |
| | | if (!wrkMastService.deleteById(wrkMast)) { |
| | | exceptionHandle(""); // todo |
| | | if (wrkMastService.deleteById(wrkMast)) { |
| | | exceptionHandle("删除工作主档[workNo={0}]失败", wrkMast.getWrkNo()); // todo |
| | | } |
| | | // 保存工作明细档历史档 |
| | | if (!wrkDetlLogService.save(wrkMast.getWrkNo())) { |
| | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | // todo |
| | | Config config = new Config( |
| | | "name", // 名称[非空] |
| | | "code", // 编码[非空] |
| | | "val", // 对应值[非空] |
| | | (short)1, // 类型[非空] |
| | | (short)1 // 状态[非空] |
| | | ); |
| | | return FAIL.setMsg(e.getMessage()).setContent(config); |
| | | } |
| | | |
| | | return SUCCESS; |
| | | } |
| | | |
| | | } |