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