Commit 4d80a30b by Administrator

Merge branch 'tzq' into 'develop'

Tzq

See merge request 8timerv2/8timerapiv200!74
parents b3ee7dc0 ec60e32e
......@@ -37,25 +37,38 @@ import cn.timer.api.utils.ResultUtil;
@Component
public class BindingResultAspect {
// 配置织入点
// @annotation配置织入点
@Pointcut("@annotation(cn.timer.api.aspect.lang.annotation.BindingResultCtrol)")
public void bindingResultPointCut()
{
}
// execution 配置织入点
@Pointcut("execution(* cn.timer.api.controller.*.*.*(..))")
public void clazzPointCut()
{
}
@Before("bindingResultPointCut()")
// @Before("bindingResultPointCut()")
public void doBefore(JoinPoint point) throws Throwable
{
//预留
// handleDataScope(point);
}
@Around("bindingResultPointCut() && args(..,bindingResult)")
public Object doAround(ProceedingJoinPoint joinPoint,BindingResult bindingResult) throws Throwable {
// @Around("bindingResultPointCut() && args(..,bindingResult)")
@Around("clazzPointCut()")
public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
Long startTime = System.currentTimeMillis();
Object retVal;
if(bindingResult.hasErrors()){
List<ObjectError> ls = bindingResult.getAllErrors();
Object[] objs = joinPoint.getArgs();
List<Object> listObj = CollectionUtil.toList(objs);
BeanPropertyBindingResult optional = (BeanPropertyBindingResult)listObj.stream()
.filter(p -> "BeanPropertyBindingResult".equals(ClassUtil.getClassName(p, true)))
.findFirst()
.orElse(null);
if(optional != null && optional.hasErrors()){
List<ObjectError> ls = optional.getAllErrors();
List<ValidationError> listVe = new ArrayList<ValidationError>();
ValidationError ve;
for (ObjectError one : ls) {
......@@ -80,6 +93,26 @@ public class BindingResultAspect {
Console.log("返回内容 {}: " ,JSONObject.toJSONString(retVal));
Long endtime = System.currentTimeMillis();
Console.log("执行耗时为{}:" ,endtime-startTime + "ms");
// Object[] objs = joinPoint.getArgs();
//
// List<Object> listObj = CollectionUtil.toList(objs);
// BeanPropertyBindingResult optional = (BeanPropertyBindingResult)listObj.stream()
// .filter(p -> "BeanPropertyBindingResult".equals(ClassUtil.getClassName(p, true)))
// .findFirst()
// .orElse(null);
// if (optional != null && optional.hasErrors()) {
// System.err.println("Optional: "+ optional);
// }
return retVal;
}
......
package cn.timer.api.aspect.lang.bean;
import cn.timer.api.bean.spmk.SpmkApprovalG;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
......
......@@ -70,7 +70,7 @@ public class SpmkApprovalTemplate extends Model<SpmkApprovalTemplate> {
@ApiModelProperty(value = "创建时间 ", example = "创建时间")
private Date createTime;
@ApiModelProperty(value = "关联类型 1转正 2离职 3调薪 4调岗 5加班 6请假 7出差 8外出 9补卡", example = "1")
@ApiModelProperty(value = "关联类型 0无 1转正 2离职 3调岗 4加班 5请假 6出差 7外出 8补卡 9调薪", example = "1")
private Integer assoType;
@ApiModelProperty(value = "审批表单 ", example = "审批表单")
......
......@@ -73,7 +73,7 @@ public class SpmkApproveSummary extends Model<SpmkApproveSummary> {
@ApiModelProperty(value = "历史审批人 ", example = "历史审批人")
private String historyApprover;
@ApiModelProperty(value = "关联类型 1转正 2离职 3调薪 4调岗 5加班 6请假 7出差 8外出 9补卡", example = "5")
@ApiModelProperty(value = "关联类型 0无 1转正 2离职 3调岗 4加班 5请假 6出差 7外出 8补卡 9调薪", example = "1")
private Integer assoType;
@TableField(fill = FieldFill.UPDATE)
......
......@@ -73,8 +73,11 @@ public class SpmkCustomApproval extends Model<SpmkCustomApproval> {
@ApiModelProperty(value = "创建时间 ", example = "创建时间")
private Date createTime;
@ApiModelProperty(value = "关联类型 1转正 2离职 3调薪 4调岗 5加班 6请假 7出差 8外出 9补卡", example = "1")
@ApiModelProperty(value = "关联类型 0无 1转正 2离职 3调岗 4加班 5请假 6出差 7外出 8补卡 9调薪", example = "1")
private Integer assoType;
@ApiModelProperty(value = "所有可见 0否 1是", example = "1")
private Integer isAllvisible;
@ApiModelProperty(value = "审批表单 ", example = "审批表单")
private byte[] froms;
......
......@@ -39,7 +39,6 @@ import cn.timer.api.bean.zzgl.ZzglBmgwM;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.enums.CommonEnum;
import cn.timer.api.dao.qyzx.QyzxEmpEntAssoMapper;
import cn.timer.api.dao.qyzx.QyzxEmpLoginMapper;
import cn.timer.api.dao.qyzx.QyzxEntAuthMapper;
......
......@@ -43,6 +43,7 @@ import cn.timer.api.bean.spmk.SpmkInitiatorConfig;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.annotation.CurrentUser;
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.SpmkApprovalTemplateGMapper;
import cn.timer.api.dao.spmk.SpmkApprovalTemplateMapper;
......@@ -66,6 +67,9 @@ import cn.timer.api.dto.spmk.SummaryQueryDto;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import cn.timer.api.utils.router.RouterUtils;
import cn.timer.api.utils.router.business.SpmkAssoBusiness;
import cn.timer.api.utils.router.business.SpmkAssoBusinessFactory;
import cn.timer.api.utils.router.enums.ApproveEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -74,6 +78,7 @@ import io.swagger.annotations.ApiOperation;
@Transactional
@RequestMapping(value = "/spmk",
produces = { "application/json","multipart/form-data" })
//@BindingResultCtrol(title = "发起审批")
public class SpmkServiceImpl {
@Autowired
......@@ -88,7 +93,12 @@ public class SpmkServiceImpl {
@Autowired
private SpmkCustomApprovalMapper spmkCustomApprovalMapper;
//TODO 新增或编辑-审批模板组
@Autowired
private ZzglBmgwMService zzglBmgwMService;
//TODO 审批模板组
/**
* 新增或编辑-审批模板组
*/
......@@ -197,7 +207,7 @@ public class SpmkServiceImpl {
* 排序-审批模板
*/
@PutMapping(value = "/update_approval_template")
@ApiOperation(value = "8.查询列表-审批模板组", httpMethod = "PUT", notes = "查询列表-审批模板组")
@ApiOperation(value = "8.排序-审批模板", httpMethod = "PUT", notes = "查询列表-审批模板组")
@ApiOperationSupport(order = 8)
public Result<Object> ranksAt(@RequestBody List<SpmkApprovalTemplate> list){
......@@ -214,7 +224,7 @@ public class SpmkServiceImpl {
@PostMapping(value = "/save_approval_g")
@ApiOperation(value = "9.新增或编辑-审批组", httpMethod = "POST", notes = "新增或编辑-审批组")
@ApiOperationSupport(order = 9)
public Result<Object> saveAg(@CurrentUser UserBean userBean,@RequestBody SpmkApprovalG spmkApprovalG){
public Result<Object> saveAg(@CurrentUser UserBean userBean, @RequestBody SpmkApprovalG spmkApprovalG){
spmkApprovalG.setOrgCode(userBean.getOrgCode());
return spmkApprovalG.insertOrUpdate() ? ResultUtil.data(spmkApprovalG, "操作成功!") : ResultUtil.error("操作失败!");
......@@ -243,7 +253,9 @@ public class SpmkServiceImpl {
@ApiOperationSupport(order = 11)
public Result<Object> selectListAg(@CurrentUser UserBean userBean){
return ResultUtil.data(spmkApprovalGMapper.selectListAgInCa(userBean.getOrgCode(), userBean.getEmpNum()),"操作成功!");
List<Integer> depts = zzglBmgwMService.empNumupGetDepts(userBean.getOrgCode(), userBean.getEmpNum());
System.out.println(depts);
return ResultUtil.data(spmkApprovalGMapper.selectListAgInCa(userBean.getOrgCode(), userBean.getEmpNum(), depts),"操作成功!");
}
......@@ -277,10 +289,14 @@ public class SpmkServiceImpl {
ca.setFroms(ObjectUtil.serialize(spmkCustomApprovalDto.getFroms()));
ca.setRouter(ObjectUtil.serialize(spmkCustomApprovalDto.getRouter()));
//1.新增 SpmkCustomApproval-自定义审批
if (!ca.insertOrUpdate())
return ResultUtil.error("操作失败!-2");
Integer id = ca.getId();
// 2.删除 历史的 SpmkInitiatorConfig-审批发起人配置,
SpmkInitiatorConfig.builder().build().delete(new QueryWrapper<SpmkInitiatorConfig>().lambda().eq(SpmkInitiatorConfig::getCustomApprovalId, id));
Console.log("自定义审批id: " + id);
List<SpmkInitiatorConfig> listIc = spmkCustomApprovalDto.getInitiatorConfigs();
......@@ -288,6 +304,7 @@ public class SpmkServiceImpl {
for (int i = 0, n = listIc.size(); i < n; i++) {
listIc.get(i).setCustomApprovalId(id);
}
// 3.新增 最新的 SpmkInitiatorConfig-审批发起人配置,
if (!spmkInitiatorConfigMapper.insertList(listIc)) {
// 手动抛出异常,事务回滚
throw new Exception();
......@@ -295,14 +312,14 @@ public class SpmkServiceImpl {
}
SpmkInitiatorConfig.builder().build().delete(new QueryWrapper<SpmkInitiatorConfig>().lambda().eq(SpmkInitiatorConfig::getCustomApprovalId, id));
//
/**
* 注意: 为保证该api的原子性 要加 事务处理 回滚(方法注解-@Transactional(rollbackFor = Exception.class))
* 1.删除 历史的 SpmkInitiatorConfig-审批发起人配置,
* 2.新增 最新的 SpmkInitiatorConfig-审批发起人配置,
* 3.新增 SpmkCustomApproval-自定义审批
* 1.新增 SpmkCustomApproval-自定义审批
* 2.删除 历史的 SpmkInitiatorConfig-审批发起人配置,
* 3.新增 最新的 SpmkInitiatorConfig-审批发起人配置,
*/
// 清空前端不需要的字段再返回,节省流量
......@@ -340,8 +357,8 @@ public class SpmkServiceImpl {
public Result<Object> selectCaById(@PathVariable int id){
SpmkCustomApproval ca = SpmkCustomApproval.builder().id(id).build().selectById();
SpmkCustomApprovalDto caD = SpmkCustomApprovalDto.builder()
.froms(ObjectUtil.unserialize(ca.getFroms()))
.router(ObjectUtil.unserialize(ca.getRouter()))
.froms(ObjectUtil.deserialize(ca.getFroms()))
.router(ObjectUtil.deserialize(ca.getRouter()))
.build();
BeanUtil.copyProperties(ca, caD,"froms","router");
......@@ -380,7 +397,7 @@ public class SpmkServiceImpl {
@ApiOperation(value = "17.发起审批", httpMethod = "POST", notes = "发起审批")
@ApiOperationSupport(order = 17)
@Transactional(rollbackFor = Exception.class)
@BindingResultCtrol(title = "发起审批")
// @BindingResultCtrol(title = "发起审批")
public Result<Object> saveCa(@CurrentUser UserBean userBean,@Valid @RequestBody SpmkApproveSummaryDto spmkApproveSummaryDto,BindingResult bindingResult) throws Exception{
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>()
......@@ -394,10 +411,10 @@ public class SpmkServiceImpl {
List<Router> listRouter = new ArrayList<Router>();
listRouter.add(spmkApproveSummaryDto.getRouter());
JSONObject jSONObject = spmkApproveSummaryDto.getRequestData()
.put("orgCode", FromData.builder().value(String.valueOf(userBean.getOrgCode())).build())
.put("initiator", FromData.builder().value(spmkApproveSummaryDto.getInitiator()).build())
.put("headUrl", FromData.builder().value(ygglMainEmp.getHeadUrl()).build())
.put("id", FromData.builder().value(StrUtil.toString(userBean.getEmpNum())).build());
.set("orgCode", FromData.builder().value(String.valueOf(userBean.getOrgCode())).build())
.set("initiator", FromData.builder().value(spmkApproveSummaryDto.getInitiator()).build())
.set("headUrl", FromData.builder().value(ygglMainEmp.getHeadUrl()).build())
.set("id", FromData.builder().value(StrUtil.toString(userBean.getEmpNum())).build());
RouterUtils.NextNode(listRouter, jSONObject, ISFIRST);
List<FlowChildren> listFlowChildren = new ArrayList<FlowChildren>();
RouterUtils.getIsFlowChildren(listRouter,listFlowChildren);
......@@ -462,7 +479,7 @@ public class SpmkServiceImpl {
empNums.add(ygglMainEmp.getEmpNum());
}
summaryQueryDto.setEmpNums(empNums);
// 缺-部门id 搜索
IPage<SpmkApproveSummary> pageAs = spmkApproveSummaryMapper.selectPageByQuery(page, summaryQueryDto);
......@@ -484,11 +501,10 @@ public class SpmkServiceImpl {
SpmkApproveDetailDto adD = SpmkApproveDetailDto.builder().build();
List<SpmkApproveExecuteRecord> listAer = spmkApproveExecuteRecordMapper.selectListByAsId(id);
BeanUtil.copyProperties(ad, adD, "requestData","froms","router","spmkApproveExecuteRecord");
adD.setRequestData(ObjectUtil.unserialize(ad.getRequestData()));
adD.setFroms(ObjectUtil.unserialize(ad.getFroms()));
adD.setRouter(ObjectUtil.unserialize(ad.getRouter()));
adD.setFlowChildren(ObjectUtil.unserialize(ad.getFlowChildren()));
adD.setRequestData(ObjectUtil.deserialize(ad.getRequestData()));
adD.setFroms(ObjectUtil.deserialize(ad.getFroms()));
adD.setRouter(ObjectUtil.deserialize(ad.getRouter()));
adD.setFlowChildren(ObjectUtil.deserialize(ad.getFlowChildren()));
adD.setApproveExecuteRecord(listAer);
return ResultUtil.data(adD, "操作成功!");
......@@ -521,6 +537,9 @@ public class SpmkServiceImpl {
SpmkApproveDetail ad = SpmkApproveDetail.builder().build()
.selectOne(new QueryWrapper<SpmkApproveDetail>()
.lambda()
.select(SpmkApproveDetail::getId,
SpmkApproveDetail::getRequestData,
SpmkApproveDetail::getFlowChildren)
.eq(SpmkApproveDetail::getApproveSummaryId, approvingDto.getAsId()));
// 查询 SpmkApproveSummary 状态
......@@ -542,7 +561,7 @@ public class SpmkServiceImpl {
}
if (aSummary.getSts() == 0) {
List<FlowChildren> listFlowChildren = ObjectUtil.unserialize(ad.getFlowChildren());
List<FlowChildren> listFlowChildren = ObjectUtil.deserialize(ad.getFlowChildren());
RouterUtils.approving(
listFlowChildren,
approvingDto.getAsId(),
......@@ -560,10 +579,18 @@ public class SpmkServiceImpl {
if (fc.getExecute() == "2") {
// 查询 SpmkApproveSummary 状态
aSummary = spmkApproveSummaryMapper.selectOne(new QueryWrapper<SpmkApproveSummary>().lambda()
.select(SpmkApproveSummary::getSts)
.select(SpmkApproveSummary::getSts,SpmkApproveSummary::getAssoType)
.eq(SpmkApproveSummary::getId, approvingDto.getAsId()));
if (aSummary.getSts() != 3) {
SpmkApproveSummary.builder().id(approvingDto.getAsId()).endTime(new Date()).sts(2).build().updateById();
//审批完成后 业务
SpmkAssoBusiness sab = SpmkAssoBusinessFactory.createSpmkAssoType(ApproveEnum.getEnums(aSummary.getAssoType()));
if (sab != null)
sab.handleApprove(ObjectUtil.deserialize(ad.getRequestData()));
}
}
......
......@@ -189,37 +189,6 @@ public class ZzglController {
}
//根据传来的empNum获取该人员的岗位,以及上面所有的部门id,返回integer数组
public List<Integer> empNumupdept(Integer orgCode,Integer empNum) {
Set<Integer> lanzi = new HashSet<Integer>();
//所有部门岗位
List<ZzglBmgwM> bmgws = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper).eq(ZzglBmgwM::getOrgCode, orgCode).list();
//个人岗位
YgglMainEmp one = new LambdaQueryChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
.select(YgglMainEmp::getBmgwId)
.eq(YgglMainEmp::getOrgCode, orgCode).eq(YgglMainEmp::getEmpNum, empNum).one();
Integer getId = one.getBmgwId();
Set<Integer> all = empNumupdept2(lanzi, bmgws, getId);
return ListUtil.toList(all);
}
//遍历
public Set<Integer> empNumupdept2(Set<Integer> lanzi,List<ZzglBmgwM> bmgws,Integer getId) {
for (ZzglBmgwM z : bmgws) {
if (getId.equals(z.getId())) {
lanzi.add(getId);
if (z.getUpId()==null || z.getUpId() == 0) {
return lanzi;
}
getId = z.getUpId();
empNumupdept2(lanzi, bmgws, getId);
}
}
return lanzi;
}
/**
* 删除部门岗位
*
......
package cn.timer.api.controller.zzgl.service;
import java.util.List;
/**
* 部门岗位 服务层
*
* @author Tang
*/
public interface ZzglBmgwMService {
public List<Integer> empNumupGetDepts(Integer orgCode,Integer empNum);
}
package cn.timer.api.controller.zzgl.service;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import cn.hutool.core.collection.ListUtil;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.bean.zzgl.ZzglBmgwM;
import cn.timer.api.dao.yggl.YgglMainEmpMapper;
import cn.timer.api.dao.zzgl.ZzglBmgwMMapper;
/**
* 部门岗位 服务逻辑层
*
* @author Tang
*/
@Service
public class ZzglBmgwMServiceImpl implements ZzglBmgwMService {
@Autowired
private ZzglBmgwMMapper zzglBmgwMMapper;
@Autowired
private YgglMainEmpMapper ygglMainEmpMapper;
//根据传来的empNum获取该人员的岗位,以及上面所有的部门id,返回integer数组
@Override
public List<Integer> empNumupGetDepts(Integer orgCode,Integer empNum) {
Set<Integer> lanzi = new HashSet<Integer>();
//所有部门岗位
List<ZzglBmgwM> bmgws = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper).eq(ZzglBmgwM::getOrgCode, orgCode).list();
//个人岗位
YgglMainEmp one = new LambdaQueryChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
.select(YgglMainEmp::getBmgwId)
.eq(YgglMainEmp::getOrgCode, orgCode).eq(YgglMainEmp::getEmpNum, empNum).one();
Integer getId = one.getBmgwId();
System.out.println(getId);
Set<Integer> all = empNumupdept2(lanzi, bmgws, getId);
all.add(getId);
return ListUtil.toList(all);
}
//遍历
public Set<Integer> empNumupdept2(Set<Integer> lanzi,List<ZzglBmgwM> bmgws,Integer getId) {
for (ZzglBmgwM z : bmgws) {
if (getId.equals(z.getId())) {
lanzi.add(getId);
if (z.getUpId()==null || z.getUpId() == 0) {
return lanzi;
}
getId = z.getUpId();
empNumupdept2(lanzi, bmgws, getId);
}
}
return lanzi;
}
}
......@@ -17,7 +17,7 @@ import cn.timer.api.bean.spmk.SpmkApprovalG;
@Repository
public interface SpmkApprovalGMapper extends BaseMapper<SpmkApprovalG> {
List<SpmkApprovalG> selectListAgInCa(@Param("org_code") Integer org_code, @Param("emp_num") Integer emp_num);
List<SpmkApprovalG> selectListAgInCa(@Param("org_code") Integer org_code, @Param("emp_num") Integer emp_num, @Param("deptIds") List<Integer> deptIds);
boolean updateListRandsById(List<SpmkApprovalG> list);
......
......@@ -35,8 +35,8 @@ public class MySummaryQueryDto extends Page{
private String endTime;
@NotNull(message = "type为空")
@DecimalMax(value = "2",message = "assoType 只能为 0我发起的 1抄送我的 2我审批的")
@DecimalMin(value = "0",message = "assoType 只能为 0我发起的 1抄送我的 2我审批的")
@DecimalMax(value = "2",message = "type 只能为 0我发起的 1抄送我的 2我审批的")
@DecimalMin(value = "0",message = "type 只能为 0我发起的 1抄送我的 2我审批的")
@ApiModelProperty(value = "0我发起的 1抄送我的 2我审批的", example = "0")
private Integer type;
......
......@@ -47,7 +47,7 @@ public class SpmkApprovalTemplateDto {
@ApiModelProperty(value = "创建时间 ", example = "创建时间")
private Date createTime;
@ApiModelProperty(value = "关联类型 1转正 2离职 3调薪 4调岗 5加班 6请假 7出差 8外出 9补卡", example = "2")
@ApiModelProperty(value = "关联类型 0无 1转正 2离职 3调岗 4加班 5请假 6出差 7外出 8补卡 9调薪", example = "1")
private Integer assoType;
@ApiModelProperty(value = "审批表单 ", example = "审批表单")
......
......@@ -38,9 +38,9 @@ public class SpmkApproveSummaryDto{
private String initiator;
@NotNull(message = "assoType为空")
@DecimalMax(value = "9",message = "assoType 只能为 0无 1转正 2离职 3调薪 4调岗 5加班 6请假 7出差 8外出 9补卡")
@DecimalMin(value = "0",message = "assoType 只能为 0无 1转正 2离职 3调薪 4调岗 5加班 6请假 7出差 8外出 9补卡")
@ApiModelProperty(value = "关联类型 0无 1转正 2离职 3调薪 4调岗 5加班 6请假 7出差 8外出 9补卡 ", example = "5")
@DecimalMax(value = "9",message = "assoType 只能为 0无 1转正 2离职 3调岗 4加班 5请假 6出差 7外出 8补卡 9调薪")
@DecimalMin(value = "0",message = "assoType 只能为 0无 1转正 2离职 3调岗 4加班 5请假 6出差 7外出 8补卡 9调薪")
@ApiModelProperty(value = "关联类型 0无 1转正 2离职 3调岗 4加班 5请假 6出差 7外出 8补卡 9调薪", example = "1")
private Integer assoType;
@NotNull(message = "requestData为空")
......
......@@ -3,6 +3,10 @@ package cn.timer.api.dto.spmk;
import java.util.Date;
import java.util.List;
import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
import cn.hutool.json.JSONObject;
import cn.timer.api.bean.spmk.SpmkInitiatorConfig;
import io.swagger.annotations.ApiModelProperty;
......@@ -23,12 +27,15 @@ public class SpmkCustomApprovalDto {
@ApiModelProperty(value = "企业组织代码 企业组织代码", example = "101")
private Integer orgCode;
@NotBlank(message = "approvalGId为空")
@ApiModelProperty(value = "审批组id 当前用户ID", example = "101")
private Integer approvalGId;
@NotBlank(message = "iconUrl为空")
@ApiModelProperty(value = "审批图标地址 ", example = "审批图标地址")
private String iconUrl;
@NotBlank(message = "name为空")
@ApiModelProperty(value = "审批名称 ", example = "审批名称")
private String name;
......@@ -41,6 +48,7 @@ public class SpmkCustomApprovalDto {
@ApiModelProperty(value = "排序 排序", example = "101")
private Integer ranks;
@NotBlank(message = "isOpinion为空")
@ApiModelProperty(value = "审批意见 是否必填 意见 0是 1否", example = "101")
private Integer isOpinion;
......@@ -50,15 +58,27 @@ public class SpmkCustomApprovalDto {
@ApiModelProperty(value = "创建时间 ", example = "创建时间")
private Date createTime;
@ApiModelProperty(value = "关联类型 1转正 2离职 3调薪 4调岗 5加班 6请假 7出差 8外出 9补卡", example = "1")
@NotBlank(message = "assoType为空")
@DecimalMax(value = "9",message = "assoType 只能为 0无 1转正 2离职 3调岗 4加班 5请假 6出差 7外出 8补卡 9调薪")
@DecimalMin(value = "0",message = "assoType 只能为 0无 1转正 2离职 3调岗 4加班 5请假 6出差 7外出 8补卡 9调薪")
@ApiModelProperty(value = "关联类型 0无 1转正 2离职 3调岗 4加班 5请假 6出差 7外出 8补卡 9调薪", example = "1")
private Integer assoType;
@NotBlank(message = "isAllvisible为空")
@DecimalMax(value = "1",message = "isAllvisible 只能为 0否 1是")
@DecimalMin(value = "0",message = "isAllvisible 只能为 0否 1是")
@ApiModelProperty(value = "所有可见 0否 1是", example = "1")
private Integer isAllvisible;
@NotBlank(message = "froms为空")
@ApiModelProperty(value = "审批表单 ", example = "审批表单")
private List<JSONObject> froms;
@NotBlank(message = "router为空")
@ApiModelProperty(value = "审批流程 ", example = "审批流程")
private Router router;
@NotBlank(message = "initiatorConfigs为空")
@ApiModelProperty(value = "可见发起人配置 ", example = "数组类型")
private List<SpmkInitiatorConfig> initiatorConfigs;
......
......@@ -196,8 +196,8 @@ public class RouterUtils {
if (listCondition == null || listCondition.size() == 0) {
routerRule.setFlow(true);
}else {
Compare compare;
for (Condition condition : listCondition) {
Compare compare ;
for (String string : condition.getValues()) {
// 简单工厂模式 - 判断条件
......
package cn.timer.api.utils.router.business;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import cn.timer.api.dto.spmk.FromData;
import lombok.Builder;
/**
* 出差-业务
* @author Tang
*
*/
@Builder
public class EvectionBusiness extends SpmkAssoBusiness {
@Override
public void handleApprove(JSONObject jsonObj) {
// TODO Auto-generated method stub
// 发起人企业id
String orgCode = jsonObj.get("orgCode",FromData.class).getValue();
// 发起人id
String id = jsonObj.get("id",FromData.class).getValue();
// 发起人名称
String initiator = jsonObj.get("initiator",FromData.class).getValue();
// 开始时间
String startTime = jsonObj.get("__startTime",FromData.class).getValue();
// 结束时间
String endTime = jsonObj.get("__endTime",FromData.class).getValue();
// 时长
String longTime = jsonObj.get("__longTime",FromData.class).getValue();
// 出差事由
String businessTrip = jsonObj.get("__businessTrip",FromData.class).getValue();
// 上传文件
String UploadAttachment = jsonObj.get("UploadAttachment",FromData.class).getValue();
// 调 考勤管理 业务
}
}
package cn.timer.api.utils.router.business;
import cn.hutool.json.JSONObject;
import cn.timer.api.dto.spmk.FromData;
import lombok.Builder;
/**
* 请假-业务
*
* @author Tang
*
*/
@Builder
public class LeaveBusiness extends SpmkAssoBusiness {
@Override
public void handleApprove(JSONObject jsonObj) {
// TODO Auto-generated method stub
// 发起人企业id
String orgCode = jsonObj.get("orgCode",FromData.class).getValue();
// 发起人id
String id = jsonObj.get("id",FromData.class).getValue();
// 发起人名称
String initiator = jsonObj.get("initiator",FromData.class).getValue();
// 请假类型
String LeaveType = jsonObj.get("__LeaveType",FromData.class).getValue();
// 开始时间
String startTime = jsonObj.get("__startTime",FromData.class).getValue();
// 结束时间
String endTime = jsonObj.get("__endTime",FromData.class).getValue();
// 时长
String longTime = jsonObj.get("__longTime",FromData.class).getValue();
// 请假事由
String ReasonsForLeave = jsonObj.get("__ReasonsForLeave",FromData.class).getValue();
// 上传文件
String UploadAttachment = jsonObj.get("UploadAttachment",FromData.class).getValue();
// 调 考勤管理 业务
}
}
package cn.timer.api.utils.router.business;
import cn.hutool.json.JSONObject;
import cn.timer.api.dto.spmk.FromData;
import lombok.Builder;
/**
* 招聘-业务
*
* @author Tang
*
*/
@Builder
public class RecruitBusiness extends SpmkAssoBusiness {
@Override
public void handleApprove(JSONObject jsonObj) {
// TODO Auto-generated method stub
// 发起人企业id
String orgCode = jsonObj.get("orgCode",FromData.class).getValue();
// 发起人id
String id = jsonObj.get("id",FromData.class).getValue();
// 发起人名称
String initiator = jsonObj.get("initiator",FromData.class).getValue();
// 招聘部门
String RecruitmentDept = jsonObj.get("__RecruitmentDept",FromData.class).getValue();
// 招聘职位
String RecruitmentPost = jsonObj.get("__RecruitmentPost",FromData.class).getValue();
// 工性性质
String WorkingNature = jsonObj.get("__WorkingNature",FromData.class).getValue();
// 招聘人数
String NumberOfRecruiters = jsonObj.get("__NumberOfRecruiters",FromData.class).getValue();
// 已在岗人数
String NumberOfPeople = jsonObj.get("NumberOfPeople",FromData.class).getValue();
// 招聘原因
String RecruitmentReasons = jsonObj.get("RecruitmentReasons",FromData.class).getValue();
// 该岗位工作职责
String operatingDuty = jsonObj.get("operatingDuty",FromData.class).getValue();
// 招聘要求
String RecruitmentRequirements = jsonObj.get("RecruitmentRequirements",FromData.class).getValue();
// 薪酬上限
String SalaryCap = jsonObj.get("SalaryCap",FromData.class).getValue();
// 薪酬下限
String TransferInDepartment = jsonObj.get("TransferInDepartment",FromData.class).getValue();
// 生效日期
String PayFloor = jsonObj.get("PayFloor",FromData.class).getValue();
// 备注
String Remarks = jsonObj.get("Remarks",FromData.class).getValue();
// 上传文件
String UploadAttachment = jsonObj.get("UploadAttachment",FromData.class).getValue();
// 调 招聘管理 业务
}
}
package cn.timer.api.utils.router.business;
import cn.hutool.json.JSONObject;
import cn.timer.api.dto.spmk.FromData;
import lombok.Builder;
/**
* 转正-业务
* @author Tang
*
*/
@Builder
public class RegularizationBusiness extends SpmkAssoBusiness {
@Override
public void handleApprove(JSONObject jsonObj) {
// TODO Auto-generated method stub
// 发起人企业id
String orgCode = jsonObj.get("orgCode",FromData.class).getValue();
// 发起人名称
String initiator = jsonObj.get("initiator",FromData.class).getValue();
// 申请人名称
String applicant = jsonObj.get("__applicant",FromData.class).getValue();
// 试用期内主要工作和成绩
String WorkAndAchievement = jsonObj.get("WorkAndAchievement",FromData.class).getValue();
// 存在问题及改进意见
String problem = jsonObj.get("problem",FromData.class).getValue();
// 上传文件
String file = jsonObj.get("file",FromData.class).getValue();
// 发起人id
String id = jsonObj.get("id",FromData.class).getValue();
// 实际转正时间
String newConfirmationTime = jsonObj.get("__newConfirmationTime",FromData.class).getValue();
// 备注
String Remarks = jsonObj.get("Remarks",FromData.class).getValue();
// 调 员工管理 业务
}
}
package cn.timer.api.utils.router.business;
import cn.hutool.json.JSONObject;
import cn.timer.api.dto.spmk.FromData;
import lombok.Builder;
/**
* 补卡-业务
* @author Tang
*
*/
@Builder
public class ReissueACardBusiness extends SpmkAssoBusiness {
@Override
public void handleApprove(JSONObject jsonObj) {
// TODO Auto-generated method stub
// 发起人企业id
String orgCode = jsonObj.get("orgCode",FromData.class).getValue();
// 发起人id
String id = jsonObj.get("id",FromData.class).getValue();
// 发起人名称
String initiator = jsonObj.get("initiator",FromData.class).getValue();
// 补卡时间
String PatchCardTime = jsonObj.get("__PatchCardTime",FromData.class).getValue();
// 缺卡原因
String cardShortage = jsonObj.get("cardShortage",FromData.class).getValue();
// 上传文件
String UploadAttachment = jsonObj.get("UploadAttachment",FromData.class).getValue();
// 调 考勤管理 业务
}
}
package cn.timer.api.utils.router.business;
import cn.hutool.json.JSONObject;
import cn.timer.api.dto.spmk.FromData;
import lombok.Builder;
/**
* 离职-业务
* @author Tang
*
*/
@Builder
public class ResignationBusiness extends SpmkAssoBusiness {
@Override
public void handleApprove(JSONObject jsonObj) {
// TODO Auto-generated method stub
// 发起人企业id
String orgCode = jsonObj.get("orgCode",FromData.class).getValue();
// 发起人id
String id = jsonObj.get("id",FromData.class).getValue();
// 发起人名称
String initiator = jsonObj.get("initiator",FromData.class).getValue();
// 申请人
String applicant = jsonObj.get("__applicant",FromData.class).getValue();
// 计划离职日期
String terminationDate = jsonObj.get("__terminationDate",FromData.class).getValue();
// 离职原因
String ReasonForResignation = jsonObj.get("__ReasonForResignation",FromData.class).getValue();
// 备注
String Remarks = jsonObj.get("Remarks",FromData.class).getValue();
// 上传文件
String UploadAttachment = jsonObj.get("UploadAttachment",FromData.class).getValue();
// 调 员工管理 业务
}
}
package cn.timer.api.utils.router.business;
import cn.hutool.json.JSONObject;
import lombok.Data;
/**
* 审批关联业务
* @author Tang
*
*/
@Data
public abstract class SpmkAssoBusiness {
public abstract void handleApprove(JSONObject jsonObj);
}
package cn.timer.api.utils.router.business;
import cn.timer.api.utils.router.enums.ApproveEnum;
/**
* 审批关联业务工厂类
* @author Tang
*
*/
public class SpmkAssoBusinessFactory {
public static SpmkAssoBusiness createSpmkAssoType(ApproveEnum assotype) {
SpmkAssoBusiness sat = null;
switch (assotype) {
case DEFAULT:
break;
case REGULARIZATION:
sat = RegularizationBusiness.builder().build();
break;
case RESIGNATION:
sat = ResignationBusiness.builder().build();
break;
case TRANSFER_POSITION:
sat = TransferPositionBusiness.builder().build();
break;
case RECRUIT:
sat = RecruitBusiness.builder().build();
break;
case WORK_OVERTIME:
sat = WorkOvertimeBusiness.builder().build();
break;
case LEAVE:
sat = LeaveBusiness.builder().build();
break;
case EVECTION:
sat = EvectionBusiness.builder().build();
break;
case REISSUE_A_CARD:
sat = ReissueACardBusiness.builder().build();
break;
default:
break;
}
return sat;
}
}
package cn.timer.api.utils.router.business;
import cn.hutool.json.JSONObject;
import cn.timer.api.dto.spmk.FromData;
import lombok.Builder;
/**
* 调岗-业务
* @author Tang
*
*/
@Builder
public class TransferPositionBusiness extends SpmkAssoBusiness {
@Override
public void handleApprove(JSONObject jsonObj) {
// TODO Auto-generated method stub
// 发起人企业id
String orgCode = jsonObj.get("orgCode",FromData.class).getValue();
// 发起人id
String id = jsonObj.get("id",FromData.class).getValue();
// 发起人名称
String initiator = jsonObj.get("initiator",FromData.class).getValue();
// 申请人
String applicant = jsonObj.get("__applicant",FromData.class).getValue();
// 申请原因
String ReasonForApplication = jsonObj.get("__ReasonForApplication",FromData.class).getValue();
// 调入部门
String TransferInDepartment = jsonObj.get("__TransferInDepartment",FromData.class).getValue();
// 调入岗位
String TransferInPosition = jsonObj.get("__TransferInPosition",FromData.class).getValue();
// 生效日期
String effectiveDate = jsonObj.get("__effectiveDate",FromData.class).getValue();
// 备注
String Remarks = jsonObj.get("Remarks",FromData.class).getValue();
// 上传文件
String UploadAttachment = jsonObj.get("UploadAttachment",FromData.class).getValue();
// 调 员工管理 业务
}
}
package cn.timer.api.utils.router.business;
import cn.hutool.json.JSONObject;
import cn.timer.api.dto.spmk.FromData;
import lombok.Builder;
/**
* 加班-业务
* @author Tang
*
*/
@Builder
public class WorkOvertimeBusiness extends SpmkAssoBusiness {
@Override
public void handleApprove(JSONObject jsonObj) {
// TODO Auto-generated method stub
// 发起人企业id
String orgCode = jsonObj.get("orgCode",FromData.class).getValue();
// 发起人id
String id = jsonObj.get("id",FromData.class).getValue();
// 发起人名称
String initiator = jsonObj.get("initiator",FromData.class).getValue();
// 开始时间
String startTime = jsonObj.get("__startTime",FromData.class).getValue();
// 结束时间
String endTime = jsonObj.get("__endTime",FromData.class).getValue();
// 时长
String timeLong = jsonObj.get("__timeLong",FromData.class).getValue();
// 加班补偿方式
String compensate = jsonObj.get("__compensate",FromData.class).getValue();
// 加班原因
String OvertimeReason = jsonObj.get("__OvertimeReason",FromData.class).getValue();
// 上传文件
String UploadAttachment = jsonObj.get("UploadAttachment",FromData.class).getValue();
// 调 考勤管理 业务
}
}
package cn.timer.api.utils.router.enums;
public enum ApproveEnum {
DEFAULT(0, "默认", 1), REGULARIZATION(1, "转正", 1), RESIGNATION(2, "离职", 1), TRANSFER_POSITION(3, "调岗", 1),
RECRUIT(4, "招聘", 1), WORK_OVERTIME(5, "加班", 2), LEAVE(6, "请假", 2), EVECTION(7, "出差", 2), REISSUE_A_CARD(8, "补卡", 2),
WAGE_ADJUSTMENT(9, "调薪", 3),;
private Integer type;
private String desc;
private Integer businessType;
ApproveEnum(Integer type, String desc, Integer businessType) {
this.type = type;
this.desc = desc;
this.businessType = businessType;
}
public Integer getType() {
return this.type;
}
public static ApproveEnum getEnums(Integer type) {
for (ApproveEnum approveEnum : values()) {
if (approveEnum.getType() == type) {
return approveEnum;
}
}
return null;
}
public String getDesc() {
return this.desc;
}
public Integer getBusinessType() {
return this.businessType;
}
}
......@@ -60,7 +60,8 @@
b.is_opinion SpmkCustomApproval_is_opinion,
b.update_time SpmkCustomApproval_update_time,
b.create_time SpmkCustomApproval_create_time,
b.asso_type SpmkCustomApproval_asso_type<!-- ,
b.asso_type SpmkCustomApproval_asso_type,
b.is_allvisible SpmkCustomApproval_is_allvisible<!-- ,
b.froms SpmkCustomApproval_froms,
b.router SpmkCustomApproval_router -->
</sql>
......@@ -71,12 +72,31 @@
<include refid="Base_Column_List_Alias_ca" />
FROM spmk_approval_g a
LEFT JOIN spmk_custom_approval b ON a.id = b.approval_g_id
LEFT JOIN spmk_custom_approval b
ON a.id = b.approval_g_id AND ( b.id IN (
SELECT custom_approval_id FROM spmk_initiator_config WHERE asso_id = #{emp_num} AND type = 1 GROUP BY custom_approval_id
<if test="deptIds != null and deptIds.size() > 0">
UNION
SELECT custom_approval_id FROM spmk_initiator_config WHERE
<choose>
<when test="deptIds.size() > 1">
asso_id IN
(
<foreach item="it" index="index" collection="deptIds" separator="," close="" >
#{it}
</foreach>
)
</when>
<otherwise>
asso_id = #{deptIds[0]}
</otherwise>
</choose>
AND type IN (2,3) GROUP BY custom_approval_id
</if>
) OR b.is_allvisible = 1)
WHERE a.org_code = #{org_code}
<!-- AND b.id IN (
SELECT custom_approval_id FROM spmk_initiator_config WHERE asso_id = #{emp_num} AND type = 1 GROUP BY custom_approval_id
) -->
ORDER BY a.ranks, b.ranks
</select>
......
......@@ -16,6 +16,7 @@
<result column="update_time" property="updateTime" />
<result column="create_time" property="createTime" />
<result column="asso_type" property="assoType" />
<result column="is_allvisible" property="isAllvisible" />
<result column="froms" property="froms" />
<result column="router" property="router" />
</resultMap>
......@@ -33,6 +34,7 @@
update_time,
create_time,
asso_type,
is_allvisible,
froms,
router
</sql>
......@@ -50,6 +52,7 @@
update_time SpmkCustomApproval_update_time,
create_time SpmkCustomApproval_create_time,
asso_type SpmkCustomApproval_asso_type,
is_allvisible SpmkCustomApproval_is_allvisible,
froms SpmkCustomApproval_froms,
router SpmkCustomApproval_router
</sql>
......@@ -102,6 +105,9 @@
<if test ='null != assoType'>
asso_type,
</if>
<if test ='null != isAllvisible'>
is_allvisible,
</if>
<if test ='null != froms'>
froms,
</if>
......@@ -143,6 +149,9 @@
<if test ='null != assoType'>
#{assoType},
</if>
<if test ='null != isAllvisible'>
#{isAllvisible},
</if>
<if test ='null != froms'>
#{froms},
</if>
......@@ -171,6 +180,7 @@
<if test ='null != updateTime'>update_time = #{updateTime},</if>
<if test ='null != createTime'>create_time = #{createTime},</if>
<if test ='null != assoType'>asso_type = #{assoType},</if>
<if test ='null != isAllvisible'>is_allvisible = #{isAllvisible},</if>
<if test ='null != froms'>froms = #{froms},</if>
<if test ='null != router'>router = #{router}</if>
</set>
......
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