编制上报 编制变更

pull/66/MERGE^2
dxfeng 3 years ago
parent 184580bb39
commit 77d27801b4

@ -2,6 +2,7 @@ package com.engine.organization.entity.staff.bo;
import com.engine.organization.entity.staff.param.StaffSearchParam;
import com.engine.organization.entity.staff.po.StaffPO;
import com.engine.organization.transmethod.StaffTransMethod;
import java.util.Date;
@ -35,4 +36,44 @@ public class StaffBO {
.creator(employeeId)
.build();
}
public static void buildStaffDesc(StaffPO staffPO) {
staffPO.setLackStatus(parseLackStatus(null == staffPO.getStaffNum() ? 0 : staffPO.getStaffNum(), null == staffPO.getPermanentNum() ? 0 : staffPO.getPermanentNum()));
StringBuilder sb = new StringBuilder();
sb.append("编制数:").append(parseNull(staffPO.getStaffNum()))
.append(",在编数:").append(parseNull(staffPO.getPermanentNum()))
.append(",冻结数:").append(parseNull(staffPO.getFreezeNum()))
.append(",缺编状态:").append(StaffTransMethod.getLackSpan(staffPO.getLackStatus()+""));
staffPO.setStaffDesc(sb.toString());
}
/**
* null 0
*
* @param number
* @return
*/
private static Integer parseNull(Integer number) {
return null == number ? 0 : number;
}
/**
*
*
* @param staffNum
* @param permanentNum
* @return
*/
private static int parseLackStatus(int staffNum, int permanentNum) {
if (staffNum == permanentNum) {
return 1;
}
if (staffNum > permanentNum) {
return 2;
}
return 3;
}
}

@ -70,4 +70,9 @@ public class StaffSearchParam {
*
*/
private String staffName;
/**
*
*/
private Integer changeNum;
}

@ -0,0 +1,50 @@
package com.engine.organization.entity.staff.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @description: TODO
* @author:dxfeng
* @createTime: 2022/06/07
* @version: 1.0
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class StaffsPO {
/**
*
*/
private Long id;
/**
* ID
*/
private Long staffId;
/**
*
*/
private Integer businessType;
/**
*
*/
private Integer changeNum;
/**
*
*/
private Integer businessSource;
/**
*
*/
private Integer requestId;
private Long creator;
private int deleteType;
private Date createTime;
private Date updateTime;
}

@ -80,8 +80,8 @@ public class StaffTableVO {
/**
*
*/
@OrganizationTableColumn(text = "缺编状态", width = "10%", column = "lack_status")
private Integer lackStatus;
@OrganizationTableColumn(text = "缺编状态", width = "10%", column = "lack_status", transmethod = "com.engine.organization.transmethod.StaffTransMethod.getLackSpan")
private String lackStatus;
/**
*
*/

@ -23,6 +23,16 @@ public interface StaffMapper {
*/
StaffPO getStaffByID(@Param("id") long id);
/**
*
*
* @param companyId
* @param departmentId
* @param jobId
* @return
*/
StaffPO getStaffByFilter(@Param("companyId") Long companyId, @Param("departmentId") Long departmentId, @Param("jobId") Long jobId);
/**
*
*

@ -48,6 +48,20 @@
from jcl_org_staffs
where delete_type = 0
</select>
<select id="getStaffByFilter" resultType="com.engine.organization.entity.staff.po.StaffPO">
select staff_id
from jcl_org_staffs
where delete_type = 0
<if test="companyId != null">
and comp_id = #{companyId}
</if>
<if test="departmentId != null">
and dept_id = #{departmentId}
</if>
<if test="JobId != null">
and job_id = #{companyId}
</if>
</select>
<update id="updateStaff" parameterType="com.engine.organization.entity.staff.po.StaffPO">
update jcl_org_staff

@ -0,0 +1,19 @@
package com.engine.organization.mapper.staff;
import com.engine.organization.entity.staff.po.StaffsPO;
/**
* @description: TODO
* @author:dxfeng
* @createTime: 2022/06/07
* @version: 1.0
*/
public interface StaffsMapper {
/**
*
*
* @param staffsPO
* @return
*/
int insertIgnoreNull(StaffsPO staffsPO);
}

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.organization.mapper.staff.StaffsMapper">
<resultMap id="BaseResultMap" type="com.engine.organization.entity.staff.po.StaffsPO">
<result column="id" property="id"/>
<result column="staff_id" property="staffId"/>
<result column="business_type" property="businessType"/>
<result column="change_num" property="changeNum"/>
<result column="business_source" property="businessSource"/>
<result column="requestid" property="requestId"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t
.
id
, t.staff_id
, t.business_type
, t.change_num
, t.business_source
, t.staff_num
, t.requestid
</sql>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.staff.po.StaffsPO" keyProperty="id"
keyColumn="id" useGeneratedKeys="true">
INSERT INTO jcl_org_staffs
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="staffId != null ">
staff_id,
</if>
<if test="businessType != null ">
business_type,
</if>
<if test="changeNum != null ">
change_num,
</if>
<if test="businessSource != null ">
business_source,
</if>
<if test="requestId != null ">
requestid,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="staffId != null ">
#{staffId},
</if>
<if test="businessType != null ">
#{businessType},
</if>
<if test="changeNum != null ">
#{changeNum},
</if>
<if test="businessSource != null ">
#{businessSource},
</if>
<if test="requestId != null ">
#{requestId},
</if>
</trim>
</insert>
</mapper>

@ -11,12 +11,14 @@ import com.engine.organization.entity.DeleteParam;
import com.engine.organization.entity.staff.bo.StaffBO;
import com.engine.organization.entity.staff.param.StaffSearchParam;
import com.engine.organization.entity.staff.po.StaffPO;
import com.engine.organization.entity.staff.po.StaffsPO;
import com.engine.organization.entity.staff.vo.StaffTableVO;
import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.mapper.staff.StaffMapper;
import com.engine.organization.mapper.staff.StaffPlanMapper;
import com.engine.organization.mapper.staff.StaffsMapper;
import com.engine.organization.service.StaffService;
import com.engine.organization.util.*;
import com.engine.organization.util.db.DBType;
@ -89,8 +91,25 @@ public class StaffServiceImpl extends Service implements StaffService {
@Override
public int updateStaff(StaffSearchParam param) {
HasRightUtil.hasRight(user, RIGHT_NAME, false);
StaffPO staffPlanPO = StaffBO.convertParamToPO(param, (long) user.getUID());
return getStaffMapper().updateStaff(staffPlanPO);
StaffPO staffByID = getStaffMapper().getStaffByID(param.getId());
StaffPO staffPO = StaffBO.convertParamToPO(param, (long) user.getUID());
Integer changeNum = param.getChangeNum();
if (null == changeNum) {
// 插入明细表数据
StaffsPO staffsPO = StaffsPO.builder().staffId(staffPO.getId()).businessType(1).changeNum(staffPO.getStaffNum() - staffByID.getStaffNum()).businessSource(1).build();
MapperProxyFactory.getProxy(StaffsMapper.class).insertIgnoreNull(staffsPO);
} else {
// 插入明细表数据
StaffsPO staffsPO = StaffsPO.builder().staffId(staffPO.getId()).businessType(2).changeNum(changeNum).businessSource(1).build();
MapperProxyFactory.getProxy(StaffsMapper.class).insertIgnoreNull(staffsPO);
// 更新编制表
staffPO.setStaffNum(staffPO.getStaffNum() + changeNum);
}
StaffBO.buildStaffDesc(staffPO);
// 更新主表
return getStaffMapper().updateStaff(staffPO);
}
@ -183,6 +202,9 @@ public class StaffServiceImpl extends Service implements StaffService {
SearchConditionItem controlPolicyItem = OrganizationFormItemUtil.selectItem(user, selectOptions, 2, 16, 6, false, "控制策略", "controlPolicy");
controlPolicyItem.setViewAttr(3);
controlPolicyItem.setRules("required|string");
SearchConditionItem descriptionItem = OrganizationFormItemUtil.textareaItem(user, 2, 16, true, 2, 60, "描述说明", "description");
// 编辑状态下赋值操作
String id = Util.null2String(params.get("id"));
@ -196,22 +218,23 @@ public class StaffServiceImpl extends Service implements StaffService {
planIdItem.setBrowserConditionParam(planIdItemBean);
BrowserBean compIdItemBean = compIdItem.getBrowserConditionParam();
List<Map<String, Object>> compIdMaps = getCompMapper().listCompsByIds(DeleteParam.builder().ids(staffPO.getPlanId().toString()).build().getIds());
List<Map<String, Object>> compIdMaps = getCompMapper().listCompsByIds(DeleteParam.builder().ids(staffPO.getCompId().toString()).build().getIds());
compIdItemBean.setReplaceDatas(compIdMaps);
compIdItem.setBrowserConditionParam(compIdItemBean);
BrowserBean deptIdItemBean = deptIdItem.getBrowserConditionParam();
List<Map<String, Object>> deptIdMaps = getDepartmentMapper().listDeptsByIds(DeleteParam.builder().ids(staffPO.getPlanId().toString()).build().getIds());
List<Map<String, Object>> deptIdMaps = getDepartmentMapper().listDeptsByIds(DeleteParam.builder().ids(staffPO.getDeptId().toString()).build().getIds());
deptIdItemBean.setReplaceDatas(deptIdMaps);
deptIdItem.setBrowserConditionParam(deptIdItemBean);
BrowserBean jobIdItemBean = jobIdItem.getBrowserConditionParam();
List<Map<String, Object>> jobIdMaps = getJobMapper().listJobsByIds(DeleteParam.builder().ids(staffPO.getPlanId().toString()).build().getIds());
List<Map<String, Object>> jobIdMaps = getJobMapper().listJobsByIds(DeleteParam.builder().ids(staffPO.getJobId().toString()).build().getIds());
jobIdItemBean.setReplaceDatas(jobIdMaps);
jobIdItem.setBrowserConditionParam(jobIdItemBean);
staffNumItem.setValue(staffPO.getStaffNum());
controlPolicyItem.setValue(staffPO.getControlPolicy());
controlPolicyItem.setValue(staffPO.getControlPolicy()+"");
descriptionItem.setValue(staffPO.getDescription());
}
selectItems.add(planIdItem);
selectItems.add(compIdItem);
@ -219,6 +242,14 @@ public class StaffServiceImpl extends Service implements StaffService {
selectItems.add(jobIdItem);
selectItems.add(staffNumItem);
selectItems.add(controlPolicyItem);
selectItems.add(descriptionItem);
String operateType = (String)params.get("operateType");
if ("2".equals(operateType)) {
selectItems.forEach(item->item.setViewAttr(1));
SearchConditionItem changeNumItem = OrganizationFormItemUtil.inputNumberItem(user, 2, 16, 3, "调整数量", "changeNum");
staffNumItem.setRules("required");
selectItems.add(changeNumItem);
}
addGroups.add(new SearchConditionGroup("基本信息", true, selectItems));
apiDatas.put("condition", addGroups);

@ -0,0 +1,28 @@
package com.engine.organization.transmethod;
/**
* @description: TODO
* @author:dxfeng
* @createTime: 2022/06/07
* @version: 1.0
*/
public class StaffTransMethod {
public static String getLackSpan(String lackStatus) {
String lackSpan = "";
switch (lackStatus) {
case "1":
lackSpan = "缺编";
break;
case "2":
lackSpan = "满员";
break;
case "3":
lackSpan = "超编";
break;
default:
break;
}
return lackSpan;
}
}

@ -0,0 +1,81 @@
package weaver.interfaces.organization.action;
import com.engine.organization.entity.staff.bo.StaffBO;
import com.engine.organization.entity.staff.po.StaffPO;
import com.engine.organization.entity.staff.po.StaffsPO;
import com.engine.organization.mapper.staff.StaffMapper;
import com.engine.organization.mapper.staff.StaffsMapper;
import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.lang3.StringUtils;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.MainTableInfo;
import weaver.soa.workflow.request.Property;
import weaver.soa.workflow.request.RequestInfo;
/**
* @description: TODO
* @author:dxfeng
* @createTime: 2022/06/07
* @version: 1.0
*/
public class StaffChangeAction implements Action {
@Override
public String execute(RequestInfo requestInfo) {
Integer requestid = Integer.parseInt(requestInfo.getRequestid());
Long companyId = null;
Long departmentId = null;
Long jobId = null;
Integer changeNum = null;
Integer businessSource = null;
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
Property[] property = mainTableInfo.getProperty();
// 取表单数据赋值
for (int i = 0; i < property.length; i++) {
String name = property[i].getName();
String value = Util.null2String(property[i].getValue());
if (StringUtils.isNotBlank(name) && StringUtils.isNotBlank(value)) {
switch (name) {
case "fb":
companyId = Long.parseLong(value);
break;
case "bm":
departmentId = Long.parseLong(value);
break;
case "gw":
jobId = Long.parseLong(value);
break;
case "bzbds":
changeNum = Integer.parseInt(value);
break;
case "ywly":
businessSource = Integer.parseInt(value);
break;
default:
break;
}
}
}
// 根据分部、部门、岗位 定位具体编制信息
StaffPO staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffByFilter(companyId, departmentId, jobId);
if (null != staffPO) {
// 插入明细表
StaffsPO staffsPO = StaffsPO.builder().staffId(staffPO.getId()).businessType(2).changeNum(changeNum).businessSource(businessSource).requestId(requestid).build();
MapperProxyFactory.getProxy(StaffsMapper.class).insertIgnoreNull(staffsPO);
// 更新编制表
staffPO.setStaffNum(staffPO.getStaffNum() + changeNum);
StaffBO.buildStaffDesc(staffPO);
MapperProxyFactory.getProxy(StaffMapper.class).updateStaff(staffPO);
}
return null;
}
}
Loading…
Cancel
Save