Commit 00e13054 by tangzhaoqian Committed by chenzg

个人审批、我审批的、我发起的、抄送我的

parent 49b95f25
......@@ -73,6 +73,9 @@ public class SpmkApproveSummary extends Model<SpmkApproveSummary> {
@ApiModelProperty(value = "历史审批人 ", example = "历史审批人")
private String historyApprover;
@ApiModelProperty(value = "关联类型 1转正 2离职 3调薪 4调岗 5加班 6请假 7出差 8外出 9补卡", example = "5")
private Integer assoType;
@TableField(fill = FieldFill.UPDATE)
@ApiModelProperty(value = "最近处理时间 ", example = "最近处理时间")
private Date updateTime;
......
......@@ -67,6 +67,7 @@ import cn.timer.api.dao.spmk.SpmkSpzMapper;
import cn.timer.api.dto.spmk.ApprovingDto;
import cn.timer.api.dto.spmk.FlowChildren;
import cn.timer.api.dto.spmk.FromData;
import cn.timer.api.dto.spmk.MySummaryQueryDto;
import cn.timer.api.dto.spmk.Router;
import cn.timer.api.dto.spmk.Spmk;
import cn.timer.api.dto.spmk.SpmkApprovalTemplateDto;
......@@ -83,7 +84,7 @@ import cn.timer.api.dto.spmk.SpmkSpzSpglDto;
import cn.timer.api.dto.spmk.SummaryQueryDto;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import cn.timer.api.utils.RouterUtils;
import cn.timer.api.utils.router.RouterUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -805,6 +806,7 @@ public class SpmkServiceImpl {
.title(spmkApproveSummaryDto.getTitle())
.initiator(spmkApproveSummaryDto.getInitiator())
.approveName(spmkApproveSummaryDto.getApproveName())
.assoType(spmkApproveSummaryDto.getAssoType())
.sts(0)
.currentApprover(currentApprover).build();
......@@ -844,10 +846,26 @@ public class SpmkServiceImpl {
summaryQueryDto.getCurrentPage() == null ? 1 : summaryQueryDto.getCurrentPage(),
summaryQueryDto.getTotalPage() == null ? 10 : summaryQueryDto.getTotalPage());
summaryQueryDto.setOrgCode(userBean.getOrgCode());
Integer deptId = summaryQueryDto.getDeptId();
List<YgglMainEmp> listYgglMainEmp = RouterUtils.selectOtherlistent(userBean.getOrgCode(), deptId);
Console.log("listYgglMainEmp:"+ listYgglMainEmp);
if (deptId != null && (listYgglMainEmp == null || listYgglMainEmp.size() == 0)) {
return ResultUtil.data(new ArrayList<SpmkApproveSummary>(), "操作成功!");
}
List<Integer> empNums = new ArrayList<Integer>();
for (YgglMainEmp ygglMainEmp : listYgglMainEmp) {
empNums.add(ygglMainEmp.getEmpNum());
}
summaryQueryDto.setEmpNums(empNums);
// 缺-部门id 搜索
List<SpmkApproveSummary> listAs = spmkApproveSummaryMapper.selectPageByQuery(page, summaryQueryDto);
IPage<SpmkApproveSummary> pageAs = spmkApproveSummaryMapper.selectPageByQuery(page, summaryQueryDto);
List<SpmkApproveSummary> listAs = pageAs.getRecords();
return ResultUtil.data(listAs, "操作成功!");
return ResultUtil.data(pageAs, listAs, "操作成功!");
}
//TODO 审批详情
......@@ -866,10 +884,10 @@ public class SpmkServiceImpl {
BeanUtil.copyProperties(ad, adD, "requestData","froms","router","spmkApproveExecuteRecord");
adD.setRequestData(ObjectUtil.unserialize(ad.getRequestData()));
adD.setFroms(ObjectUtil.unserialize(ad.getFroms()));
adD.setFroms((List<JSONObject>)ObjectUtil.unserialize(ad.getFroms()));
adD.setRouter((Router)ObjectUtil.unserialize(ad.getRouter()));
adD.setListFlowChildren((List<FlowChildren>)ObjectUtil.unserialize(ad.getFlowChildren()));
adD.setListSpmkApproveExecuteRecord(listAer);
adD.setFlowChildren((List<FlowChildren>)ObjectUtil.unserialize(ad.getFlowChildren()));
adD.setApproveExecuteRecord(listAer);
return ResultUtil.data(adD, "操作成功!");
}
......@@ -887,6 +905,16 @@ public class SpmkServiceImpl {
.lambda()
.eq(SpmkApproveDetail::getApproveSummaryId, approvingDto.getAsId()));
// 查询 SpmkApproveSummary 状态
SpmkApproveSummary aSummary = spmkApproveSummaryMapper.selectOne(new QueryWrapper<SpmkApproveSummary>().lambda()
.select(SpmkApproveSummary::getSts)
.eq(SpmkApproveSummary::getId, approvingDto.getAsId()));
if (aSummary.getSts() == 2 || aSummary.getSts() == 3) {
return ResultUtil.error("该审批已结束!");
}
// 查询该 审批的状态 是否为 1 审批中
Integer count = SpmkExecutor.builder().build().selectCount(new QueryWrapper<SpmkExecutor>().lambda()
.eq(SpmkExecutor::getId, approvingDto.getExecutorId())
.eq(SpmkExecutor::getSts, "1"));
......@@ -895,7 +923,6 @@ public class SpmkServiceImpl {
return ResultUtil.error("您已审批过!");
}
SpmkApproveSummary aSummary = spmkApproveSummaryMapper.selectById(approvingDto.getAsId());
if (aSummary.getSts() == 0) {
List<FlowChildren> listFlowChildren = (List<FlowChildren>)ObjectUtil.unserialize(ad.getFlowChildren());
RouterUtils.approving(
......@@ -909,21 +936,60 @@ public class SpmkServiceImpl {
System.out.println(listFlowChildren);
// 更新 flowChildren
SpmkApproveDetail.builder().id(ad.getId()).flowChildren(ObjectUtil.serialize(listFlowChildren)).build().updateById();
if (CollUtil.getLast(listFlowChildren).getExecute() == "2") {
// 更新 审批汇总 状态
FlowChildren fc = CollUtil.getLast(listFlowChildren);
if (fc.getExecute() == "2") {
// 查询 SpmkApproveSummary 状态
aSummary = spmkApproveSummaryMapper.selectOne(new QueryWrapper<SpmkApproveSummary>().lambda()
.select(SpmkApproveSummary::getSts)
.eq(SpmkApproveSummary::getId, approvingDto.getAsId()));
if (aSummary.getSts() != 3) {
SpmkApproveSummary.builder().id(approvingDto.getAsId()).endTime(new Date()).sts(2).build().updateById();
}
}
}else {
return ResultUtil.error("该审批已结束!");
}
return ResultUtil.data(null, "操作成功!");
}
//TODO 我审批的/抄送我的
/**
* 查询列表-我审批的/抄送我的-分页
*/
@PostMapping(value = "/select_my_approve")
@ApiOperation(value = "21.查询列表-我审批的/抄送我的-分页", httpMethod = "POST", notes = "查询列表-我审批的-关键字、审批状态、发起时间-分页")
@ApiOperationSupport(order = 18)
public Result<Object> selectMyAs(@CurrentUser UserBean userBean, @RequestBody MySummaryQueryDto mySummaryQueryDto) {
return ResultUtil.data(null, "操作成功!");
IPage<SpmkApproveSummary> page = new Page<SpmkApproveSummary>(
mySummaryQueryDto.getCurrentPage() == null ? 1 : mySummaryQueryDto.getCurrentPage(),
mySummaryQueryDto.getTotalPage() == null ? 10 : mySummaryQueryDto.getTotalPage());
mySummaryQueryDto.setOrgCode(userBean.getOrgCode());
mySummaryQueryDto.setEmpNum(userBean.getEmpNum());
// 缺-部门id 搜索
IPage<SpmkApproveSummary> pageAs = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(page, mySummaryQueryDto);
List<SpmkApproveSummary> listAs = pageAs.getRecords();
return ResultUtil.data(pageAs, listAs, "操作成功!");
}
/**
* 删除-审批汇总、审批详情、审批执行记录、审批执行人记录 所有数据
*/
@DeleteMapping(value = "/delete_approval_data")
@ApiOperation(value = "90.(开发使用)删除-审批数据", httpMethod = "DELETE", notes = "审批汇总、审批详情、审批执行记录、审批执行人记录 所有数据")
@ApiOperationSupport(order = 10)
public Result<Object> deleteApprovalData(@CurrentUser UserBean userBean){
spmkApproveSummaryMapper.delete(null);
spmkApproveDetailMapper.delete(null);
spmkApproveExecuteRecordMapper.delete(null);
spmkExecutorMapper.delete(null);
return ResultUtil.data(null, "操作成功!");
}
}
......@@ -8,7 +8,9 @@ import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import cn.timer.api.bean.dzht.DzhtAssoHtmb;
import cn.timer.api.bean.spmk.SpmkApproveSummary;
import cn.timer.api.dto.spmk.MySummaryQueryDto;
import cn.timer.api.dto.spmk.SummaryQueryDto;
/**
......@@ -19,6 +21,8 @@ import cn.timer.api.dto.spmk.SummaryQueryDto;
@Repository
public interface SpmkApproveSummaryMapper extends BaseMapper<SpmkApproveSummary> {
List<SpmkApproveSummary> selectPageByQuery(IPage<SpmkApproveSummary> page,@Param("param") SummaryQueryDto summaryQueryDto);
IPage<SpmkApproveSummary> selectPageByQuery(IPage<SpmkApproveSummary> page,@Param("param") SummaryQueryDto summaryQueryDto);
IPage<SpmkApproveSummary> selectPageByQueryForEmpNum(IPage<SpmkApproveSummary> page,@Param("param") MySummaryQueryDto mySummaryQueryDto);
}
package cn.timer.api.dto.spmk;
import cn.timer.api.utils.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class MySummaryQueryDto extends Page{
private Integer orgCode;
private Integer empNum;
@ApiModelProperty(value = "关键字", example = "请假")
private String query;
@ApiModelProperty(value = "状态 0审批中 1审批撤销 2审批通过/审批完成 3审批拒绝", example = "0")
private Integer sts;
@ApiModelProperty(value = "开始时间 ", example = "2000-10-10 10:10:10")
private String startTime;
@ApiModelProperty(value = "结束时间 ", example = "2020-10-10 10:10:10")
private String endTime;
@ApiModelProperty(value = "1抄送人 2审批人 3连续多级主管", example = "0")
private Integer type;
}
......@@ -32,15 +32,15 @@ public class SpmkApproveDetailDto {
private JSONObject requestData;
@ApiModelProperty(value = "审批表单 ", example = "审批表单")
private JSONObject froms;
private List<JSONObject> froms;
@ApiModelProperty(value = "审批流程 ", example = "审批流程")
private Router router;
@ApiModelProperty(value = "通过节点", example = "通过节点")
private List<FlowChildren> listFlowChildren;
private List<FlowChildren> flowChildren;
@ApiModelProperty(value = "审批执行记录 ", example = "审批执行记录")
private List<SpmkApproveExecuteRecord> listSpmkApproveExecuteRecord;
private List<SpmkApproveExecuteRecord> approveExecuteRecord;
}
......@@ -33,7 +33,8 @@ public class SpmkApproveSummaryDto{
@ApiModelProperty(value = "发起人名称 ", example = "发起人名称")
private String initiator;
@ApiModelProperty(value = "关联类型 1转正 2离职 3调薪 4调岗 5加班 6请假 7出差 8外出 9补卡", example = "5")
private Integer assoType;
@ApiModelProperty(value = "申请数据 ", example = "申请数据")
private JSONObject requestData;
......
package cn.timer.api.dto.spmk;
import java.util.List;
import cn.hutool.json.JSONObject;
import cn.timer.api.utils.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
......@@ -15,16 +18,21 @@ public class SummaryQueryDto extends Page{
private Integer orgCode;
@ApiModelProperty(value = "关键字", example = "请假")
private String query;
@ApiModelProperty(value = "部门id", example = "10")
private Integer deptId;
@ApiModelProperty(value = "状态 0审批中 1审批撤销 2审批通过/审批完成 3审批拒绝", example = "0")
private Integer sts;
@ApiModelProperty(value = "开始时间 ", example = "2000-10-10 10:10:10")
private String startTime;
@ApiModelProperty(value = "结束时间 ", example = "2020-10-10 10:10:10")
private String endTime;
private String[] empNums;
private List<Integer> empNums;
}
package cn.timer.api.utils.router;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public abstract class Compare {
protected String strA = "";
protected String strB = "";
public abstract boolean GetResutl();
}
package cn.timer.api.utils.router;
public class CompareFactory{
public static Compare createCompare(String strA, String strB, String compare) {
Compare comp = null;
switch (compare) {
case "<":
comp = new LtCompare(strA,strB);
break;
case "<=":
comp = new LtOREqualCompare(strA,strB);
break;
case "=":
comp = new EqualCompare(strA,strB);
break;
case ">":
comp = new GtCompare(strA,strB);
break;
case ">=":
comp = new GtOREqualCompare(strA,strB);
break;
default :
comp = new EqualCompare(strA,strB);
break;
}
return comp;
}
}
package cn.timer.api.utils.router;
public class EqualCompare extends Compare {
public EqualCompare() {
super();
}
public EqualCompare(String strA, String strB) {
super(strA, strB);
}
@Override
public boolean GetResutl() {
return strA.equals(strB) ? true : false;
}
}
package cn.timer.api.utils.router;
import cn.hutool.core.util.NumberUtil;
public class GtCompare extends Compare {
public GtCompare(){
super();
}
public GtCompare(String strA, String strB){
super(strA,strB);
}
@Override
public boolean GetResutl() {
return NumberUtil.compare(Double.parseDouble(strA),Double.parseDouble(strB)) == 1
? true : false;
}
}
package cn.timer.api.utils.router;
import cn.hutool.core.util.NumberUtil;
public class GtOREqualCompare extends Compare {
public GtOREqualCompare() {
super();
}
public GtOREqualCompare(String strA, String strB) {
super(strA,strB);
}
@Override
public boolean GetResutl() {
double d1 = Double.parseDouble(strA);
double d2 = Double.parseDouble(strB);
return NumberUtil.compare(d1,d2) >= 0
? true : false;
}
}
package cn.timer.api.utils.router;
import cn.hutool.core.util.NumberUtil;
public class LtCompare extends Compare {
public LtCompare(){
super();
}
public LtCompare(String strA, String strB){
super(strA,strB);
}
@Override
public boolean GetResutl() {
return NumberUtil.compare(Double.parseDouble(strA),Double.parseDouble(strB)) == -1
? true : false;
}
}
package cn.timer.api.utils.router;
import cn.hutool.core.util.NumberUtil;
import lombok.Data;
public class LtOREqualCompare extends Compare {
public LtOREqualCompare(){
super();
}
public LtOREqualCompare(String strA, String strB){
super(strA,strB);
}
@Override
public boolean GetResutl() {
double d1 = Double.parseDouble(strA);
double d2 = Double.parseDouble(strB);
return NumberUtil.compare(d1,d2) <= 0
? true : false;
}
}
package cn.timer.api.utils;
package cn.timer.api.utils.router;
import java.util.ArrayList;
import java.util.Date;
......@@ -180,11 +180,15 @@ public class RouterUtils {
routerRule.setFlow(true);
}else {
for (Condition condition : listCondition) {
Compare compare ;
for (String string : condition.getValues()) {
// 判断条件
if (!stringCompare(obj.get(condition.getKey(),FromData.class).getValue(), string , condition.getFormat())) {
// 简单工厂模式 - 判断条件
compare = CompareFactory.createCompare(obj.get(condition.getKey(),FromData.class).getValue(), string, condition.getFormat());
if (!compare.GetResutl()) {
condition_b = false;
}
}
}
}
......@@ -285,9 +289,6 @@ public class RouterUtils {
}else if (listRouter.size() > 1) {
for (Router router2 : listRouter) {
if (router2.getFlow()) {
// FlowChildren fc = FlowChildren.builder().build();
// BeanUtil.copyProperties(router2, fc, "condition","children");
// listFlowChildren.add(fc);
getIsFlowChildren(router2.getChildren(), listFlowChildren);
}
}
......@@ -439,6 +440,14 @@ public class RouterUtils {
if (sts == 3) {
// 更新 审批汇总 状态
SpmkApproveSummary.builder().id(asId).endTime(new Date()).sts(sts).build().updateById();
SpmkApproveExecuteRecord
.builder()
.id(executeRecordId)
.sts(sts)
.build()
// 更新 审批执行记录
.updateById();
listFlowChildren.get(i_user).setExecute(EXECUTED);
return;
}
}else if (UNEXECUTED.equals(listUser.get(i_user).getExecute())) {
......@@ -454,9 +463,13 @@ public class RouterUtils {
// 当前审批人
SpmkApproveSummary.builder().id(asId).currentApprover(listUser.get(i_user).getName()).build().updateById();
// 处理了 下一个审批人 则跳出循环
break;
}
}
// 无下一个审批人 则更新 节点状态 为 EXECUTED(已执行)
if (!hasNextApprover) {
SpmkApproveExecuteRecord aer = SpmkApproveExecuteRecord
.builder()
......
......@@ -15,6 +15,7 @@
<result column="sts" property="sts" />
<result column="current_approver" property="currentApprover" />
<result column="history_approver" property="historyApprover" />
<result column="asso_type" property="assoType" />
<result column="update_time" property="updateTime" />
<result column="end_time" property="endTime" />
<result column="digest" property="digest" />
......@@ -32,6 +33,7 @@
sts,
current_approver,
history_approver,
asso_type,
update_time,
end_time,
digest
......@@ -49,6 +51,7 @@
a.sts,
a.current_approver,
a.history_approver,
a.asso_type,
a.update_time,
a.end_time,
a.digest
......@@ -66,6 +69,7 @@
sts SpmkApproveSummary_sts,
current_approver SpmkApproveSummary_current_approver,
history_approver SpmkApproveSummary_history_approver,
asso_type SpmkApproveSummary_asso_type,
update_time SpmkApproveSummary_update_time,
end_time SpmkApproveSummary_end_time,
digest SpmkApproveSummary_digest
......@@ -74,11 +78,11 @@
<select id="selectPageByQuery" resultMap="BaseResultMap" >
SELECT
<include refid="Base_Column_List_a" />,
(SELECT name FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num)) as gw_name,
(SELECT id FROM zzgl_bmgw_m WHERE id = (SELECT up_id FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num) )) as bm_id,
(SELECT name FROM zzgl_bmgw_m WHERE id = (SELECT up_id FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num) )) as bm_name
(SELECT name FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num limit 1) limit 1) as gw_name,
(SELECT id FROM zzgl_bmgw_m WHERE id = (SELECT up_id FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num limit 1) limit 1) limit 1) as bm_id,
(SELECT name FROM zzgl_bmgw_m WHERE id = (SELECT up_id FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num limit 1) limit 1) limit 1) as bm_name
FROM spmk_approve_summary a
WHERE 1 = 1
WHERE a.org_code = #{param.orgCode}
<if test="param.query != null and param.query != ''">
and (
a.title like CONCAT(#{param.query},'%') or
......@@ -86,12 +90,65 @@
a.id like CONCAT(#{param.query},'%')
)
</if>
<if test="param.sts != null and param.sts != ''">
and a.sts = #{param.sts}
</if>
<if test="param.startTime != null and param.startTime != ''">
and a.create_time <![CDATA[ >= ]]> #{param.startTime}
</if>
<if test="param.endTime != null and param.endTime != ''">
and qlb.create_time <![CDATA[ <= ]]> #{param.endTime}
</if>
<if test="param.empNums != null and param.empNums.size() > 0">
and a.emp_num IN
(
<foreach item="it" index="index" collection="param.empNums" separator="," close="" >
#{it}
</foreach>
)
</if>
ORDER BY a.id DESC
</select>
<select id="selectPageByQueryForEmpNum" resultMap="BaseResultMap" >
SELECT
<include refid="Base_Column_List_a" />,
(SELECT name FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num limit 1) limit 1) as gw_name,
(SELECT id FROM zzgl_bmgw_m WHERE id = (SELECT up_id FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num limit 1) limit 1) limit 1) as bm_id,
(SELECT name FROM zzgl_bmgw_m WHERE id = (SELECT up_id FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num limit 1) limit 1) limit 1) as bm_name
FROM spmk_approve_summary a
WHERE a.org_code = #{param.orgCode}
<if test="param.type != null and param.type >= 1">
and a.id in
(SELECT approve_summary_id FROM spmk_approve_execute_record WHERE id IN
(SELECT approve_execute_record_id FROM spmk_executor WHERE emp_num = #{param.empNum})
and type = #{param.type}
)
</if>
<if test="param.type != null and param.type == 0">
and a.emp_num = #{param.empNum}
</if>
<if test="param.sts != null and param.sts != ''">
and a.sts = #{param.sts}
</if>
<if test="param.query != null and param.query != ''">
and (
a.title like CONCAT(#{param.query},'%') or
a.initiator like CONCAT(#{param.query},'%') or
a.id like CONCAT(#{param.query},'%')
)
</if>
<if test="param.startTime != null and param.startTime != ''">
and a.create_time <![CDATA[ >= ]]> #{param.startTime}
</if>
<if test="param.endTime != null and param.endTime != ''">
and qlb.create_time <![CDATA[ <= ]]> #{param.endTime}
</if>
ORDER BY a.id DESC
</select>
......@@ -130,6 +187,9 @@
<if test ='null != historyApprover'>
history_approver,
</if>
<if test ='null != assoType'>
asso_type,
</if>
<if test ='null != updateTime'>
update_time,
</if>
......@@ -171,6 +231,9 @@
<if test ='null != historyApprover'>
#{historyApprover},
</if>
<if test ='null != assoType'>
#{assoType},
</if>
<if test ='null != updateTime'>
#{updateTime},
</if>
......@@ -201,6 +264,7 @@
<if test ='null != sts'>sts = #{sts},</if>
<if test ='null != currentApprover'>current_approver = #{currentApprover},</if>
<if test ='null != historyApprover'>history_approver = #{historyApprover},</if>
<if test ='null != assoType'>asso_type = #{assoType},</if>
<if test ='null != updateTime'>update_time = #{updateTime},</if>
<if test ='null != endTime'>end_time = #{endTime},</if>
<if test ='null != digest'>digest = #{digest}</if>
......
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