Commit 667b9522 by 翁国栋

管理员审批重复扣除假期余额bug

parent 78b4ac17
......@@ -51,7 +51,7 @@ import java.util.*;
@Api(tags = "3.0Admin审批模块")
@RestController
@Transactional
@RequestMapping(value = "/admin/spmk", produces = { "application/json","multipart/form-data" })
@RequestMapping(value = "/admin/spmk", produces = {"application/json", "multipart/form-data"})
public class AdminSpmkController {
......@@ -74,6 +74,7 @@ public class AdminSpmkController {
private RedisUtil redisUtil;
//TODO 管理员审批
/**
* 管理员审批
*/
......@@ -82,13 +83,13 @@ public class AdminSpmkController {
@Transactional(rollbackFor = Exception.class)
@ApiOperationSupport(order = 20)
@Log(title = "审批-审批流程", businessType = BusinessType.UPDATE)
public Result<Object> approving(@CurrentUser UserBean userBean,@Validated @RequestBody AdminApprovingDto approvingDto) throws Exception {
public Result<Object> approving(@CurrentUser UserBean userBean, @Validated @RequestBody AdminApprovingDto approvingDto) throws Exception {
/*判断是否有权限转派*/
//if(approvingDto.getSts()==4){
QyzxEmpEntAsso ent = QyzxEmpEntAsso.builder().build().selectOne(new QueryWrapper<QyzxEmpEntAsso>().lambda().eq(QyzxEmpEntAsso::getOrgCode, userBean.getOrgCode()).eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum()));
if(ent != null) {
if (ent != null) {
/*超管和管理员不受权限控制*/
if(ent.getUserType() == 2) {
if (ent.getUserType() == 2) {
ZzglAuth zzglAuth = ZzglAuth.builder().build().selectOne(new QueryWrapper<ZzglAuth>().lambda().eq(ZzglAuth::getBmgwId, userBean.getUserInfo().getBmgwId())
.eq(ZzglAuth::getMenuId, "/Approvalspbutonspbuton020102"));
if (zzglAuth == null) {
......@@ -99,11 +100,11 @@ public class AdminSpmkController {
//}
Integer asId = approvingDto.getAsId();
//查询redis中当前有没有在被审批执行中,0是没有在执行,1是在执行
Integer approStatus=Integer.parseInt(redisUtil.get(asId.toString())==null?"0":redisUtil.get(asId.toString()).toString());
if(approStatus==1){
Integer approStatus = Integer.parseInt(redisUtil.get(asId.toString()) == null ? "0" : redisUtil.get(asId.toString()).toString());
if (approStatus == 1) {
return ResultUtil.error("该审批已在审批中!");
}else{
redisUtil.set(asId.toString(),1,2);
} else {
redisUtil.set(asId.toString(), 1, 2);
}
SpmkApproveDetailSummary ad = SpmkApproveDetailSummary.builder().build().selectOne(new QueryWrapper<SpmkApproveDetailSummary>()
.lambda()
......@@ -115,7 +116,7 @@ public class AdminSpmkController {
// 查询 SpmkApproveSummary 状态,
SpmkApproveSummary aSummary = spmkApproveSummaryMapper.selectOne(new QueryWrapper<SpmkApproveSummary>().lambda()
.select(SpmkApproveSummary::getSts,SpmkApproveSummary::getAssoType,SpmkApproveSummary::getEmpNum,SpmkApproveSummary::getOrgCode)
.select(SpmkApproveSummary::getSts, SpmkApproveSummary::getAssoType, SpmkApproveSummary::getEmpNum, SpmkApproveSummary::getOrgCode)
.eq(SpmkApproveSummary::getId, asId));
// if (aSummary.getSts() > ApproveSummarySts.IN.ordinal()) {
......@@ -133,8 +134,8 @@ public class AdminSpmkController {
// return ResultUtil.error("您已审批过!");
// }
//判断是否是请假审批
if(aSummary.getAssoType()==ApproveEnum.LEAVE.getType()){
if(approvingDto.getSts()==2) {
if (aSummary.getAssoType() == ApproveEnum.LEAVE.getType()) {
if (approvingDto.getSts() == 2) {
JSONObject jSONObject = jsonObject.parseObject(ad.getRequestData(), JSONObject.class);
// 请假类型 - 前端传中文
String LeaveType = ObjectUtil.isNull(jSONObject.get("__LeaveType", FromData.class)) ? null : jSONObject.get("__LeaveType", FromData.class).getValue();
......@@ -144,13 +145,13 @@ public class AdminSpmkController {
KqglAssoLeaveEmployeeBalance emba = KqglAssoLeaveEmployeeBalance.builder().build().selectOne(new QueryWrapper<KqglAssoLeaveEmployeeBalance>().lambda().eq(KqglAssoLeaveEmployeeBalance::getLeaveRulesId, Convert.toInt(LeaveType))
.eq(KqglAssoLeaveEmployeeBalance::getUserid, aSummary.getEmpNum()).eq(KqglAssoLeaveEmployeeBalance::getOrgCode, aSummary.getOrgCode()));
if (emba != null) {
if (emba.getBalanceDays()!=-1&&emba.getBalanceDays() < Convert.toInt(longTime)) {
if (emba.getBalanceDays() != -1 && emba.getBalanceDays() < Convert.toInt(longTime)) {
return ResultUtil.error("当前发起人假期余额不足");
}
}
}
}
if ( spmkExecutorMapper.selectCount(new QueryWrapper<SpmkExecutor>().lambda()
if (spmkExecutorMapper.selectCount(new QueryWrapper<SpmkExecutor>().lambda()
.eq(SpmkExecutor::getId, approvingDto.getExecutorId())
.eq(SpmkExecutor::getEmpNum, userBean.getEmpNum())
.eq(SpmkExecutor::getSts, ExecutorSts.IN_EXECUTION.ordinal())) == 0) {
......@@ -158,22 +159,22 @@ public class AdminSpmkController {
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)
.in(QyzxEmpEntAsso::getUserType, SysRoleType.U_TYPE_ADMIN, SysRoleType.U_TYPE_C_ADMIN)
.count();
if (adminNum <= 0) {
redisUtil.set(asId.toString(),0,500);
redisUtil.set(asId.toString(), 0, 500);
return ResultUtil.error("非当前审批人 或 管理员,无法操作!");
}
}
//如果是再次审批
SpmkApproveExecuteRecord spmkApproveExecuteRecord = SpmkApproveExecuteRecord.builder().id(approvingDto.getExecuteRecordId()).build().selectById();
if(spmkApproveExecuteRecord.getSts()>1){
if (spmkApproveExecuteRecord.getSts() > 1) {
spmkApproveExecuteRecordMapper.delExecuteRecord(approvingDto.getExecuteRecordId(), asId);
}
List<FlowChildren> listFlowChildren = jsonObject.parseArray(ad.getFlowChildren(),FlowChildren.class);
List<FlowChildren> listFlowChildren = jsonObject.parseArray(ad.getFlowChildren(), FlowChildren.class);
RouterUtils.updateRefuseToAgree(
listFlowChildren,
......@@ -192,16 +193,16 @@ public class AdminSpmkController {
);
listFlowChildren.forEach(l->{
listFlowChildren.forEach(l -> {
//如果大节点已经完成
if(l.getClassName().equals("audit")){
if(l.getExecute().equals("2")){
l.getRelation().get(0).getUsers().forEach(v->{
if(!v.getExecute().equals("2")){
if (l.getClassName().equals("audit")) {
if (l.getExecute().equals("2")) {
l.getRelation().get(0).getUsers().forEach(v -> {
if (!v.getExecute().equals("2")) {
v.setExecute("2");
}
});
}else if(l.getExecute().equals("1")){
} else if (l.getExecute().equals("1")) {
//大节点未执行完
}
......@@ -227,35 +228,41 @@ public class AdminSpmkController {
*/
if (fc.getExecute() == "2") {
//未更新sts前
int lastSts = aSummary.getSts();
// 查询 SpmkApproveSummary 状态
aSummary = spmkApproveSummaryMapper.selectOne(new QueryWrapper<SpmkApproveSummary>().lambda()
.select(SpmkApproveSummary::getSts,SpmkApproveSummary::getAssoType)
.select(SpmkApproveSummary::getSts, SpmkApproveSummary::getAssoType, SpmkApproveSummary::getEmpNum, SpmkApproveSummary::getOrgCode)
.eq(SpmkApproveSummary::getId, asId));
// if (aSummary.getSts() != ApproveSummarySts.REFUSE.ordinal()) {
SpmkApproveSummary.builder().id(asId).currentApprover(CommonEnum.NULL_STR.getDesc()).endTime(new Date()).sts(ApproveSummarySts.FINISH.ordinal()).build().updateById();
JSONObject jSONObject = jsonObject.parseObject(ad.getRequestData(),JSONObject.class);
JSONObject jSONObject = jsonObject.parseObject(ad.getRequestData(), JSONObject.class);
jSONObject.set("approveId", FromData.builder().value(String.valueOf(asId)).build());
jSONObject.set("orgCode", userBean.getOrgCode());
//如果请假审批,并且上一次是同意这次重复同意不会扣除假期余额
if (aSummary.getAssoType() == ApproveEnum.LEAVE.getType() && Integer.parseInt(fc.getExecute()) == lastSts) {
} else {
//审批完成后 业务
SpmkAssoBusiness sab = spmkAssoBusinessFactory.createSpmkService(ApproveEnum.getEnums(aSummary.getAssoType()));
if (sab != null){
log.info("1----------{}",sab);
if (sab != null) {
log.info("1----------{}", sab);
}
log.info("2----------{}", jSONObject);
sab.handleApprove(jSONObject);
}
}
// }
// }else {
// redisUtil.set(asId.toString(),0,500);
// return ResultUtil.error("该审批已结束!");
// }
redisUtil.set(asId.toString(),0,500);
redisUtil.set(asId.toString(), 0, 500);
return ResultUtil.success();
}
/**
......@@ -264,8 +271,7 @@ public class AdminSpmkController {
@DeleteMapping(value = "/del_appraisal_t/{id}")
@ApiOperation(value = "2.移除-审批人", httpMethod = "DELETE", notes = "移除-审批人")
@ApiOperationSupport(order = 6)
@Role
public Result<Object> delAT(@CurrentUser UserBean userBean,@Validated @RequestBody AdminApprovingDto approvingDto) throws Exception {
@Role public Result<Object> delAT(@CurrentUser UserBean userBean,@Validated @RequestBody AdminApprovingDto approvingDto) throws Exception {
jxglAppraisalTMapper.delete(new QueryWrapper<JxglAppraisalT>().lambda().eq(JxglAppraisalT::getId, id)
.eq(JxglAppraisalT::getOrgCode, userBean.getOrgCode()));
......
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