明细表更新BUG修复

pull/20/MERGE^2
dxfeng 3 years ago
parent 477df79cd1
commit 3578a0f166

@ -292,6 +292,7 @@ public class CompServiceImpl extends Service implements CompService {
return apiDatas; return apiDatas;
} }
/** /**
* *
* *
@ -299,7 +300,14 @@ public class CompServiceImpl extends Service implements CompService {
* @return * @return
*/ */
private boolean isFilter(CompPO compPO) { private boolean isFilter(CompPO compPO) {
return !(StringUtil.isEmpty(compPO.getCompName()) && StringUtil.isEmpty(compPO.getCompNo()) && null == compPO.getParentCompany() && StringUtil.isEmpty(compPO.getOrgCode()) && null == compPO.getIndustry() && null == compPO.getCompPrincipal() && null == compPO.getForbiddenTag()); return !(StringUtil.isEmpty(compPO.getCompName())
&& StringUtil.isEmpty(compPO.getCompNo())
&& StringUtil.isEmpty(compPO.getCompNameShort())
&& StringUtil.isEmpty(compPO.getOrgCode())
&& null == compPO.getParentCompany()
&& null == compPO.getIndustry()
&& null == compPO.getCompPrincipal()
&& null == compPO.getForbiddenTag());
} }

@ -82,7 +82,7 @@ public class ExtServiceImpl extends Service implements ExtService {
tableMap.put("tabname", getExtendGroupMapper().getGroupNameById(entry.getKey() + "")); tableMap.put("tabname", getExtendGroupMapper().getGroupNameById(entry.getKey() + ""));
Map<String, Object> tabinfoMap = new HashMap<>(); Map<String, Object> tabinfoMap = new HashMap<>();
tabinfoMap.put("columns", ExtendInfoBO.convertInfoListToTable(user, entry.getValue(), viewAttr, showLabel)); tabinfoMap.put("columns", ExtendInfoBO.convertInfoListToTable(user, entry.getValue(), viewAttr, showLabel));
tabinfoMap.put("rownum", "rownum"); tabinfoMap.put("rownum", "rownum" + entry.getKey());
// 浏览按钮添加filespan字段 // 浏览按钮添加filespan字段
String fields = entry.getValue().stream().map(item -> { String fields = entry.getValue().stream().map(item -> {
@ -150,33 +150,32 @@ public class ExtServiceImpl extends Service implements ExtService {
@Override @Override
public void updateExtDT(User user, String extendType, String tableName, Map<String, Object> params, Long id) { public void updateExtDT(User user, String extendType, String tableName, Map<String, Object> params, Long id) {
List<ExtendInfoPO> dtInfoPOList = getExtendInfoMapper().listFields(extendType, "", tableName); List<ExtendInfoPO> dtInfoPOList = getExtendInfoMapper().listFields(extendType, "", "");
List<String> dtFields = dtInfoPOList.stream().map(ExtendInfoPO::getFieldName).collect(Collectors.toList()); Map<Long, String> groups = dtInfoPOList.stream().collect(Collectors.toMap(ExtendInfoPO::getExtendGroupId, ExtendInfoPO::getTableName, (k1, k2) -> k1));
// 删除原有明细表数据
List<Map<String, Object>> insertList = new ArrayList<>(); groups.forEach((k, v) -> {
// 删除明细表数据 if (v.toLowerCase().contains("_dt")) getExtDTMapper().deleteByMainID(v, id);
getExtDTMapper().deleteByMainID(tableName, id); });
// 处理明细表数据
int rowNum = Util.getIntValue((String) params.get("rownum")); for (Map.Entry<Long, String> entry : groups.entrySet()) {
rowNum = 5; int rowNum = Util.getIntValue((String) params.get("rownum" + entry.getKey()));
for (int i = 0; i < rowNum; i++) { List<ExtendInfoPO> filterS = dtInfoPOList.stream().filter(item -> entry.getKey().equals(item.getExtendGroupId())).collect(Collectors.toList());
Map<String, Object> map = new HashMap<>(); for (int i = 0; i < rowNum; i++) {
for (ExtendInfoPO extendInfoPO : dtInfoPOList) { Map<String, Object> map = new HashMap<>();
if (BROWSER_TYPE == extendInfoPO.getControlType()) {
map.put(extendInfoPO.getFieldName() + "span", params.get(extendInfoPO.getFieldName() + "span_" + i)); for (ExtendInfoPO extendInfoPO : filterS) {
if (BROWSER_TYPE == extendInfoPO.getControlType()) {
map.put(extendInfoPO.getFieldName() + "span", params.get(extendInfoPO.getFieldName() + "span_" + i));
}
map.put(extendInfoPO.getFieldName(), params.get(extendInfoPO.getFieldName() + "_" + i));
} }
map.put(extendInfoPO.getFieldName(), params.get(extendInfoPO.getFieldName() + "_" + i)); map.put("mainid", id);
map.put("creator", user.getUID());
map.put("delete_type", 0);
map.put("create_time", new Date());
map.put("update_time", new Date());
getExtDTMapper().insertCompExtDT(entry.getValue(), map);
} }
map.put("mainid", id);
map.put("creator", user.getUID());
map.put("delete_type", 0);
map.put("create_time", new Date());
map.put("update_time", new Date());
insertList.add(map);
}
// 更新拓展表数据
for (Map<String, Object> map : insertList) {
getExtDTMapper().insertCompExtDT(tableName, map);
} }
} }
} }

Loading…
Cancel
Save