14 changed files with 471 additions and 38 deletions
@ -0,0 +1,44 @@ |
|||||
|
package com.qs.serve.modules.seeyon.entity.bo; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author YenHex |
||||
|
* @since 2023/5/24 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CtpAddNodeDTO { |
||||
|
|
||||
|
/** |
||||
|
* 添加审批节点的用户ID |
||||
|
*/ |
||||
|
List<String> userIds; |
||||
|
|
||||
|
/** |
||||
|
* 是否回退到我 |
||||
|
*/ |
||||
|
Integer backToMe; |
||||
|
|
||||
|
/** |
||||
|
* 用户登陆账号 |
||||
|
*/ |
||||
|
String userCode; |
||||
|
|
||||
|
/** |
||||
|
* 用户致远登陆账号 |
||||
|
*/ |
||||
|
String userSyId; |
||||
|
|
||||
|
/** |
||||
|
* 模板编码 |
||||
|
*/ |
||||
|
String templateCode; |
||||
|
|
||||
|
/** |
||||
|
* 目标id |
||||
|
*/ |
||||
|
String targetId; |
||||
|
|
||||
|
} |
@ -0,0 +1,29 @@ |
|||||
|
package com.qs.serve.modules.seeyon.entity.bo; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author YenHex |
||||
|
* @since 2023/5/24 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CtpAddNodeParam { |
||||
|
|
||||
|
/** |
||||
|
* 添加审批节点的用户ID |
||||
|
*/ |
||||
|
List<String> userIds; |
||||
|
|
||||
|
/** |
||||
|
* 是否回退到我 |
||||
|
*/ |
||||
|
Integer backToMe; |
||||
|
|
||||
|
/** |
||||
|
* 目标id |
||||
|
*/ |
||||
|
String targetId; |
||||
|
|
||||
|
} |
@ -0,0 +1,199 @@ |
|||||
|
package com.qs.serve.modules.tbs.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.qs.serve.common.model.consts.BudgetLogOptFlag; |
||||
|
import com.qs.serve.common.model.consts.BudgetLogRollbackFlag; |
||||
|
import com.qs.serve.common.model.dto.PageVo; |
||||
|
import com.qs.serve.common.model.dto.R; |
||||
|
import com.qs.serve.common.util.Assert; |
||||
|
import com.qs.serve.modules.seeyon.entity.CtpAffair; |
||||
|
import com.qs.serve.modules.seeyon.entity.CtpAffairQo; |
||||
|
import com.qs.serve.modules.seeyon.entity.bo.CtpAddNodeParam; |
||||
|
import com.qs.serve.modules.seeyon.service.SeeYonOperationService; |
||||
|
import com.qs.serve.modules.seeyon.service.SeeYonRequestService; |
||||
|
import com.qs.serve.modules.sys.mapper.SysUserMapper; |
||||
|
import com.qs.serve.modules.sys.service.SysUserService; |
||||
|
import com.qs.serve.modules.tbs.common.TbsCostApplyState; |
||||
|
import com.qs.serve.modules.tbs.common.TbsSeeYonConst; |
||||
|
import com.qs.serve.modules.tbs.entity.TbsActivity; |
||||
|
import com.qs.serve.modules.tbs.entity.TbsBudgetLog; |
||||
|
import com.qs.serve.modules.tbs.entity.TbsCostApply; |
||||
|
import com.qs.serve.modules.tbs.entity.bo.TbsAffairCommitBo; |
||||
|
import com.qs.serve.modules.tbs.entity.vo.CtpAffairVo; |
||||
|
import com.qs.serve.modules.tbs.mapper.TbsActivityMapper; |
||||
|
import com.qs.serve.modules.tbs.mapper.TbsCostApplyMapper; |
||||
|
import com.qs.serve.modules.tbs.service.TbsActivityService; |
||||
|
import com.qs.serve.modules.tbs.service.TbsBudgetLogService; |
||||
|
import com.qs.serve.modules.tbs.service.TbsCostApplyService; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.time.LocalDateTime; |
||||
|
import java.util.List; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* @author YenHex |
||||
|
* @since 2023/5/24 |
||||
|
*/ |
||||
|
|
||||
|
@Slf4j |
||||
|
@Service |
||||
|
@AllArgsConstructor |
||||
|
public class TbsCostApplyOperationServiceImpl implements SeeYonOperationService { |
||||
|
|
||||
|
private final TbsBudgetLogService tbsBudgetLogService; |
||||
|
private final SeeYonRequestService requestService; |
||||
|
private final SysUserService sysUserService; |
||||
|
|
||||
|
private final TbsCostApplyService costApplyService; |
||||
|
private final TbsActivityMapper tbsActivityMapper; |
||||
|
private final SysUserMapper userMapper; |
||||
|
|
||||
|
@Override |
||||
|
public SysUserService getSysUserService() { |
||||
|
return sysUserService; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public boolean checkSyFormIdIsNotNull(String targetId) { |
||||
|
TbsCostApply costApplyParam = costApplyService.getById(targetId); |
||||
|
if(costApplyParam!=null&&costApplyParam.getSyFormId()!=null){ |
||||
|
return true; |
||||
|
} |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String getTemplateCode() { |
||||
|
return TbsSeeYonConst.CostApplyConf.Code(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public SeeYonRequestService getRequestService() { |
||||
|
return requestService; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public SysUserMapper getUserMapper() { |
||||
|
return userMapper; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public boolean testConnection() { |
||||
|
return SeeYonOperationService.super.testConnection(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Object doNext(TbsAffairCommitBo param) { |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Object doBacked(TbsAffairCommitBo param) { |
||||
|
Long costApplyId = Long.parseLong(this.getTargetId(param)); |
||||
|
TbsCostApply apply = new TbsCostApply(); |
||||
|
apply.setId(costApplyId); |
||||
|
apply.setChargeState(TbsCostApplyState.State_4_refused.getCode()); |
||||
|
costApplyService.updateById(apply); |
||||
|
LambdaQueryWrapper<TbsBudgetLog> logLqw = new LambdaQueryWrapper<>(); |
||||
|
logLqw.select(TbsBudgetLog::getId); |
||||
|
logLqw.eq(TbsBudgetLog::getCostApplyId,costApplyId); |
||||
|
logLqw.eq(TbsBudgetLog::getRollbackFlag, BudgetLogRollbackFlag.State_0); |
||||
|
List<TbsBudgetLog> budgetLogList = tbsBudgetLogService.list(logLqw); |
||||
|
budgetLogList.forEach(a->a.setRollbackFlag(BudgetLogRollbackFlag.State_1)); |
||||
|
tbsBudgetLogService.updateBatchById(budgetLogList); |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Object doFinished(TbsAffairCommitBo param) { |
||||
|
Long targetId = Long.parseLong(this.getTargetId(param)); |
||||
|
TbsCostApply apply = new TbsCostApply(); |
||||
|
apply.setId(targetId); |
||||
|
apply.setChargeState(TbsCostApplyState.State_2_actioning.getCode()); |
||||
|
costApplyService.updateById(apply); |
||||
|
//更新活动通过时间
|
||||
|
TbsActivity tbsActivity = new TbsActivity(); |
||||
|
tbsActivity.setCostPassTime(LocalDateTime.now()); |
||||
|
tbsActivity.setCostPassFlag(1); |
||||
|
LambdaQueryWrapper<TbsActivity> actLqw = new LambdaQueryWrapper<>(); |
||||
|
actLqw.eq(TbsActivity::getCostApplyId,targetId); |
||||
|
tbsActivityMapper.update(tbsActivity,actLqw); |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Object doRefuse(TbsAffairCommitBo param) { |
||||
|
Long costApplyId = Long.parseLong(this.getTargetId(param)); |
||||
|
TbsCostApply apply = new TbsCostApply(); |
||||
|
apply.setId(costApplyId); |
||||
|
apply.setChargeState(TbsCostApplyState.State_5_stop.getCode()); |
||||
|
costApplyService.updateById(apply); |
||||
|
costApplyService.releaseCost(costApplyId, 1); |
||||
|
//移除日志
|
||||
|
LambdaQueryWrapper<TbsBudgetLog> logLqw = new LambdaQueryWrapper<>(); |
||||
|
logLqw.eq(TbsBudgetLog::getCostApplyId,costApplyId); |
||||
|
List<TbsBudgetLog> oldLogList = tbsBudgetLogService.list(logLqw); |
||||
|
List<TbsBudgetLog> oldLogList4Upd = oldLogList.stream().map(a->{ |
||||
|
TbsBudgetLog budgetLog = new TbsBudgetLog(); |
||||
|
budgetLog.setId(a.getId()); |
||||
|
budgetLog.setRollbackFlag(BudgetLogRollbackFlag.State_3); |
||||
|
return budgetLog; |
||||
|
}).collect(Collectors.toList()); |
||||
|
tbsBudgetLogService.updateBatchById(oldLogList4Upd); |
||||
|
for (TbsBudgetLog budgetLog : oldLogList) { |
||||
|
budgetLog.setCreateBy(null); |
||||
|
budgetLog.setCreateTime(null); |
||||
|
budgetLog.setUpdateBy(null); |
||||
|
budgetLog.setUpdateTime(null); |
||||
|
budgetLog.setId(null); |
||||
|
budgetLog.setAmount(budgetLog.getAmount().negate()); |
||||
|
budgetLog.setOptType(BudgetLogOptFlag.State_5); |
||||
|
} |
||||
|
tbsBudgetLogService.saveBatch(oldLogList); |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void pageMemberAffair4packageVo(List<CtpAffairVo> result) { |
||||
|
List<String> costApplyIds = result.stream() |
||||
|
.filter(a->a.getAffairInfo()!=null) |
||||
|
.map(b->b.getAffairInfo().getCostApplyId()) |
||||
|
.collect(Collectors.toList()); |
||||
|
List<TbsCostApply> costApplyList = costApplyService.listByIds(costApplyIds); |
||||
|
for (CtpAffairVo affairVo : result) { |
||||
|
CtpAffair ctpAffair = affairVo.getAffairInfo(); |
||||
|
if(ctpAffair!=null){ |
||||
|
for (TbsCostApply costApply : costApplyList) { |
||||
|
if(costApply.getId().toString().equals(ctpAffair.getCostApplyId())){ |
||||
|
affairVo.setCostApply(costApply); |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public R<?> commitAffair(TbsAffairCommitBo affairCommit) { |
||||
|
return SeeYonOperationService.super.commitAffair(affairCommit); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String getTargetId(TbsAffairCommitBo affairCommit) { |
||||
|
return affairCommit.getCostApplyId().toString(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String commitGetSyFormId(TbsAffairCommitBo affairCommit) { |
||||
|
TbsCostApply costApply = costApplyService.getById(affairCommit.getCostApplyId()); |
||||
|
if(!costApply.getChargeState().equals(TbsCostApplyState.State_1_apply.getCode())){ |
||||
|
Assert.throwEx("费用申请处于未非审批状态"); |
||||
|
} |
||||
|
return costApply.getSyFormId(); |
||||
|
} |
||||
|
|
||||
|
} |
Loading…
Reference in new issue