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