yaozhixue il y a 1 an
Parent
commit
83822e0223

+ 60 - 38
src/main/java/com/zfire/jiasm/syncdata/service/impl/GLPPXSLXDownloadServiceImpl.java

@@ -52,55 +52,29 @@ public class GLPPXSLXDownloadServiceImpl implements GLPPXSLXDownloadService {
         List<SysDict> oldSysDictRec =  sysDictService.lambdaQuery().eq(SysDict::getDictType, DictTypeEnum.DICT_TYPE_SALE_TYPE.getCode()).list();
         Map<String, List<SysDict>> oldSysDictRecMap = oldSysDictRec.stream().collect(Collectors.groupingBy(SysDict::getDictCode));
 
-        Boolean flag = Boolean.FALSE;
+
 
         // 获取新增的
         if (addRec.size()>0){
             for (ItfTblAzAssignXslxDowload item : addRec){
-                SysDict v = new SysDict();
-                v.setSysDictId(UUID.randomUUID().toString());
-                v.setDictType(DictTypeEnum.DICT_TYPE_SALE_TYPE.getCode());
-                v.setDictCode(String.valueOf(item.getXslxid()));
-                v.setDictValue(item.getXslxmc());
-                v.setStatus(DictTypeEnum.DICT_TYPE_OFF.getCode());
-                if (item.getFlag().equals(DictTypeEnum.DICT_TYPE_FLAG_ON.getCode())){
-                    v.setStatus(DictTypeEnum.DICT_TYPE_ON.getCode());
-                }
-                v.setSortNum(item.getPxdj());
-                v.setCreateTime(new Date());
-                if (item.getCjdt() !=null){
-                    v.setCreateTime(item.getCjdt());
+                if (!oldSysDictRecMap.containsKey(String.valueOf(item.getXslxid()))){
+                    // 新增
+                    addXslx(addSysDict, item);
+                } else {
+                    // 修改
+                    upXslx(updateSysDict, oldSysDictRecMap, item);
                 }
-                addSysDict.add(v);
             }
         }
         // 获取修改的
         if (updateRec.size()>0){
             for (ItfTblAzAssignXslxDowload item : updateRec){
-                flag = Boolean.FALSE;
-                SysDict v = oldSysDictRecMap.get(String.valueOf(item.getXslxid())).get(0);
-                if (!v.getDictValue().equals(item.getXslxmc())){
-                    v.setDictValue(item.getXslxmc());
-                    flag = Boolean.TRUE;
-                }
-                // 修改的为有效
-                if (item.getFlag().equals(DictTypeEnum.DICT_TYPE_FLAG_ON.getCode())){
-                    if (v.getStatus().equals(DictTypeEnum.DICT_TYPE_OFF.getCode())){
-                        v.setStatus(DictTypeEnum.DICT_TYPE_ON.getCode());
-                        flag = Boolean.TRUE;
-                    }
+                // 修改
+                if (oldSysDictRecMap.containsKey(String.valueOf(item.getXslxid()))){
+                    upXslx(updateSysDict, oldSysDictRecMap, item);
                 } else {
-                    if (v.getStatus().equals(DictTypeEnum.DICT_TYPE_ON.getCode())){
-                        v.setStatus(DictTypeEnum.DICT_TYPE_OFF.getCode());
-                        flag = Boolean.TRUE;
-                    }
-                }
-                if (v.getSortNum() != item.getPxdj()){
-                    v.setSortNum(item.getPxdj());
-                    flag = Boolean.TRUE;
-                }
-                if (flag){
-                    updateSysDict.add(v);
+                    // 新增
+                    addXslx(addSysDict, item);
                 }
             }
         }
@@ -119,6 +93,54 @@ public class GLPPXSLXDownloadServiceImpl implements GLPPXSLXDownloadService {
         }
     }
 
+    private void upXslx(List<SysDict> updateSysDict, Map<String, List<SysDict>> oldSysDictRecMap, ItfTblAzAssignXslxDowload item) {
+        Boolean flag = Boolean.FALSE;
+        flag = Boolean.FALSE;
+
+        SysDict v = oldSysDictRecMap.get(String.valueOf(item.getXslxid())).get(0);
+        if (!v.getDictValue().equals(item.getXslxmc())){
+            v.setDictValue(item.getXslxmc());
+            flag = Boolean.TRUE;
+        }
+        // 修改的为有效
+        if (item.getFlag().equals(DictTypeEnum.DICT_TYPE_FLAG_ON.getCode())){
+            if (v.getStatus().equals(DictTypeEnum.DICT_TYPE_OFF.getCode())){
+                v.setStatus(DictTypeEnum.DICT_TYPE_ON.getCode());
+                flag = Boolean.TRUE;
+            }
+        } else {
+            if (v.getStatus().equals(DictTypeEnum.DICT_TYPE_ON.getCode())){
+                v.setStatus(DictTypeEnum.DICT_TYPE_OFF.getCode());
+                flag = Boolean.TRUE;
+            }
+        }
+        if (v.getSortNum() != item.getPxdj()){
+            v.setSortNum(item.getPxdj());
+            flag = Boolean.TRUE;
+        }
+        if (flag){
+            updateSysDict.add(v);
+        }
+    }
+
+    private void addXslx(List<SysDict> addSysDict, ItfTblAzAssignXslxDowload item) {
+        SysDict v = new SysDict();
+        v.setSysDictId(UUID.randomUUID().toString());
+        v.setDictType(DictTypeEnum.DICT_TYPE_SALE_TYPE.getCode());
+        v.setDictCode(String.valueOf(item.getXslxid()));
+        v.setDictValue(item.getXslxmc());
+        v.setStatus(DictTypeEnum.DICT_TYPE_OFF.getCode());
+        if (item.getFlag().equals(DictTypeEnum.DICT_TYPE_FLAG_ON.getCode())){
+            v.setStatus(DictTypeEnum.DICT_TYPE_ON.getCode());
+        }
+        v.setSortNum(item.getPxdj());
+        v.setCreateTime(new Date());
+        if (item.getCjdt() !=null){
+            v.setCreateTime(item.getCjdt());
+        }
+        addSysDict.add(v);
+    }
+
     private void extractedXSLXAddOrUpdate(JSONArray jsonArray, List<ItfTblAzAssignXslxDowload> addRec, List<ItfTblAzAssignXslxDowload> updateRec) {
         Boolean flag = Boolean.FALSE;
         String synTaskNo = UUID.randomUUID().toString();

+ 1 - 1
src/main/resources/bootstrap-test.properties

@@ -330,7 +330,7 @@ lbxlc=TRUE
 lbxltc=TRUE
 lbjxc=TRUE
 #销售类型
-azxslxc=TRUE
+azxslxc=FALSE
 #需求类别 需求大类、小类
 xqdlc=TRUE
 xqxlc=TRUE