Commit 10c07a40 authored by zhangwanglin's avatar zhangwanglin

退回

parent 329526b9
...@@ -6,7 +6,6 @@ import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; ...@@ -6,7 +6,6 @@ import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hungraim.ltc.account.dao.*; import com.hungraim.ltc.account.dao.*;
...@@ -27,7 +26,6 @@ import lombok.AllArgsConstructor; ...@@ -27,7 +26,6 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -992,6 +990,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -992,6 +990,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
//退回 //退回
@Override @Override
@Transactional(rollbackFor = Exception.class)
public Result accountReturn(SrvTaskRespVO srvTaskRespVO){ public Result accountReturn(SrvTaskRespVO srvTaskRespVO){
Long taskDetailId = srvTaskRespVO.getTaskDetailId(); Long taskDetailId = srvTaskRespVO.getTaskDetailId();
String disabInfoId = srvTaskRespVO.getDisabInfoId(); String disabInfoId = srvTaskRespVO.getDisabInfoId();
...@@ -999,11 +998,17 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -999,11 +998,17 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
String srvPlanTime = srvTaskRespVO.getSrvDate(); String srvPlanTime = srvTaskRespVO.getSrvDate();
Date date = DateUtils.strToDate(srvPlanTime); Date date = DateUtils.strToDate(srvPlanTime);
String srvOrganId = srvTaskRespVO.getSrvOrganId(); String srvOrganId = srvTaskRespVO.getSrvOrganId();
Long itemId = srvTaskRespVO.getItemId();
ChDisabDetailAccounts chDisabDetailAccounts = chDisabAccountsDetailMapper.queryDisabDetailAccounts(String.valueOf(srvOrganId), DateUtils.dateToStrYm(date), disabInfoId, srvModeName); ChDisabDetailAccounts chDisabDetailAccounts = chDisabAccountsDetailMapper.queryDisabDetailAccounts(String.valueOf(srvOrganId), DateUtils.dateToStrYm(date), disabInfoId, srvModeName);
Short status = chDisabDetailAccounts.getStatus(); Short status = chDisabDetailAccounts.getStatus();
if(status != 0){ if(status != 0){
return Result.failed("此任务已提交申报,不可再操作,请联系管理员"); return Result.failed("此任务已提交申报,不可再操作,请联系管理员");
} }
// 删除 chSrvTaskFinishItemStream
LambdaQueryWrapper<ChSrvTaskFinishItem> chSrvTaskFinishItem = new LambdaQueryWrapper<ChSrvTaskFinishItem>()
.eq(ChSrvTaskFinishItem::getTaskDetailId, taskDetailId)
.eq(ChSrvTaskFinishItem::getItemId, itemId);
int delete = chSrvTaskFinishItemMapper.delete(chSrvTaskFinishItem);
LambdaQueryWrapper<ChSrvPlan> queryWrapper= new LambdaQueryWrapper<>(); LambdaQueryWrapper<ChSrvPlan> queryWrapper= new LambdaQueryWrapper<>();
queryWrapper.eq(ChSrvPlan::getTaskDetailId,taskDetailId); queryWrapper.eq(ChSrvPlan::getTaskDetailId,taskDetailId);
queryWrapper.eq(ChSrvPlan::getIsStatus, (short) 4); queryWrapper.eq(ChSrvPlan::getIsStatus, (short) 4);
...@@ -1015,8 +1020,15 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -1015,8 +1020,15 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chSrvPlan.setIsStatus(0L); chSrvPlan.setIsStatus(0L);
chSrvPlan.setPlanID(srvTaskRespVO.getPlanId()); chSrvPlan.setPlanID(srvTaskRespVO.getPlanId());
chSrvPlanMapper.updateById(chSrvPlan); chSrvPlanMapper.updateById(chSrvPlan);
ChSrvTaskDetail ca = new ChSrvTaskDetail();
ca.setStatus((short) 0);
ca.setTaskDetailId(Long.valueOf(taskDetailId));
chSrvTaskDetailMapper.updateById(ca);
if(size == 1){ if(size == 1){
BigDecimal accountsAllCost = chDisabDetailAccounts.getAccountsAllCost(); BigDecimal accountsAllCost = chDisabDetailAccounts.getAccountsAllCost();
if (accountsAllCost.compareTo(BigDecimal.ZERO) == 0) {
return Result.success("当前费用为0,不再进行费用退回");
}
BigDecimal accountsOverallCost = chDisabDetailAccounts.getAccountsOverallCost(); BigDecimal accountsOverallCost = chDisabDetailAccounts.getAccountsOverallCost();
BigDecimal accountsPersonalCost = chDisabDetailAccounts.getAccountsPersonalCost(); BigDecimal accountsPersonalCost = chDisabDetailAccounts.getAccountsPersonalCost();
BigDecimal allCost = new BigDecimal(0); BigDecimal allCost = new BigDecimal(0);
...@@ -1044,6 +1056,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -1044,6 +1056,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabDetailAccounts.setAccountsOverallCost(overCostSubtract); chDisabDetailAccounts.setAccountsOverallCost(overCostSubtract);
chDisabDetailAccounts.setAccountsPersonalCost(personCostSubtract); chDisabDetailAccounts.setAccountsPersonalCost(personCostSubtract);
chDisabAccountsDetailMapper.updateById(chDisabDetailAccounts); chDisabAccountsDetailMapper.updateById(chDisabDetailAccounts);
} }
} catch (Exception e) { } catch (Exception e) {
log.error("==============accountReturn error:{}",e); log.error("==============accountReturn error:{}",e);
......
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