|
|
@ -46,6 +46,22 @@ import java.util.stream.Collectors;
|
|
|
|
* @version: 1.0
|
|
|
|
* @version: 1.0
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public class CompServiceImpl extends Service implements CompService {
|
|
|
|
public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 分组类型
|
|
|
|
|
|
|
|
* 1:分部
|
|
|
|
|
|
|
|
* 2:部门
|
|
|
|
|
|
|
|
* 3:岗位
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private static final String EXTEND_TYPE = "1";
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 主表拓展表
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private static final String JCL_ORG_COMPEXT = "JCL_ORG_COMPEXT";
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 明细表拓展表
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private static final String JCL_ORG_COMPEXT_DT1 = "JCL_ORG_COMPEXT_DT1";
|
|
|
|
|
|
|
|
|
|
|
|
private CompMapper getCompMapper() {
|
|
|
|
private CompMapper getCompMapper() {
|
|
|
|
return MapperProxyFactory.getProxy(CompMapper.class);
|
|
|
|
return MapperProxyFactory.getProxy(CompMapper.class);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -122,18 +138,41 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int updateComp(Map<String, Object> params) {
|
|
|
|
public int updateComp(Map<String, Object> params) {
|
|
|
|
CompSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), CompSearchParam.class);
|
|
|
|
CompSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), CompSearchParam.class);
|
|
|
|
// 更新主表数据
|
|
|
|
String groupId = (String) params.get("viewCondition");
|
|
|
|
|
|
|
|
int updateBaseComp = 0;
|
|
|
|
CompPO compPO = CompBO.convertParamToPO(searchParam, (long) user.getUID());
|
|
|
|
CompPO compPO = CompBO.convertParamToPO(searchParam, (long) user.getUID());
|
|
|
|
int updateBaseComp = getCompMapper().updateBaseComp(compPO);
|
|
|
|
if (StringUtil.isEmpty(groupId) || "0".equals(groupId)) {
|
|
|
|
|
|
|
|
// 更新主表数据
|
|
|
|
|
|
|
|
updateBaseComp = getCompMapper().updateBaseComp(compPO);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
List<ExtendInfoPO> extInfoPOList = getExtendInfoMapper().listFields(EXTEND_TYPE, groupId, JCL_ORG_COMPEXT);
|
|
|
|
|
|
|
|
List<String> extFields = extInfoPOList.stream().map(ExtendInfoPO::getFieldName).collect(Collectors.toList());
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
|
|
|
for (String dtField : extFields) {
|
|
|
|
|
|
|
|
map.put(dtField, params.get(dtField));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 判断更新还是插入
|
|
|
|
|
|
|
|
int count = getCompExtMapper().countCompExtById(JCL_ORG_COMPEXT, searchParam.getId());
|
|
|
|
|
|
|
|
if (count > 0) {
|
|
|
|
|
|
|
|
map.put("update_time", compPO.getUpdateTime());
|
|
|
|
|
|
|
|
updateBaseComp = getCompExtMapper().updateCompExt(JCL_ORG_COMPEXT, compPO.getId(), map);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
map.put("creator", compPO.getCreator());
|
|
|
|
|
|
|
|
map.put("delete_type", compPO.getDeleteType());
|
|
|
|
|
|
|
|
map.put("create_time", compPO.getCreateTime());
|
|
|
|
|
|
|
|
map.put("update_time", compPO.getUpdateTime());
|
|
|
|
|
|
|
|
map.put("id", compPO.getId());
|
|
|
|
|
|
|
|
updateBaseComp = getCompExtMapper().insertCompExt(JCL_ORG_COMPEXT, map);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取分部明细表的所有拓展列
|
|
|
|
// 获取分部明细表的所有拓展列
|
|
|
|
String tableName = "JCL_ORG_COMPEXT_DT1";
|
|
|
|
List<ExtendInfoPO> dtInfoPOList = getExtendInfoMapper().listFields(EXTEND_TYPE, "", JCL_ORG_COMPEXT_DT1);
|
|
|
|
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields("1", "", tableName);
|
|
|
|
List<String> dtFields = dtInfoPOList.stream().map(ExtendInfoPO::getFieldName).collect(Collectors.toList());
|
|
|
|
List<String> dtFields = infoPOList.stream().map(ExtendInfoPO::getFieldName).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> insertList = new ArrayList<>();
|
|
|
|
List<Map<String, Object>> insertList = new ArrayList<>();
|
|
|
|
// 删除明细表数据
|
|
|
|
// 删除明细表数据
|
|
|
|
getCompExtDTMapper().deleteByMainID(tableName, compPO.getId());
|
|
|
|
getCompExtDTMapper().deleteByMainID(JCL_ORG_COMPEXT_DT1, compPO.getId());
|
|
|
|
// 处理明细表数据
|
|
|
|
// 处理明细表数据
|
|
|
|
int rowNum = Util.getIntValue((String) params.get("rownum"));
|
|
|
|
int rowNum = Util.getIntValue((String) params.get("rownum"));
|
|
|
|
for (int i = 0; i < rowNum; i++) {
|
|
|
|
for (int i = 0; i < rowNum; i++) {
|
|
|
@ -150,7 +189,7 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 更新拓展表数据
|
|
|
|
// 更新拓展表数据
|
|
|
|
for (Map<String, Object> map : insertList) {
|
|
|
|
for (Map<String, Object> map : insertList) {
|
|
|
|
getCompExtDTMapper().insertCompExtDT(tableName, map);
|
|
|
|
getCompExtDTMapper().insertCompExtDT(JCL_ORG_COMPEXT_DT1, map);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return updateBaseComp;
|
|
|
|
return updateBaseComp;
|
|
|
@ -235,21 +274,17 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
buttonsMap.put("hasEdit", true);
|
|
|
|
buttonsMap.put("hasEdit", true);
|
|
|
|
buttonsMap.put("hasSave", true);
|
|
|
|
buttonsMap.put("hasSave", true);
|
|
|
|
|
|
|
|
|
|
|
|
HashMap<String, Object> conditionsMap = new HashMap<>();
|
|
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
|
|
if (StringUtil.isEmpty(groupId) || "0".equals(groupId)) {
|
|
|
|
if (StringUtil.isEmpty(groupId) || "0".equals(groupId)) {
|
|
|
|
conditionsMap.put("items", getBaseForm(viewAttr, id));
|
|
|
|
addGroups.add(new SearchConditionGroup("基本信息", true, getBaseForm(viewAttr, id)));
|
|
|
|
conditionsMap.put("title", "基本信息");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
conditionsMap.put("items", getExtForm(viewAttr, id, groupId));
|
|
|
|
addGroups.add(new SearchConditionGroup(getExtendGroupMapper().getGroupNameById(groupId), true, getExtForm(viewAttr, id, groupId)));
|
|
|
|
conditionsMap.put("title", getExtendGroupMapper().getGroupNameById(groupId));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
conditionsMap.put("hide", false);
|
|
|
|
|
|
|
|
conditionsMap.put("defaultshow", true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HashMap<String, Object> resultMap = new HashMap<>();
|
|
|
|
HashMap<String, Object> resultMap = new HashMap<>();
|
|
|
|
resultMap.put("buttons", buttonsMap);
|
|
|
|
resultMap.put("buttons", buttonsMap);
|
|
|
|
resultMap.put("conditions", conditionsMap);
|
|
|
|
resultMap.put("conditions", addGroups);
|
|
|
|
resultMap.put("id", id);
|
|
|
|
resultMap.put("id", id);
|
|
|
|
resultMap.put("tabInfo", getTabInfo());
|
|
|
|
resultMap.put("tabInfo", getTabInfo());
|
|
|
|
resultMap.put("tables", getExtendTables(id, viewAttr, false));
|
|
|
|
resultMap.put("tables", getExtendTables(id, viewAttr, false));
|
|
|
@ -357,9 +392,8 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private List<Map<String, Object>> getExtendTables(long id, int viewAttr, boolean showLabel) {
|
|
|
|
private List<Map<String, Object>> getExtendTables(long id, int viewAttr, boolean showLabel) {
|
|
|
|
List<Map<String, Object>> tables = new ArrayList<>();
|
|
|
|
List<Map<String, Object>> tables = new ArrayList<>();
|
|
|
|
String tableName = "JCL_ORG_COMPEXT_DT1";
|
|
|
|
|
|
|
|
// 查询所有分布模块,拓展明细表信息
|
|
|
|
// 查询所有分布模块,拓展明细表信息
|
|
|
|
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields("1", "", tableName);
|
|
|
|
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields(EXTEND_TYPE, "", JCL_ORG_COMPEXT_DT1);
|
|
|
|
Map<Long, List<ExtendInfoPO>> groupMap = infoPOList.stream().collect(Collectors.groupingBy(ExtendInfoPO::getExtendGroupId));
|
|
|
|
Map<Long, List<ExtendInfoPO>> groupMap = infoPOList.stream().collect(Collectors.groupingBy(ExtendInfoPO::getExtendGroupId));
|
|
|
|
// 遍历Map,组装数据
|
|
|
|
// 遍历Map,组装数据
|
|
|
|
for (Map.Entry<Long, List<ExtendInfoPO>> entry : groupMap.entrySet()) {
|
|
|
|
for (Map.Entry<Long, List<ExtendInfoPO>> entry : groupMap.entrySet()) {
|
|
|
@ -371,7 +405,7 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
tabinfoMap.put("rownum", "rownum");
|
|
|
|
tabinfoMap.put("rownum", "rownum");
|
|
|
|
|
|
|
|
|
|
|
|
String fields = entry.getValue().stream().map(ExtendInfoPO::getFieldName).collect(Collectors.joining(","));
|
|
|
|
String fields = entry.getValue().stream().map(ExtendInfoPO::getFieldName).collect(Collectors.joining(","));
|
|
|
|
tabinfoMap.put("datas", getCompExtDTMapper().listCompExtDT(tableName, id, fields));
|
|
|
|
tabinfoMap.put("datas", getCompExtDTMapper().listCompExtDT(JCL_ORG_COMPEXT_DT1, id, fields));
|
|
|
|
tableMap.put("tabinfo", tabinfoMap);
|
|
|
|
tableMap.put("tabinfo", tabinfoMap);
|
|
|
|
tables.add(tableMap);
|
|
|
|
tables.add(tableMap);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -406,7 +440,7 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
// 基本信息
|
|
|
|
// 基本信息
|
|
|
|
topTabs.add(TopTab.builder().color("#000000").groupId("0").showcount(false).title("基本信息").viewCondition("0").build());
|
|
|
|
topTabs.add(TopTab.builder().color("#000000").groupId("0").showcount(false).title("基本信息").viewCondition("0").build());
|
|
|
|
|
|
|
|
|
|
|
|
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields("1", "", "JCL_ORG_COMPEXT");
|
|
|
|
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields(EXTEND_TYPE, "", JCL_ORG_COMPEXT);
|
|
|
|
List<Long> extendGroups = infoPOList.stream().map(ExtendInfoPO::getExtendGroupId).collect(Collectors.toList());
|
|
|
|
List<Long> extendGroups = infoPOList.stream().map(ExtendInfoPO::getExtendGroupId).collect(Collectors.toList());
|
|
|
|
// 拓展信息
|
|
|
|
// 拓展信息
|
|
|
|
if (CollectionUtils.isNotEmpty(extendGroups)) {
|
|
|
|
if (CollectionUtils.isNotEmpty(extendGroups)) {
|
|
|
@ -510,10 +544,9 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
|
|
|
|
|
|
|
// 2编辑 1查看
|
|
|
|
// 2编辑 1查看
|
|
|
|
OrganizationAssert.notNull(groupId, "请选择对应的拓展页");
|
|
|
|
OrganizationAssert.notNull(groupId, "请选择对应的拓展页");
|
|
|
|
String tableName = "JCL_ORG_COMPEXT";
|
|
|
|
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields(EXTEND_TYPE, groupId, JCL_ORG_COMPEXT);
|
|
|
|
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields("1", groupId, tableName);
|
|
|
|
|
|
|
|
String fields = infoPOList.stream().map(ExtendInfoPO::getFieldName).collect(Collectors.joining(","));
|
|
|
|
String fields = infoPOList.stream().map(ExtendInfoPO::getFieldName).collect(Collectors.joining(","));
|
|
|
|
Map<String, Object> compExtMap = getCompExtMapper().listCompExt(tableName, fields, id);
|
|
|
|
Map<String, Object> compExtMap = getCompExtMapper().listCompExt(JCL_ORG_COMPEXT, fields, id);
|
|
|
|
|
|
|
|
|
|
|
|
// 组装拓展页内容
|
|
|
|
// 组装拓展页内容
|
|
|
|
for (ExtendInfoPO extendInfoPO : infoPOList) {
|
|
|
|
for (ExtendInfoPO extendInfoPO : infoPOList) {
|
|
|
|