Commit 0b8de90a authored by zhangwanglin's avatar zhangwanglin

结算

parent 53b3350e
......@@ -299,11 +299,11 @@ public class AccountController {
* @param accountsDetailId 结算详情id
*/
@DeleteMapping("/deleteAccountsDetail")
public Result deleteAccountsDetail(Long accountsDetailId) {
public Result deleteAccountsDetail(Long accountsDetailId,Long freeRdId) {
if (null == accountsDetailId) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
int result = accountService.deleteAccountsDetail(accountsDetailId);
int result = accountService.deleteAccountsDetail(accountsDetailId,freeRdId);
if(result > 0){
return Result.success();
}else{
......@@ -313,7 +313,8 @@ public class AccountController {
@GetMapping("/queryOverallCostList")
public Result<Page<OverallCostListRespVO>> queryOverallCostList(OverallCostReqVO req) {
Page<OverallCostListRespVO> overallCostRecords = accountService.queryOverallCostList(req);
// Page<OverallCostListRespVO> overallCostRecords = accountService.queryOverallCostList(req);
Page<OverallCostListRespVO> overallCostRecords = accountService.queryFreeRdInfo(req);
return Result.success(overallCostRecords);
}
......
package com.hungraim.ltc.account.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.pojo.entity.account.ChDisabFreeRdInfo;
import com.hungraim.ltc.pojo.entity.account.OverallCostListRespVO;
import com.hungraim.ltc.pojo.entity.account.OverallCostReqVO;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
/**
* @author zwl
* @ClassName ChDisabFreeRdInfoMapper
* @description
* @date 2023/2/27 20:59
**/
@Repository
@Mapper
public interface ChDisabFreeRdInfoMapper extends BaseMapper<ChDisabFreeRdInfo> {
Page<OverallCostListRespVO> queryFreeRdInfo(Page page, OverallCostReqVO req);
}
......@@ -39,6 +39,8 @@ public interface AccountService extends IService<ChDisabAccounts> {
Page<OverallCostListRespVO> queryOverallCostList(OverallCostReqVO req);
Page<OverallCostListRespVO> queryFreeRdInfo(OverallCostReqVO req);
int overallCostSubmit(OverallCostSubmitReqVO req);
int updateChDisabAccounts(int id);
......@@ -48,7 +50,7 @@ public interface AccountService extends IService<ChDisabAccounts> {
void otherPlaceHandler(String programId);
int deleteAccountsDetail(Long accountsDetailId);
int deleteAccountsDetail(Long accountsDetailId,Long freeRdId);
int accountsFreeCommit(Long accountsDetailId);
......
......@@ -50,6 +50,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
private final ChCfgCareServiceMapper chCfgCareServiceMapper;
private final ChCfgCostStandardMapper chCfgCostStandardMapper;
private final ChDisabAccountsDetailMapper chDisabAccountsDetailMapper;
private final ChDisabFreeRdInfoMapper chDisabFreeRdInfoMapper;
......@@ -75,6 +76,9 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabAccounts.setPersonalCost(BigDecimal.valueOf(0));
chDisabAccounts.setReissueAmountTotal(BigDecimal.valueOf(0));
chDisabAccounts.setDeductionAmountTotal(BigDecimal.valueOf(0));
HashMap map = new HashMap();
map.put("ACCOUNTS_ID",accountsId);
chDisabFreeRdInfoMapper.deleteByMap(map);
}
//待审核
if(accountsStatus == 1) {
......@@ -492,12 +496,23 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
}
@Override
public Page<OverallCostListRespVO> queryFreeRdInfo(OverallCostReqVO req) {
req.setDealType((null == req.getDealType() || 0 == req.getDealType()) ? null : req.getDealType());
Page<OverallCostListRespVO> overallCostListRespVOPage = chDisabFreeRdInfoMapper.queryFreeRdInfo(new Page<>(req.getPageNum(), req.getPageSize()), req);
return overallCostListRespVOPage;
}
@Override
public int overallCostSubmit(OverallCostSubmitReqVO req){
ChDisabDetailAccounts chDisabDetailAccounts = new ChDisabDetailAccounts();
int dealType = req.getDealType();
chDisabDetailAccounts.setAccountsDetailId(req.getAccountsDetailId());
Long accountsDetailId = req.getAccountsDetailId();
chDisabDetailAccounts.setAccountsDetailId(accountsDetailId);
Long accountsId = req.getAccountsId();
ChDisabAccounts chDisabAccounts = disabAccountsMapper.selectById(accountsId);
ChDisabDetailAccounts chDisabDetailAccountsDTO = chDisabAccountsDetailMapper.selectById(accountsDetailId);
BigDecimal deductionAmount = chDisabDetailAccountsDTO.getDeductionAmount();
BigDecimal reissueAmount = chDisabDetailAccountsDTO.getReissueAmount();
BigDecimal deductionAmountTotal = chDisabAccounts.getDeductionAmountTotal();
BigDecimal reissueAmountTotal = chDisabAccounts.getReissueAmountTotal();
chDisabDetailAccounts.setDealType(dealType);
......@@ -505,11 +520,11 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
BigDecimal amountOfMoney = new BigDecimal(amountOfMoneyStr);
if(dealType == 1){
// 补发
chDisabDetailAccounts.setReissueAmount(amountOfMoney);
chDisabDetailAccounts.setReissueAmount(reissueAmount.add(amountOfMoney));
reissueAmountTotal = reissueAmountTotal.add(amountOfMoney);
}else if(dealType == 2){
// 扣减
chDisabDetailAccounts.setDeductionAmount(amountOfMoney);
chDisabDetailAccounts.setDeductionAmount(deductionAmount.add(amountOfMoney));
deductionAmountTotal = deductionAmountTotal.add(amountOfMoney);
}
chDisabDetailAccounts.setRemarks(req.getRemarks());
......@@ -517,6 +532,13 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabAccounts.setReissueAmountTotal(reissueAmountTotal);
chDisabAccounts.setDeductionAmountTotal(deductionAmountTotal);
disabAccountsMapper.updateById(chDisabAccounts);
ChDisabFreeRdInfo chDisabFreeRdInfo = new ChDisabFreeRdInfo();
chDisabFreeRdInfo.setDealType(dealType);
chDisabFreeRdInfo.setAmountOfMoney(amountOfMoney);
chDisabFreeRdInfo.setAccountsDetailId(accountsDetailId);
chDisabFreeRdInfo.setAccountsId(accountsId);
chDisabFreeRdInfo.setCreationTime(new Date());
chDisabFreeRdInfoMapper.insert(chDisabFreeRdInfo);
return result;
}
......@@ -682,13 +704,33 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
@Override
@Transactional(rollbackFor = Exception.class)
public int deleteAccountsDetail(Long accountsDetailId){
ChDisabDetailAccounts chDisabDetailAccounts = new ChDisabDetailAccounts();
chDisabDetailAccounts.setDeductionAmount(BigDecimal.valueOf(0));
chDisabDetailAccounts.setReissueAmount(BigDecimal.valueOf(0));
chDisabDetailAccounts.setDealType(0);
chDisabDetailAccounts.setAccountsDetailId(accountsDetailId);
int result = chDisabAccountsDetailMapper.updateById(chDisabDetailAccounts);
public int deleteAccountsDetail(Long accountsDetailId,Long freeRdId){
ChDisabFreeRdInfo chDisabFreeRdInfo = chDisabFreeRdInfoMapper.selectById(freeRdId);
BigDecimal amountOfMoney = chDisabFreeRdInfo.getAmountOfMoney();
int freeDealType = chDisabFreeRdInfo.getDealType();
ChDisabDetailAccounts chDisabDetailAccountsDTO = chDisabAccountsDetailMapper.selectById(accountsDetailId);
BigDecimal deductionAmount = chDisabDetailAccountsDTO.getDeductionAmount();
BigDecimal reissueAmount = chDisabDetailAccountsDTO.getReissueAmount();
Long accountsId = chDisabDetailAccountsDTO.getAccountsId();
ChDisabAccounts chDisabAccountDTO = disabAccountsMapper.selectById(accountsId);
BigDecimal reissueAmountTotal = chDisabAccountDTO.getReissueAmountTotal();
BigDecimal deductionAmountTotal = chDisabAccountDTO.getDeductionAmountTotal();
if (freeDealType == 1) {
// 删除减掉补发
BigDecimal reissueAmountSubtract = reissueAmountTotal.subtract(amountOfMoney);
chDisabAccountDTO.setReissueAmountTotal(reissueAmountSubtract);
BigDecimal subtract = reissueAmount.subtract(amountOfMoney);
chDisabDetailAccountsDTO.setReissueAmount(subtract);
} else if (freeDealType == 2) {
// 删除减掉扣减
BigDecimal deductionAmountSubtract = deductionAmountTotal.subtract(amountOfMoney);
chDisabAccountDTO.setDeductionAmountTotal(deductionAmountSubtract);
BigDecimal subtract = deductionAmount.subtract(amountOfMoney);
chDisabDetailAccountsDTO.setDeductionAmount(subtract);
}
disabAccountsMapper.updateById(chDisabAccountDTO);
int result = chDisabAccountsDetailMapper.updateById(chDisabDetailAccountsDTO);
chDisabFreeRdInfoMapper.deleteById(freeRdId);
return result;
}
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hungraim.ltc.account.dao.ChDisabFreeRdInfoMapper">
<select id="queryFreeRdInfo" 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,
rd.DEAL_TYPE dealType,
organ.SRV_ORGAN_NAME srvOrganName,
rd.AMOUNT_OF_MONEY amountOfMoney,
rd.FREE_RD_ID freeRdId,
d.ACCOUNTS_STATUS accountsStatus
from CH_DISAB_FREE_RD_INFO rd left join
CH_DISAB_ACCOUNTS_DETAIL detail on
rd.ACCOUNTS_DETAIL_ID = detail.ACCOUNTS_DETAIL_ID
left join CH_DISAB_ACCOUNTS d on d.ACCOUNTS_ID = detail.ACCOUNTS_ID
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 rd.DEAL_TYPE = #{req.dealType}
</if>
</where>
order by rd.CREATION_TIME desc
</select>
</mapper>
\ No newline at end of file
package com.hungraim.ltc.pojo.entity.account;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author zwl
* @ClassName ChDisabFreeRdInfo
* @description
* @date 2023/2/28 8:43
**/
@Data
@TableName("CH_DISAB_FREE_RD_INFO")
@KeySequence("SEQ_CH_DISAB_FREE_RD_INFO")
public class ChDisabFreeRdInfo implements Serializable {
@TableId(value = "FREE_RD_ID", type = IdType.INPUT)
private Long freeRdId;
private Long accountsDetailId;
private Long accountsId;
private Date creationTime;
private int dealType;
private BigDecimal amountOfMoney;
private String remarks;
}
......@@ -17,6 +17,8 @@ public class OverallCostListRespVO {
*/
private String realName;
private Long freeRdId;
/**
*身份证号
......@@ -61,4 +63,6 @@ public class OverallCostListRespVO {
private String accountsOverallCost;
private String srvOrganName;
private String accountsStatus;
}
......@@ -219,7 +219,7 @@ public class SrvTaskServiceImpl implements SrvTaskService {
}
ChSrvTaskDetail chSrvTaskDetail = new ChSrvTaskDetail();
chSrvTaskDetail.setSrvTaskId(srvTaskId);//taskId
chSrvTaskDetail.setSrvDate(new Date());//服务开始时间
chSrvTaskDetail.setSrvDate(DateUtils.strToDate(nextDay));//服务开始时间
chSrvTaskDetail.setStatus((short) 0);//状态 未执行:0;执行中:1;已执行:2;已失效:3已完成4
chSrvTaskDetailMapper.insert(chSrvTaskDetail);
}
......
......@@ -57,8 +57,8 @@
ILLEGALRE_NAME, ILLEGALRE_TIME, ACCOUNT_SIGN, TASK_DETAIL_TYPE
</sql>
<select id="getSrvTaskDetail">
select count(*) from CH_SRV_TASK_DETAIL t where t.SRV_TASK_ID = #{srvTaskId}
<select id="getSrvTaskDetail" resultType="java.lang.Integer">
select count(0) from CH_SRV_TASK_DETAIL t where t.SRV_TASK_ID = #{srvTaskId}
and to_char(t.SRV_DATE,'yyyy-MM-dd') = #{srvDate}
</select>
</mapper>
\ No newline at end of file
......@@ -21,7 +21,7 @@ public class SrvTaskScheduledController {
private final SrvTaskFeignService srvTaskFeignService;
// 表示每天3点5分执行
@Scheduled(cron = "30 41 17 * * ?")
@Scheduled(cron = "30 32 19 * * ?")
public void timeAllocationSrvTask() {
Result result = srvTaskFeignService.timeAllocationSrvTask();
System.out.println();
......
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