Commit 4b8d2f46 authored by zhangwanglin's avatar zhangwanglin

定时任务

parent 657a87a1
......@@ -109,8 +109,8 @@ public class AccountController {
@PostMapping("/organAccountTaskExecute")
public Result organAccountTaskExecute(AccountTaskReqVO accountTaskReqVO){
List<AccountTaskExecuteReqVO> accountTaskExecuteReqVOS = accountTaskReqVO.getAccountTaskList();
accountService.organAccountTaskExecute(accountTaskExecuteReqVOS);
return Result.success();
Result result = accountService.organAccountTaskExecute(accountTaskExecuteReqVOS);
return result;
}
......@@ -142,6 +142,8 @@ public class AccountController {
*/
@GetMapping("/searchSrvOrganAccountList")
public Result<Page<SrvOrganAccountListResp>> searchSrvOrganAccountList(SrvOrganListReq srvOrganListReq) {
List<String> list = Arrays.asList("1");
srvOrganListReq.setAccountsStatusList(list);
return Result.success(accountService.searchSrvOrganAccountList(srvOrganListReq));
}
......@@ -232,7 +234,7 @@ public class AccountController {
if (result > 0) {
return Result.success();
} else {
return Result.failed();
return Result.failed("该记录不可操作,请联系管理员");
}
}
......@@ -248,7 +250,7 @@ public class AccountController {
if (result > 0) {
return Result.success();
} else {
return Result.failed();
return Result.failed("该记录已不可申报,请联系管理员");
}
}
......@@ -313,7 +315,6 @@ public class AccountController {
@GetMapping("/queryOverallCostList")
public Result<Page<OverallCostListRespVO>> queryOverallCostList(OverallCostReqVO req) {
// Page<OverallCostListRespVO> overallCostRecords = accountService.queryOverallCostList(req);
Page<OverallCostListRespVO> overallCostRecords = accountService.queryFreeRdInfo(req);
return Result.success(overallCostRecords);
}
......
......@@ -31,11 +31,11 @@ public interface ChDisabAccountsDetailMapper extends BaseMapper<ChDisabDetailAcc
OverallEduceDecreaseCostRespVO queryOverallCostRecords(OverallCostReqVO req);
Page<OverallCostListRespVO> queryOverallCostList(Page page, OverallCostReqVO req);
int updateByAccountsId(String accountsId,Integer accountsStatus);
}
\ No newline at end of file
......@@ -17,6 +17,9 @@ public interface ChSrvTaskDetailMapper extends BaseMapper<ChSrvTaskDetail> {
Page<SrvTaskRespVO> getSrvTaskList(Page page,SrvTaskReqVO req);
/**
*@desc 更新任务计划表状态为已完成
**/
Integer updateSrvPlanById(String palnId);
}
\ No newline at end of file
package com.hungraim.ltc.account.service;
import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hungraim.ltc.pojo.entity.account.*;
import com.hungraim.ltc.pojo.vo.account.*;
import com.hungraim.ltc.util.Result;
import org.apache.poi.ss.usermodel.Workbook;
import java.text.ParseException;
......@@ -37,7 +39,6 @@ public interface AccountService extends IService<ChDisabAccounts> {
OverallEduceDecreaseCostRespVO queryOverallCostRecords(OverallCostReqVO req);
Page<OverallCostListRespVO> queryOverallCostList(OverallCostReqVO req);
Page<OverallCostListRespVO> queryFreeRdInfo(OverallCostReqVO req);
......@@ -46,7 +47,7 @@ public interface AccountService extends IService<ChDisabAccounts> {
int updateChDisabAccounts(int id);
void organAccountTaskExecute(List<AccountTaskExecuteReqVO> accountTaskExecuteReqVOS);
Result organAccountTaskExecute(List<AccountTaskExecuteReqVO> accountTaskExecuteReqVOS);
void otherPlaceHandler(String programId);
......
......@@ -82,11 +82,15 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
}
//待审核
if(accountsStatus == 1) {
chDisabAccountsDetailMapper.updateByAccountsId(accountsId,1);
// chDisabAccountsDetailMapper.updateByAccountsIdReject(accountsId);
}
// 审核通过
if(accountsStatus == 2||accountsStatus == 3) {
chDisabAccountsDetailMapper.updateByAccountsId(accountsId,3);
if(accountsStatus == 2) {
// chDisabAccountsDetailMapper.updateByAccountsIdAuditing(accountsId);
}
// 复核
if(accountsStatus == 3) {
// chDisabAccountsDetailMapper.updateByAccountsIdCheck(accountsId);
}
// 已结算
if(accountsStatus == 4) {
......@@ -94,6 +98,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabAccountDTO.setTotalAllocatedExpenses(chDisabAccountDTO.getTotalAllocatedExpenses());
chDisabAccountDTO.setChooseSettle((short) 1); // 是否结算(0未结算,1已结算)
disabAccountsMapper.updateById(chDisabAccountDTO);
//chDisabAccountsDetailMapper.updateByAccountsIdAccounts(accountsId);
}
this.saveOrUpdate(chDisabAccounts);
}
......@@ -478,22 +483,6 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
return chDisabAccountsDetailMapper.queryOverallCostRecords(req);
}
@Override
public Page<OverallCostListRespVO> queryOverallCostList(OverallCostReqVO req) {
req.setDealType((null == req.getDealType() || 0 == req.getDealType()) ? null : req.getDealType());
Page<OverallCostListRespVO> overallCostListRespVOPage = chDisabAccountsDetailMapper.queryOverallCostList(new Page<>(req.getPageNum(), req.getPageSize()), req);
List<OverallCostListRespVO> records = overallCostListRespVOPage.getRecords();
for (OverallCostListRespVO record : records) {
int dealType = record.getDealType();
if (dealType == 1) {
record.setAmountOfMoney(record.getReissueAmount());
} else if (dealType == 2) {
record.setAmountOfMoney(record.getDeductionAmount());
}
}
return overallCostListRespVOPage;
}
@Override
public Page<OverallCostListRespVO> queryFreeRdInfo(OverallCostReqVO req) {
......@@ -563,11 +552,13 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
@Override
@Transactional(rollbackFor = Exception.class)
public void organAccountTaskExecute(List<AccountTaskExecuteReqVO> accountTaskExecuteReqVOS) {
public Result organAccountTaskExecute(List<AccountTaskExecuteReqVO> accountTaskExecuteReqVOS) {
log.info("organAccountTaskExecute.accountTaskExecuteReqVOS:{}",accountTaskExecuteReqVOS);
if (CollectionUtil.isEmpty(accountTaskExecuteReqVOS)) {
return;
return Result.failed("参数不能为空");
}
List<String> taskDetailIds = accountTaskExecuteReqVOS.stream().map(AccountTaskExecuteReqVO::getTaskDetailId).distinct().collect(Collectors.toList());
// 根据任务id查找结算详情,还没有对应的任务数据说明还未发生过结算,进行插入详情表和结算表
List<ChDisabDetailAccounts> chDisabDetailList = chDisabAccountsDetailMapper.queryAccountByCondition(taskDetailIds);
// 根据任务id分组,一个任务下会有多个项目,任务id相同
......@@ -579,16 +570,21 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
.eq(ChSrvTaskFinishItem::getTaskDetailId, taskDetailId));
List<AccountTaskExecuteReqVO> accountTaskList = entry.getValue();
// 处理具体的服务项目
try {
for (AccountTaskExecuteReqVO accountTaskExecuteReqVO : accountTaskList) {
// 已完成的任务更新ch_srv_plan状态
String planId = accountTaskExecuteReqVO.getPlanId();
Integer integer = chSrvTaskDetailMapper.updateSrvPlanById(planId);
if(integer == 0){
log.info("更新任务计划表失败");
}
if (CollectionUtil.isNotEmpty(chSrvTaskFinishItems)) {
List<ChSrvTaskFinishItem> chSrvTaskFinishItemStream = chSrvTaskFinishItems.stream()
.filter(s -> s.getItemId().equals(Long.valueOf(accountTaskExecuteReqVO.getItemId()))).collect(Collectors.toList());
// 如果存在就不插入了
if (CollectionUtil.isNotEmpty(chSrvTaskFinishItemStream)) {
return;
log.info("chSrvTaskFinishItemStream is totEmpty:{}",chSrvTaskFinishItemStream);
return Result.success();
}
}
ChSrvTaskFinishItem chSrvTaskFinishItem = new ChSrvTaskFinishItem();
......@@ -600,8 +596,13 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
ca.setTaskDetailId(Long.valueOf(accountTaskExecuteReqVO.getTaskDetailId()));
chSrvTaskDetailMapper.updateById(ca);
}
accountSave( taskDetailId, chDisabDetailList);
accountSave(taskDetailId, chDisabDetailList);
} catch (Exception e) {
log.info("=====accountSave error:{}",e);
return Result.failed("服务异常");
}
}
return Result.success();
}
private void accountSave(String taskDetailId, List<ChDisabDetailAccounts> chDisabDetailList) {
......@@ -652,6 +653,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
}
}
private ChDisabAccounts getChDisabAccounts(OrganAccountsVO accountsVO, BigDecimal limit, BigDecimal overallCost, BigDecimal personalCost) {
// 结算表 根据机构和结算时间 服务方式
ChDisabAccounts chDisabAccounts = disabAccountsMapper.queryAccountByCondition(DateUtils.dateToStrYm(DateUtils.strToDate(accountsVO.getSrvDate())), accountsVO.getSrvModeName(), accountsVO.getSrvOrganId(),null);
......@@ -743,6 +745,11 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
BigDecimal personalCost = chDisabDetailAccountsDTO.getAccountsPersonalCost();
Long accountsId = chDisabDetailAccountsDTO.getAccountsId();
ChDisabAccounts chDisabAccountDTO = disabAccountsMapper.selectById(accountsId);
Short accountsStatus = chDisabAccountDTO.getAccountsStatus();
if(accountsStatus > 1){
return -1;
}
if(chDisabAccountDTO !=null){
BigDecimal accountAllCost = chDisabAccountDTO.getAllCost();
BigDecimal accountOverallCost = chDisabAccountDTO.getOverallCost();
......@@ -773,6 +780,10 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
BigDecimal allCost = chDisabAccountDTO.getAllCost();
BigDecimal overallCost = chDisabAccountDTO.getOverallCost();
BigDecimal personalCost = chDisabAccountDTO.getPersonalCost();
Short accountsStatus = chDisabAccountDTO.getAccountsStatus();
if (accountsStatus > 2) {
return -1;
}
// 暂缓
if(status == 2){
allCost = allCost.subtract(accountsAllCost);
......
......@@ -63,44 +63,7 @@
</select>
<select id="queryOverallCostList" resultType="com.hungraim.ltc.pojo.entity.account.OverallCostListRespVO">
select info.REAL_NAME realName,
info.CERTI_CODE certiCode,
(select district_name from ch_fnd_district dis where apply.MEDICAL_AREA = dis.district_code) medicalArea,
detail.ACCOUNTS_DETAIL_ID accountsDetailId,
detail.ACCOUNTS_START_TIME svrStartTime,
detail.ACCOUNTS_END_TIME svrEndTime,
detail.DEAL_TYPE dealType,
organ.SRV_ORGAN_NAME srvOrganName,
detail.ACCOUNTS_OVERALL_COST accountsOverallCost,
detail.REISSUE_AMOUNT reissueAmount,
detail.ACCOUNTS_ID accountsId,
detail.DEDUCTION_AMOUNT deductionAmount
from CH_DISAB_ACCOUNTS_DETAIL detail
left join CH_DISABLE_INFO info on info.DISAB_INFO_ID = detail.DISAB_INFO_ID
left join CH_DISABLE_APPLY apply on apply.APPLY_ID = info.APPLY_ID
left join CH_SRV_ORGAN organ on organ.SRV_ORGAN_ID = detail.SRV_ORGAN_ID
<where>
<if test="req.realName != null and req.realName != ''">
and info.REAL_NAME = #{req.realName}
</if>
<if test="req.accountsTime != null and req.accountsTime != ''">
and to_char(detail.accounts_time,'yyyy-MM-dd') = #{req.accountsTime}
</if>
<if test="req.srvOrganName != null and req.srvOrganName != ''">
and organ.SRV_ORGAN_NAME = #{req.srvOrganName}
</if>
<if test="req.certiCode != null and req.certiCode != ''">
and info.certi_Code = #{req.certiCode}
</if>
<if test="req.dealType != null">
and detail.DEAL_TYPE = #{req.dealType}
</if>
<if test="req.dealType == null ">
and detail.DEAL_TYPE in (1,2)
</if>
</where>
</select>
<select id="queryOverallCostRecords"
resultType="com.hungraim.ltc.pojo.entity.account.OverallEduceDecreaseCostRespVO">
......@@ -285,15 +248,11 @@
d.REISSUE_AMOUNT = 0,
d.DEDUCTION_AMOUNT = 0
</if>
<if test="accountsStatus == 1">
d.status = #{accountsStatus}
</if>
<if test="accountsStatus == 3">
d.status = #{accountsStatus}
</if>
</set>
where d.ACCOUNTS_ID = #{accountsId}
</update>
</mapper>
......@@ -8,8 +8,8 @@
info.CERTI_CODE certiCode,
(select district_name from ch_fnd_district dis where apply.MEDICAL_AREA = dis.district_code) medicalArea,
detail.ACCOUNTS_DETAIL_ID accountsDetailId,
detail.ACCOUNTS_START_TIME svrStartTime,
detail.ACCOUNTS_END_TIME svrEndTime,
to_char(detail.ACCOUNTS_START_TIME,'yyyy-MM-dd') svrStartTime,
to_char(detail.ACCOUNTS_END_TIME,'yyyy-MM-dd') svrEndTime,
rd.DEAL_TYPE dealType,
organ.SRV_ORGAN_NAME srvOrganName,
rd.AMOUNT_OF_MONEY amountOfMoney,
......
......@@ -112,7 +112,7 @@ public class ChDisabDetailAccounts implements Serializable {
*/
private String remarks;
/**
* 状态(1 恢复状态 2 暂缓状态 3
* 状态(0 未申报 1 恢复状态 已申报 2 暂缓状态
*/
private Short status;
......
......@@ -135,7 +135,7 @@ public class SrvTaskController {
e.printStackTrace();
return Result.failed(e.getMessage());
}
srvTaskService.otherPlaceHandler(param.getProgramId());
//srvTaskService.otherPlaceHandler(param.getProgramId());
return Result.success();
}
......
......@@ -216,8 +216,11 @@
<select id="getAllocationSrvTask" resultType="com.hungraim.ltc.pojo.vo.governance.AllocationSrvTaskVO">
select t.SRV_TASK_ID,t.SRV_DATE,info.EXIT_TIME,info.EXIT_FLAG,info.EXIT_REASON_ID from CH_SRV_TASK t
left join CH_DISABLE_INFO info on t.DISAB_INFO_ID = info.DISAB_INFO_ID
left join ch_apr_task aprtask on info.last_task_id = aprtask.task_id--评定任务
left join ch_apr_report report on aprtask.task_id = report.task_id--评定报告
where t.SRV_DATE <![CDATA[ < ]]> sysdate and
(info.EXIT_TIME <![CDATA[ > ]]> sysdate or info.EXIT_TIME is null)
and sysdate <![CDATA[ > ]]> report.PUBLICITY_END_TIME
</select>
</mapper>
\ No newline at end of file
......@@ -65,6 +65,11 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.hungraim.ltc</groupId>
<artifactId>governance</artifactId>
<version>0.0.1</version>
</dependency>
</dependencies>
<build>
......
package com.hungraim.ltc.system.service;
public interface SrvTaskScheduledService {
void timeAllocationSrvTask();
}
package com.hungraim.ltc.system.service.impl;
import com.hungraim.ltc.api.SrvTaskFeignService;
import com.hungraim.ltc.util.Result;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
/**
* @author zwl
* @ClassName SrvTaskScheduledServiceImpl
* @description
* @date 2023/3/1 17:05
**/
@Service
@Slf4j
@AllArgsConstructor
public class SrvTaskScheduledServiceImpl {
private final SrvTaskFeignService srvTaskFeignService;
// 表示每天3点5分执行
@Scheduled(cron = "30 10 17 * * ?")
public void timeAllocationSrvTask() {
log.info("timeAllocationSrvTask========start");
Result result = srvTaskFeignService.timeAllocationSrvTask();
log.info("timeAllocationSrvTask========end:{}",result);
}
}
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