17 changed files with 349 additions and 9 deletions
@ -0,0 +1,27 @@ |
|||
package com.qs.serve.modules.seeyon.entity.vo; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.time.LocalDateTime; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/8/8 |
|||
*/ |
|||
@Data |
|||
public class TodoVO { |
|||
|
|||
/** 类型 */ |
|||
private String targetType; |
|||
|
|||
private String targetCode; |
|||
|
|||
private String targetId; |
|||
|
|||
/** 标题 */ |
|||
private String title; |
|||
|
|||
/** 时间 */ |
|||
private LocalDateTime time; |
|||
|
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.qs.serve.modules.seeyon.service; |
|||
|
|||
import com.qs.serve.modules.seeyon.entity.vo.TodoVO; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 通用的审批服务 |
|||
* @author YenHex |
|||
* @since 2023/8/8 |
|||
*/ |
|||
public interface CommonCheckService { |
|||
|
|||
/** |
|||
* 退回列表 |
|||
* @return |
|||
*/ |
|||
List<TodoVO> listCallbackList(); |
|||
|
|||
} |
@ -0,0 +1,73 @@ |
|||
package com.qs.serve.modules.seeyon.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.util.AuthContextUtils; |
|||
import com.qs.serve.modules.seeyon.entity.vo.TodoVO; |
|||
import com.qs.serve.modules.seeyon.service.CommonCheckService; |
|||
import com.qs.serve.modules.sys.service.SysUserService; |
|||
import com.qs.serve.modules.tbs.common.TbsCostApplyState; |
|||
import com.qs.serve.modules.tbs.entity.TbsCostApply; |
|||
import com.qs.serve.modules.tbs.mapper.TbsCostApplyMapper; |
|||
import com.qs.serve.modules.tzc.common.TzcPolicyStatus; |
|||
import com.qs.serve.modules.tzc.entity.TzcPolicy; |
|||
import com.qs.serve.modules.tzc.service.TzcPolicyService; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/8/8 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class CommonCheckServiceImpl implements CommonCheckService { |
|||
|
|||
private final SysUserService sysUserService; |
|||
private final TbsCostApplyMapper costApplyMapper; |
|||
private final TzcPolicyService tzcPolicyService; |
|||
|
|||
@Override |
|||
public List<TodoVO> listCallbackList() { |
|||
String userId = AuthContextUtils.getSysUserId(); |
|||
//费用
|
|||
LambdaQueryWrapper<TbsCostApply> costLqw = new LambdaQueryWrapper<>(); |
|||
costLqw.eq(TbsCostApply::getUserId,userId); |
|||
costLqw.eq(TbsCostApply::getChargeState, TbsCostApplyState.State_4_refused.getCode()); |
|||
List<TbsCostApply> costApplyList = costApplyMapper.selectList(costLqw); |
|||
List<TodoVO> todoCostList = costApplyList.stream().map(obj -> { |
|||
TodoVO todo = new TodoVO(); |
|||
todo.setTargetType("CostBill"); |
|||
todo.setTargetId(obj.getId()+""); |
|||
todo.setTargetCode(obj.getCode()); |
|||
todo.setTitle(obj.getChargeTheme()); |
|||
todo.setTime(obj.getCreateTime()); |
|||
return todo; |
|||
}).collect(Collectors.toList()); |
|||
//政策
|
|||
LambdaQueryWrapper<TzcPolicy> policyLqw = new LambdaQueryWrapper<>(); |
|||
policyLqw.eq(TzcPolicy::getUserId, userId); |
|||
policyLqw.eq(TzcPolicy::getPolicyStatus, TzcPolicyStatus.Status_4_RollBack); |
|||
List<TzcPolicy> policyList = tzcPolicyService.list(policyLqw); |
|||
List<TodoVO> todoPolicyList = policyList.stream().map(obj -> { |
|||
TodoVO todo = new TodoVO(); |
|||
todo.setTargetType("ReleasePolicy"); |
|||
todo.setTargetId(obj.getId()+""); |
|||
todo.setTargetCode(obj.getPolicyCode()); |
|||
todo.setTitle(obj.getTitle()); |
|||
todo.setTime(obj.getCreateTime()); |
|||
return todo; |
|||
}).collect(Collectors.toList()); |
|||
|
|||
List<TodoVO> result = new ArrayList<>(); |
|||
result.addAll(todoCostList); |
|||
result.addAll(todoPolicyList); |
|||
return result; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.qs.serve.modules.tbs.common; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/8/8 |
|||
*/ |
|||
public interface TbsBudgetCheckState { |
|||
|
|||
/** |
|||
* 0=未发布;1=审批中;2=完成;3-被驳回;4-中止; |
|||
*/ |
|||
int State_0_unPublish = 0; |
|||
int State_1_apply = 1; |
|||
int State_2_finished = 2; |
|||
int State_3_setback = 3; |
|||
int State_4_stop = 4; |
|||
|
|||
} |
@ -0,0 +1,43 @@ |
|||
package com.qs.serve.modules.tbs.controller; |
|||
|
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.modules.tbs.entity.bo.TbsBudgetUpdateAfterStartBo; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
/** |
|||
* 预算 预算审批 |
|||
* @author YenHex |
|||
* @since 2023/8/8 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("tbs/budgetCheck") |
|||
public class TbsBudgetCheckController { |
|||
|
|||
/** |
|||
* 提交申请 |
|||
* @return |
|||
*/ |
|||
@PostMapping("commitApply/{id}") |
|||
public R<?> commitApply(@PathVariable("id") String id){ |
|||
|
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 提交更新申请 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("commitChangeApply") |
|||
public R<?> commitApply(@RequestBody TbsBudgetUpdateAfterStartBo param){ |
|||
|
|||
return R.ok(); |
|||
} |
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.qs.serve.modules.tbs.entity.bo; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/8/8 |
|||
*/ |
|||
@Data |
|||
public class TbsBudgetAmtBo { |
|||
|
|||
private Integer type; |
|||
|
|||
private Long budgetScheduleItemId; |
|||
|
|||
private Integer amount; |
|||
|
|||
} |
@ -0,0 +1,92 @@ |
|||
package com.qs.serve.modules.tbs.service.impl; |
|||
|
|||
import com.qs.serve.common.util.Assert; |
|||
import com.qs.serve.modules.seeyon.service.SeeYonOperationService; |
|||
import com.qs.serve.modules.tbs.common.TbsBudgetCheckState; |
|||
import com.qs.serve.modules.tbs.common.TbsSeeYonConst; |
|||
import com.qs.serve.modules.tbs.entity.TbsBudget; |
|||
import com.qs.serve.modules.tbs.entity.bo.TbsAffairCommitBo; |
|||
import com.qs.serve.modules.tbs.mapper.TbsBudgetMapper; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* 预算申请 |
|||
* @author YenHex |
|||
* @since 2023/8/8 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class TbsBudgetApplyOperationServiceImpl implements SeeYonOperationService { |
|||
|
|||
private TbsBudgetMapper budgetMapper; |
|||
|
|||
@Override |
|||
public String getTargetId(TbsAffairCommitBo affairCommit) { |
|||
return affairCommit.getTargetId(); |
|||
} |
|||
|
|||
@Override |
|||
public String getSyFormIdByTargetInfo(TbsAffairCommitBo affairCommit) { |
|||
TbsBudget tbsBudget = budgetMapper.selectById(affairCommit.getTargetId()); |
|||
if(!tbsBudget.getBudgetCheckState().equals(TbsBudgetCheckState.State_1_apply)){ |
|||
Assert.throwEx("操作失败,预算处于非审批状态"); |
|||
} |
|||
return tbsBudget.getSyFormId(); |
|||
} |
|||
|
|||
@Override |
|||
public Object doBacked(TbsAffairCommitBo param) { |
|||
TbsBudget tbsBudget = budgetMapper.selectById(param.getTargetId()); |
|||
if(tbsBudget.getBudgetState().equals(0)&&tbsBudget.getBudgetCheckState().equals(TbsBudgetCheckState.State_1_apply)){ |
|||
tbsBudget.setBudgetCheckState(TbsBudgetCheckState.State_3_setback); |
|||
budgetMapper.updateById(tbsBudget); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public Object doFinished(TbsAffairCommitBo param) { |
|||
TbsBudget tbsBudget = budgetMapper.selectById(param.getTargetId()); |
|||
if(tbsBudget.getBudgetState().equals(0)&&tbsBudget.getBudgetCheckState().equals(TbsBudgetCheckState.State_1_apply)){ |
|||
tbsBudget.setBudgetCheckState(TbsBudgetCheckState.State_2_finished); |
|||
//启用预算
|
|||
tbsBudget.setBudgetState(1); |
|||
budgetMapper.updateById(tbsBudget); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public Object doRefuse(TbsAffairCommitBo param) { |
|||
TbsBudget tbsBudget = budgetMapper.selectById(param.getTargetId()); |
|||
if(tbsBudget.getBudgetState().equals(0)&&tbsBudget.getBudgetCheckState().equals(TbsBudgetCheckState.State_1_apply)){ |
|||
tbsBudget.setBudgetCheckState(TbsBudgetCheckState.State_4_stop); |
|||
budgetMapper.updateById(tbsBudget); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public Object compensateBacked(String targetId) { |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public Object compensateFinished(String targetId) { |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public Object compensateRefuse(String targetId) { |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public String getTemplateCode() { |
|||
return TbsSeeYonConst.BudgetApplyConf.Code(); |
|||
} |
|||
|
|||
} |
Loading…
Reference in new issue