Browse Source

凯和保存历史信息逻辑修改

lazhaoqian 4 years ago
parent
commit
fcee896ae6

+ 18 - 25
ruoyi-shipping/src/main/java/com/ruoyi/shipping/service/impl/TCntrnoServiceImpl.java

@@ -91,12 +91,11 @@ public class TCntrnoServiceImpl implements ITCntrnoService
         int update = 0;
         if (CollectionUtils.isNotEmpty(tCntrno)){
             for (TCntrno cntrno : tCntrno) {
-                TCntrno tCntrnoById = tCntrnoMapper.selectTCntrnoById(cntrno.getfId());
-                tCntrnoById.setUpdateTime(DateUtils.getNowDate());
-                tCntrnoById.setUpdateBy(SecurityUtils.getUsername());
+                cntrno.setUpdateTime(DateUtils.getNowDate());
+                cntrno.setUpdateBy(SecurityUtils.getUsername());
                 //最新时间
                 if (cntrno.getFoldtime() == null){
-                    cntrno.setfUpdatetime(new Date());
+                    cntrno.setfUpdatetime(DateUtils.getNowDate());
                 }else {
                     cntrno.setfUpdatetime(cntrno.getFoldtime());
                 }
@@ -112,21 +111,17 @@ public class TCntrnoServiceImpl implements ITCntrnoService
                 if (StringUtils.isNotEmpty(cntrno.getFoldFCntrstatus())){
                     cntrno.setfCntrstatus(cntrno.getFoldFCntrstatus());
                 }
-                tCntrnoById.setUpdateBy(SecurityUtils.getUsername());
-                TCntrtracking setfield = setfield(tCntrnoById);
-                setfield.setfId(null);
-                if (setfield.getfStatus().equals("T") ||setfield.getfStatus().equals("正常")){
-                    setfield.setfStatus("T");
+                //更改t_cntro表信息
+                update = tCntrnoMapper.updateTCntrno((cntrno));
+                //保存信息
+                TCntrno cntrnoById = tCntrnoMapper.selectTCntrnoById(cntrno.getfId());
+                if (cntrnoById.getfStatus().equals("T") ||cntrnoById.getfStatus().equals("正常")){
+                    cntrnoById.setfStatus("T");
                 }else {
-                    setfield.setfStatus("F");
+                    cntrnoById.setfStatus("F");
                 }
+                TCntrtracking setfield = setfield(cntrnoById);
                 tCntrtrackingMapper.insertTCntrtracking(setfield);
-                //更改t_cntro表信息
-                if (cntrno.getfUpdatetime() == null){
-                    cntrno.setUpdateTime(DateUtils.getNowDate());
-                }
-                cntrno.setUpdateBy(SecurityUtils.getUsername());
-                update = tCntrnoMapper.updateTCntrno((cntrno));
             }
         }
         return update;
@@ -134,19 +129,17 @@ public class TCntrnoServiceImpl implements ITCntrnoService
 
     @Override
     public int updateTCntrnoMessage(TCntrno tCntrno) {
-        TCntrno tCntrnoById = tCntrnoMapper.selectTCntrnoById(tCntrno.getfId());
-        tCntrnoById.setUpdateTime(DateUtils.getNowDate());
-        tCntrnoById.setUpdateBy(SecurityUtils.getUsername());
-        if (tCntrnoById.getfStatus().equals("T") ||tCntrnoById.getfStatus().equals("正常")){
-            tCntrnoById.setfStatus("T");
+        tCntrno.setUpdateTime(DateUtils.getNowDate());
+        tCntrno.setUpdateBy(SecurityUtils.getUsername());
+        tCntrno.setfUpdatetime(DateUtils.getNowDate());
+        if (tCntrno.getfStatus().equals("T") ||tCntrno.getfStatus().equals("正常")){
+            tCntrno.setfStatus("T");
         }else {
-            tCntrnoById.setfStatus("F");
+            tCntrno.setfStatus("F");
         }
-        TCntrtracking setfield = setfield(tCntrnoById);
+        TCntrtracking setfield = setfield(tCntrno);
         tCntrtrackingMapper.insertTCntrtracking(setfield);
         //更改t_cntro表信息
-        tCntrno.setUpdateTime(DateUtils.getNowDate());
-        tCntrno.setUpdateBy(SecurityUtils.getUsername());
         return tCntrnoMapper.updateTCntrno((tCntrno));
 
     }

+ 1 - 0
ruoyi-shipping/src/main/resources/mapper/shipping/TCntrtrackingMapper.xml

@@ -85,6 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 and tc.create_time <= #{cLoadDate[1]}
             </if>
         </where>
+        ORDER BY tc.f_updatetime desc,tc.f_no
     </select>
     
     <select id="selectTCntrtrackingById" parameterType="Long" resultMap="TCntrtrackingResult">