Browse Source

部分核销状态查询修复

v1.0
Yen 2 years ago
parent
commit
7dd4beb019
  1. 10
      src/main/java/com/qs/serve/modules/tbs/controller/TbsCostApplyCheckController.java
  2. 49
      src/main/java/com/qs/serve/modules/tbs/mapper/TbsCostCheckStateMapper.java
  3. 1
      src/main/java/com/qs/serve/modules/tbs/service/TbsCostApplyService.java
  4. 14
      src/main/java/com/qs/serve/modules/tbs/service/impl/TbsCostApplyServiceImpl.java
  5. 9
      src/main/java/com/qs/serve/task/TbsTask.java

10
src/main/java/com/qs/serve/modules/tbs/controller/TbsCostApplyCheckController.java

@ -146,6 +146,14 @@ public class TbsCostApplyCheckController {
return tbsCostApplyOperationServiceImpl.getUnfinished();
}
/**
* 更新核销状态
* @return
*/
@GetMapping("updateCheckState")
public R<?> updateCheckState(){
tbsCostApplyService.updateCheckState();
return R.ok();
}
}

49
src/main/java/com/qs/serve/modules/tbs/mapper/TbsCostCheckStateMapper.java

@ -0,0 +1,49 @@
package com.qs.serve.modules.tbs.mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
/**
* 维护拓展状态Mapper
* @author YenHex
* @since 2023/11/24
* -- * 不参与业务流程核销状态
* -- * 有这四个状态
* -- * 0-未核销代表这案子里面的所有活动都还未开始核销
* -- * 1-已通过代表这个案子的所有活动都已经核销完成
* -- * 2-核销中代表这个案子的某些活动在核销中
* -- * 3-被拒绝代表这个案子里面的所有活动金额都被释放了
* -- * 4-部分核销部分已核销还有未完成部分
*/
public interface TbsCostCheckStateMapper {
@Update("update tbs_cost_apply set check_state = 0 where charge_state is null ")
int updateCheckState0();
@Update("update tbs_cost_apply set check_state = 1 where charge_state = 3 ")
int updateCheckState1();
@Update("update tbs_cost_apply set check_state = 2 where id in ( " +
" SELECT cost_apply_id from vtb_verification where verification_state = 0 and del_flag = 0 " +
")")
int updateCheckState2();
@Select("select cost_apply_id " +
" from tbs_activity " +
" group by cost_apply_id " +
" HAVING count(total_amount) = sum(release_amount) ")
List<Long> selectCheckState3();
@Update("<script>" +
"update tbs_cost_apply set check_state = 3 where id in " +
"<foreach collection='costIds' item='selectId' open='(' separator=',' close=')'> " +
"#{selectId}" +
"</foreach>" +
"</script>")
int updateCheckState3(@Param("costIds") List<Long> costIds);
@Update("update tbs_cost_apply set check_state = 4 where charge_state = 2 and total_activity_used_amount > 0")
int updateCheckState4();
}

1
src/main/java/com/qs/serve/modules/tbs/service/TbsCostApplyService.java

@ -18,6 +18,7 @@ import java.util.Map;
*/
public interface TbsCostApplyService extends IService<TbsCostApply> {
void updateCheckState();
TbsCostApply getByCode(String code);

14
src/main/java/com/qs/serve/modules/tbs/service/impl/TbsCostApplyServiceImpl.java

@ -123,6 +123,20 @@ public class TbsCostApplyServiceImpl extends ServiceImpl<TbsCostApplyMapper,TbsC
private TbsBudgetMatchApplication tbsBudgetMatchApplication;
private TbsCostCheckStateMapper costCheckStateMapper;
@Override
public void updateCheckState() {
costCheckStateMapper.updateCheckState0();
costCheckStateMapper.updateCheckState1();
costCheckStateMapper.updateCheckState2();
List<Long> costIds = costCheckStateMapper.selectCheckState3();
if(costIds.size()>0){
costCheckStateMapper.updateCheckState3(costIds);
}
costCheckStateMapper.updateCheckState4();
}
@Override
public TbsCostApply getByCode(String code) {
LambdaQueryWrapper<TbsCostApply> lqw = new LambdaQueryWrapper<>();

9
src/main/java/com/qs/serve/task/TbsTask.java

@ -3,6 +3,7 @@ package com.qs.serve.task;
import java.time.LocalDate;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.qs.serve.common.model.dto.R;
import com.qs.serve.common.util.AuthContextUtils;
import com.qs.serve.common.util.CollectionUtil;
import com.qs.serve.modules.tbs.common.TbsActivityState;
@ -107,7 +108,13 @@ public class TbsTask {
}
/**
* 每半小时执行一次
*/
@Scheduled(cron="0 0/30 * * * ?")
public void updateCheckState(){
tbsCostApplyService.updateCheckState();
}
}

Loading…
Cancel
Save