获取组模板列表是无法返回登记id

This commit is contained in:
wulin 2020-10-22 17:19:39 +08:00
parent 95e45b6688
commit 838e751775
9 changed files with 121 additions and 28 deletions

View File

@ -11,6 +11,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lz.modules.flow.entity.FlowApprovalRole; import com.lz.modules.flow.entity.FlowApprovalRole;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper @Mapper
public interface FlowApprovalRoleMapper extends BaseMapper<FlowApprovalRole> { public interface FlowApprovalRoleMapper extends BaseMapper<FlowApprovalRole> {
@ -30,4 +33,5 @@ public interface FlowApprovalRoleMapper extends BaseMapper<FlowApprovalRole> {
int deleteFlowApprovalRoleById(@Param("id")Long id); int deleteFlowApprovalRoleById(@Param("id")Long id);
Long insertFlowApprovalRoles(@Param("list") List<FlowApprovalRole> flowApprovalRoles);
} }

View File

@ -38,6 +38,8 @@ public class Flow implements java.io.Serializable {
private Long chartId; private Long chartId;
//权重评分时的权重 //权重评分时的权重
private BigDecimal weight; private BigDecimal weight;
//发起考核id
private Long startId;
/** /**
* *
* @return * @return
@ -169,6 +171,7 @@ public class Flow implements java.io.Serializable {
",opt=" + opt + ",opt=" + opt +
",optDesc=" + optDesc + ",optDesc=" + optDesc +
",roleId=" + roleId + ",roleId=" + roleId +
",startId=" + startId +
"}"; "}";
} }
} }

View File

@ -3,6 +3,8 @@ package com.lz.modules.flow.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.lz.modules.flow.entity.FlowApprovalRole; import com.lz.modules.flow.entity.FlowApprovalRole;
import java.util.List;
/** /**
* <p> * <p>
* 流程审批表 服务类 * 流程审批表 服务类
@ -30,4 +32,5 @@ public interface FlowApprovalRoleService extends IService<FlowApprovalRole> {
int deleteFlowApprovalRoleById(Long id); int deleteFlowApprovalRoleById(Long id);
Long insertFlowApprovalRoles(List<FlowApprovalRole> flowApprovalRoles);
} }

View File

@ -2,11 +2,15 @@ package com.lz.modules.flow.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lz.modules.flow.dao.FlowApprovalRoleMapper; import com.lz.modules.flow.dao.FlowApprovalRoleMapper;
import com.lz.modules.flow.entity.EvaluationStartStaff;
import com.lz.modules.flow.entity.FlowApprovalRole; import com.lz.modules.flow.entity.FlowApprovalRole;
import com.lz.modules.flow.service.FlowApprovalRoleService; import com.lz.modules.flow.service.FlowApprovalRoleService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/** /**
* <p> * <p>
* 流程审批表 服务类 * 流程审批表 服务类
@ -23,6 +27,7 @@ public class FlowApprovalRoleServiceImpl extends ServiceImpl<FlowApprovalRoleMap
@Autowired @Autowired
private FlowApprovalRoleMapper flowApprovalRoleMapper; private FlowApprovalRoleMapper flowApprovalRoleMapper;
static int maxInsertSQL = 100;
@Override @Override
@ -57,7 +62,32 @@ public class FlowApprovalRoleServiceImpl extends ServiceImpl<FlowApprovalRoleMap
public int deleteFlowApprovalRoleById(Long id){ public int deleteFlowApprovalRoleById(Long id){
return flowApprovalRoleMapper.deleteFlowApprovalRoleById(id); return flowApprovalRoleMapper.deleteFlowApprovalRoleById(id);
} }
@Override
public Long insertFlowApprovalRoles(List<FlowApprovalRole> flowApprovalRoles){
if(flowApprovalRoles.size() <= maxInsertSQL){
return flowApprovalRoleMapper.insertFlowApprovalRoles(flowApprovalRoles);
}
//下面防止sql语句过大
Long count = Long.getLong("0");
int insert = 0;
List<FlowApprovalRole> approvalRoles = new ArrayList<>();
for (FlowApprovalRole role:flowApprovalRoles
) {
approvalRoles.add(role);
insert++;
if(insert >= maxInsertSQL){
count += flowApprovalRoleMapper.insertFlowApprovalRoles(approvalRoles);
approvalRoles.clear();
insert = 0;
}
}
if(approvalRoles.size() > 0){
count += flowApprovalRoleMapper.insertFlowApprovalRoles(approvalRoles);
}
return count;
}
} }

View File

@ -49,6 +49,11 @@ public class FlowStartController {
@Autowired @Autowired
private FlowService flowService; private FlowService flowService;
@Autowired
private FlowApprovalRoleService flowApprovalRoleService;
@ -71,6 +76,7 @@ public class FlowStartController {
@ApiOperation("发起新的考核任务") @ApiOperation("发起新的考核任务")
public R save(@RequestBody @ApiParam FlowStart flowStart) { public R save(@RequestBody @ApiParam FlowStart flowStart) {
flowStartService.insertFlowStart(flowStart); flowStartService.insertFlowStart(flowStart);
Map<Integer, String> chartNameMaps = new HashedMap();
//下面开始初始化流程 //下面开始初始化流程
List<Long> ids = Arrays.stream(flowStart.getGroupIds().split(",")).map(new Function<String, Long>() { List<Long> ids = Arrays.stream(flowStart.getGroupIds().split(",")).map(new Function<String, Long>() {
@Override @Override
@ -132,15 +138,20 @@ public class FlowStartController {
if(evaluationStartStaffs.size() > 0){ if(evaluationStartStaffs.size() > 0){
evaluationStartStaffService.insertEvaluationStartStaffs(evaluationStartStaffs); evaluationStartStaffService.insertEvaluationStartStaffs(evaluationStartStaffs);
//下面初始化lz_flow流程表 lz_flow_approval_role流程审批表 //下面初始化lz_flow流程表 lz_flow_approval_role流程审批表
//List<Flow> flows = new ArrayList<>();
List<FlowApprovalRole> flowApprovalRoles = new ArrayList<>(); List<FlowApprovalRole> flowApprovalRoles = new ArrayList<>();
for (FlowChartDetailRecord flowChartDetailRecord:flowChartDetailRecords for (FlowChartDetailRecord flowChartDetailRecord:flowChartDetailRecords
) { ) {
Flow flow = new Flow(); Flow flow = new Flow();
flow.setFlowId(evaluationGroup.getId()); flow.setFlowId(evaluationGroup.getId());
flow.setOpt("+"); flow.setOpt("+");
flow.setStartId(flowStart.getId());
flow.setChartId(flowChartDetailRecord.getChartId()); flow.setChartId(flowChartDetailRecord.getChartId());
String optName = chartNameMaps.get(flowChartDetailRecord.getChartId());
if(optName == null){
}
flow.setOpt(optName);
flowService.insertFlow(flow); flowService.insertFlow(flow);
if(flowChartDetailRecord.getOptType().intValue() == ChartOptType.APPOINT.getCode()){//指定人员的 if(flowChartDetailRecord.getOptType().intValue() == ChartOptType.APPOINT.getCode()){//指定人员的
@ -175,7 +186,7 @@ public class FlowStartController {
//插入记录 //插入记录
} }
if(flowApprovalRoles.size() > 0){ if(flowApprovalRoles.size() > 0){
flowApprovalRoleService.insertFlowApprovalRoles(flowApprovalRoles);
} }
for (EvaluationStartStaff startStaff:evaluationStartStaffs for (EvaluationStartStaff startStaff:evaluationStartStaffs

View File

@ -48,6 +48,7 @@ public class ResultModelController {
resultModelDetailReq.setCalculateId(dto.getCalculateId()); resultModelDetailReq.setCalculateId(dto.getCalculateId());
resultModelDetailReq.setEvaluationGroupId(dto.getEvaluationGroupId()); resultModelDetailReq.setEvaluationGroupId(dto.getEvaluationGroupId());
resultModelDetailReq.setGradeStatus(dto.getGradeStatus()); resultModelDetailReq.setGradeStatus(dto.getGradeStatus());
resultModelDetailReq.setGradeGroupId(dto.getGradeGroupId());
ResultModelItemReq itemReq = new ResultModelItemReq(); ResultModelItemReq itemReq = new ResultModelItemReq();
BeanUtils.copyProperties(dto, itemReq); BeanUtils.copyProperties(dto, itemReq);
List<ResultTagetLibItemReq> req = resultTagetLibService.selectResultTagetLibByModelReqId(dto.getId()); List<ResultTagetLibItemReq> req = resultTagetLibService.selectResultTagetLibByModelReqId(dto.getId());
@ -87,10 +88,6 @@ public class ResultModelController {
@PostMapping("/saveDetail") @PostMapping("/saveDetail")
@ApiOperation("保存模板中的考核维度及指标") @ApiOperation("保存模板中的考核维度及指标")
public R saveDetail(@RequestBody @ApiParam ResultModelDetailReq resultModelDetailReq) { public R saveDetail(@RequestBody @ApiParam ResultModelDetailReq resultModelDetailReq) {
int resultModelOrderBy = 0; int resultModelOrderBy = 0;
for (ResultModelItemReq itemReq: for (ResultModelItemReq itemReq:
resultModelDetailReq.getModelItems()) { resultModelDetailReq.getModelItems()) {

View File

@ -94,5 +94,29 @@
update lz_flow_approval_role set is_delete = 1 where id=#{id} limit 1 update lz_flow_approval_role set is_delete = 1 where id=#{id} limit 1
</update> </update>
<insert id="insertFlowApprovalRoles" parameterType="FlowApprovalRole" useGeneratedKeys="true" keyProperty="id" >
insert into lz_flow_chart_detail_record(
approval_id,
type,
role_id,
flow_id,
step_type,
approval_type,
is_delete
)values
<foreach collection="list" item="item" separator=",">(
#{ item.approvalId},
#{ item.type},
#{ item.roleId},
#{ item.flowId},
#{ item.stepType},
#{ item.approvalType},
0
)
</foreach>
;
</insert>
</mapper> </mapper>

View File

@ -12,48 +12,65 @@
<result column="opt" property="opt"/> <result column="opt" property="opt"/>
<result column="opt_desc" property="optDesc"/> <result column="opt_desc" property="optDesc"/>
<result column="role_id" property="roleId"/> <result column="role_id" property="roleId"/>
<result column="chart_id" property="chartId"/>
<result column="weight" property="weight"/>
<result column="start_id" property="startId"/>
</resultMap> </resultMap>
<!-- 通用查询结果列 --> <!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, flow_id AS flowId, opt AS opt, opt_desc AS optDesc, role_id AS roleId id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, flow_id AS flowId, opt AS opt, opt_desc AS optDesc, role_id AS roleId, chart_id AS chartId, weight AS weight, start_id AS startId
</sql> </sql>
<select id="selectFlowById" resultType="Flow" > <select id="selectFlowById" resultType="Flow" >
select * from lz_flow where id=#{id} and is_delete = 0 limit 1 select * from lz_flow where id=#{id} and is_delete = 0 limit 1
</select> </select>
<insert id="insertFlow" parameterType="Flow" useGeneratedKeys="true" keyProperty="id" > <insert id="insertFlow" parameterType="Flow" useGeneratedKeys="true" keyProperty="id" >
insert into lz_flow( insert into lz_flow(
<if test="flowId != null">flow_id, </if> <if test="flowId != null">flow_id, </if>
<if test="opt != null">opt, </if> <if test="opt != null">opt, </if>
<if test="optDesc != null">opt_desc, </if> <if test="optDesc != null">opt_desc, </if>
<if test="roleId != null">role_id, </if> <if test="roleId != null">role_id, </if>
is_delete, <if test="chartId != null">chart_id, </if>
gmt_create, <if test="weight != null">weight, </if>
gmt_modified <if test="startId != null">start_id, </if>
is_delete,
gmt_create,
gmt_modified
)values( )values(
<if test="flowId != null">#{ flowId}, </if> <if test="flowId != null">#{ flowId}, </if>
<if test="opt != null">#{ opt}, </if> <if test="opt != null">#{ opt}, </if>
<if test="optDesc != null">#{ optDesc}, </if> <if test="optDesc != null">#{ optDesc}, </if>
<if test="roleId != null">#{ roleId}, </if> <if test="roleId != null">#{ roleId}, </if>
0, <if test="chartId != null">#{ chartId}, </if>
now(), <if test="weight != null">#{ weight}, </if>
now() <if test="startId != null">#{ startId}, </if>
0,
now(),
now()
) )
</insert> </insert>
<update id="updateFlowById" parameterType="Flow" > <update id="updateFlowById" parameterType="Flow" >
update update
lz_flow lz_flow
<trim prefix="set" suffixOverrides=","> <trim prefix="set" suffixOverrides=",">
<if test="isDelete != null">is_delete = #{isDelete},</if> <if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if> <if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
<if test="flowId != null">flow_id = #{flowId},</if> <if test="flowId != null">flow_id = #{flowId},</if>
<if test="opt != null">opt = #{opt},</if> <if test="opt != null">opt = #{opt},</if>
<if test="optDesc != null">opt_desc = #{optDesc},</if> <if test="optDesc != null">opt_desc = #{optDesc},</if>
<if test="roleId != null">role_id = #{roleId}</if> <if test="roleId != null">role_id = #{roleId},</if>
<if test="chartId != null">chart_id = #{chartId},</if>
<if test="weight != null">weight = #{weight},</if>
<if test="startId != null">start_id = #{startId}</if>
</trim> </trim>
,gmt_modified = now() ,gmt_modified = now()
where id = #{id} where id = #{id}
@ -62,18 +79,22 @@
<update id="updateCoverFlowById" parameterType="Flow" > <update id="updateCoverFlowById" parameterType="Flow" >
update update
lz_flow lz_flow
set set
is_delete = #{isDelete}, is_delete = #{isDelete},
gmt_create = #{gmtCreate}, gmt_create = #{gmtCreate},
flow_id = #{flowId}, flow_id = #{flowId},
opt = #{opt}, opt = #{opt},
opt_desc = #{optDesc}, opt_desc = #{optDesc},
role_id = #{roleId} role_id = #{roleId},
chart_id = #{chartId},
weight = #{weight},
start_id = #{startId}
,gmt_modified = now() ,gmt_modified = now()
where id = #{id} where id = #{id}
</update> </update>
<update id="deleteFlowById" parameterType="java.lang.Long"> <update id="deleteFlowById" parameterType="java.lang.Long">
update lz_flow set is_delete = 1 where id=#{id} limit 1 update lz_flow set is_delete = 1 where id=#{id} limit 1
</update> </update>

View File

@ -82,7 +82,7 @@ public class MysqlMain {
//list.add(new TablesBean("lz_flow_chart_detail_record")); //list.add(new TablesBean("lz_flow_chart_detail_record"));
//list.add(new TablesBean("lz_flow_approval_role")); //list.add(new TablesBean("lz_flow_approval_role"));
list.add(new TablesBean("lz_evaluation_start_staff")); list.add(new TablesBean("lz_flow"));
List<TablesBean> list2 = new ArrayList<TablesBean>(); List<TablesBean> list2 = new ArrayList<TablesBean>();
Map<String, String> map = MysqlUtil2ShowCreateTable.getComments(); Map<String, String> map = MysqlUtil2ShowCreateTable.getComments();