Commit 87eb264d by Your Name Committed by chenzg

更新部门下不能新增岗位员工

parent 888e4612
......@@ -8,10 +8,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import cn.timer.api.bean.spmk.*;
import cn.timer.api.dao.spmk.*;
import cn.timer.api.dto.spmk.*;
import javafx.scene.text.Text;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
......@@ -44,6 +41,16 @@ import cn.timer.api.aspect.lang.enums.BusinessType;
import cn.timer.api.bean.kqgl.PunchRecord;
import cn.timer.api.bean.kqmk.KqglAssoLeaveRules;
import cn.timer.api.bean.qyzx.QyzxEmpEntAsso;
import cn.timer.api.bean.spmk.SpmkApprovalG;
import cn.timer.api.bean.spmk.SpmkApprovalTemplate;
import cn.timer.api.bean.spmk.SpmkApprovalTemplateG;
import cn.timer.api.bean.spmk.SpmkApproveDetail;
import cn.timer.api.bean.spmk.SpmkApproveExecuteRecord;
import cn.timer.api.bean.spmk.SpmkApproveSummary;
import cn.timer.api.bean.spmk.SpmkCustomApproval;
import cn.timer.api.bean.spmk.SpmkExecutor;
import cn.timer.api.bean.spmk.SpmkIcon;
import cn.timer.api.bean.spmk.SpmkInitiatorConfig;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.bean.zzgl.ZzglBmgwM;
import cn.timer.api.config.annotation.CurrentUser;
......@@ -63,6 +70,15 @@ import cn.timer.api.controller.yggl.service.YgglService;
import cn.timer.api.controller.zzgl.service.ZzglBmgwMService;
import cn.timer.api.dao.kqgl.PunchRecordMapper;
import cn.timer.api.dao.qyzx.QyzxEmpEntAssoMapper;
import cn.timer.api.dao.spmk.SpmkApprovalGMapper;
import cn.timer.api.dao.spmk.SpmkApprovalTemplateGMapper;
import cn.timer.api.dao.spmk.SpmkApprovalTemplateMapper;
import cn.timer.api.dao.spmk.SpmkApproveDetailMapper;
import cn.timer.api.dao.spmk.SpmkApproveExecuteRecordMapper;
import cn.timer.api.dao.spmk.SpmkApproveSummaryMapper;
import cn.timer.api.dao.spmk.SpmkCustomApprovalMapper;
import cn.timer.api.dao.spmk.SpmkExecutorMapper;
import cn.timer.api.dao.spmk.SpmkInitiatorConfigMapper;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import cn.timer.api.utils.router.RouterUtils;
......@@ -97,24 +113,19 @@ public class SpmkController {
@Autowired
private SpmkApproveSummaryMapper spmkApproveSummaryMapper;
@Autowired
private SpmkApproveDetailMapper spmkApproveDetailMapper;
@Autowired
private SpmkApproveExecuteRecordMapper spmkApproveExecuteRecordMapper;
@Autowired
private SpmkExecutorMapper spmkExecutorMapper;
@Autowired
private SpmkInitiatorConfigMapper spmkInitiatorConfigMapper;
@Autowired
private SpmkApproveDetailSummaryMapper spmkApproveDetailSummaryMapper;
@Autowired
private SpmkAssoBusinessFactory spmkAssoBusinessFactory;
private static com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
private boolean ISFIRST = true; // 第一次启动审批流程
//TODO 审批模板组
/**
* 新增或编辑-审批模板组
......@@ -500,7 +511,7 @@ public class SpmkController {
@Transactional(rollbackFor = Exception.class)
@Log(title = "审批-发起审批", businessType = BusinessType.INSERT)
public Result<Object> saveA(@CurrentUser UserBean userBean,@Validated @RequestBody SpmkApproveSummaryDto spmkApproveSummaryDto) throws Exception{
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>()
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>()
.lambda()
.select(YgglMainEmp::getHeadUrl,YgglMainEmp::getName)
.eq(YgglMainEmp::getEmpNum, userBean.getEmpNum())
......@@ -596,18 +607,16 @@ public class SpmkController {
RouterUtils.insertogExecuteRecord(listFlowChildren, as.getId());
// 封装 审批详情
SpmkApproveDetailSummary adm = SpmkApproveDetailSummary.builder().build();
adm.setApproveSummaryId(as.getId());
adm.setName(spmkApproveSummaryDto.getTitle());
adm.setRequestData(spmkApproveSummaryDto.getRequestData().toString());
adm.setFroms(spmkApproveSummaryDto.getFroms().toString());
adm.setRouter(listRouter.get(0).toJSONString());
adm.setFlowChildren(listFlowChildren.toString());
try {
spmkApproveDetailSummaryMapper.insert(adm);
}catch (Exception e){
SpmkApproveDetail ad = SpmkApproveDetail.builder().build();
ad.setApproveSummaryId(as.getId());
ad.setName(spmkApproveSummaryDto.getTitle());
ad.setRequestData(ObjectUtil.serialize(spmkApproveSummaryDto.getRequestData()));
ad.setFroms(ObjectUtil.serialize((List<JSONObject>)spmkApproveSummaryDto.getFroms()));
ad.setRouter(ObjectUtil.serialize(listRouter.get(0)));
ad.setFlowChildren(ObjectUtil.serialize(listFlowChildren));
if (!ad.insert())
throw new CustomException("审批详情-新增异常");
}
return ResultUtil.success();
}
......@@ -662,8 +671,8 @@ public class SpmkController {
public Result<Object> selectAd(@PathVariable(required = true) Integer id) {
SpmkApproveDetailDto adD = spmkService.selectApproveDetailByAsId(id);
return ResultUtil.data(adD);
}
//TODO 审批人审批
......@@ -797,9 +806,9 @@ public class SpmkController {
String requerstr = "";
try {
SpmkApproveDetailSummary ad = spmkApproveDetailSummaryMapper.selectOne(new QueryWrapper<SpmkApproveDetailSummary>().lambda().eq(SpmkApproveDetailSummary::getApproveSummaryId, sp.getId()));
SpmkApproveDetail ad = spmkApproveDetailMapper.selectOne(new QueryWrapper<SpmkApproveDetail>().lambda().eq(SpmkApproveDetail::getApproveSummaryId, sp.getId()));
JSONObject as =jsonObject.parseObject(ad.getRequestData().toString(),JSONObject.class);
JSONObject as = ObjectUtil.deserialize(ad.getRequestData());
// Logoutput(as);
// Logoutput(sp.getId()+"==========================================="+sp.getAssoType());
requerstr = "";
......@@ -879,9 +888,9 @@ public class SpmkController {
}
spmkApproveExecuteRecordMapper.delete(new QueryWrapper<SpmkApproveExecuteRecord>().lambda().eq(SpmkApproveExecuteRecord::getApproveSummaryId, id));
//新审核表删除
spmkApproveDetailSummaryMapper.delete(new QueryWrapper<SpmkApproveDetailSummary>().lambda().eq(SpmkApproveDetailSummary::getApproveSummaryId,id));
spmkApproveDetailMapper.delete(new QueryWrapper<SpmkApproveDetail>().lambda().eq(SpmkApproveDetail::getApproveSummaryId, id));
spmkApproveSummaryMapper.delete(new QueryWrapper<SpmkApproveSummary>().lambda().eq(SpmkApproveSummary::getId, id));
return ResultUtil.success();
......@@ -897,7 +906,7 @@ public class SpmkController {
spmkApprovalGMapper.delete(null);
spmkCustomApprovalMapper.delete(null);
spmkApproveSummaryMapper.delete(null);
spmkApproveDetailSummaryMapper.delete(null);
spmkApproveDetailMapper.delete(null);
spmkApproveExecuteRecordMapper.delete(null);
spmkExecutorMapper.delete(null);
Logoutput("删除-审批组、自定义审批、审批汇总、审批详情、审批执行记录、审批执行人记录 所有数据 完成!");
......@@ -994,13 +1003,4 @@ public class SpmkController {
}
}
/**
* 审核详情数据转换
*/
@PostMapping(value = "/approved_addDetail")
@ApiOperation(value = "A审核详情数据转换", httpMethod = "POST", notes = "")
public void addApproveDetail(String status){
spmkService.addApproveDetail(status);
}
}
......@@ -13,8 +13,5 @@ public interface SpmkService {
SpmkApproveDetailDto selectApproveDetailByAsId(Integer asId);
List<SpmkApprovalG> selectListAg(UserBean userBean);
void addApproveDetail(String status);
}
......@@ -3,14 +3,6 @@ package cn.timer.api.controller.spmk.service;
import java.util.ArrayList;
import java.util.List;
import cn.hutool.json.JSONObject;
import cn.timer.api.bean.spmk.*;
import cn.timer.api.dao.spmk.*;
import cn.timer.api.dto.spmk.FlowChildren;
import cn.timer.api.dto.spmk.Router;
import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -19,10 +11,22 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.Console;
import cn.hutool.core.util.ObjectUtil;
import cn.timer.api.bean.spmk.SpmkApprovalG;
import cn.timer.api.bean.spmk.SpmkApprovalTemplate;
import cn.timer.api.bean.spmk.SpmkApprovalTemplateG;
import cn.timer.api.bean.spmk.SpmkApproveDetail;
import cn.timer.api.bean.spmk.SpmkApproveExecuteRecord;
import cn.timer.api.bean.spmk.SpmkApproveSummary;
import cn.timer.api.bean.spmk.SpmkCustomApproval;
import cn.timer.api.bean.spmk.SpmkExecutor;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.controller.zzgl.service.ZzglBmgwMService;
import cn.timer.api.dao.spmk.SpmkApprovalGMapper;
import cn.timer.api.dao.spmk.SpmkApproveDetailMapper;
import cn.timer.api.dao.spmk.SpmkApproveExecuteRecordMapper;
import cn.timer.api.dao.spmk.SpmkCustomApprovalMapper;
import cn.timer.api.dto.spmk.SpmkApproveDetailDto;
import cn.timer.api.utils.ResultUtil;
@Service
public class SpmkServiceImpl implements SpmkService{
......@@ -31,6 +35,9 @@ public class SpmkServiceImpl implements SpmkService{
private ZzglBmgwMService zzglBmgwMService;
@Autowired
private SpmkCustomApprovalMapper spmkCustomApprovalMapper;
@Autowired
private SpmkApproveDetailMapper spmkApproveDetailMapper;
@Autowired
......@@ -38,12 +45,7 @@ public class SpmkServiceImpl implements SpmkService{
@Autowired
private SpmkApproveExecuteRecordMapper spmkApproveExecuteRecordMapper;
@Autowired
private SpmkApproveDetailSummaryMapper spmkApproveDetailSummaryMapper;
private static com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
/**
* 根据orgCode查数据库 审批模板 生成 自定义模板
* orgCode 企业id
......@@ -90,8 +92,7 @@ public class SpmkServiceImpl implements SpmkService{
@Override
public SpmkApproveDetailDto selectApproveDetailByAsId(Integer asId) {
// TODO Auto-generated method stub
//SpmkApproveDetail ad = spmkApproveDetailMapper.selectOne(new QueryWrapper<SpmkApproveDetail>().lambda().eq(SpmkApproveDetail::getApproveSummaryId, asId));
SpmkApproveDetailSummary ad = spmkApproveDetailSummaryMapper.selectOne(new QueryWrapper<SpmkApproveDetailSummary>().lambda().eq(SpmkApproveDetailSummary::getApproveSummaryId, asId));
SpmkApproveDetail ad = spmkApproveDetailMapper.selectOne(new QueryWrapper<SpmkApproveDetail>().lambda().eq(SpmkApproveDetail::getApproveSummaryId, asId));
SpmkApproveSummary sum = null;
if(ad != null) {
sum = SpmkApproveSummary.builder().build().selectOne(new QueryWrapper<SpmkApproveSummary>().lambda().select(SpmkApproveSummary::getId,SpmkApproveSummary::getEmpNum,SpmkApproveSummary::getSts,SpmkApproveSummary::getCreateTime)
......@@ -104,18 +105,10 @@ public class SpmkServiceImpl implements SpmkService{
}
List<SpmkApproveExecuteRecord> listAer = spmkApproveExecuteRecordMapper.selectListByAsId(asId);
BeanUtil.copyProperties(ad, adD, "requestData","froms","router","spmkApproveExecuteRecord");
if(ad.getRequestData() !=null) {
adD.setRequestData(jsonObject.parseObject(ad.getRequestData().toString(), JSONObject.class));
}
if(ad.getFroms()!=null) {
adD.setFroms(jsonObject.parseArray(ad.getFroms().toString(), JSONObject.class));
}
if(ad.getFlowChildren() !=null) {
adD.setRouter(jsonObject.parseObject(ad.getFlowChildren().toString(), Router.class));
}
if(ad.getFlowChildren()!=null) {
adD.setFlowChildren(jsonObject.parseArray(ad.getFlowChildren().toString(), FlowChildren.class));
}
adD.setRequestData(ObjectUtil.deserialize(ad.getRequestData()));
adD.setFroms(ObjectUtil.deserialize(ad.getFroms()));
adD.setRouter(ObjectUtil.deserialize(ad.getRouter()));
adD.setFlowChildren(ObjectUtil.deserialize(ad.getFlowChildren()));
adD.setApproveExecuteRecord(listAer);
if(sum != null) {
adD.setEmpNum(sum.getEmpNum());
......@@ -141,7 +134,6 @@ public class SpmkServiceImpl implements SpmkService{
return adD;
}
@Override
public List<SpmkApprovalG> selectListAg(UserBean userBean) {
// TODO Auto-generated method stub
......@@ -149,56 +141,4 @@ public class SpmkServiceImpl implements SpmkService{
return spmkApprovalGMapper.selectListAgInCa(userBean.getOrgCode(), userBean.getEmpNum(), depts);
}
/**
* 审核汇总详情数据转换
* @param status
*/
@Override
public void addApproveDetail(String status) {
if ("1".equals(status)) {
QueryWrapper queryWrapper = new QueryWrapper<SpmkApproveDetail>().select("id,approve_summary_id", "name", "department_name", "request_data", "froms", "router", "flow_children");
List<SpmkApproveDetail> spmkApproveDetails = spmkApproveDetailMapper.selectList(queryWrapper);
spmkApproveDetails.forEach(t -> {
SpmkApproveDetailSummary spmkApproveDetailSummary = new SpmkApproveDetailSummary();
spmkApproveDetailSummary.setApproveSummaryId(t.getApproveSummaryId());
spmkApproveDetailSummary.setDepartmentName(t.getDepartmentName());
spmkApproveDetailSummary.setName(t.getName());
try {
Object deserialize2 = ObjectUtil.deserialize(t.getFlowChildren());
String flowChidren = JSON.toJSONString(deserialize2);
spmkApproveDetailSummary.setFlowChildren(flowChidren);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
Object deserialize1 = ObjectUtil.deserialize(t.getFroms());
String froms = JSON.toJSONString(deserialize1);
spmkApproveDetailSummary.setFroms(froms);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
Object deserialize = ObjectUtil.deserialize(t.getRequestData());
String s = JSON.toJSONString(deserialize);
spmkApproveDetailSummary.setRequestData(s);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
Router router = ObjectUtil.deserialize(t.getRouter());
String s = JSON.toJSONString(router);
spmkApproveDetailSummary.setRouter(s);
} catch (Exception e) {
e.printStackTrace();
} finally {
spmkApproveDetailSummary.insert();
}
}
}
}
});
}
}
}
package cn.timer.api.dao.spmk;
import cn.timer.api.bean.spmk.SpmkApproveDetailSummary;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Service;
@Service
public interface SpmkApproveDetailSummaryMapper extends BaseMapper<SpmkApproveDetailSummary> {
int deleteByPrimaryKey(Integer id);
int insert(SpmkApproveDetailSummary record);
int insertSelective(SpmkApproveDetailSummary record);
SpmkApproveDetailSummary selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(SpmkApproveDetailSummary record);
int updateByPrimaryKey(SpmkApproveDetailSummary record);
}
\ No newline at end of file
<?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="cn.timer.api.dao.spmk.SpmkApproveDetailSummaryMapper" >
<resultMap id="BaseResultMap" type="cn.timer.api.bean.spmk.SpmkApproveDetailSummary" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="approve_summary_id" property="approveSummaryId" jdbcType="INTEGER" />
<result column="name" property="name" jdbcType="VARCHAR" />
<result column="department_name" property="departmentName" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="ResultMap" type="cn.timer.api.bean.spmk.SpmkApproveDetailSummary" extends="BaseResultMap" >
<result column="request_data" property="requestData" jdbcType="LONGVARCHAR" />
<result column="froms" property="froms" jdbcType="LONGVARCHAR" />
<result column="router" property="router" jdbcType="LONGVARCHAR" />
<result column="flow_children" property="flowChildren" jdbcType="LONGVARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
id, approve_summary_id, name, department_name
</sql>
<sql id="Blob_Column_List" >
request_data, froms, router, flow_children
</sql>
<select id="selectByPrimaryKey" resultMap="ResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from spmk_approve_detail_summary
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from spmk_approve_detail_summary
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="cn.timer.api.bean.spmk.SpmkApproveDetailSummary" >
insert into spmk_approve_detail_summary (id, approve_summary_id, name,
department_name, request_data, froms,
router, flow_children)
values (#{id,jdbcType=INTEGER}, #{approveSummaryId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR},
#{departmentName,jdbcType=VARCHAR}, #{requestData,jdbcType=LONGVARCHAR}, #{froms,jdbcType=LONGVARCHAR},
#{router,jdbcType=LONGVARCHAR}, #{flowChildren,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="cn.timer.api.bean.spmk.SpmkApproveDetailSummary" >
insert into spmk_approve_detail_summary
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="approveSummaryId != null" >
approve_summary_id,
</if>
<if test="name != null" >
name,
</if>
<if test="departmentName != null" >
department_name,
</if>
<if test="requestData != null" >
request_data,
</if>
<if test="froms != null" >
froms,
</if>
<if test="router != null" >
router,
</if>
<if test="flowChildren != null" >
flow_children,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="approveSummaryId != null" >
#{approveSummaryId,jdbcType=INTEGER},
</if>
<if test="name != null" >
#{name,jdbcType=VARCHAR},
</if>
<if test="departmentName != null" >
#{departmentName,jdbcType=VARCHAR},
</if>
<if test="requestData != null" >
#{requestData,jdbcType=LONGVARCHAR},
</if>
<if test="froms != null" >
#{froms,jdbcType=LONGVARCHAR},
</if>
<if test="router != null" >
#{router,jdbcType=LONGVARCHAR},
</if>
<if test="flowChildren != null" >
#{flowChildren,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.timer.api.bean.spmk.SpmkApproveDetailSummary" >
update spmk_approve_detail_summary
<set >
<if test="approveSummaryId != null" >
approve_summary_id = #{approveSummaryId,jdbcType=INTEGER},
</if>
<if test="name != null" >
name = #{name,jdbcType=VARCHAR},
</if>
<if test="departmentName != null" >
department_name = #{departmentName,jdbcType=VARCHAR},
</if>
<if test="requestData != null" >
request_data = #{requestData,jdbcType=LONGVARCHAR},
</if>
<if test="froms != null" >
froms = #{froms,jdbcType=LONGVARCHAR},
</if>
<if test="router != null" >
router = #{router,jdbcType=LONGVARCHAR},
</if>
<if test="flowChildren != null" >
flow_children = #{flowChildren,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimary" parameterType="cn.timer.api.bean.spmk.SpmkApproveDetailSummary" >
update spmk_approve_detail_summary
set approve_summary_id = #{approveSummaryId,jdbcType=INTEGER},
name = #{name,jdbcType=VARCHAR},
department_name = #{departmentName,jdbcType=VARCHAR},
request_data = #{requestData,jdbcType=LONGVARCHAR},
froms = #{froms,jdbcType=LONGVARCHAR},
router = #{router,jdbcType=LONGVARCHAR},
flow_children = #{flowChildren,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="cn.timer.api.bean.spmk.SpmkApproveDetailSummary" >
update spmk_approve_detail_summary
set approve_summary_id = #{approveSummaryId,jdbcType=INTEGER},
name = #{name,jdbcType=VARCHAR},
department_name = #{departmentName,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ 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