Commit 74a4efed authored by 廖旭伟's avatar 廖旭伟

窗口负责人修改

parent 4c0adf10
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 窗口负责人角色类型
*/
public enum WindowRoleType {
窗口首席代表(1, "窗口首席代表"),
运维人员(2, "运维人员"),
审核人员(3, "审核人员"),
其他(4, "其他");
private Integer value;
private String desc;
WindowRoleType(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
public Integer getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static WindowRoleType getByValue(Integer value) {
for (WindowRoleType WindowRoleType : WindowRoleType.values()) {
if (WindowRoleType.getValue() == value) {
return WindowRoleType;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(Integer... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (WindowRoleType item : WindowRoleType.values()) {
try {
boolean hasE = false;
for (Integer e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
......@@ -13,7 +13,7 @@ import lombok.Data;
* 窗口负责人实体对象
*
* @author zxfei
* @date 2024-01-17
* @date 2024-04-26
*/
@Data
public class WindowOwnerEntity extends WindowOwnerVo {
......@@ -59,6 +59,18 @@ public class WindowOwnerEntity extends WindowOwnerVo {
* 备注
*/
private String remark;
/**
* 角色类型(首席代表,运维,审核,其他)
*/
private Integer roleType;
/**
* 是否允许巡检
*/
private Integer inspect;
/**
* 管辖人员
*/
private String staffIds;
/**
* 窗口负责人详细信息
......@@ -99,5 +111,8 @@ public class WindowOwnerEntity extends WindowOwnerVo {
this.phone = "";
this.windowCount = 0;
this.remark = "";
this.roleType = 0;
this.inspect = 0;
this.staffIds = "";
}
}
\ No newline at end of file
......@@ -18,4 +18,7 @@ public class WindowOwnerVo extends BaseEntityLong {
private Long windowId;
private List<Long> staffIdList;
private Integer staffCount;
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.Rest;
import com.mortals.framework.model.OrderCol;
import com.mortals.framework.model.PageInfo;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.pdu.RespData;
......@@ -18,6 +19,7 @@ import com.mortals.xhx.module.window.model.*;
import com.mortals.xhx.module.window.service.WindowPerformService;
import com.mortals.xhx.module.window.service.WindowWorkmanPerformService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
......@@ -182,6 +184,12 @@ public class WindowOwnerServiceImpl extends AbstractCRUDServiceImpl<WindowOwnerD
if(!ObjectUtils.isEmpty(windowOwnerEntity)){
throw new AppException("已经存在该负责人窗口记录!");
}
if(CollectionUtils.isNotEmpty(entity.getStaffIdList())){
entity.setStaffIds(StringUtils.join(entity.getStaffIdList(),","));
}else {
entity.setStaffIds("");
}
}
@Override
......@@ -190,6 +198,11 @@ public class WindowOwnerServiceImpl extends AbstractCRUDServiceImpl<WindowOwnerD
if (!ObjectUtils.isEmpty(entity.getWindowOwnerDetailList())) {
entity.setWindowCount(entity.getWindowOwnerDetailList().size());
}
if(CollectionUtils.isNotEmpty(entity.getStaffIdList())){
entity.setStaffIds(StringUtils.join(entity.getStaffIdList(),","));
}else {
entity.setStaffIds("");
}
}
@Override
......@@ -272,4 +285,21 @@ public class WindowOwnerServiceImpl extends AbstractCRUDServiceImpl<WindowOwnerD
}
}
@Override
protected void findAfter(WindowOwnerEntity params, PageInfo pageInfo, Context context, List<WindowOwnerEntity> list) throws AppException {
if(CollectionUtils.isNotEmpty(list)){
list.forEach(item->{
if(StringUtils.isNotEmpty(item.getStaffIds())){
List<Long> staffIdList = Arrays.asList(item.getStaffIds().split(",")).stream().map(s -> Long.parseLong(s.trim())).collect(Collectors.toList());
item.setStaffIdList(staffIdList);
item.setStaffCount(staffIdList.size());
}else {
item.setStaffIdList(Collections.emptyList());
item.setStaffCount(0);
}
});
}
}
}
\ No newline at end of file
......@@ -8,6 +8,8 @@ import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.base.system.site.model.SiteQuery;
import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.code.FillStatusEnum;
import com.mortals.xhx.common.code.WindowRoleType;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.site.SiteHallPdu;
......@@ -91,7 +93,7 @@ public class WindowOwnerController extends BaseCRUDJsonBodyMappingController<Win
// this.addDict(model, "updateUserId", collect);
this.addDict(model, "deptId", deptService.getDeptBySalaId(-1l).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getDeptName(), (o, n) -> n)));
this.addDict(model, "salaId", deptService.getAllSala().stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getDeptName(), (o, n) -> n)));
this.addDict(model, "roleType", WindowRoleType.getEnumMap());
super.init(model, context);
}
......
......@@ -1275,3 +1275,13 @@ CREATE TABLE mortals_xhx_door(
PRIMARY KEY (`id`)
,KEY `deviceCode` (`deviceCode`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='门禁设备';
-- ----------------------------
2024-04-26
-- ----------------------------
-- ----------------------------
-- 窗口负责人
-- ----------------------------
ALTER TABLE `mortals_xhx_window_owner` ADD COLUMN `roleType` tinyint(2) COMMENT '角色类型(首席代表,运维,审核,其他)' AFTER `remark`,
ADD COLUMN `inspect` tinyint(2) DEFAULT '0' COMMENT '是否允许巡检' AFTER `roleType`,
ADD COLUMN `staffIds` varchar(255) COMMENT '管辖人员' AFTER `inspect`;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment