|  |  | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  | import org.springframework.transaction.annotation.Transactional; | 
 |  |  | import org.springframework.transaction.interceptor.TransactionAspectSupport; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2020/7/6 | 
 |  |  |  */ | 
 |  |  | @Service | 
 |  |  | @Transactional | 
 |  |  | public class WorkLogHandler extends AbstractHandler { | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private WrkDetlLogService wrkDetlLogService; | 
 |  |  |  | 
 |  |  |     @Transactional | 
 |  |  |     public void start() { | 
 |  |  |         WrkMast wrkMast = wrkMastService.selectToBeHistoryData(); | 
 |  |  |         if (null == wrkMast) { | 
 |  |  |             return; | 
 |  |  |         try { | 
 |  |  |             WrkMast wrkMast = wrkMastService.selectToBeHistoryData(); | 
 |  |  |             if (null == wrkMast) { | 
 |  |  |                 return; | 
 |  |  |             } | 
 |  |  |             // 保存工作主档历史档 | 
 |  |  |             if (!wrkMastLogService.save(wrkMast.getWrkNo())) { | 
 |  |  |                 exceptionHandle(""); // todo | 
 |  |  |             } | 
 |  |  |             // 删除工作主档 | 
 |  |  |             if (!wrkMastService.deleteById(wrkMast)) { | 
 |  |  |                 exceptionHandle(""); // todo | 
 |  |  |             } | 
 |  |  |             // 保存工作明细档历史档 | 
 |  |  |             if (!wrkDetlLogService.save(wrkMast.getWrkNo())) { | 
 |  |  |                 exceptionHandle(""); // todo | 
 |  |  |             } | 
 |  |  |             // 删除工作明细档 | 
 |  |  |             if (!wrkDetlService.delete(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo()))) { | 
 |  |  |                 exceptionHandle(""); // todo | 
 |  |  |             } | 
 |  |  |         } catch (Exception e) { | 
 |  |  |             e.printStackTrace(); | 
 |  |  |             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); | 
 |  |  |             // todo | 
 |  |  |         } | 
 |  |  |         // 保存工作主档历史档 | 
 |  |  |         if (!wrkMastLogService.save(wrkMast.getWrkNo())) { | 
 |  |  |             exceptionHandle(""); // todo | 
 |  |  |         } | 
 |  |  |         // 删除工作主档 | 
 |  |  |         if (!wrkMastService.deleteById(wrkMast)) { | 
 |  |  |             exceptionHandle(""); // todo | 
 |  |  |         } | 
 |  |  |         // 保存工作明细档历史档 | 
 |  |  |         if (!wrkDetlLogService.save(wrkMast.getWrkNo())) { | 
 |  |  |             exceptionHandle(""); // todo | 
 |  |  |         } | 
 |  |  |         // 删除工作明细档 | 
 |  |  |         if (!wrkDetlService.delete(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo()))) { | 
 |  |  |             exceptionHandle(""); // todo | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } |