Commit 8f40f7c2 by Your Name Committed by chenzg

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

parent e71d6fc1
package cn.timer.api.bean.spmk;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javafx.scene.text.Text;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
/**
* @author Tang 2020-04-17
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "spmk_approve_detail_summary")
@ApiModel("新审批详情")
public class SpmkApproveDetailSummary extends Model<SpmkApproveDetailSummary> implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "编号 编号", example = "101")
private Integer id;
@ApiModelProperty(value = "审批汇总id 审批汇总id", example = "101")
private Integer approveSummaryId;
@ApiModelProperty(value = "标题 ", example = "标题")
private String name;
@ApiModelProperty(value = "所在部门名称 ", example = "所在部门名称")
private String departmentName;
@ApiModelProperty(value = "申请数据 ", example = "申请数据")
private String requestData;
@ApiModelProperty(value = "审批表单 ", example = "审批表单")
private String froms;
@ApiModelProperty(value = "审批流程 ", example = "审批流程")
private String router;
@ApiModelProperty(value = "通过节点 ", example = "通过节点")
private String flowChildren;
}
\ No newline at end of file
...@@ -221,14 +221,15 @@ public class ClockInController { ...@@ -221,14 +221,15 @@ public class ClockInController {
//无记录的话就找昨天的数据 //无记录的话就找昨天的数据
AttendanceCardListDto attdate1 = MethodCall(qyid,userid,yesterday); AttendanceCardListDto attdate1 = MethodCall(qyid,userid,yesterday);
List<AttSchedule> ashssyebo = attdate1.getAttsch();//获取昨天应打卡时间 List<AttSchedule> ashssyebo = attdate1.getAttsch();//获取昨天应打卡时间
if(ashssyebo.size() > 0) { if(ashssyebo!=null) {
Date sd1=df1.parse(ClockInTool.stampToDate(String.valueOf(ashssyebo.get(0).getTime())));//当天应打的首次上班卡时间 if (ashssyebo.size() > 0) {
Date sd2=df1.parse(current_time);//当前时间 Date sd1 = df1.parse(ClockInTool.stampToDate(String.valueOf(ashssyebo.get(0).getTime())));//当天应打的首次上班卡时间
if(sd2.after(sd1)) {//大于 Date sd2 = df1.parse(current_time);//当前时间
dnck = true; if (sd2.after(sd1)) {//大于
dnck = true;
}
} }
} }
// crdk = true; // crdk = true;
// attdate = MethodCall(qyid,userid,yesterday); // attdate = MethodCall(qyid,userid,yesterday);
if(EmptyUtil.isNotEmpty(attdate.getAttsch()) && ashss.get(0).getId() != 0) {//班次不为空 if(EmptyUtil.isNotEmpty(attdate.getAttsch()) && ashss.get(0).getId() != 0) {//班次不为空
......
package cn.timer.api.controller.spmk; package cn.timer.api.controller.spmk;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import cn.timer.api.bean.spmk.*;
import cn.timer.api.dao.spmk.*;
import cn.timer.api.dto.spmk.*; import cn.timer.api.dto.spmk.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -41,16 +42,6 @@ import cn.timer.api.aspect.lang.enums.BusinessType; ...@@ -41,16 +42,6 @@ import cn.timer.api.aspect.lang.enums.BusinessType;
import cn.timer.api.bean.kqgl.PunchRecord; import cn.timer.api.bean.kqgl.PunchRecord;
import cn.timer.api.bean.kqmk.KqglAssoLeaveRules; import cn.timer.api.bean.kqmk.KqglAssoLeaveRules;
import cn.timer.api.bean.qyzx.QyzxEmpEntAsso; 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.yggl.YgglMainEmp;
import cn.timer.api.bean.zzgl.ZzglBmgwM; import cn.timer.api.bean.zzgl.ZzglBmgwM;
import cn.timer.api.config.annotation.CurrentUser; import cn.timer.api.config.annotation.CurrentUser;
...@@ -70,15 +61,6 @@ import cn.timer.api.controller.yggl.service.YgglService; ...@@ -70,15 +61,6 @@ import cn.timer.api.controller.yggl.service.YgglService;
import cn.timer.api.controller.zzgl.service.ZzglBmgwMService; import cn.timer.api.controller.zzgl.service.ZzglBmgwMService;
import cn.timer.api.dao.kqgl.PunchRecordMapper; import cn.timer.api.dao.kqgl.PunchRecordMapper;
import cn.timer.api.dao.qyzx.QyzxEmpEntAssoMapper; 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.Result;
import cn.timer.api.utils.ResultUtil; import cn.timer.api.utils.ResultUtil;
import cn.timer.api.utils.router.RouterUtils; import cn.timer.api.utils.router.RouterUtils;
...@@ -91,41 +73,46 @@ import io.swagger.annotations.ApiOperation; ...@@ -91,41 +73,46 @@ import io.swagger.annotations.ApiOperation;
@Api(tags = "3.0审批模块") @Api(tags = "3.0审批模块")
@RestController @RestController
@Transactional @Transactional
@RequestMapping(value = "/spmk", @RequestMapping(value = "/spmk",
produces = { "application/json","multipart/form-data" }) produces = { "application/json","multipart/form-data" })
public class SpmkController { public class SpmkController {
@Autowired @Autowired
private SpmkService spmkService; private SpmkService spmkService;
@Autowired @Autowired
private ZzglBmgwMService zzglBmgwMService; private ZzglBmgwMService zzglBmgwMService;
@Autowired @Autowired
private QyzxEmpEntAssoMapper qyzxEmpEntAssoMapper; private QyzxEmpEntAssoMapper qyzxEmpEntAssoMapper;
@Autowired @Autowired
private SpmkApprovalTemplateGMapper spmkApprovalTemplateGMapper; private SpmkApprovalTemplateGMapper spmkApprovalTemplateGMapper;
@Autowired @Autowired
private SpmkApprovalTemplateMapper spmkApprovalTemplateMapper; private SpmkApprovalTemplateMapper spmkApprovalTemplateMapper;
@Autowired @Autowired
private SpmkApprovalGMapper spmkApprovalGMapper; private SpmkApprovalGMapper spmkApprovalGMapper;
@Autowired @Autowired
private SpmkCustomApprovalMapper spmkCustomApprovalMapper; private SpmkCustomApprovalMapper spmkCustomApprovalMapper;
@Autowired @Autowired
private SpmkApproveSummaryMapper spmkApproveSummaryMapper; private SpmkApproveSummaryMapper spmkApproveSummaryMapper;
@Autowired @Autowired
private SpmkApproveDetailMapper spmkApproveDetailMapper;
@Autowired
private SpmkApproveExecuteRecordMapper spmkApproveExecuteRecordMapper; private SpmkApproveExecuteRecordMapper spmkApproveExecuteRecordMapper;
@Autowired @Autowired
private SpmkExecutorMapper spmkExecutorMapper; private SpmkExecutorMapper spmkExecutorMapper;
@Autowired @Autowired
private SpmkInitiatorConfigMapper spmkInitiatorConfigMapper; private SpmkInitiatorConfigMapper spmkInitiatorConfigMapper;
@Autowired
private SpmkApproveDetailSummaryMapper spmkApproveDetailSummaryMapper;
@Autowired @Autowired
private SpmkAssoBusinessFactory spmkAssoBusinessFactory; private SpmkAssoBusinessFactory spmkAssoBusinessFactory;
private static com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
private boolean ISFIRST = true; // 第一次启动审批流程 private boolean ISFIRST = true; // 第一次启动审批流程
//TODO 审批模板组 //TODO 审批模板组
/** /**
* 新增或编辑-审批模板组 * 新增或编辑-审批模板组
...@@ -134,17 +121,17 @@ public class SpmkController { ...@@ -134,17 +121,17 @@ public class SpmkController {
@ApiOperation(value = "1.新增或编辑-审批模板组", httpMethod = "POST", notes = "新增或编辑-审批模板组") @ApiOperation(value = "1.新增或编辑-审批模板组", httpMethod = "POST", notes = "新增或编辑-审批模板组")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
public Result<Object> saveAtg(@Validated({Insert.class,Update.class}) @RequestBody SpmkApprovalTemplateG spmkApprovalTemplateG){ public Result<Object> saveAtg(@Validated({Insert.class,Update.class}) @RequestBody SpmkApprovalTemplateG spmkApprovalTemplateG){
if (spmkApprovalTemplateG.selectCount(new QueryWrapper<SpmkApprovalTemplateG>().lambda() if (spmkApprovalTemplateG.selectCount(new QueryWrapper<SpmkApprovalTemplateG>().lambda()
.ne(spmkApprovalTemplateG.getId() != null,SpmkApprovalTemplateG::getId, spmkApprovalTemplateG.getId()) .ne(spmkApprovalTemplateG.getId() != null,SpmkApprovalTemplateG::getId, spmkApprovalTemplateG.getId())
.eq(SpmkApprovalTemplateG::getName, spmkApprovalTemplateG.getName())) > 0) { .eq(SpmkApprovalTemplateG::getName, spmkApprovalTemplateG.getName())) > 0) {
return ResultUtil.error("审批模板组名重复!"); return ResultUtil.error("审批模板组名重复!");
} }
return spmkApprovalTemplateG.insertOrUpdate() ? return spmkApprovalTemplateG.insertOrUpdate() ?
ResultUtil.data(spmkApprovalTemplateG) : ResultUtil.error(); ResultUtil.data(spmkApprovalTemplateG) : ResultUtil.error();
} }
/** /**
* 删除-审批模板组 * 删除-审批模板组
*/ */
...@@ -152,14 +139,14 @@ public class SpmkController { ...@@ -152,14 +139,14 @@ public class SpmkController {
@ApiOperation(value = "2.删除-审批模板组", httpMethod = "DELETE", notes = "删除-审批模板组") @ApiOperation(value = "2.删除-审批模板组", httpMethod = "DELETE", notes = "删除-审批模板组")
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
public Result<Object> deleteAtgById(@PathVariable int id){ public Result<Object> deleteAtgById(@PathVariable int id){
if (spmkApprovalTemplateMapper.selectCount(new QueryWrapper<SpmkApprovalTemplate>().lambda().eq(SpmkApprovalTemplate::getApprovalTemplateGId, id)) > 0 ) if (spmkApprovalTemplateMapper.selectCount(new QueryWrapper<SpmkApprovalTemplate>().lambda().eq(SpmkApprovalTemplate::getApprovalTemplateGId, id)) > 0 )
return ResultUtil.error("审批模板组存在 模板,不可直接删除!"); return ResultUtil.error("审批模板组存在 模板,不可直接删除!");
return SpmkApprovalTemplateG.builder().id(id).build().deleteById() ? return SpmkApprovalTemplateG.builder().id(id).build().deleteById() ?
ResultUtil.success() : ResultUtil.error("没有找到该对象"); ResultUtil.success() : ResultUtil.error("没有找到该对象");
} }
/** /**
* 查询列表-审批模板组 * 查询列表-审批模板组
*/ */
...@@ -167,10 +154,10 @@ public class SpmkController { ...@@ -167,10 +154,10 @@ public class SpmkController {
@ApiOperation(value = "3.查询列表-审批模板组", httpMethod = "GET", notes = "查询列表-审批模板组") @ApiOperation(value = "3.查询列表-审批模板组", httpMethod = "GET", notes = "查询列表-审批模板组")
@ApiOperationSupport(order = 3) @ApiOperationSupport(order = 3)
public Result<Object> selectListAtg(){ public Result<Object> selectListAtg(){
return ResultUtil.data(spmkApprovalTemplateGMapper.selectListAtInAtg()); return ResultUtil.data(spmkApprovalTemplateGMapper.selectListAtInAtg());
} }
/** /**
* 排序-审批模板组 * 排序-审批模板组
*/ */
...@@ -178,13 +165,13 @@ public class SpmkController { ...@@ -178,13 +165,13 @@ public class SpmkController {
@ApiOperation(value = "4.排序-审批模板组", httpMethod = "PUT", notes = "排序-审批模板组") @ApiOperation(value = "4.排序-审批模板组", httpMethod = "PUT", notes = "排序-审批模板组")
@ApiOperationSupport(order = 4) @ApiOperationSupport(order = 4)
public Result<Object> ranksAtg(@Validated(Ranks.class) @RequestBody ValidList<SpmkApprovalTemplateG> list){ public Result<Object> ranksAtg(@Validated(Ranks.class) @RequestBody ValidList<SpmkApprovalTemplateG> list){
if (list == null || (list != null && list.size() <= 0)) { if (list == null || (list != null && list.size() <= 0)) {
return ResultUtil.success(); return ResultUtil.success();
} }
return spmkApprovalTemplateGMapper.updateListRandsById(list) ? ResultUtil.success() : ResultUtil.error(); return spmkApprovalTemplateGMapper.updateListRandsById(list) ? ResultUtil.success() : ResultUtil.error();
} }
//TODO 审批模板 //TODO 审批模板
/** /**
* 新增或编辑-审批模板 * 新增或编辑-审批模板
...@@ -193,9 +180,9 @@ public class SpmkController { ...@@ -193,9 +180,9 @@ public class SpmkController {
@ApiOperation(value = "5.新增或编辑-审批模板", httpMethod = "POST", notes = "新增或编辑-审批模板") @ApiOperation(value = "5.新增或编辑-审批模板", httpMethod = "POST", notes = "新增或编辑-审批模板")
@ApiOperationSupport(order = 5) @ApiOperationSupport(order = 5)
public Result<Object> saveAt(@Validated @RequestBody SpmkApprovalTemplateDto spmkApprovalTemplateDto){ public Result<Object> saveAt(@Validated @RequestBody SpmkApprovalTemplateDto spmkApprovalTemplateDto){
Integer approvalTemplateGId = spmkApprovalTemplateDto.getApprovalTemplateGId(); Integer approvalTemplateGId = spmkApprovalTemplateDto.getApprovalTemplateGId();
if (ObjectUtil.isNull(approvalTemplateGId)) if (ObjectUtil.isNull(approvalTemplateGId))
return ResultUtil.error("审批模板ID不为空"); return ResultUtil.error("审批模板ID不为空");
SpmkApprovalTemplate at = SpmkApprovalTemplate.builder().build(); SpmkApprovalTemplate at = SpmkApprovalTemplate.builder().build();
...@@ -205,23 +192,23 @@ public class SpmkController { ...@@ -205,23 +192,23 @@ public class SpmkController {
// 序列化 后 写入 SpmkApprovalTemplate对象 // 序列化 后 写入 SpmkApprovalTemplate对象
at.setFroms(ObjectUtil.serialize((List<JSONObject>)spmkApprovalTemplateDto.getFroms())); at.setFroms(ObjectUtil.serialize((List<JSONObject>)spmkApprovalTemplateDto.getFroms()));
at.setRouter(ObjectUtil.serialize(spmkApprovalTemplateDto.getRouter())); at.setRouter(ObjectUtil.serialize(spmkApprovalTemplateDto.getRouter()));
if (at.selectCount(new QueryWrapper<SpmkApprovalTemplate>().lambda() if (at.selectCount(new QueryWrapper<SpmkApprovalTemplate>().lambda()
.ne(at.getId() != null, SpmkApprovalTemplate::getId, at.getId()) .ne(at.getId() != null, SpmkApprovalTemplate::getId, at.getId())
.eq(SpmkApprovalTemplate::getName, at.getName())) > 0) { .eq(SpmkApprovalTemplate::getName, at.getName())) > 0) {
return ResultUtil.error("审批模板名重复!"); return ResultUtil.error("审批模板名重复!");
} }
if (!at.insertOrUpdate()) if (!at.insertOrUpdate())
return ResultUtil.error("数据库操作失败"); return ResultUtil.error("数据库操作失败");
// 清空前端不需要的字段再返回,节省流量 // 清空前端不需要的字段再返回,节省流量
at.setFroms(null); at.setFroms(null);
at.setRouter(null); at.setRouter(null);
return ResultUtil.data(at); return ResultUtil.data(at);
} }
/** /**
* 删除-审批模板 * 删除-审批模板
*/ */
...@@ -229,9 +216,9 @@ public class SpmkController { ...@@ -229,9 +216,9 @@ public class SpmkController {
@ApiOperation(value = "6.删除-审批模板", httpMethod = "DELETE", notes = "删除-审批模板") @ApiOperation(value = "6.删除-审批模板", httpMethod = "DELETE", notes = "删除-审批模板")
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
public Result<Object> deleteAtById(@PathVariable int id){ public Result<Object> deleteAtById(@PathVariable int id){
return SpmkApprovalTemplate.builder().id(id).build().deleteById() ? ResultUtil.success() : ResultUtil.error("没有找到该对象"); return SpmkApprovalTemplate.builder().id(id).build().deleteById() ? ResultUtil.success() : ResultUtil.error("没有找到该对象");
} }
/** /**
...@@ -242,15 +229,15 @@ public class SpmkController { ...@@ -242,15 +229,15 @@ public class SpmkController {
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
public Result<Object> selectAtById(@PathVariable int id){ public Result<Object> selectAtById(@PathVariable int id){
SpmkApprovalTemplate at = SpmkApprovalTemplate.builder().id(id).build().selectById(); SpmkApprovalTemplate at = SpmkApprovalTemplate.builder().id(id).build().selectById();
SpmkApprovalTemplateDto atd = SpmkApprovalTemplateDto.builder().build(); SpmkApprovalTemplateDto atd = SpmkApprovalTemplateDto.builder().build();
BeanUtil.copyProperties(at, atd,"froms","router"); BeanUtil.copyProperties(at, atd,"froms","router");
atd.setFroms(ObjectUtil.deserialize(at.getFroms())); atd.setFroms(ObjectUtil.deserialize(at.getFroms()));
atd.setRouter(ObjectUtil.deserialize(at.getRouter())); atd.setRouter(ObjectUtil.deserialize(at.getRouter()));
return ResultUtil.data(atd); return ResultUtil.data(atd);
} }
/** /**
* 排序-审批模板 * 排序-审批模板
*/ */
...@@ -262,13 +249,13 @@ public class SpmkController { ...@@ -262,13 +249,13 @@ public class SpmkController {
if (list == null || (list != null && list.size() <= 0)) { if (list == null || (list != null && list.size() <= 0)) {
return ResultUtil.success(); return ResultUtil.success();
} }
return spmkApprovalTemplateMapper.updateListRandsById(list) ? ResultUtil.success() : ResultUtil.error(); return spmkApprovalTemplateMapper.updateListRandsById(list) ? ResultUtil.success() : ResultUtil.error();
} }
//TODO 审批组 //TODO 审批组
/** /**
* 新增或编辑-审批组 * 新增或编辑-审批组
...@@ -277,19 +264,19 @@ public class SpmkController { ...@@ -277,19 +264,19 @@ public class SpmkController {
@ApiOperation(value = "9.新增或编辑-审批组", httpMethod = "POST", notes = "新增或编辑-审批组") @ApiOperation(value = "9.新增或编辑-审批组", httpMethod = "POST", notes = "新增或编辑-审批组")
@ApiOperationSupport(order = 9) @ApiOperationSupport(order = 9)
public Result<Object> saveAg(@CurrentUser UserBean userBean, @Validated({Insert.class,Update.class}) @RequestBody SpmkApprovalG spmkApprovalG){ public Result<Object> saveAg(@CurrentUser UserBean userBean, @Validated({Insert.class,Update.class}) @RequestBody SpmkApprovalG spmkApprovalG){
if (spmkApprovalG.selectCount(new QueryWrapper<SpmkApprovalG>().lambda() if (spmkApprovalG.selectCount(new QueryWrapper<SpmkApprovalG>().lambda()
.ne(spmkApprovalG.getId() != null, SpmkApprovalG::getId, spmkApprovalG.getId()) .ne(spmkApprovalG.getId() != null, SpmkApprovalG::getId, spmkApprovalG.getId())
.eq(SpmkApprovalG::getName, spmkApprovalG.getName()) .eq(SpmkApprovalG::getName, spmkApprovalG.getName())
.eq(SpmkApprovalG::getOrgCode, userBean.getOrgCode())) > 0) { .eq(SpmkApprovalG::getOrgCode, userBean.getOrgCode())) > 0) {
return ResultUtil.error("审批组名重复!"); return ResultUtil.error("审批组名重复!");
} }
spmkApprovalG.setOrgCode(userBean.getOrgCode()); spmkApprovalG.setOrgCode(userBean.getOrgCode());
return spmkApprovalG.insertOrUpdate() ? ResultUtil.data(spmkApprovalG) : ResultUtil.error(); return spmkApprovalG.insertOrUpdate() ? ResultUtil.data(spmkApprovalG) : ResultUtil.error();
} }
/** /**
* 删除-审批组 * 删除-审批组
*/ */
...@@ -297,15 +284,15 @@ public class SpmkController { ...@@ -297,15 +284,15 @@ public class SpmkController {
@ApiOperation(value = "10.删除-审批组", httpMethod = "DELETE", notes = "删除-审批组") @ApiOperation(value = "10.删除-审批组", httpMethod = "DELETE", notes = "删除-审批组")
@ApiOperationSupport(order = 10) @ApiOperationSupport(order = 10)
public Result<Object> deleteAgById(@PathVariable int id){ public Result<Object> deleteAgById(@PathVariable int id){
// if (spmkCustomApprovalMapper.selectCount(new QueryWrapper<SpmkCustomApproval>().lambda().eq(SpmkCustomApproval::getApprovalGId, id)) > 0 ) // if (spmkCustomApprovalMapper.selectCount(new QueryWrapper<SpmkCustomApproval>().lambda().eq(SpmkCustomApproval::getApprovalGId, id)) > 0 )
// return ResultUtil.error("审批组存在 自定义审批,不可直接删除!"); // return ResultUtil.error("审批组存在 自定义审批,不可直接删除!");
SpmkCustomApproval.builder().build().delete(new QueryWrapper<SpmkCustomApproval>().lambda().eq(SpmkCustomApproval::getApprovalGId, id)); SpmkCustomApproval.builder().build().delete(new QueryWrapper<SpmkCustomApproval>().lambda().eq(SpmkCustomApproval::getApprovalGId, id));
return SpmkApprovalG.builder().id(id).build().deleteById() ? ResultUtil.success() : ResultUtil.error("没有找到该对象"); return SpmkApprovalG.builder().id(id).build().deleteById() ? ResultUtil.success() : ResultUtil.error("没有找到该对象");
} }
/** /**
* 查询列表-审批组-审批管理 * 查询列表-审批组-审批管理
*/ */
...@@ -313,12 +300,12 @@ public class SpmkController { ...@@ -313,12 +300,12 @@ public class SpmkController {
@ApiOperation(value = "11.查询列表-审批组-审批管理", httpMethod = "GET", notes = "查询列表-审批组-审批管理") @ApiOperation(value = "11.查询列表-审批组-审批管理", httpMethod = "GET", notes = "查询列表-审批组-审批管理")
@ApiOperationSupport(order = 11) @ApiOperationSupport(order = 11)
public Result<Object> selectListAgByAdmin(@CurrentUser UserBean userBean){ public Result<Object> selectListAgByAdmin(@CurrentUser UserBean userBean){
List<Integer> depts = zzglBmgwMService.empNumupGetDepts(userBean.getOrgCode(), userBean.getEmpNum()); List<Integer> depts = zzglBmgwMService.empNumupGetDepts(userBean.getOrgCode(), userBean.getEmpNum());
return ResultUtil.data(spmkApprovalGMapper.selectListAgInCaByAdmin(userBean.getOrgCode(), userBean.getEmpNum(), depts)); return ResultUtil.data(spmkApprovalGMapper.selectListAgInCaByAdmin(userBean.getOrgCode(), userBean.getEmpNum(), depts));
} }
/** /**
* 查询列表-审批组-个人审批 * 查询列表-审批组-个人审批
*/ */
...@@ -326,10 +313,10 @@ public class SpmkController { ...@@ -326,10 +313,10 @@ public class SpmkController {
@ApiOperation(value = "11.查询列表-审批组-个人审批", httpMethod = "GET", notes = "查询列表-审批组-个人审批") @ApiOperation(value = "11.查询列表-审批组-个人审批", httpMethod = "GET", notes = "查询列表-审批组-个人审批")
@ApiOperationSupport(order = 11) @ApiOperationSupport(order = 11)
public Result<Object> selectListAg(@CurrentUser UserBean userBean){ public Result<Object> selectListAg(@CurrentUser UserBean userBean){
return ResultUtil.data(spmkService.selectListAg(userBean)); return ResultUtil.data(spmkService.selectListAg(userBean));
} }
/** /**
* 排序-审批组 * 排序-审批组
*/ */
...@@ -337,16 +324,16 @@ public class SpmkController { ...@@ -337,16 +324,16 @@ public class SpmkController {
@ApiOperation(value = "12.排序-审批组", httpMethod = "PUT", notes = "排序-审批组") @ApiOperation(value = "12.排序-审批组", httpMethod = "PUT", notes = "排序-审批组")
@ApiOperationSupport(order = 12) @ApiOperationSupport(order = 12)
public Result<Object> ranksAg(@Validated({Ranks.class}) @RequestBody ValidList<SpmkApprovalG> list){ public Result<Object> ranksAg(@Validated({Ranks.class}) @RequestBody ValidList<SpmkApprovalG> list){
if (list == null || list.size() <= 0) { if (list == null || list.size() <= 0) {
return ResultUtil.success(); return ResultUtil.success();
} }
return spmkApprovalGMapper.updateListRandsById(list) ? ResultUtil.success() : ResultUtil.error(); return spmkApprovalGMapper.updateListRandsById(list) ? ResultUtil.success() : ResultUtil.error();
} }
//TODO 自定义审批 //TODO 自定义审批
/** /**
* 新增或编辑-自定义审批 * 新增或编辑-自定义审批
*/ */
...@@ -359,7 +346,7 @@ public class SpmkController { ...@@ -359,7 +346,7 @@ public class SpmkController {
SpmkCustomApproval ca = SpmkCustomApproval.builder().build(); SpmkCustomApproval ca = SpmkCustomApproval.builder().build();
BeanUtil.copyProperties(spmkCustomApprovalDto, ca , "froms","router","initiatorConfigs"); BeanUtil.copyProperties(spmkCustomApprovalDto, ca , "froms","router","initiatorConfigs");
if (ca.selectCount(new QueryWrapper<SpmkCustomApproval>().lambda() if (ca.selectCount(new QueryWrapper<SpmkCustomApproval>().lambda()
.ne(ca.getId() != null, SpmkCustomApproval::getId, ca.getId()) .ne(ca.getId() != null, SpmkCustomApproval::getId, ca.getId())
.eq(SpmkCustomApproval::getName, ca.getName()) .eq(SpmkCustomApproval::getName, ca.getName())
...@@ -370,12 +357,12 @@ public class SpmkController { ...@@ -370,12 +357,12 @@ public class SpmkController {
ca.setFroms(ObjectUtil.serialize(spmkCustomApprovalDto.getFroms())); ca.setFroms(ObjectUtil.serialize(spmkCustomApprovalDto.getFroms()));
ca.setRouter(ObjectUtil.serialize(spmkCustomApprovalDto.getRouter())); ca.setRouter(ObjectUtil.serialize(spmkCustomApprovalDto.getRouter()));
ca.setUpdateTime(new Date()); ca.setUpdateTime(new Date());
//1.新增 SpmkCustomApproval-自定义审批 //1.新增 SpmkCustomApproval-自定义审批
if (!ca.insertOrUpdate()) if (!ca.insertOrUpdate())
return ResultUtil.error("新增自定义审批 失败!"); return ResultUtil.error("新增自定义审批 失败!");
Integer id = ca.getId(); Integer id = ca.getId();
// 2.删除 历史的 SpmkInitiatorConfig-审批发起人配置, // 2.删除 历史的 SpmkInitiatorConfig-审批发起人配置,
SpmkInitiatorConfig.builder().build().delete(new QueryWrapper<SpmkInitiatorConfig>().lambda().eq(SpmkInitiatorConfig::getCustomApprovalId, id)); SpmkInitiatorConfig.builder().build().delete(new QueryWrapper<SpmkInitiatorConfig>().lambda().eq(SpmkInitiatorConfig::getCustomApprovalId, id));
...@@ -391,10 +378,10 @@ public class SpmkController { ...@@ -391,10 +378,10 @@ public class SpmkController {
// 手动抛出异常,事务回滚 // 手动抛出异常,事务回滚
throw new Exception(); throw new Exception();
} }
} }
// //
/** /**
* 注意: 为保证该api的原子性 要加 事务处理 回滚(方法注解-@Transactional(rollbackFor = Exception.class)) * 注意: 为保证该api的原子性 要加 事务处理 回滚(方法注解-@Transactional(rollbackFor = Exception.class))
* 1.新增 SpmkCustomApproval-自定义审批 * 1.新增 SpmkCustomApproval-自定义审批
...@@ -406,12 +393,12 @@ public class SpmkController { ...@@ -406,12 +393,12 @@ public class SpmkController {
ca.setFroms(null); ca.setFroms(null);
ca.setRouter(null); ca.setRouter(null);
return ResultUtil.data(ca); return ResultUtil.data(ca);
} }
/** /**
* 删除-自定义审批 * 删除-自定义审批
* @throws Exception * @throws Exception
*/ */
@DeleteMapping(value = "/delete_custom_approval/{id}") @DeleteMapping(value = "/delete_custom_approval/{id}")
@ApiOperation(value = "14.删除-自定义审批", httpMethod = "DELETE", notes = "删除-自定义审批") @ApiOperation(value = "14.删除-自定义审批", httpMethod = "DELETE", notes = "删除-自定义审批")
...@@ -419,11 +406,11 @@ public class SpmkController { ...@@ -419,11 +406,11 @@ public class SpmkController {
@ApiOperationSupport(order = 14) @ApiOperationSupport(order = 14)
public Result<Object> deleteCaById(@PathVariable int id) throws Exception{ public Result<Object> deleteCaById(@PathVariable int id) throws Exception{
SpmkInitiatorConfig.builder().build().delete(new QueryWrapper<SpmkInitiatorConfig>().lambda().eq(SpmkInitiatorConfig::getCustomApprovalId, id)); SpmkInitiatorConfig.builder().build().delete(new QueryWrapper<SpmkInitiatorConfig>().lambda().eq(SpmkInitiatorConfig::getCustomApprovalId, id));
if (!SpmkCustomApproval.builder().id(id).build().deleteById()) { if (!SpmkCustomApproval.builder().id(id).build().deleteById()) {
throw new Exception(); throw new Exception();
} }
return ResultUtil.success(); return ResultUtil.success();
} }
...@@ -442,9 +429,9 @@ public class SpmkController { ...@@ -442,9 +429,9 @@ public class SpmkController {
.build(); .build();
BeanUtil.copyProperties(ca, caD,"froms","router"); BeanUtil.copyProperties(ca, caD,"froms","router");
caD.setInitiatorConfigs(listIc); caD.setInitiatorConfigs(listIc);
return ResultUtil.data(caD); return ResultUtil.data(caD);
} }
/** /**
* 排序-自定义审批 * 排序-自定义审批
*/ */
...@@ -452,17 +439,17 @@ public class SpmkController { ...@@ -452,17 +439,17 @@ public class SpmkController {
@ApiOperation(value = "16.排序-自定义审批", httpMethod = "PUT", notes = "排序-自定义审批") @ApiOperation(value = "16.排序-自定义审批", httpMethod = "PUT", notes = "排序-自定义审批")
@ApiOperationSupport(order = 16) @ApiOperationSupport(order = 16)
public Result<Object> ranksCa(@Validated({Ranks.class}) @RequestBody ValidList<SpmkCustomApproval> list){ public Result<Object> ranksCa(@Validated({Ranks.class}) @RequestBody ValidList<SpmkCustomApproval> list){
if (list == null || (list != null && list.size() <= 0)) { if (list == null || (list != null && list.size() <= 0)) {
return ResultUtil.success(); return ResultUtil.success();
} }
return spmkCustomApprovalMapper.updateListRandsById(list) ? ResultUtil.success() : ResultUtil.error(); return spmkCustomApprovalMapper.updateListRandsById(list) ? ResultUtil.success() : ResultUtil.error();
} }
@Autowired @Autowired
YgglService ygglService; YgglService ygglService;
/** /**
* 排序-自定义审批 * 排序-自定义审批
*/ */
...@@ -470,21 +457,21 @@ public class SpmkController { ...@@ -470,21 +457,21 @@ public class SpmkController {
@ApiOperation(value = "16.测试", httpMethod = "PUT", notes = "排序-自定义审批") @ApiOperation(value = "16.测试", httpMethod = "PUT", notes = "排序-自定义审批")
@ApiOperationSupport(order = 16) @ApiOperationSupport(order = 16)
public Result<Object> test222(@Validated({Ranks.class}) @RequestBody ValidList<SpmkCustomApproval> list){ public Result<Object> test222(@Validated({Ranks.class}) @RequestBody ValidList<SpmkCustomApproval> list){
Set<Integer> lanzi = new HashSet<Integer>(); Set<Integer> lanzi = new HashSet<Integer>();
//所有部门岗位 //所有部门岗位
List<ZzglBmgwM> bmgws = ZzglBmgwM.builder().build().selectList(new QueryWrapper<ZzglBmgwM>().lambda().eq(ZzglBmgwM::getOrgCode, 311)); List<ZzglBmgwM> bmgws = ZzglBmgwM.builder().build().selectList(new QueryWrapper<ZzglBmgwM>().lambda().eq(ZzglBmgwM::getOrgCode, 311));
//个人岗位 //个人岗位
YgglMainEmp one = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda() YgglMainEmp one = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda()
.select(YgglMainEmp::getBmgwId) .select(YgglMainEmp::getBmgwId)
.eq(YgglMainEmp::getOrgCode, 311).eq(YgglMainEmp::getEmpNum, 12512)); .eq(YgglMainEmp::getOrgCode, 311).eq(YgglMainEmp::getEmpNum, 12512));
Integer getId = one != null ? one.getBmgwId() : null; Integer getId = one != null ? one.getBmgwId() : null;
Set<Integer> all = getId != null ? empNumupdept2(lanzi, bmgws, getId) : new HashSet<Integer>(); Set<Integer> all = getId != null ? empNumupdept2(lanzi, bmgws, getId) : new HashSet<Integer>();
all.add(getId); all.add(getId);
return spmkCustomApprovalMapper.updateListRandsById(list) ? ResultUtil.success() : ResultUtil.error(); return spmkCustomApprovalMapper.updateListRandsById(list) ? ResultUtil.success() : ResultUtil.error();
} }
//遍历 //遍历
public static Set<Integer> empNumupdept2(Set<Integer> lanzi,List<ZzglBmgwM> bmgws,Integer getId) { public static Set<Integer> empNumupdept2(Set<Integer> lanzi,List<ZzglBmgwM> bmgws,Integer getId) {
for (ZzglBmgwM z : bmgws) { for (ZzglBmgwM z : bmgws) {
...@@ -499,11 +486,11 @@ public class SpmkController { ...@@ -499,11 +486,11 @@ public class SpmkController {
} }
return lanzi; return lanzi;
} }
// TODO 审批汇总(发起审批) // TODO 审批汇总(发起审批)
/** /**
* 发起审批 * 发起审批
* @throws Exception * @throws Exception
*/ */
@PostMapping(value = "/start_approval") @PostMapping(value = "/start_approval")
@ApiOperation(value = "17.发起审批", httpMethod = "POST", notes = "发起审批") @ApiOperation(value = "17.发起审批", httpMethod = "POST", notes = "发起审批")
...@@ -511,25 +498,25 @@ public class SpmkController { ...@@ -511,25 +498,25 @@ public class SpmkController {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Log(title = "审批-发起审批", businessType = BusinessType.INSERT) @Log(title = "审批-发起审批", businessType = BusinessType.INSERT)
public Result<Object> saveA(@CurrentUser UserBean userBean,@Validated @RequestBody SpmkApproveSummaryDto spmkApproveSummaryDto) throws Exception{ 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() .lambda()
.select(YgglMainEmp::getHeadUrl,YgglMainEmp::getName) .select(YgglMainEmp::getHeadUrl,YgglMainEmp::getName)
.eq(YgglMainEmp::getEmpNum, userBean.getEmpNum()) .eq(YgglMainEmp::getEmpNum, userBean.getEmpNum())
.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()) .eq(YgglMainEmp::getOrgCode, userBean.getOrgCode())
); );
if (ygglMainEmp == null) if (ygglMainEmp == null)
return ResultUtil.error("发起人不存在!"); return ResultUtil.error("发起人不存在!");
// List<SpmkApprovalG> saG = spmkService.selectListAg(userBean); // List<SpmkApprovalG> saG = spmkService.selectListAg(userBean);
Router router = spmkApproveSummaryDto.getRouter(); Router router = spmkApproveSummaryDto.getRouter();
List<Router> routers = router.getChildren(); List<Router> routers = router.getChildren();
// routers = RouterUtils.clearRouters(routers); // routers = RouterUtils.clearRouters(routers);
if(routers==null){ if(routers==null){
return ResultUtil.error("无法发起,请完善审批流程"); return ResultUtil.error("无法发起,请完善审批流程");
} }
if (CollectionUtil.isNotEmpty(routers)) { if (CollectionUtil.isNotEmpty(routers)) {
// boolean hasAudit=false; // boolean hasAudit=false;
// if(routers.size()>0){ // if(routers.size()>0){
// for (Relation relation:routers.get(0).getRelation()) { // for (Relation relation:routers.get(0).getRelation()) {
...@@ -549,25 +536,25 @@ public class SpmkController { ...@@ -549,25 +536,25 @@ public class SpmkController {
// if(!hasAudit){ // if(!hasAudit){
// return ResultUtil.error("请选择审批人!"); // return ResultUtil.error("请选择审批人!");
// } // }
}else { }else {
return ResultUtil.error("无法发起,请完善审批流程"); return ResultUtil.error("无法发起,请完善审批流程");
} }
List<Router> listRouter = new ArrayList<Router>(); List<Router> listRouter = new ArrayList<Router>();
listRouter.add(router); listRouter.add(router);
JSONObject jSONObject = spmkApproveSummaryDto.getRequestData() JSONObject jSONObject = spmkApproveSummaryDto.getRequestData()
.set("orgCode", userBean.getOrgCode()) .set("orgCode", userBean.getOrgCode())
.set("initiator", ygglMainEmp.getName()) .set("initiator", ygglMainEmp.getName())
.set("headUrl", ygglMainEmp.getHeadUrl()) .set("headUrl", ygglMainEmp.getHeadUrl())
.set("id", userBean.getEmpNum()); .set("id", userBean.getEmpNum());
RouterUtils.NextNode(listRouter, jSONObject, ISFIRST); RouterUtils.NextNode(listRouter, jSONObject, ISFIRST);
List<FlowChildren> listFlowChildren = new ArrayList<FlowChildren>(); List<FlowChildren> listFlowChildren = new ArrayList<FlowChildren>();
RouterUtils.getIsFlowChildren(listRouter,listFlowChildren); RouterUtils.getIsFlowChildren(listRouter,listFlowChildren);
if(listFlowChildren.isEmpty()){ if(listFlowChildren.isEmpty()){
return ResultUtil.error("无法发起,请完善审批流程"); return ResultUtil.error("无法发起,请完善审批流程");
} }
for (FlowChildren flowChildrenItem: listFlowChildren) { for (FlowChildren flowChildrenItem: listFlowChildren) {
if("audit".equals(flowChildrenItem.getClassName())){ if("audit".equals(flowChildrenItem.getClassName())){
...@@ -583,50 +570,52 @@ public class SpmkController { ...@@ -583,50 +570,52 @@ public class SpmkController {
} }
} }
Logoutput("listFlowChildren"); Logoutput("listFlowChildren");
// 当前审批人 // 当前审批人
String currentApprover = jSONObject.getStr("current_approver"); String currentApprover = jSONObject.getStr("current_approver");
// 封装 审批汇总 // 封装 审批汇总
SpmkApproveSummary as = SpmkApproveSummary SpmkApproveSummary as = SpmkApproveSummary
.builder() .builder()
.orgCode(userBean.getOrgCode()) .orgCode(userBean.getOrgCode())
.empNum(userBean.getEmpNum()) .empNum(userBean.getEmpNum())
.title(spmkApproveSummaryDto.getTitle()) .title(spmkApproveSummaryDto.getTitle())
.initiator(spmkApproveSummaryDto.getInitiator()) .initiator(spmkApproveSummaryDto.getInitiator())
.approveName(spmkApproveSummaryDto.getApproveName()) .approveName(spmkApproveSummaryDto.getApproveName())
.assoType(spmkApproveSummaryDto.getAssoType()) .assoType(spmkApproveSummaryDto.getAssoType())
.sts(ApproveSummarySts.IN.ordinal()) .sts(ApproveSummarySts.IN.ordinal())
.currentApprover(currentApprover).build(); .currentApprover(currentApprover).build();
if (!as.insert()) { if (!as.insert()) {
throw new CustomException("审批汇总-新增异常"); throw new CustomException("审批汇总-新增异常");
} }
// 插入记录- 审批执行记录 - 执行人记录 // 插入记录- 审批执行记录 - 执行人记录
RouterUtils.insertogExecuteRecord(listFlowChildren, as.getId()); RouterUtils.insertogExecuteRecord(listFlowChildren, as.getId());
// 封装 审批详情 // 封装 审批详情
SpmkApproveDetail ad = SpmkApproveDetail.builder().build(); SpmkApproveDetailSummary adm = SpmkApproveDetailSummary.builder().build();
ad.setApproveSummaryId(as.getId()); adm.setApproveSummaryId(as.getId());
ad.setName(spmkApproveSummaryDto.getTitle()); adm.setName(spmkApproveSummaryDto.getTitle());
ad.setRequestData(ObjectUtil.serialize(spmkApproveSummaryDto.getRequestData())); adm.setRequestData(spmkApproveSummaryDto.getRequestData().toString());
ad.setFroms(ObjectUtil.serialize((List<JSONObject>)spmkApproveSummaryDto.getFroms())); adm.setFroms(spmkApproveSummaryDto.getFroms().toString());
ad.setRouter(ObjectUtil.serialize(listRouter.get(0))); adm.setRouter(listRouter.get(0).toJSONString());
ad.setFlowChildren(ObjectUtil.serialize(listFlowChildren)); adm.setFlowChildren(listFlowChildren.toString());
try {
if (!ad.insert()) spmkApproveDetailSummaryMapper.insert(adm);
throw new CustomException("审批详情-新增异常"); }catch (Exception e){
throw new CustomException("审批详情-新增异常");
return ResultUtil.success(); }
return ResultUtil.success();
} }
//TODO 审批汇总 //TODO 审批汇总
/** /**
* 审批汇总 * 审批汇总
* @param summaryQueryDto * @param summaryQueryDto
* @return * @return
* @throws * @throws
*/ */
@PostMapping(value = "/select_approve_summary") @PostMapping(value = "/select_approve_summary")
@ApiOperation(value = "18.审批汇总", httpMethod = "POST", notes = "审批汇总") @ApiOperation(value = "18.审批汇总", httpMethod = "POST", notes = "审批汇总")
...@@ -634,32 +623,32 @@ public class SpmkController { ...@@ -634,32 +623,32 @@ public class SpmkController {
@Log(title = "审批-审批汇总", businessType = BusinessType.OTHER) @Log(title = "审批-审批汇总", businessType = BusinessType.OTHER)
public Result<Object> selectAs(@CurrentUser UserBean userBean, @RequestBody SummaryQueryDto summaryQueryDto) { public Result<Object> selectAs(@CurrentUser UserBean userBean, @RequestBody SummaryQueryDto summaryQueryDto) {
IPage<SpmkApproveSummary> page = new Page<SpmkApproveSummary>( IPage<SpmkApproveSummary> page = new Page<SpmkApproveSummary>(
summaryQueryDto.getCurrentPage() == null ? 1 : summaryQueryDto.getCurrentPage(), summaryQueryDto.getCurrentPage() == null ? 1 : summaryQueryDto.getCurrentPage(),
summaryQueryDto.getTotalPage() == null ? 10 : summaryQueryDto.getTotalPage()); summaryQueryDto.getTotalPage() == null ? 10 : summaryQueryDto.getTotalPage());
summaryQueryDto.setOrgCode(userBean.getOrgCode()); summaryQueryDto.setOrgCode(userBean.getOrgCode());
Integer deptId = summaryQueryDto.getDeptId();
List<YgglMainEmp> listYgglMainEmp = zzglBmgwMService.selectOtherlistent(userBean.getOrgCode(), deptId);
if (deptId != null && (listYgglMainEmp == null || listYgglMainEmp.size() == 0)) { Integer deptId = summaryQueryDto.getDeptId();
return ResultUtil.data(new ArrayList<SpmkApproveSummary>()); List<YgglMainEmp> listYgglMainEmp = zzglBmgwMService.selectOtherlistent(userBean.getOrgCode(), deptId);
}
List<Integer> empNums = new ArrayList<Integer>();
for (YgglMainEmp ygglMainEmp : listYgglMainEmp) {
empNums.add(ygglMainEmp.getEmpNum());
}
summaryQueryDto.setEmpNums(empNums);
// 缺-部门id 搜索 if (deptId != null && (listYgglMainEmp == null || listYgglMainEmp.size() == 0)) {
IPage<SpmkApproveSummary> pageAs = spmkApproveSummaryMapper.selectPageByQuery(page, summaryQueryDto); return ResultUtil.data(new ArrayList<SpmkApproveSummary>());
}
List<SpmkApproveSummary> listAs = pageAs.getRecords();
List<Integer> empNums = new ArrayList<Integer>();
return ResultUtil.data(pageAs, listAs); for (YgglMainEmp ygglMainEmp : listYgglMainEmp) {
empNums.add(ygglMainEmp.getEmpNum());
}
summaryQueryDto.setEmpNums(empNums);
// 缺-部门id 搜索
IPage<SpmkApproveSummary> pageAs = spmkApproveSummaryMapper.selectPageByQuery(page, summaryQueryDto);
List<SpmkApproveSummary> listAs = pageAs.getRecords();
return ResultUtil.data(pageAs, listAs);
} }
//TODO 审批详情 //TODO 审批详情
/** /**
* 审批详情 * 审批详情
...@@ -669,12 +658,12 @@ public class SpmkController { ...@@ -669,12 +658,12 @@ public class SpmkController {
@ApiOperationSupport(order = 19) @ApiOperationSupport(order = 19)
@Log(title = "审批-审批详情", businessType = BusinessType.OTHER) @Log(title = "审批-审批详情", businessType = BusinessType.OTHER)
public Result<Object> selectAd(@PathVariable(required = true) Integer id) { public Result<Object> selectAd(@PathVariable(required = true) Integer id) {
SpmkApproveDetailDto adD = spmkService.selectApproveDetailByAsId(id); SpmkApproveDetailDto adD = spmkService.selectApproveDetailByAsId(id);
return ResultUtil.data(adD); return ResultUtil.data(adD);
} }
//TODO 审批人审批 //TODO 审批人审批
/** /**
* 审批人审批 * 审批人审批
...@@ -686,7 +675,7 @@ public class SpmkController { ...@@ -686,7 +675,7 @@ public class SpmkController {
@Log(title = "审批-审批流程", businessType = BusinessType.UPDATE) @Log(title = "审批-审批流程", businessType = BusinessType.UPDATE)
// @BindingResultCtrol(title = "审批人审批") // @BindingResultCtrol(title = "审批人审批")
public Result<Object> approving(@CurrentUser UserBean userBean,@Validated @RequestBody ApprovingDto approvingDto) throws Exception { public Result<Object> approving(@CurrentUser UserBean userBean,@Validated @RequestBody ApprovingDto approvingDto) throws Exception {
Integer asId = approvingDto.getAsId(); Integer asId = approvingDto.getAsId();
SpmkApproveDetail ad = SpmkApproveDetail.builder().build().selectOne(new QueryWrapper<SpmkApproveDetail>() SpmkApproveDetail ad = SpmkApproveDetail.builder().build().selectOne(new QueryWrapper<SpmkApproveDetail>()
.lambda() .lambda()
...@@ -694,55 +683,55 @@ public class SpmkController { ...@@ -694,55 +683,55 @@ public class SpmkController {
SpmkApproveDetail::getRequestData, SpmkApproveDetail::getRequestData,
SpmkApproveDetail::getFlowChildren) SpmkApproveDetail::getFlowChildren)
.eq(SpmkApproveDetail::getApproveSummaryId, asId)); .eq(SpmkApproveDetail::getApproveSummaryId, asId));
// 查询 SpmkApproveSummary 状态 // 查询 SpmkApproveSummary 状态
SpmkApproveSummary aSummary = spmkApproveSummaryMapper.selectOne(new QueryWrapper<SpmkApproveSummary>().lambda() SpmkApproveSummary aSummary = spmkApproveSummaryMapper.selectOne(new QueryWrapper<SpmkApproveSummary>().lambda()
.select(SpmkApproveSummary::getSts) .select(SpmkApproveSummary::getSts)
.eq(SpmkApproveSummary::getId, asId)); .eq(SpmkApproveSummary::getId, asId));
if (aSummary.getSts() > SpmkEnumInterface.ApproveSummarySts.IN.ordinal()) { if (aSummary.getSts() > SpmkEnumInterface.ApproveSummarySts.IN.ordinal()) {
return ResultUtil.error("该审批已结束!"); return ResultUtil.error("该审批已结束!");
} }
// 查询该 审批的状态 是否为 1 审批中 // 查询该 审批的状态 是否为 1 审批中
Integer count = SpmkExecutor.builder().build().selectCount(new QueryWrapper<SpmkExecutor>().lambda() Integer count = SpmkExecutor.builder().build().selectCount(new QueryWrapper<SpmkExecutor>().lambda()
.eq(SpmkExecutor::getId, approvingDto.getExecutorId()) .eq(SpmkExecutor::getId, approvingDto.getExecutorId())
.eq(SpmkExecutor::getSts, ExecutorSts.IN_EXECUTION.ordinal())); .eq(SpmkExecutor::getSts, ExecutorSts.IN_EXECUTION.ordinal()));
if (count == 0) { if (count == 0) {
return ResultUtil.error("您已审批过!"); return ResultUtil.error("您已审批过!");
} }
if ( spmkExecutorMapper.selectCount(new QueryWrapper<SpmkExecutor>().lambda() if ( spmkExecutorMapper.selectCount(new QueryWrapper<SpmkExecutor>().lambda()
.eq(SpmkExecutor::getId, approvingDto.getExecutorId()) .eq(SpmkExecutor::getId, approvingDto.getExecutorId())
.eq(SpmkExecutor::getEmpNum, userBean.getEmpNum()) .eq(SpmkExecutor::getEmpNum, userBean.getEmpNum())
.eq(SpmkExecutor::getSts, SpmkEnumInterface.ExecutorSts.IN_EXECUTION.ordinal())) == 0) { .eq(SpmkExecutor::getSts, SpmkEnumInterface.ExecutorSts.IN_EXECUTION.ordinal())) == 0) {
Integer adminNum = new LambdaQueryChainWrapper<QyzxEmpEntAsso>(qyzxEmpEntAssoMapper) Integer adminNum = new LambdaQueryChainWrapper<QyzxEmpEntAsso>(qyzxEmpEntAssoMapper)
.eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum()) .eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum())
.eq(QyzxEmpEntAsso::getOrgCode, userBean.getOrgCode()) .eq(QyzxEmpEntAsso::getOrgCode, userBean.getOrgCode())
.in(QyzxEmpEntAsso::getUserType, SysRoleType.U_TYPE_ADMIN,SysRoleType.U_TYPE_C_ADMIN) .in(QyzxEmpEntAsso::getUserType, SysRoleType.U_TYPE_ADMIN,SysRoleType.U_TYPE_C_ADMIN)
.count(); .count();
if (adminNum <= 0) { if (adminNum <= 0) {
return ResultUtil.error("非当前审批人 或 管理员,无法操作!"); return ResultUtil.error("非当前审批人 或 管理员,无法操作!");
} }
} }
if (aSummary.getSts() == 0) { if (aSummary.getSts() == 0) {
List<FlowChildren> listFlowChildren = ObjectUtil.deserialize(ad.getFlowChildren()); List<FlowChildren> listFlowChildren = ObjectUtil.deserialize(ad.getFlowChildren());
// 审批逻辑 // 审批逻辑
RouterUtils.approving( RouterUtils.approving(
listFlowChildren, listFlowChildren,
asId, asId,
approvingDto.getExecuteRecordId(), approvingDto.getExecuteRecordId(),
approvingDto.getExecutorId(), approvingDto.getExecutorId(),
approvingDto.getOpinion(), approvingDto.getOpinion(),
approvingDto.getSts(), approvingDto.getSts(),
approvingDto.getUser() approvingDto.getUser()
); );
// 更新 flowChildren // 更新 flowChildren
SpmkApproveDetail.builder().id(ad.getId()).flowChildren(ObjectUtil.serialize(listFlowChildren)).build().updateById(); SpmkApproveDetail.builder().id(ad.getId()).flowChildren(ObjectUtil.serialize(listFlowChildren)).build().updateById();
FlowChildren fc = CollUtil.getLast(listFlowChildren); FlowChildren fc = CollUtil.getLast(listFlowChildren);
...@@ -751,29 +740,29 @@ public class SpmkController { ...@@ -751,29 +740,29 @@ public class SpmkController {
aSummary = spmkApproveSummaryMapper.selectOne(new QueryWrapper<SpmkApproveSummary>().lambda() aSummary = spmkApproveSummaryMapper.selectOne(new QueryWrapper<SpmkApproveSummary>().lambda()
.select(SpmkApproveSummary::getSts,SpmkApproveSummary::getAssoType) .select(SpmkApproveSummary::getSts,SpmkApproveSummary::getAssoType)
.eq(SpmkApproveSummary::getId, asId)); .eq(SpmkApproveSummary::getId, asId));
if (aSummary.getSts() != SpmkEnumInterface.ApproveSummarySts.REFUSE.ordinal()) { if (aSummary.getSts() != SpmkEnumInterface.ApproveSummarySts.REFUSE.ordinal()) {
SpmkApproveSummary.builder().id(asId).currentApprover(CommonEnum.NULL_STR.getDesc()).endTime(new Date()).sts(ApproveSummarySts.FINISH.ordinal()).build().updateById(); SpmkApproveSummary.builder().id(asId).currentApprover(CommonEnum.NULL_STR.getDesc()).endTime(new Date()).sts(ApproveSummarySts.FINISH.ordinal()).build().updateById();
JSONObject jSONObject = ObjectUtil.deserialize(ad.getRequestData()); JSONObject jSONObject = ObjectUtil.deserialize(ad.getRequestData());
jSONObject.set("approveId", FromData.builder().value(String.valueOf(asId)).build()); jSONObject.set("approveId", FromData.builder().value(String.valueOf(asId)).build());
jSONObject.set("orgCode", userBean.getOrgCode()); jSONObject.set("orgCode", userBean.getOrgCode());
//审批完成后 业务 //审批完成后 业务
SpmkAssoBusiness sab = spmkAssoBusinessFactory.createSpmkService(ApproveEnum.getEnums(aSummary.getAssoType())); SpmkAssoBusiness sab = spmkAssoBusinessFactory.createSpmkService(ApproveEnum.getEnums(aSummary.getAssoType()));
if (sab != null) if (sab != null)
Logoutput("1----------"+ sab); Logoutput("1----------"+ sab);
Logoutput("2----------"+ jSONObject); Logoutput("2----------"+ jSONObject);
sab.handleApprove(jSONObject); sab.handleApprove(jSONObject);
} }
} }
}else { }else {
return ResultUtil.error("该审批已结束!"); return ResultUtil.error("该审批已结束!");
} }
return ResultUtil.success(); return ResultUtil.success();
} }
@Autowired @Autowired
private PunchRecordMapper punchrecordmapper; private PunchRecordMapper punchrecordmapper;
//TODO 我发起的/我审批的/抄送我的 //TODO 我发起的/我审批的/抄送我的
...@@ -785,35 +774,35 @@ public class SpmkController { ...@@ -785,35 +774,35 @@ public class SpmkController {
@ApiOperationSupport(order = 21) @ApiOperationSupport(order = 21)
@Log(title = "审批-我发起的/我审批的/抄送我的", businessType = BusinessType.OTHER) @Log(title = "审批-我发起的/我审批的/抄送我的", businessType = BusinessType.OTHER)
public Result<Object> selectMyAs(@CurrentUser UserBean userBean, @Validated @RequestBody MySummaryQueryDto mySummaryQueryDto) throws MethodArgumentNotValidException{ public Result<Object> selectMyAs(@CurrentUser UserBean userBean, @Validated @RequestBody MySummaryQueryDto mySummaryQueryDto) throws MethodArgumentNotValidException{
IPage<SpmkApproveSummary> page = new Page<SpmkApproveSummary>( IPage<SpmkApproveSummary> page = new Page<SpmkApproveSummary>(
mySummaryQueryDto.getCurrentPage() == null ? 1 : mySummaryQueryDto.getCurrentPage(), mySummaryQueryDto.getCurrentPage() == null ? 1 : mySummaryQueryDto.getCurrentPage(),
mySummaryQueryDto.getTotalPage() == null ? 10 : mySummaryQueryDto.getTotalPage()); mySummaryQueryDto.getTotalPage() == null ? 10 : mySummaryQueryDto.getTotalPage());
mySummaryQueryDto.setOrgCode(userBean.getOrgCode()); mySummaryQueryDto.setOrgCode(userBean.getOrgCode());
mySummaryQueryDto.setEmpNum(userBean.getEmpNum()); mySummaryQueryDto.setEmpNum(userBean.getEmpNum());
if(mySummaryQueryDto.getSts() == null) { if(mySummaryQueryDto.getSts() == null) {
mySummaryQueryDto.setSts(0); mySummaryQueryDto.setSts(0);
} }
//我发起的 //我发起的
if(mySummaryQueryDto.getType() == 0) { if(mySummaryQueryDto.getType() == 0) {
// mySummaryQueryDto.setSts(null); // mySummaryQueryDto.setSts(null);
} }
// 缺-部门id 搜索 // 缺-部门id 搜索
IPage<SpmkApproveSummary> pageAs = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(page, mySummaryQueryDto); IPage<SpmkApproveSummary> pageAs = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(page, mySummaryQueryDto);
List<SpmkApproveSummary> listAs = pageAs.getRecords(); List<SpmkApproveSummary> listAs = pageAs.getRecords();
for(SpmkApproveSummary sp : listAs) { for(SpmkApproveSummary sp : listAs) {
String requerstr = ""; String requerstr = "";
try { try {
SpmkApproveDetail ad = spmkApproveDetailMapper.selectOne(new QueryWrapper<SpmkApproveDetail>().lambda().eq(SpmkApproveDetail::getApproveSummaryId, sp.getId())); SpmkApproveDetailSummary ad = spmkApproveDetailSummaryMapper.selectOne(new QueryWrapper<SpmkApproveDetailSummary>().lambda().eq(SpmkApproveDetailSummary::getApproveSummaryId, sp.getId()));
JSONObject as = ObjectUtil.deserialize(ad.getRequestData()); JSONObject as =jsonObject.parseObject(ad.getRequestData().toString(),JSONObject.class);
// Logoutput(as); // Logoutput(as);
// Logoutput(sp.getId()+"==========================================="+sp.getAssoType()); // Logoutput(sp.getId()+"==========================================="+sp.getAssoType());
requerstr = ""; requerstr = "";
//assoType : 1转正 2离职 3调薪 4调岗 5加班 6请假 7出差 8外出 9补卡 //assoType : 1转正 2离职 3调薪 4调岗 5加班 6请假 7出差 8外出 9补卡
switch (sp.getAssoType()) { switch (sp.getAssoType()) {
case 1:requerstr = "转正时间:"+as.getJSONObject("__newConfirmationTime").getStr("value");break; case 1:requerstr = "转正时间:"+as.getJSONObject("__newConfirmationTime").getStr("value");break;
case 2:requerstr = "离职时间:"+as.getJSONObject("__terminationDate").getStr("value");break; case 2:requerstr = "离职时间:"+as.getJSONObject("__terminationDate").getStr("value");break;
case 3: case 3:
...@@ -838,17 +827,17 @@ public class SpmkController { ...@@ -838,17 +827,17 @@ public class SpmkController {
case 9:requerstr = "补卡时间:"+as.getJSONObject("__PatchCardTime").getStr("value");break; case 9:requerstr = "补卡时间:"+as.getJSONObject("__PatchCardTime").getStr("value");break;
default: default:
break; break;
}
} catch (Exception e) {
e.printStackTrace();
} }
// Logoutput(requerstr); } catch (Exception e) {
sp.setDigest(requerstr); e.printStackTrace();
} }
// Logoutput(requerstr);
return ResultUtil.data(pageAs, listAs); sp.setDigest(requerstr);
}
return ResultUtil.data(pageAs, listAs);
} }
//TODO 撤销审批 //TODO 撤销审批
/** /**
* 撤销审批 * 撤销审批
...@@ -859,16 +848,16 @@ public class SpmkController { ...@@ -859,16 +848,16 @@ public class SpmkController {
@ApiOperationSupport(order = 22) @ApiOperationSupport(order = 22)
@Log(title = "审批-撤销审批", businessType = BusinessType.UPDATE) @Log(title = "审批-撤销审批", businessType = BusinessType.UPDATE)
public Result<Object> revokeApproval(@PathVariable Integer id) throws Exception { public Result<Object> revokeApproval(@PathVariable Integer id) throws Exception {
SpmkApproveSummary as = spmkApproveSummaryMapper.selectOne(new QueryWrapper<SpmkApproveSummary>() SpmkApproveSummary as = spmkApproveSummaryMapper.selectOne(new QueryWrapper<SpmkApproveSummary>()
.lambda() .lambda()
.select(SpmkApproveSummary::getSts) .select(SpmkApproveSummary::getSts)
.eq(SpmkApproveSummary::getId, id)); .eq(SpmkApproveSummary::getId, id));
return as != null && as.getSts() != ApproveSummarySts.FINISH.ordinal() ? (SpmkApproveSummary.builder().id(id).endTime(new Date()).sts(ApproveSummarySts.UNDONE.ordinal()).build().updateById() ? return as != null && as.getSts() != ApproveSummarySts.FINISH.ordinal() ? (SpmkApproveSummary.builder().id(id).endTime(new Date()).sts(ApproveSummarySts.UNDONE.ordinal()).build().updateById() ?
ResultUtil.success() : ResultUtil.error("撤销异常")) : ResultUtil.error("审批已结束,无法撤销!"); ResultUtil.success() : ResultUtil.error("撤销异常")) : ResultUtil.error("审批已结束,无法撤销!");
} }
/** /**
* 删除-审批(发起的审批)-根据审批汇总id * 删除-审批(发起的审批)-根据审批汇总id
*/ */
...@@ -886,16 +875,16 @@ public class SpmkController { ...@@ -886,16 +875,16 @@ public class SpmkController {
spmkExecutorMapper.delete(new QueryWrapper<SpmkExecutor>().lambda().eq(SpmkExecutor::getApproveExecuteRecordId, aer.getId())); spmkExecutorMapper.delete(new QueryWrapper<SpmkExecutor>().lambda().eq(SpmkExecutor::getApproveExecuteRecordId, aer.getId()));
} }
} }
spmkApproveExecuteRecordMapper.delete(new QueryWrapper<SpmkApproveExecuteRecord>().lambda().eq(SpmkApproveExecuteRecord::getApproveSummaryId, id)); spmkApproveExecuteRecordMapper.delete(new QueryWrapper<SpmkApproveExecuteRecord>().lambda().eq(SpmkApproveExecuteRecord::getApproveSummaryId, id));
//新审核表删除
spmkApproveDetailMapper.delete(new QueryWrapper<SpmkApproveDetail>().lambda().eq(SpmkApproveDetail::getApproveSummaryId, id)); spmkApproveDetailSummaryMapper.delete(new QueryWrapper<SpmkApproveDetailSummary>().lambda().eq(SpmkApproveDetailSummary::getApproveSummaryId,id));
spmkApproveSummaryMapper.delete(new QueryWrapper<SpmkApproveSummary>().lambda().eq(SpmkApproveSummary::getId, id)); spmkApproveSummaryMapper.delete(new QueryWrapper<SpmkApproveSummary>().lambda().eq(SpmkApproveSummary::getId, id));
return ResultUtil.success(); return ResultUtil.success();
} }
/** /**
* 删除-审批组、自定义审批、审批汇总、审批详情、审批执行记录、审批执行人记录 所有数据 * 删除-审批组、自定义审批、审批汇总、审批详情、审批执行记录、审批执行人记录 所有数据
*/ */
...@@ -906,37 +895,37 @@ public class SpmkController { ...@@ -906,37 +895,37 @@ public class SpmkController {
spmkApprovalGMapper.delete(null); spmkApprovalGMapper.delete(null);
spmkCustomApprovalMapper.delete(null); spmkCustomApprovalMapper.delete(null);
spmkApproveSummaryMapper.delete(null); spmkApproveSummaryMapper.delete(null);
spmkApproveDetailMapper.delete(null); spmkApproveDetailSummaryMapper.delete(null);
spmkApproveExecuteRecordMapper.delete(null); spmkApproveExecuteRecordMapper.delete(null);
spmkExecutorMapper.delete(null); spmkExecutorMapper.delete(null);
Logoutput("删除-审批组、自定义审批、审批汇总、审批详情、审批执行记录、审批执行人记录 所有数据 完成!"); Logoutput("删除-审批组、自定义审批、审批汇总、审批详情、审批执行记录、审批执行人记录 所有数据 完成!");
return ResultUtil.success(); return ResultUtil.success();
} }
//TODO 审批图标列表 //TODO 审批图标列表
@GetMapping(value = "/icon") @GetMapping(value = "/icon")
@ApiOperation(value = "99.图标列表", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "99.图标列表", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 99) @ApiOperationSupport(order = 99)
public Result<List<SpmkIcon>> selectListIcon(@CurrentUser UserBean userBean){ public Result<List<SpmkIcon>> selectListIcon(@CurrentUser UserBean userBean){
List<SpmkIcon> spmkIcons = SpmkIcon.builder().build().selectAll(); List<SpmkIcon> spmkIcons = SpmkIcon.builder().build().selectAll();
return ResultUtil.data(spmkIcons,"获取图标列表成功"); return ResultUtil.data(spmkIcons,"获取图标列表成功");
} }
//TODO 测试-生成 审批组 和 自定义审批 //TODO 测试-生成 审批组 和 自定义审批
@GetMapping(value = "/test") @GetMapping(value = "/test")
@ApiOperation(value = "98.测试-生成 审批组 和 自定义审批", httpMethod = "GET", notes = "测试-生成 审批组 和 自定义审批") @ApiOperation(value = "98.测试-生成 审批组 和 自定义审批", httpMethod = "GET", notes = "测试-生成 审批组 和 自定义审批")
@ApiOperationSupport(order = 98) @ApiOperationSupport(order = 98)
public Result<List<SpmkIcon>> createCustomApproval(@RequestParam Integer orgCode){ public Result<List<SpmkIcon>> createCustomApproval(@RequestParam Integer orgCode){
spmkService.createCustomApproval(orgCode); spmkService.createCustomApproval(orgCode);
List<SpmkIcon> spmkIcons = SpmkIcon.builder().build().selectAll(); List<SpmkIcon> spmkIcons = SpmkIcon.builder().build().selectAll();
return ResultUtil.data(spmkIcons,"生成 审批组 和 自定义审批成功"); return ResultUtil.data(spmkIcons,"生成 审批组 和 自定义审批成功");
} }
@GetMapping(value = "/verification_staff") @GetMapping(value = "/verification_staff")
@ApiOperation(value = "校验员工是否是正式员工", httpMethod = "GET", notes = " 查询列表-假期规则") @ApiOperation(value = "校验员工是否是正式员工", httpMethod = "GET", notes = " 查询列表-假期规则")
public Result<Object> verification_staff(@CurrentUser UserBean userBean) { public Result<Object> verification_staff(@CurrentUser UserBean userBean) {
...@@ -946,61 +935,70 @@ public class SpmkController { ...@@ -946,61 +935,70 @@ public class SpmkController {
if(ygem.getJobStatus() == 1) { if(ygem.getJobStatus() == 1) {
msg = "正式员工不能发起转正审批"; msg = "正式员工不能发起转正审批";
} }
return ResultUtil.data(msg); return ResultUtil.data(msg);
} }
@PostMapping(value = "/approved_quantity") @PostMapping(value = "/approved_quantity")
@ApiOperation(value = "APP-我发起的/我审批的/抄送我的-数量", httpMethod = "POST", notes = "") @ApiOperation(value = "APP-我发起的/我审批的/抄送我的-数量", httpMethod = "POST", notes = "")
public Result<Object> ApprovedQuantity(@CurrentUser UserBean userBean, @Validated @RequestBody MySummaryQueryDto mysummaryquerydto){ public Result<Object> ApprovedQuantity(@CurrentUser UserBean userBean, @Validated @RequestBody MySummaryQueryDto mysummaryquerydto){
ApprovedQuantityDto qna = ApprovedQuantityDto.builder().build(); ApprovedQuantityDto qna = ApprovedQuantityDto.builder().build();
mysummaryquerydto.setEndTime(null); mysummaryquerydto.setEndTime(null);
mysummaryquerydto.setStartTime(null); mysummaryquerydto.setStartTime(null);
mysummaryquerydto.setOrgCode(userBean.getOrgCode()); mysummaryquerydto.setOrgCode(userBean.getOrgCode());
mysummaryquerydto.setEmpNum(userBean.getEmpNum()); mysummaryquerydto.setEmpNum(userBean.getEmpNum());
mysummaryquerydto.setSts(5);//状态 0审批中 1审批撤销 2审批通过/审批完成 3审批拒绝 4:(2/3) 5:全部 mysummaryquerydto.setSts(5);//状态 0审批中 1审批撤销 2审批通过/审批完成 3审批拒绝 4:(2/3) 5:全部
int istartedit=0,ccme=0,iapprovedit=0; int istartedit=0,ccme=0,iapprovedit=0;
mysummaryquerydto.setType(0);//我发起的 mysummaryquerydto.setType(0);//我发起的
List<SpmkApproveSummary> istartedit_ = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(mysummaryquerydto); List<SpmkApproveSummary> istartedit_ = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(mysummaryquerydto);
if(istartedit_.size() > 0) { if(istartedit_.size() > 0) {
istartedit = istartedit_.size(); istartedit = istartedit_.size();
} }
mysummaryquerydto.setType(1);//抄送我的 mysummaryquerydto.setType(1);//抄送我的
List<SpmkApproveSummary> ccme_ = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(mysummaryquerydto); List<SpmkApproveSummary> ccme_ = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(mysummaryquerydto);
if(ccme_.size() > 0) { if(ccme_.size() > 0) {
ccme = ccme_.size(); ccme = ccme_.size();
} }
mysummaryquerydto.setType(2);//我审批的 mysummaryquerydto.setType(2);//我审批的
List<SpmkApproveSummary> iapprovedit_ = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(mysummaryquerydto); List<SpmkApproveSummary> iapprovedit_ = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(mysummaryquerydto);
if(iapprovedit_.size() > 0) { if(iapprovedit_.size() > 0) {
iapprovedit = iapprovedit_.size(); iapprovedit = iapprovedit_.size();
} }
qna.setIstartedit(istartedit); qna.setIstartedit(istartedit);
qna.setCcme(ccme); qna.setCcme(ccme);
qna.setIapprovedit(iapprovedit); qna.setIapprovedit(iapprovedit);
return ResultUtil.data(qna); return ResultUtil.data(qna);
} }
@Value("${config-8timer.environmental-science}") @Value("${config-8timer.environmental-science}")
public String environmental_science; public String environmental_science;
public void Logoutput(String science) { public void Logoutput(String science) {
if(!("pro").equals(environmental_science)) { if(!("pro").equals(environmental_science)) {
System.out.println(science); System.out.println(science);
}else { }else {
System.out.println(""); System.out.println("");
} }
}
/**
* 审核详情数据转换
*/
@PostMapping(value = "/approved_addDetail")
@ApiOperation(value = "A审核详情数据转换", httpMethod = "POST", notes = "")
public void addApproveDetail(String status){
spmkService.addApproveDetail(status);
} }
} }
...@@ -13,5 +13,8 @@ public interface SpmkService { ...@@ -13,5 +13,8 @@ public interface SpmkService {
SpmkApproveDetailDto selectApproveDetailByAsId(Integer asId); SpmkApproveDetailDto selectApproveDetailByAsId(Integer asId);
List<SpmkApprovalG> selectListAg(UserBean userBean); List<SpmkApprovalG> selectListAg(UserBean userBean);
void addApproveDetail(String status);
} }
...@@ -3,6 +3,14 @@ package cn.timer.api.controller.spmk.service; ...@@ -3,6 +3,14 @@ package cn.timer.api.controller.spmk.service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -11,22 +19,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -11,22 +19,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.Console; import cn.hutool.core.lang.Console;
import cn.hutool.core.util.ObjectUtil; 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.config.annotation.UserBean;
import cn.timer.api.controller.zzgl.service.ZzglBmgwMService; 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.dto.spmk.SpmkApproveDetailDto;
import cn.timer.api.utils.ResultUtil;
@Service @Service
public class SpmkServiceImpl implements SpmkService{ public class SpmkServiceImpl implements SpmkService{
...@@ -35,9 +31,6 @@ public class SpmkServiceImpl implements SpmkService{ ...@@ -35,9 +31,6 @@ public class SpmkServiceImpl implements SpmkService{
private ZzglBmgwMService zzglBmgwMService; private ZzglBmgwMService zzglBmgwMService;
@Autowired @Autowired
private SpmkCustomApprovalMapper spmkCustomApprovalMapper;
@Autowired
private SpmkApproveDetailMapper spmkApproveDetailMapper; private SpmkApproveDetailMapper spmkApproveDetailMapper;
@Autowired @Autowired
...@@ -45,7 +38,12 @@ public class SpmkServiceImpl implements SpmkService{ ...@@ -45,7 +38,12 @@ public class SpmkServiceImpl implements SpmkService{
@Autowired @Autowired
private SpmkApproveExecuteRecordMapper spmkApproveExecuteRecordMapper; private SpmkApproveExecuteRecordMapper spmkApproveExecuteRecordMapper;
@Autowired
private SpmkApproveDetailSummaryMapper spmkApproveDetailSummaryMapper;
private static com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
/** /**
* 根据orgCode查数据库 审批模板 生成 自定义模板 * 根据orgCode查数据库 审批模板 生成 自定义模板
* orgCode 企业id * orgCode 企业id
...@@ -92,7 +90,8 @@ public class SpmkServiceImpl implements SpmkService{ ...@@ -92,7 +90,8 @@ public class SpmkServiceImpl implements SpmkService{
@Override @Override
public SpmkApproveDetailDto selectApproveDetailByAsId(Integer asId) { public SpmkApproveDetailDto selectApproveDetailByAsId(Integer asId) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
SpmkApproveDetail ad = spmkApproveDetailMapper.selectOne(new QueryWrapper<SpmkApproveDetail>().lambda().eq(SpmkApproveDetail::getApproveSummaryId, asId)); //SpmkApproveDetail ad = spmkApproveDetailMapper.selectOne(new QueryWrapper<SpmkApproveDetail>().lambda().eq(SpmkApproveDetail::getApproveSummaryId, asId));
SpmkApproveDetailSummary ad = spmkApproveDetailSummaryMapper.selectOne(new QueryWrapper<SpmkApproveDetailSummary>().lambda().eq(SpmkApproveDetailSummary::getApproveSummaryId, asId));
SpmkApproveSummary sum = null; SpmkApproveSummary sum = null;
if(ad != null) { if(ad != null) {
sum = SpmkApproveSummary.builder().build().selectOne(new QueryWrapper<SpmkApproveSummary>().lambda().select(SpmkApproveSummary::getId,SpmkApproveSummary::getEmpNum,SpmkApproveSummary::getSts,SpmkApproveSummary::getCreateTime) sum = SpmkApproveSummary.builder().build().selectOne(new QueryWrapper<SpmkApproveSummary>().lambda().select(SpmkApproveSummary::getId,SpmkApproveSummary::getEmpNum,SpmkApproveSummary::getSts,SpmkApproveSummary::getCreateTime)
...@@ -105,10 +104,18 @@ public class SpmkServiceImpl implements SpmkService{ ...@@ -105,10 +104,18 @@ public class SpmkServiceImpl implements SpmkService{
} }
List<SpmkApproveExecuteRecord> listAer = spmkApproveExecuteRecordMapper.selectListByAsId(asId); List<SpmkApproveExecuteRecord> listAer = spmkApproveExecuteRecordMapper.selectListByAsId(asId);
BeanUtil.copyProperties(ad, adD, "requestData","froms","router","spmkApproveExecuteRecord"); BeanUtil.copyProperties(ad, adD, "requestData","froms","router","spmkApproveExecuteRecord");
adD.setRequestData(ObjectUtil.deserialize(ad.getRequestData())); if(ad.getRequestData() !=null) {
adD.setFroms(ObjectUtil.deserialize(ad.getFroms())); adD.setRequestData(jsonObject.parseObject(ad.getRequestData(), JSONObject.class));
adD.setRouter(ObjectUtil.deserialize(ad.getRouter())); }
adD.setFlowChildren(ObjectUtil.deserialize(ad.getFlowChildren())); if(ad.getFroms()!=null) {
adD.setFroms(jsonObject.parseArray(ad.getFroms(), JSONObject.class));
}
if(ad.getFlowChildren() !=null) {
adD.setRouter(jsonObject.parseObject(ad.getRouter(), Router.class));
}
if(ad.getFlowChildren()!=null) {
adD.setFlowChildren(jsonObject.parseArray(ad.getFlowChildren(), FlowChildren.class));
}
adD.setApproveExecuteRecord(listAer); adD.setApproveExecuteRecord(listAer);
if(sum != null) { if(sum != null) {
adD.setEmpNum(sum.getEmpNum()); adD.setEmpNum(sum.getEmpNum());
...@@ -134,6 +141,7 @@ public class SpmkServiceImpl implements SpmkService{ ...@@ -134,6 +141,7 @@ public class SpmkServiceImpl implements SpmkService{
return adD; return adD;
} }
@Override @Override
public List<SpmkApprovalG> selectListAg(UserBean userBean) { public List<SpmkApprovalG> selectListAg(UserBean userBean) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
...@@ -141,4 +149,56 @@ public class SpmkServiceImpl implements SpmkService{ ...@@ -141,4 +149,56 @@ public class SpmkServiceImpl implements SpmkService{
return spmkApprovalGMapper.selectListAgInCa(userBean.getOrgCode(), userBean.getEmpNum(), depts); 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