commit
e5235468a1
@ -0,0 +1,84 @@
|
|||||||
|
package com.engine.organization.entity.codesetting.bo;
|
||||||
|
|
||||||
|
import com.engine.organization.entity.codesetting.param.CodeBaseParam;
|
||||||
|
import com.engine.organization.entity.codesetting.param.CodeSaveDetailParam;
|
||||||
|
import com.engine.organization.entity.codesetting.param.CodeSaveParam;
|
||||||
|
import com.engine.organization.entity.codesetting.po.CodeRuleDetailPO;
|
||||||
|
import com.engine.organization.entity.codesetting.po.CodeRulePO;
|
||||||
|
import com.engine.organization.enums.DeleteTypeEnum;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import weaver.general.Util;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author weaver_cl
|
||||||
|
* @Description: TODO
|
||||||
|
* @Date 2022/5/31
|
||||||
|
* @Version V1.0
|
||||||
|
**/
|
||||||
|
public class CodeSettingBO {
|
||||||
|
|
||||||
|
public static CodeRulePO buildCodeRule(CodeSaveParam params,Long uid,Long codeRuleId) {
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
parseOneSelfType(params.getDateSerial(), sb);
|
||||||
|
parseOneSelfType(params.getDeptSerial(), sb);
|
||||||
|
parseOneSelfType(params.getJobtitlesSerial(), sb);
|
||||||
|
|
||||||
|
CodeRulePO codeRulePO = CodeRulePO.builder()
|
||||||
|
.serialType(params.getSerialType())
|
||||||
|
.serialEnable(Optional.of(params.getSerialEnable()).orElse("0"))
|
||||||
|
.oneselfType(sb.toString())
|
||||||
|
.creator(uid)
|
||||||
|
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
|
||||||
|
.updateTime(new Date())
|
||||||
|
.build();
|
||||||
|
if (codeRuleId == null) {
|
||||||
|
codeRulePO.setCreateTime(new Date());
|
||||||
|
}else {
|
||||||
|
codeRulePO.setId(codeRuleId);
|
||||||
|
}
|
||||||
|
return codeRulePO;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<CodeRuleDetailPO> bulidCodeDetailList(List<CodeSaveDetailParam> codeSaveDetailParams, Long uid,Long codeRuleId) {
|
||||||
|
if(CollectionUtils.isEmpty(codeSaveDetailParams)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return codeSaveDetailParams.stream().map(e -> CodeRuleDetailPO.builder()
|
||||||
|
.coderuleId(codeRuleId)
|
||||||
|
.ruleType(e.getRuletype())
|
||||||
|
.ruleValue(e.getRulevalue())
|
||||||
|
.showOrder(e.getShoworder())
|
||||||
|
.creator(uid)
|
||||||
|
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
|
||||||
|
.createTime(new Date())
|
||||||
|
.updateTime(new Date())
|
||||||
|
.build()
|
||||||
|
).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析构建单独流程类型
|
||||||
|
* @param param
|
||||||
|
* @param sb
|
||||||
|
*/
|
||||||
|
private static void parseOneSelfType(CodeBaseParam param, StringBuilder sb) {
|
||||||
|
if(Objects.nonNull(param)) {
|
||||||
|
String enable = Util.null2String(param.getEnable(),"0");
|
||||||
|
String key = param.getKey();
|
||||||
|
if (enable.equals("1") && StringUtils.isNotEmpty(key)) {
|
||||||
|
sb.append(key);
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.engine.organization.entity.codesetting.param;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author weaver_cl
|
||||||
|
* @Description: TODO
|
||||||
|
* @Date 2022/5/31
|
||||||
|
* @Version V1.0
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class CodeBaseParam {
|
||||||
|
|
||||||
|
private String enable;
|
||||||
|
|
||||||
|
private String key;
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.engine.organization.entity.codesetting.param;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author weaver_cl
|
||||||
|
* @Description: TODO
|
||||||
|
* @Date 2022/5/31
|
||||||
|
* @Version V1.0
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class CodeSaveDetailParam {
|
||||||
|
|
||||||
|
private String ruletype;
|
||||||
|
|
||||||
|
private String rulevalue;
|
||||||
|
|
||||||
|
private int showorder;
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.engine.organization.entity.codesetting.param;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author weaver_cl
|
||||||
|
* @Description: TODO
|
||||||
|
* @Date 2022/5/31
|
||||||
|
* @Version V1.0
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class CodeSaveParam {
|
||||||
|
|
||||||
|
private String serialEnable;
|
||||||
|
|
||||||
|
private List<CodeSaveDetailParam> codeSaveDetailParams;
|
||||||
|
|
||||||
|
private String serialType;
|
||||||
|
|
||||||
|
private CodeBaseParam dateSerial;
|
||||||
|
|
||||||
|
private CodeBaseParam deptSerial;
|
||||||
|
|
||||||
|
private CodeBaseParam jobtitlesSerial;
|
||||||
|
}
|
@ -1,10 +0,0 @@
|
|||||||
package com.engine.organization.entity.codesetting.po;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author weaver_cl
|
|
||||||
* @Description: TODO
|
|
||||||
* @Date 2022/5/30
|
|
||||||
* @Version V1.0
|
|
||||||
**/
|
|
||||||
public class CodeRule {
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
package com.engine.organization.entity.codesetting.po;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author weaver_cl
|
|
||||||
* @Description: TODO
|
|
||||||
* @Date 2022/5/30
|
|
||||||
* @Version V1.0
|
|
||||||
**/
|
|
||||||
public class CodeRuleDetail {
|
|
||||||
}
|
|
@ -0,0 +1,46 @@
|
|||||||
|
package com.engine.organization.entity.codesetting.po;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author weaver_cl
|
||||||
|
* @Description: TODO
|
||||||
|
* @Date 2022/5/30
|
||||||
|
* @Version V1.0
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class CodeRuleDetailPO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private Long coderuleId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规则类型
|
||||||
|
*/
|
||||||
|
private String ruleType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规则值
|
||||||
|
*/
|
||||||
|
private String ruleValue;
|
||||||
|
|
||||||
|
private int showOrder;
|
||||||
|
|
||||||
|
private Long creator;
|
||||||
|
private int deleteType;
|
||||||
|
private Date createTime;
|
||||||
|
private Date updateTime;
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.engine.organization.entity.codesetting.po;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author weaver_cl
|
||||||
|
* @Description: TODO
|
||||||
|
* @Date 2022/5/31
|
||||||
|
* @Version V1.0
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class CodeRuleReservedPO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private int codeRuleId;
|
||||||
|
|
||||||
|
private String reservedCode;
|
||||||
|
|
||||||
|
private String reservedDesc;
|
||||||
|
|
||||||
|
private Long creator;
|
||||||
|
private int deleteType;
|
||||||
|
private Date createTime;
|
||||||
|
private Date updateTime;
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
package com.engine.organization.enums;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author weaver_cl
|
||||||
|
* @Description: TODO
|
||||||
|
* @Date 2022/5/31
|
||||||
|
* @Version V1.0
|
||||||
|
**/
|
||||||
|
public enum RuleCodeTypeEnum {
|
||||||
|
|
||||||
|
|
||||||
|
SUBCOMPANY("SUBCOMPANY"),
|
||||||
|
DEPARTMENT("DEPARTMENT"),
|
||||||
|
JOBTITLES("JOBTITLES"),
|
||||||
|
USER("USER"),
|
||||||
|
YEAR("YEAR"),
|
||||||
|
MONTH("MONTH"),
|
||||||
|
DAY("DAY"),
|
||||||
|
STRING("STRING"),
|
||||||
|
NUMBER("NUMBER");
|
||||||
|
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
RuleCodeTypeEnum(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static RuleCodeTypeEnum getByValue(String value) {
|
||||||
|
for (RuleCodeTypeEnum ruleCodeType : values()) {
|
||||||
|
if (ruleCodeType.getValue().equals(value)) {
|
||||||
|
return ruleCodeType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.engine.organization.mapper.codesetting;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author weaver_cl
|
||||||
|
* @Description: TODO
|
||||||
|
* @Date 2022/5/31
|
||||||
|
* @Version V1.0
|
||||||
|
**/
|
||||||
|
public interface CodeRuleDetailMapper {
|
||||||
|
|
||||||
|
void delete(Long codeRuleId);
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
<?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.codesetting.CodeRuleDetailMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<delete id="delete">
|
||||||
|
delete from JCL_CODERULE_DETAIL where coderule_id = #{codeRuleId}
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.engine.organization.mapper.codesetting;
|
||||||
|
|
||||||
|
import com.engine.organization.entity.codesetting.po.CodeRulePO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author weaver_cl
|
||||||
|
* @Description: TODO
|
||||||
|
* @Date 2022/5/31
|
||||||
|
* @Version V1.0
|
||||||
|
**/
|
||||||
|
public interface CodeRuleMapper {
|
||||||
|
|
||||||
|
Long getCodeRuleId(@Param("serialType") String serialType);
|
||||||
|
|
||||||
|
void updateCodeRule(@Param("codeRulePO") CodeRulePO codeRulePO);
|
||||||
|
|
||||||
|
void insertCodeRule(CodeRulePO codeRulePO);
|
||||||
|
}
|
@ -0,0 +1,76 @@
|
|||||||
|
<?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.codesetting.CodeRuleMapper">
|
||||||
|
|
||||||
|
<select id="getCodeRuleId" resultType="long">
|
||||||
|
select t.id
|
||||||
|
from JCL_CODERULE t
|
||||||
|
where serial_type = #{serialType}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<update id="updateCodeRule" parameterType="com.engine.organization.entity.codesetting.po.CodeRulePO">
|
||||||
|
update JCL_CODERULE
|
||||||
|
<set>
|
||||||
|
serial_enable = #{serialEnable}
|
||||||
|
oneself_type = #{oneselfType}
|
||||||
|
creator=#{creator},
|
||||||
|
update_time=#{updateTime},
|
||||||
|
</set>
|
||||||
|
WHERE id = #{codeRuleId} AND delete_type = 0
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
<insert id="insertCodeRule" parameterType="com.engine.organization.entity.codesetting.po.CodeRulePO" keyProperty="id"
|
||||||
|
keyColumn="id" useGeneratedKeys="true">
|
||||||
|
INSERT INTO JCL_CODERULE
|
||||||
|
<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="serial_type != null ">
|
||||||
|
serial_type,
|
||||||
|
</if>
|
||||||
|
<if test="serial_enable != null ">
|
||||||
|
serial_enable,
|
||||||
|
</if>
|
||||||
|
<if test="oneself_type != null ">
|
||||||
|
oneself_type,
|
||||||
|
</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="serialType != null ">
|
||||||
|
serialType,
|
||||||
|
</if>
|
||||||
|
<if test="serialEnable != null ">
|
||||||
|
serialEnable,
|
||||||
|
</if>
|
||||||
|
<if test="oneselfType != null ">
|
||||||
|
oneselfType,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue