人员卡片按钮保存

pull/59/head
dxfeng 2 years ago
parent 854a40b7cd
commit 16794bf98c

@ -47,7 +47,7 @@ public class ExtendInfoBO {
public static String DATE_Time_TO = "_end";
// 封装对象为table组件
public static List<Map<String, Object>> convertInfoListToTable(User user, List<ExtendInfoPO> infoPOList, int viewAttr, boolean showLabel) {
public static List<Map<String, Object>> convertInfoListToTable(User user, List<ExtendInfoPO> infoPOList, int viewAttr, boolean showLabel, boolean checkBox) {
List<Map<String, Object>> lsCol = new ArrayList<>();
Map<String, Object> col;
@ -56,19 +56,23 @@ public class ExtendInfoBO {
String tmpkey = extendInfoPO.getFieldName();
col = new HashMap<>();
col.put("title", extendInfoPO.getFieldNameDesc());
col.put("key", tmpkey);
col.put("dataIndex", tmpkey);
col.put("com", getFieldDetailInfo(user, extendInfoPO, viewAttr, showLabel, width));
col.put("width", width + "%");
if (checkBox && Integer.valueOf(7).equals(extendInfoPO.getControlType())) {
col.put("checkType", "checkbox");
}
lsCol.add(col);
}
return lsCol;
}
public static List<Map<String, Object>> convertInfoListToTable(User user, List<ExtendInfoPO> infoPOList, int viewAttr, boolean showLabel) {
return convertInfoListToTable(user, infoPOList, viewAttr, showLabel, false);
}
/**
*
*
@ -160,9 +164,9 @@ public class ExtendInfoBO {
/**
*
*
* @param user
* @param user
* @param extendInfoPO
* @param viewAttr
* @param viewAttr
*/
private static List<FieldItem> getFieldDetailInfo(User user, ExtendInfoPO extendInfoPO, int viewAttr, boolean showLabel, int width) {
List<FieldItem> ls = new ArrayList<>();
@ -174,11 +178,11 @@ public class ExtendInfoBO {
/**
*
*
* @param user
* @param user
* @param extendInfoPO
* @param viewAttr
* @param showLabel
* @param width
* @param viewAttr
* @param showLabel
* @param width
*/
private static FieldItem createField(User user, ExtendInfoPO extendInfoPO, int viewAttr, boolean showLabel, int width) {
FieldItem fieldItem = new FieldItem();
@ -260,7 +264,7 @@ public class ExtendInfoBO {
String fieldid = Util.null2String(extendInfoPO.getId());//字段id
String fieldname = Util.null2String(extendInfoPO.getFieldName());//字段名
// String fieldlabel = Util.null2String(extendInfoPO.getFieldNameDesc());//字段显示名
String fieldlabel = "502327";//字段显示名
String fieldlabel = "502327";//字段显示名
String fieldhtmltype = Util.null2String(extendInfoPO.getControlType());//字段类型
String detailtype = Util.null2String(extendInfoPO.getBrowserType());//字段二级类型(浏览框--单人力)
String customValue = Util.null2String(extendInfoPO.getCustomValue());
@ -320,7 +324,7 @@ public class ExtendInfoBO {
}
default:
if (detailtype.equals("161") || detailtype.equals("162") || detailtype.equals("256") || detailtype.equals("257")) {
BrowserBean browserbean = new BrowserBean( Util.null2String(detailtype));
BrowserBean browserbean = new BrowserBean(Util.null2String(detailtype));
BrowserInitUtil browserInitUtil = new BrowserInitUtil();
String fielddbtype = customValue;
if (!customValue.startsWith("browser.")) {

@ -4,19 +4,23 @@ import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.core.impl.Service;
import com.engine.organization.component.OrganizationWeaTable;
import com.engine.organization.entity.extend.bo.ExtendInfoBO;
import com.engine.organization.entity.extend.param.ExtendInfoParams;
import com.engine.organization.entity.extend.po.ExtendInfoPO;
import com.engine.organization.entity.personnelcard.po.CardAccessPO;
import com.engine.organization.entity.personnelcard.po.CardButtonPO;
import com.engine.organization.entity.personnelcard.vo.CardAccessVO;
import com.engine.organization.mapper.extend.ExtMapper;
import com.engine.organization.mapper.personnelcard.CardAccessMapper;
import com.engine.organization.mapper.personnelcard.CardButtonMapper;
import com.engine.organization.service.CardAccessService;
import com.engine.organization.transmethod.SystemTransMethod;
import com.engine.organization.util.HasRightUtil;
import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.lang3.StringUtils;
import weaver.general.Util;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
@ -65,12 +69,12 @@ public class CardAccessServiceImpl extends Service implements CardAccessService
List<CardAccessPO> dataList = new ArrayList<>();
for (int i = 0; i < rowNum; i++) {
CardAccessPO data = CardAccessPO.builder()
.id(Util.getIntValue((String)params.get("id_"+i)))
.status(Util.getIntValue((String)params.get("status_"+i)))
.allPeople(Util.getIntValue((String)params.get("all_people_"+i)))
.superior(Util.getIntValue((String)params.get("superior_"+i)))
.allSuperior(Util.getIntValue((String)params.get("all_superior_"+i)))
.custom(Util.null2String(params.get("custom_"+i)))
.id(Util.getIntValue((String) params.get("id_" + i)))
.status(Util.getIntValue((String) params.get("status_" + i)))
.allPeople(Util.getIntValue((String) params.get("all_people_" + i)))
.superior(Util.getIntValue((String) params.get("superior_" + i)))
.allSuperior(Util.getIntValue((String) params.get("all_superior_" + i)))
.custom(Util.null2String(params.get("custom_" + i)))
.updateTime(new Date())
.build();
dataList.add(data);
@ -89,40 +93,70 @@ public class CardAccessServiceImpl extends Service implements CardAccessService
}
@Override
public int updateTabName(String name,Integer id) {
return getCardAccessMapper().updateTabName(name,id);
public int updateTabName(String name, Integer id) {
return getCardAccessMapper().updateTabName(name, id);
}
@Override
public Map<String, Object> getCardButtonTable() {
List<ExtendInfoPO> infoPOList = new ArrayList<>();
infoPOList.add(ExtendInfoPO.builder().id(null).fieldName("name").fieldNameDesc("按钮名称").fieldType("varchar(50)").controlType(1).browserType("1").customValue("[\"input\",\"text\",\"50\"]").showOrder(1).isrequired(0).isSystemDefault(0).build());
infoPOList.add(ExtendInfoPO.builder().id(null).fieldName("status").fieldNameDesc("启用").fieldType("char(1)").controlType(4).browserType("1").customValue("[\"check\"]").showOrder(2).isrequired(0).isSystemDefault(0).build());
infoPOList.add(ExtendInfoPO.builder().id(null).fieldName("status").fieldNameDesc("启用").fieldType("char(1)").controlType(7).browserType("1").customValue("[\"check\"]").showOrder(2).isrequired(0).isSystemDefault(0).build());
infoPOList.add(ExtendInfoPO.builder().id(null).fieldName("url").fieldNameDesc("跳转地址").fieldType("varchar(1000)").controlType(1).browserType("1").customValue("[\"input\",\"text\",\"1000\"]").showOrder(3).isrequired(0).isSystemDefault(0).build());
infoPOList.add(ExtendInfoPO.builder().id(null).fieldName("roles").fieldNameDesc("角色").fieldType("text").controlType(3).browserType("65").customValue("[\"browser\",{\"valueSpan\":\"多角色\",\"replaceDatas\":[{\"itemorderid\":\"65\",\"name\":\"多角色\",\"id\":\"65\",\"parenttitle\":\"人员\",\"title\":\"人员-多角色\"}],\"value\":\"65\"}]").showOrder(4).isrequired(0).isSystemDefault(0).build());
Map<String, Object> tabInfoMap = new HashMap<>();
tabInfoMap.put("columns", ExtendInfoBO.convertInfoListToTable(user, infoPOList, 2, false));
tabInfoMap.put("columns", ExtendInfoBO.convertInfoListToTable(user, infoPOList, 2, false, true));
List<CardButtonPO> cardButtonPOS = getCardButtonMapper().listAll();
List<Integer> isUsed = new ArrayList<>();
AtomicInteger index = new AtomicInteger(0);
List<Map<String, Object>> collect = cardButtonPOS.stream().map(item -> {
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("id", item.getId());
resultMap.put("name", item.getName());
resultMap.put("status", item.getStatus());
resultMap.put("status", "");
if (1 == item.getStatus()) {
isUsed.add(index.get());
}
index.getAndIncrement();
resultMap.put("url", item.getUrl());
resultMap.put("roles", item.getRoles());
resultMap.put("rolesspan", SystemTransMethod.getRoleName(item.getRoles()));
return resultMap;
}).collect(Collectors.toList());
tabInfoMap.put("datas", collect);
tabInfoMap.put("api_status", true);
Map<String, List<Integer>> isUsedMap = new HashMap<>();
isUsedMap.put("status", isUsed);
tabInfoMap.put("selectedData", isUsedMap);
tabInfoMap.put("isModalEdit", false);
return tabInfoMap;
}
@Override
public int saveCardButton(Map<String, Object> params) {
return 0;
String tableName = "JCL_ORG_CARDBUTTON";
int rowNum = Util.getIntValue((String) params.get("rownum"));
int count = 0;
for (int i = 0; i < rowNum; i++) {
String recordIndex = "_" + i;
Map<String, Object> recordData = new HashMap<>();
recordData.put("name", params.get("name") + recordIndex);
recordData.put("status", params.get("status") + recordIndex);
recordData.put("url", params.get("url") + recordIndex);
recordData.put("roles", params.get("roles") + recordIndex);
String id = Util.null2String(params.get("id") + recordIndex);
if (StringUtils.isNotBlank(id)) {
// 更新
count += MapperProxyFactory.getProxy(ExtMapper.class).updateTable(ExtendInfoParams.builder().tableName(tableName).id(Long.parseLong(id)).params(recordData).build());
} else {
//插入
count += MapperProxyFactory.getProxy(ExtMapper.class).insertTable(ExtendInfoParams.builder().tableName(tableName).params(recordData).build());
}
}
return count;
}

@ -160,7 +160,12 @@ public class ExtServiceImpl extends Service implements ExtService {
boolean checkRight = true;
if ("4".equals(extendType) && !user.isAdmin()) {
checkRight = false;
infoPOList.removeIf(item -> !"1".equals(Util.null2String(item.getIsModify())));
String ecResourceId = MapperProxyFactory.getProxy(HrmResourceMapper.class).getEcResourceId(String.valueOf(id));
if (Util.null2String(user.getUID()).equals(ecResourceId)) {
infoPOList.removeIf(item -> !"1".equals(Util.null2String(item.getIsModify())));
}else{
infoPOList = new ArrayList<>();
}
}
// 查询所有分布模块,拓展明细表信息

@ -79,4 +79,17 @@ public class CardAccessController {
return ReturnResult.exceptionHandle(e);
}
}
@POST
@Path("/saveCardButton")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult saveCardButton(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
return ReturnResult.successed(getCardAccessWrapper(user).saveCardButton(map));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
}

@ -35,4 +35,8 @@ public class CardAccessWrapper extends OrganizationWrapper {
public Map<String, Object> getCardButtonTable() {
return getCardAccessService(user).getCardButtonTable();
}
public int saveCardButton(Map<String, Object> params) {
return getCardAccessService(user).saveCardButton(params);
}
}

Loading…
Cancel
Save