|
@@ -71,9 +71,10 @@ public class GLPPXuQiuLeiBieServiceImpl implements GLPPXuQiuLeiBieService {
|
|
|
|
|
|
|
|
|
private void extractedXQXLLocalRefAddOrUpdate(Brand brandRec, List<ItfTblAssignXqxlDowload> addRec, List<ItfTblAssignXqxlDowload> updateRec) {
|
|
|
- Boolean flag = Boolean.FALSE;
|
|
|
+
|
|
|
List<SysDictRef> addSysDictRef = new ArrayList<>();
|
|
|
List<SysDictRef> updateSysDictRef = new ArrayList<>();
|
|
|
+ List<String> dictcodes = new ArrayList<>();
|
|
|
|
|
|
// 提取字典对应关系
|
|
|
List<SysDictRef> oldSysDictRefRec = sysDictRefService.lambdaQuery()
|
|
@@ -84,47 +85,22 @@ public class GLPPXuQiuLeiBieServiceImpl implements GLPPXuQiuLeiBieService {
|
|
|
// 获取新增的
|
|
|
if (addRec.size()>0){
|
|
|
for (ItfTblAssignXqxlDowload item : addRec){
|
|
|
- SysDictRef v = new SysDictRef();
|
|
|
- v.setId(UUID.randomUUID().toString());
|
|
|
- v.setDictType(DictTypeEnum.DICT_TYPE_DEMAND_SMALL_TYPE.getCode());
|
|
|
- v.setDictCode(String.valueOf(item.getId()));
|
|
|
- v.setDictValue(item.getLbmc());
|
|
|
- v.setSortNum(Integer.valueOf(item.getPxdj()));
|
|
|
- v.setBrandId(brandRec.getBrandId());
|
|
|
- v.setRefDictCode(String.valueOf(item.getId()));
|
|
|
- v.setRefDictName(item.getLbmc());
|
|
|
- v.setCreateTime(new Date());
|
|
|
- v.setCreateBy("system");
|
|
|
- addSysDictRef.add(v);
|
|
|
+ if (oldSysDictRefRecMap.containsKey(item.getId()) || dictcodes.contains(item.getId())){
|
|
|
+ upXqxlRef(updateSysDictRef, oldSysDictRefRecMap, item);
|
|
|
+ } else {
|
|
|
+ addXqxlRef(brandRec, addSysDictRef, item);
|
|
|
+ dictcodes.add(String.valueOf(item.getId()));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
// 获取修改的
|
|
|
if (updateRec.size()>0){
|
|
|
for (ItfTblAssignXqxlDowload item : updateRec){
|
|
|
- flag = Boolean.FALSE;
|
|
|
- SysDictRef v = oldSysDictRefRecMap.get(String.valueOf(item.getId())).get(0);
|
|
|
- if (!v.getDictValue().equals(item.getLbmc())){
|
|
|
- v.setDictValue(item.getLbmc());
|
|
|
- flag = Boolean.TRUE;
|
|
|
- }
|
|
|
- if (!v.getRefDictName().equals(item.getLbmc())){
|
|
|
- v.setRefDictName(item.getLbmc());
|
|
|
- flag = Boolean.TRUE;
|
|
|
- }
|
|
|
- if (!v.getSortNum().equals(Integer.valueOf(item.getPxdj()))){
|
|
|
- v.setSortNum(Integer.valueOf(item.getPxdj()));
|
|
|
- flag = Boolean.TRUE;
|
|
|
- }
|
|
|
- if (flag){
|
|
|
- v.setUpdateBy("system");
|
|
|
- v.setUpdateTime(new Date());
|
|
|
- if (item.getLastModifiedBy()!=null){
|
|
|
- v.setUpdateBy(item.getLastModifiedBy());
|
|
|
- }
|
|
|
- if (item.getLastModifiedDate()!=null){
|
|
|
- v.setUpdateTime(item.getLastModifiedDate());
|
|
|
- }
|
|
|
- updateSysDictRef.add(v);
|
|
|
+ if (oldSysDictRefRecMap.containsKey(item.getId()) || dictcodes.contains(item.getId())){
|
|
|
+ upXqxlRef(updateSysDictRef, oldSysDictRefRecMap, item);
|
|
|
+ } else {
|
|
|
+ addXqxlRef(brandRec, addSysDictRef, item);
|
|
|
+ dictcodes.add(String.valueOf(item.getId()));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -139,72 +115,83 @@ public class GLPPXuQiuLeiBieServiceImpl implements GLPPXuQiuLeiBieService {
|
|
|
sysDictRefService.updateBatchById(updateSysDictRef);
|
|
|
log.info("本地字典对应关系信息表更新修改了{}条数据", updateSysDictRef.size());
|
|
|
}
|
|
|
+ dictcodes.clear();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void upXqxlRef(List<SysDictRef> updateSysDictRef, Map<String, List<SysDictRef>> oldSysDictRefRecMap, ItfTblAssignXqxlDowload item) {
|
|
|
+ Boolean flag = Boolean.FALSE;
|
|
|
+ flag = Boolean.FALSE;
|
|
|
+ SysDictRef v = oldSysDictRefRecMap.get(item.getId()).get(0);
|
|
|
+ if (!v.getDictValue().equals(item.getLbmc())){
|
|
|
+ v.setDictValue(item.getLbmc());
|
|
|
+ flag = Boolean.TRUE;
|
|
|
+ }
|
|
|
+ if (!v.getRefDictName().equals(item.getLbmc())){
|
|
|
+ v.setRefDictName(item.getLbmc());
|
|
|
+ flag = Boolean.TRUE;
|
|
|
+ }
|
|
|
+ if (!v.getSortNum().equals(Integer.valueOf(item.getPxdj()))){
|
|
|
+ v.setSortNum(Integer.valueOf(item.getPxdj()));
|
|
|
+ flag = Boolean.TRUE;
|
|
|
+ }
|
|
|
+ if (flag){
|
|
|
+ v.setUpdateBy("system");
|
|
|
+ v.setUpdateTime(new Date());
|
|
|
+ if (item.getLastModifiedBy()!=null){
|
|
|
+ v.setUpdateBy(item.getLastModifiedBy());
|
|
|
+ }
|
|
|
+ if (item.getLastModifiedDate()!=null){
|
|
|
+ v.setUpdateTime(item.getLastModifiedDate());
|
|
|
+ }
|
|
|
+ updateSysDictRef.add(v);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void addXqxlRef(Brand brandRec, List<SysDictRef> addSysDictRef, ItfTblAssignXqxlDowload item) {
|
|
|
+ SysDictRef v = new SysDictRef();
|
|
|
+ v.setId(UUID.randomUUID().toString());
|
|
|
+ v.setDictType(DictTypeEnum.DICT_TYPE_DEMAND_SMALL_TYPE.getCode());
|
|
|
+ v.setDictCode(item.getId());
|
|
|
+ v.setDictValue(item.getLbmc());
|
|
|
+ v.setSortNum(Integer.valueOf(item.getPxdj()));
|
|
|
+ v.setBrandId(brandRec.getBrandId());
|
|
|
+ v.setRefDictCode((item.getId()));
|
|
|
+ v.setRefDictName(item.getLbmc());
|
|
|
+ v.setCreateTime(new Date());
|
|
|
+ v.setCreateBy("system");
|
|
|
+ addSysDictRef.add(v);
|
|
|
}
|
|
|
|
|
|
private void extractedLocalAddOrUPdate(List<ItfTblAssignXqxlDowload> addRec, List<ItfTblAssignXqxlDowload> updateRec) {
|
|
|
List<SysDict> addSysDict = new ArrayList<>();
|
|
|
List<SysDict> updateSysDict = new ArrayList<>();
|
|
|
+ List<String> dictcodes = new ArrayList<>();
|
|
|
|
|
|
// 提取大类字典数据 sysDictService
|
|
|
List<SysDict> oldSysDictRec = sysDictService.lambdaQuery().eq(SysDict::getDictType, DictTypeEnum.DICT_TYPE_DEMAND_SMALL_TYPE.getCode()).list();
|
|
|
Map<String, List<SysDict>> oldSysDictRecMap = oldSysDictRec.stream().collect(Collectors.groupingBy(SysDict::getDictCode));
|
|
|
|
|
|
- Boolean flag = Boolean.FALSE;
|
|
|
+
|
|
|
|
|
|
// 获取新增的
|
|
|
if (addRec.size()>0){
|
|
|
for (ItfTblAssignXqxlDowload item : addRec){
|
|
|
- SysDict v = new SysDict();
|
|
|
- v.setSysDictId(UUID.randomUUID().toString());
|
|
|
- v.setDictType(DictTypeEnum.DICT_TYPE_DEMAND_SMALL_TYPE.getCode());
|
|
|
- v.setDictCode(String.valueOf(item.getId()));
|
|
|
- v.setDictValue(item.getLbmc());
|
|
|
- v.setSortNum(Integer.valueOf(item.getPxdj()));
|
|
|
- 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.setParentDictCode(item.getDaleiid());
|
|
|
- v.setParentDictType(DictTypeEnum.DICT_TYPE_DEMAND_TYPE.getCode());
|
|
|
- v.setCreateTime(new Date());
|
|
|
- if (item.getCreatedDate() !=null){
|
|
|
- v.setCreateTime(item.getCreatedDate());
|
|
|
+ if (oldSysDictRecMap.containsKey(item.getId()) || dictcodes.contains(item.getId())){
|
|
|
+ upXqxl(updateSysDict, oldSysDictRecMap, item);
|
|
|
+ } else {
|
|
|
+ addXqxl(addSysDict, item);
|
|
|
+ dictcodes.add(item.getId());
|
|
|
}
|
|
|
- addSysDict.add(v);
|
|
|
}
|
|
|
}
|
|
|
// 获取修改的
|
|
|
if (updateRec.size()>0){
|
|
|
for (ItfTblAssignXqxlDowload item : updateRec){
|
|
|
- flag = Boolean.FALSE;
|
|
|
- SysDict v = oldSysDictRecMap.get(String.valueOf(item.getId())).get(0);
|
|
|
- if (!v.getDictValue().equals(item.getLbmc())){
|
|
|
- v.setDictValue(item.getLbmc());
|
|
|
- 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(item.getId()) || dictcodes.contains(item.getId())){
|
|
|
+ upXqxl(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().equals(Integer.valueOf(item.getPxdj()))){
|
|
|
- v.setSortNum(Integer.valueOf(item.getPxdj()));
|
|
|
- flag = Boolean.TRUE;
|
|
|
- }
|
|
|
- if (!v.getParentDictCode().equals(item.getDaleiid())){
|
|
|
- v.setParentDictCode(item.getDaleiid());
|
|
|
- flag = Boolean.TRUE;
|
|
|
- }
|
|
|
-
|
|
|
- if (flag){
|
|
|
- updateSysDict.add(v);
|
|
|
+ addXqxl(addSysDict, item);
|
|
|
+ dictcodes.add(item.getId());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -221,6 +208,61 @@ public class GLPPXuQiuLeiBieServiceImpl implements GLPPXuQiuLeiBieService {
|
|
|
log.info("格力品牌需求小类本地字典信息表更新修改了{}条数据", updateSysDict.size());
|
|
|
updateSysDict.clear();
|
|
|
}
|
|
|
+ dictcodes.clear();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void upXqxl(List<SysDict> updateSysDict, Map<String, List<SysDict>> oldSysDictRecMap, ItfTblAssignXqxlDowload item) {
|
|
|
+ Boolean flag = Boolean.FALSE;
|
|
|
+ flag = Boolean.FALSE;
|
|
|
+ SysDict v = oldSysDictRecMap.get(item.getId()).get(0);
|
|
|
+ if (!v.getDictValue().equals(item.getLbmc())){
|
|
|
+ v.setDictValue(item.getLbmc());
|
|
|
+ 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().equals(Integer.valueOf(item.getPxdj()))){
|
|
|
+ v.setSortNum(Integer.valueOf(item.getPxdj()));
|
|
|
+ flag = Boolean.TRUE;
|
|
|
+ }
|
|
|
+ if (!v.getParentDictCode().equals(item.getDaleiid())){
|
|
|
+ v.setParentDictCode(item.getDaleiid());
|
|
|
+ flag = Boolean.TRUE;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (flag){
|
|
|
+ updateSysDict.add(v);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void addXqxl(List<SysDict> addSysDict, ItfTblAssignXqxlDowload item) {
|
|
|
+ SysDict v = new SysDict();
|
|
|
+ v.setSysDictId(UUID.randomUUID().toString());
|
|
|
+ v.setDictType(DictTypeEnum.DICT_TYPE_DEMAND_SMALL_TYPE.getCode());
|
|
|
+ v.setDictCode(item.getId());
|
|
|
+ v.setDictValue(item.getLbmc());
|
|
|
+ v.setSortNum(Integer.valueOf(item.getPxdj()));
|
|
|
+ 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.setParentDictCode(item.getDaleiid());
|
|
|
+ v.setParentDictType(DictTypeEnum.DICT_TYPE_DEMAND_TYPE.getCode());
|
|
|
+ v.setCreateTime(new Date());
|
|
|
+ if (item.getCreatedDate() !=null){
|
|
|
+ v.setCreateTime(item.getCreatedDate());
|
|
|
+ }
|
|
|
+ addSysDict.add(v);
|
|
|
}
|
|
|
|
|
|
private void extractedXQXLAddOrUpdate(JSONArray jsonArray, List<ItfTblAssignXqxlDowload> addRec, List<ItfTblAssignXqxlDowload> updateRec) {
|
|
@@ -310,9 +352,9 @@ public class GLPPXuQiuLeiBieServiceImpl implements GLPPXuQiuLeiBieService {
|
|
|
}
|
|
|
|
|
|
private void extractedLocalRefAddOrUpdate(Brand brandRec, List<ItfTblAssignXxlbDowload> addRec, List<ItfTblAssignXxlbDowload> updateRec) {
|
|
|
- Boolean flag = Boolean.FALSE;
|
|
|
List<SysDictRef> addSysDictRef = new ArrayList<>();
|
|
|
List<SysDictRef> updateSysDictRef = new ArrayList<>();
|
|
|
+ List<String> dictcodes = new ArrayList<>();
|
|
|
|
|
|
// 提取字典对应关系
|
|
|
List<SysDictRef> oldSysDictRefRec = sysDictRefService.lambdaQuery()
|
|
@@ -323,47 +365,24 @@ public class GLPPXuQiuLeiBieServiceImpl implements GLPPXuQiuLeiBieService {
|
|
|
// 获取新增的
|
|
|
if (addRec.size()>0){
|
|
|
for (ItfTblAssignXxlbDowload item : addRec){
|
|
|
- SysDictRef v = new SysDictRef();
|
|
|
- v.setId(UUID.randomUUID().toString());
|
|
|
- v.setDictType(DictTypeEnum.DICT_TYPE_DEMAND_TYPE.getCode());
|
|
|
- v.setDictCode(String.valueOf(item.getLbid()));
|
|
|
- v.setDictValue(item.getLbmc());
|
|
|
- v.setSortNum(item.getPxdj());
|
|
|
- v.setBrandId(brandRec.getBrandId());
|
|
|
- v.setRefDictCode(String.valueOf(item.getLbid()));
|
|
|
- v.setRefDictName(item.getLbmc());
|
|
|
- v.setCreateTime(new Date());
|
|
|
- v.setCreateBy("system");
|
|
|
- addSysDictRef.add(v);
|
|
|
+ if (oldSysDictRefRecMap.containsKey(String.valueOf(item.getLbid())) ||
|
|
|
+ dictcodes.contains(String.valueOf(item.getLbid()))){
|
|
|
+ upXxlRef(updateSysDictRef, oldSysDictRefRecMap, item);
|
|
|
+ } else {
|
|
|
+ addXxlbRef(brandRec, addSysDictRef, item);
|
|
|
+ dictcodes.add(String.valueOf(item.getLbid()));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
// 获取修改的
|
|
|
if (updateRec.size()>0){
|
|
|
for (ItfTblAssignXxlbDowload item : updateRec){
|
|
|
- flag = Boolean.FALSE;
|
|
|
- SysDictRef v = oldSysDictRefRecMap.get(String.valueOf(item.getLbid())).get(0);
|
|
|
- if (!v.getDictValue().equals(item.getLbmc())){
|
|
|
- v.setDictValue(item.getLbmc());
|
|
|
- flag = Boolean.TRUE;
|
|
|
- }
|
|
|
- if (!v.getRefDictName().equals(item.getLbmc())){
|
|
|
- v.setRefDictName(item.getLbmc());
|
|
|
- flag = Boolean.TRUE;
|
|
|
- }
|
|
|
- if (v.getSortNum() != item.getPxdj()){
|
|
|
- v.setSortNum(item.getPxdj());
|
|
|
- flag = Boolean.TRUE;
|
|
|
- }
|
|
|
- if (flag){
|
|
|
- v.setUpdateBy("system");
|
|
|
- v.setUpdateTime(new Date());
|
|
|
- if (item.getLastModifiedBy()!=null){
|
|
|
- v.setUpdateBy(item.getLastModifiedBy());
|
|
|
- }
|
|
|
- if (item.getLastModifiedDate()!=null){
|
|
|
- v.setUpdateTime(item.getLastModifiedDate());
|
|
|
- }
|
|
|
- updateSysDictRef.add(v);
|
|
|
+ if (oldSysDictRefRecMap.containsKey(String.valueOf(item.getLbid())) ||
|
|
|
+ dictcodes.contains(String.valueOf(item.getLbid()))){
|
|
|
+ upXxlRef(updateSysDictRef, oldSysDictRefRecMap, item);
|
|
|
+ } else {
|
|
|
+ addXxlbRef(brandRec, addSysDictRef, item);
|
|
|
+ dictcodes.add(String.valueOf(item.getLbid()));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -380,65 +399,85 @@ public class GLPPXuQiuLeiBieServiceImpl implements GLPPXuQiuLeiBieService {
|
|
|
log.info("本地字典对应关系信息表更新修改了{}条数据", updateSysDictRef.size());
|
|
|
updateSysDictRef.clear();
|
|
|
}
|
|
|
+ dictcodes.clear();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void upXxlRef(List<SysDictRef> updateSysDictRef, Map<String, List<SysDictRef>> oldSysDictRefRecMap, ItfTblAssignXxlbDowload item) {
|
|
|
+ Boolean flag = Boolean.FALSE;
|
|
|
+ flag = Boolean.FALSE;
|
|
|
+ SysDictRef v = oldSysDictRefRecMap.get(String.valueOf(item.getLbid())).get(0);
|
|
|
+ if (!v.getDictValue().equals(item.getLbmc())){
|
|
|
+ v.setDictValue(item.getLbmc());
|
|
|
+ flag = Boolean.TRUE;
|
|
|
+ }
|
|
|
+ if (!v.getRefDictName().equals(item.getLbmc())){
|
|
|
+ v.setRefDictName(item.getLbmc());
|
|
|
+ flag = Boolean.TRUE;
|
|
|
+ }
|
|
|
+ if (v.getSortNum() != item.getPxdj()){
|
|
|
+ v.setSortNum(item.getPxdj());
|
|
|
+ flag = Boolean.TRUE;
|
|
|
+ }
|
|
|
+ if (flag){
|
|
|
+ v.setUpdateBy("system");
|
|
|
+ v.setUpdateTime(new Date());
|
|
|
+ if (item.getLastModifiedBy()!=null){
|
|
|
+ v.setUpdateBy(item.getLastModifiedBy());
|
|
|
+ }
|
|
|
+ if (item.getLastModifiedDate()!=null){
|
|
|
+ v.setUpdateTime(item.getLastModifiedDate());
|
|
|
+ }
|
|
|
+ updateSysDictRef.add(v);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void addXxlbRef(Brand brandRec, List<SysDictRef> addSysDictRef, ItfTblAssignXxlbDowload item) {
|
|
|
+ SysDictRef v = new SysDictRef();
|
|
|
+ v.setId(UUID.randomUUID().toString());
|
|
|
+ v.setDictType(DictTypeEnum.DICT_TYPE_DEMAND_TYPE.getCode());
|
|
|
+ v.setDictCode(String.valueOf(item.getLbid()));
|
|
|
+ v.setDictValue(item.getLbmc());
|
|
|
+ v.setSortNum(item.getPxdj());
|
|
|
+ v.setBrandId(brandRec.getBrandId());
|
|
|
+ v.setRefDictCode(String.valueOf(item.getLbid()));
|
|
|
+ v.setRefDictName(item.getLbmc());
|
|
|
+ v.setCreateTime(new Date());
|
|
|
+ v.setCreateBy("system");
|
|
|
+ addSysDictRef.add(v);
|
|
|
}
|
|
|
|
|
|
private void extractedLocalAddOrUpdate(List<ItfTblAssignXxlbDowload> addRec, List<ItfTblAssignXxlbDowload> updateRec) {
|
|
|
List<SysDict> addSysDict = new ArrayList<>();
|
|
|
List<SysDict> updateSysDict = new ArrayList<>();
|
|
|
+ List<String> dictcodes = new ArrayList<>();
|
|
|
|
|
|
// 提取大类字典数据 sysDictService
|
|
|
List<SysDict> oldSysDictRec = sysDictService.lambdaQuery().eq(SysDict::getDictType, DictTypeEnum.DICT_TYPE_DEMAND_TYPE.getCode()).list();
|
|
|
Map<String, List<SysDict>> oldSysDictRecMap = oldSysDictRec.stream().collect(Collectors.groupingBy(SysDict::getDictCode));
|
|
|
|
|
|
- Boolean flag = Boolean.FALSE;
|
|
|
+
|
|
|
|
|
|
// 获取新增的
|
|
|
if (addRec.size()>0){
|
|
|
for (ItfTblAssignXxlbDowload item : addRec){
|
|
|
- SysDict v = new SysDict();
|
|
|
- v.setSysDictId(UUID.randomUUID().toString());
|
|
|
- v.setDictType(DictTypeEnum.DICT_TYPE_DEMAND_TYPE.getCode());
|
|
|
- v.setDictCode(String.valueOf(item.getLbid()));
|
|
|
- v.setDictValue(item.getLbmc());
|
|
|
- v.setSortNum(item.getPxdj());
|
|
|
- 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.setCreateTime(new Date());
|
|
|
- if (item.getCreatedDate() !=null){
|
|
|
- v.setCreateTime(item.getCreatedDate());
|
|
|
+ if (oldSysDictRecMap.containsKey(String.valueOf(item.getLbid())) ||
|
|
|
+ dictcodes.contains(String.valueOf(item.getLbid()))){
|
|
|
+ addXxlb(addSysDict, item);
|
|
|
+ dictcodes.add(String.valueOf(item.getLbid()));
|
|
|
+ } else {
|
|
|
+ upXxlb(updateSysDict, oldSysDictRecMap, item);
|
|
|
}
|
|
|
- addSysDict.add(v);
|
|
|
}
|
|
|
}
|
|
|
// 获取修改的
|
|
|
if (updateRec.size()>0){
|
|
|
for (ItfTblAssignXxlbDowload item : updateRec){
|
|
|
- flag = Boolean.FALSE;
|
|
|
- SysDict v = oldSysDictRecMap.get(String.valueOf(item.getLbid())).get(0);
|
|
|
- if (!v.getDictValue().equals(item.getLbmc())){
|
|
|
- v.setDictValue(item.getLbmc());
|
|
|
- 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.getLbid())) ||
|
|
|
+ dictcodes.contains(String.valueOf(item.getLbid()))){
|
|
|
+ addXxlb(addSysDict, item);
|
|
|
+ dictcodes.add(String.valueOf(item.getLbid()));
|
|
|
} 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);
|
|
|
+ upXxlb(updateSysDict, oldSysDictRecMap, item);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -453,6 +492,54 @@ public class GLPPXuQiuLeiBieServiceImpl implements GLPPXuQiuLeiBieService {
|
|
|
sysDictService.updateBatchById(updateSysDict);
|
|
|
log.info("格力品牌需求大类本地字典信息表更新修改了{}条数据", updateSysDict.size());
|
|
|
}
|
|
|
+ dictcodes.clear();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void upXxlb(List<SysDict> updateSysDict, Map<String, List<SysDict>> oldSysDictRecMap, ItfTblAssignXxlbDowload item) {
|
|
|
+ Boolean flag = Boolean.FALSE;
|
|
|
+ flag = Boolean.FALSE;
|
|
|
+ SysDict v = oldSysDictRecMap.get(String.valueOf(item.getLbid())).get(0);
|
|
|
+ if (!v.getDictValue().equals(item.getLbmc())){
|
|
|
+ v.setDictValue(item.getLbmc());
|
|
|
+ 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 addXxlb(List<SysDict> addSysDict, ItfTblAssignXxlbDowload item) {
|
|
|
+ SysDict v = new SysDict();
|
|
|
+ v.setSysDictId(UUID.randomUUID().toString());
|
|
|
+ v.setDictType(DictTypeEnum.DICT_TYPE_DEMAND_TYPE.getCode());
|
|
|
+ v.setDictCode(String.valueOf(item.getLbid()));
|
|
|
+ v.setDictValue(item.getLbmc());
|
|
|
+ v.setSortNum(item.getPxdj());
|
|
|
+ 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.setCreateTime(new Date());
|
|
|
+ if (item.getCreatedDate() !=null){
|
|
|
+ v.setCreateTime(item.getCreatedDate());
|
|
|
+ }
|
|
|
+ addSysDict.add(v);
|
|
|
}
|
|
|
|
|
|
private void extractedXQLBAddOrUpdate(JSONArray jsonArray, List<ItfTblAssignXxlbDowload> addRec, List<ItfTblAssignXxlbDowload> updateRec) {
|