Commit 9ea85fa8 authored by zhangwanglin's avatar zhangwanglin

退回

parent 62802335
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.account.service.AccountService; import com.hungraim.ltc.account.service.AccountService;
import com.hungraim.ltc.pojo.entity.account.*; import com.hungraim.ltc.pojo.entity.account.*;
import com.hungraim.ltc.pojo.entity.governance.ChSrvPlan;
import com.hungraim.ltc.pojo.vo.account.*; import com.hungraim.ltc.pojo.vo.account.*;
import com.hungraim.ltc.pojo.vo.disable.PlaceOtherVO; import com.hungraim.ltc.pojo.vo.disable.PlaceOtherVO;
import com.hungraim.ltc.util.FileUtils; import com.hungraim.ltc.util.FileUtils;
...@@ -385,6 +386,15 @@ public class AccountController { ...@@ -385,6 +386,15 @@ public class AccountController {
} }
@RequestMapping("/accountReturn")
public Result accountReturn(ChSrvPlan chSrvPlan) {
Result result = accountService.accountReturn(chSrvPlan);
return result;
}
} }
......
package com.hungraim.ltc.account.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hungraim.ltc.pojo.entity.governance.ChSrvPlan;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
@Mapper
public interface ChSrvPlanMapper extends BaseMapper<ChSrvPlan> {
}
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.api.R; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.hungraim.ltc.pojo.entity.account.*; import com.hungraim.ltc.pojo.entity.account.*;
import com.hungraim.ltc.pojo.entity.governance.ChSrvPlan;
import com.hungraim.ltc.pojo.vo.account.*; import com.hungraim.ltc.pojo.vo.account.*;
import com.hungraim.ltc.pojo.vo.disable.PlaceOtherVO; import com.hungraim.ltc.pojo.vo.disable.PlaceOtherVO;
...@@ -67,4 +68,7 @@ public interface AccountService extends IService<ChDisabAccounts> { ...@@ -67,4 +68,7 @@ public interface AccountService extends IService<ChDisabAccounts> {
Page<PlaceOtherVO> placeOtherQuery(Page page, String name, String certiCode); Page<PlaceOtherVO> placeOtherQuery(Page page, String name, String certiCode);
void placeOtherTaskQuery(); void placeOtherTaskQuery();
//退回
Result accountReturn(ChSrvPlan chSrvPlan);
} }
...@@ -6,6 +6,7 @@ import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; ...@@ -6,6 +6,7 @@ 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.*;
...@@ -16,6 +17,7 @@ import com.hungraim.ltc.pojo.entity.SysConfig.ChCfgCareService; ...@@ -16,6 +17,7 @@ import com.hungraim.ltc.pojo.entity.SysConfig.ChCfgCareService;
import com.hungraim.ltc.pojo.entity.SysConfig.ChCfgCostStandard; import com.hungraim.ltc.pojo.entity.SysConfig.ChCfgCostStandard;
import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach; import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
import com.hungraim.ltc.pojo.entity.account.*; import com.hungraim.ltc.pojo.entity.account.*;
import com.hungraim.ltc.pojo.entity.governance.ChSrvPlan;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetail; import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetail;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskFinishItem; import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskFinishItem;
import com.hungraim.ltc.pojo.vo.account.*; import com.hungraim.ltc.pojo.vo.account.*;
...@@ -25,6 +27,7 @@ import lombok.AllArgsConstructor; ...@@ -25,6 +27,7 @@ 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;
...@@ -52,6 +55,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -52,6 +55,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
private final ChCfgCostStandardMapper chCfgCostStandardMapper; private final ChCfgCostStandardMapper chCfgCostStandardMapper;
private final ChDisabAccountsDetailMapper chDisabAccountsDetailMapper; private final ChDisabAccountsDetailMapper chDisabAccountsDetailMapper;
private final ChDisabFreeRdInfoMapper chDisabFreeRdInfoMapper; private final ChDisabFreeRdInfoMapper chDisabFreeRdInfoMapper;
private final ChSrvPlanMapper chSrvPlanMapper;
...@@ -986,4 +990,43 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -986,4 +990,43 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
} }
} }
//退回
@Override
public Result accountReturn(ChSrvPlan chSrvPlan){
Long taskDetailId = chSrvPlan.getTaskDetailId();
Long disabInfoId = chSrvPlan.getDisabInfoId();
Long modeId = chSrvPlan.getModeId();
Date srvPlanTime = chSrvPlan.getSrvPlanTime();
String srvPlanTimeStr = DateUtils.dateToStrYm(srvPlanTime);
Long srvOrganId = chSrvPlan.getSrvOrganId();
LambdaQueryWrapper<ChSrvPlan> queryWrapper= new LambdaQueryWrapper<>();
queryWrapper.eq(ChSrvPlan::getTaskDetailId,taskDetailId);
queryWrapper.eq(ChSrvPlan::getIsStatus, (short) 4);
List<ChSrvPlan> srvPlanList = chSrvPlanMapper.selectList(queryWrapper);
int size = srvPlanList.size();
// 大于1说明还有已完成的任务,不退回,只更新状态 等于1结算退回费用
try {
if(size > 1){
chSrvPlan.setIsStatus(0L);
chSrvPlanMapper.updateById(chSrvPlan);
}else {
String srvModeName = null;
if(modeId==1){
srvModeName = "医疗";
}else if(modeId==2){
srvModeName = "养老";
}else if(modeId==3){
srvModeName = "上门";
}
chDisabAccountsDetailMapper.queryDisabDetailAccounts(String.valueOf(srvOrganId),srvPlanTimeStr,String.valueOf(disabInfoId),srvModeName);
}
} catch (Exception e) {
log.error("==============accountReturn error:{}",e);
return Result.failed("服务器异常");
}
return Result.success();
}
} }
package com.hungraim.ltc.dao; package com.hungraim.ltc.dao;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.pojo.entity.account.ChDisabDetailAccounts;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetail; import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetail;
import com.hungraim.ltc.pojo.vo.disable.ChSrvTaskDetail2Vo; import com.hungraim.ltc.pojo.vo.disable.ChSrvTaskDetail2Vo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.math.BigDecimal;
/** /**
* @author mq * @author mq
...@@ -22,6 +26,13 @@ public interface ChSrvTaskDetailMapper extends BaseMapper<ChSrvTaskDetail> { ...@@ -22,6 +26,13 @@ public interface ChSrvTaskDetailMapper extends BaseMapper<ChSrvTaskDetail> {
*/ */
Page<ChSrvTaskDetail2Vo> chSrvTaskDetailQuery(Page<ChSrvTaskDetail2Vo> page, Long empId); Page<ChSrvTaskDetail2Vo> chSrvTaskDetailQuery(Page<ChSrvTaskDetail2Vo> page, Long empId);
String selectBySrvTaskId(String srvTaskId);
int updateByTaskDetailId(String taskDetailId);
ChDisabDetailAccounts selectAccountsDetail(String disabInfoId, String srvDateStr);
void updateChDisabDetailAccounts(Long accountsId, BigDecimal accountsAllCostsub, BigDecimal accountsOverallCostsub, BigDecimal accountsPersonalCostsub);
} }
...@@ -3,22 +3,26 @@ package com.hungraim.ltc.service.impl; ...@@ -3,22 +3,26 @@ package com.hungraim.ltc.service.impl;
import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.api.AttachFeignService; import com.hungraim.ltc.api.AttachFeignService;
import com.hungraim.ltc.dao.*; import com.hungraim.ltc.dao.*;
import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach; import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
import com.hungraim.ltc.pojo.entity.account.ChDisabDetailAccounts;
import com.hungraim.ltc.pojo.entity.disable.ChCfgSrvEmpType; import com.hungraim.ltc.pojo.entity.disable.ChCfgSrvEmpType;
import com.hungraim.ltc.pojo.entity.disable.ChSrvOrgan; import com.hungraim.ltc.pojo.entity.disable.ChSrvOrgan;
import com.hungraim.ltc.pojo.entity.riskLevel.ChSrvempRiskLevel; import com.hungraim.ltc.pojo.entity.riskLevel.ChSrvempRiskLevel;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvOrganEmp; import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvOrganEmp;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetail; import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetail;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetailDelete; import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetailDelete;
import com.hungraim.ltc.pojo.vo.disable.*; import com.hungraim.ltc.pojo.vo.disable.ChSrvTaskDetail2Vo;
import com.hungraim.ltc.pojo.vo.disable.SrvOrganEmpExportVo;
import com.hungraim.ltc.pojo.vo.disable.SrvOrganEmpListVo;
import com.hungraim.ltc.pojo.vo.disable.SrvOrganEmpVo;
import com.hungraim.ltc.pojo.vo.system.AttachUpdateVo; import com.hungraim.ltc.pojo.vo.system.AttachUpdateVo;
import com.hungraim.ltc.service.OrganService; import com.hungraim.ltc.service.OrganService;
import com.hungraim.ltc.service.SrvOrganEmpService; import com.hungraim.ltc.service.SrvOrganEmpService;
import com.hungraim.ltc.util.AttachType; import com.hungraim.ltc.util.AttachType;
import com.hungraim.ltc.util.DateUtils;
import com.hungraim.ltc.util.Result; import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode; import com.hungraim.ltc.util.ResultCode;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
...@@ -28,8 +32,9 @@ import org.springframework.beans.BeanUtils; ...@@ -28,8 +32,9 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; 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;
import org.springframework.util.StringUtils;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -174,16 +179,90 @@ public class SrvOrganEmpServiceImpl implements SrvOrganEmpService { ...@@ -174,16 +179,90 @@ public class SrvOrganEmpServiceImpl implements SrvOrganEmpService {
chSrvTaskDetailDelete.setDeleteDate(new Date()); chSrvTaskDetailDelete.setDeleteDate(new Date());
chSrvTaskDetailDelete.setDeleteName(userName); chSrvTaskDetailDelete.setDeleteName(userName);
chSrvTaskDetailDeleteMapper.insert(chSrvTaskDetailDelete); chSrvTaskDetailDeleteMapper.insert(chSrvTaskDetailDelete);
if( 4 == chSrvTaskDetail.getStatus()) {
// 开始时间
Date srvStartTime = chSrvTaskDetail.getSrvStartTime();
String srvStartTimeStr = DateUtils.dateToStr(srvStartTime);
// 结束时间
Date srvEndTime = chSrvTaskDetail.getSrvEndTime();
String srvEndTimeStr = DateUtils.dateToStr(srvEndTime);
Long min = dateDiff(srvStartTimeStr, srvEndTimeStr, "yyyy-MM-dd HH:mm:ss", "min");
if(min>=90){
Date srvDate = chSrvTaskDetail.getSrvDate();
String srvDateStr = DateUtils.dateToStrYm(srvDate);
Long srvTaskId = chSrvTaskDetail.getSrvTaskId();
String disabInfoId = chSrvTaskDetailMapper.selectBySrvTaskId(String.valueOf(srvTaskId));
ChDisabDetailAccounts chDisabDetailAccounts = chSrvTaskDetailMapper.selectAccountsDetail(disabInfoId, srvDateStr);
Short status = chDisabDetailAccounts.getStatus();
if(status == 1){
// 已申报不能进行删除
return -1;
}
BigDecimal accountsAllCost = chDisabDetailAccounts.getAccountsAllCost();
BigDecimal accountsPersonalCost = chDisabDetailAccounts.getAccountsPersonalCost();
BigDecimal accountsOverallCost = chDisabDetailAccounts.getAccountsOverallCost();
BigDecimal accountsAllCostsub = accountsAllCost.subtract(new BigDecimal(75));
BigDecimal accountsOverallCostsub = accountsOverallCost.subtract(new BigDecimal(60));
BigDecimal accountsPersonalCostsub = accountsPersonalCost.subtract(new BigDecimal(15));
Long accountsId = chDisabDetailAccounts.getAccountsId();
chSrvTaskDetailMapper.updateChDisabDetailAccounts(accountsId,accountsAllCostsub,accountsOverallCostsub,accountsPersonalCostsub);
}
}
return chSrvTaskDetailMapper.updateByTaskDetailId(String.valueOf(chSrvTaskDetail.getTaskDetailId()));
}
chSrvTaskDetail.setSrvStartTime(null); /**
chSrvTaskDetail.setSrvEndTime(null); * 计算2个时间相差的天数、小时、分钟、秒
chSrvTaskDetail.setSrvStartPic(null); * @param startTime 开始时间
chSrvTaskDetail.setSrvEndPic(null); * @param endTime 截止时间
chSrvTaskDetail.setSrvStartPic2(null); * @param format 时间格式 yyyy-MM-dd HH:mm:ss
chSrvTaskDetail.setStatus((short)0); * @param str 返回的数据为:day-天、hour-小时、min-分钟、second-秒
return chSrvTaskDetailMapper.updateById(chSrvTaskDetail); * @return
*/
public static Long dateDiff(String startTime, String endTime, String format, String str) {
// 按照传入的格式生成一个simpledateformate对象
SimpleDateFormat sd = new SimpleDateFormat(format);
long nd = 1000 * 24 * 60 * 60;// 一天的毫秒数
long nh = 1000 * 60 * 60;// 一小时的毫秒数
long nm = 1000 * 60;// 一分钟的毫秒数
long ns = 1000;// 一秒钟的毫秒数
long diff;
long day = 0;
long hour = 0;
long min = 0;
long second = 0;
// 获得两个时间的毫秒时间差异
try {
diff = sd.parse(endTime).getTime() - sd.parse(startTime).getTime();
// 计算差多少天
day = diff / nd;
// 计算差多少小时
hour = diff / nh ;
// 计算差多少分钟
min = diff / nm ;
// 计算差多少秒
second = diff / ns;
// 输出结果
System.out.println("时间相差:" + day + "天" +
(hour - day * 24) + "小时"
+ (min - day * 24 * 60) + "分钟" +
second + "秒。");
/*System.out.println("hour=" + hour + ",min=" + min);*/
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (str.equalsIgnoreCase("day")) {
return day;
} else if(str.equalsIgnoreCase("hour")) {
return hour;
} else if(str.equalsIgnoreCase("min")) {
return min;
} else {
return second;
}
} }
} }
...@@ -77,4 +77,19 @@ ...@@ -77,4 +77,19 @@
WHERE m.EMP_ID = #{empId} WHERE m.EMP_ID = #{empId}
order by t.STATUS desc order by t.STATUS desc
</select> </select>
<update id="updateByTaskDetailId">
UPDATE CH_SRV_TASK_DETAIL SET SRV_START_TIME=null,SRV_END_TIME=null,SRV_START_PIC=null,SRV_END_PIC=null,
SRV_START_PIC2=null,STATUS=0
WHERE TASK_DETAIL_ID = #{taskDetailId}
</update>
<update id = "updateChDisabDetailAccounts">
UPDATE CH_DISAB_ACCOUNTS_DETAIL d SET d.ACCOUNTS_ALL_COST = #{accountsAllCostsub}, d.ACCOUNTS_OVERALL_COST = #{accountsOverallCostsub},
d.ACCOUNTS_PERSONAL_COST = #{accountsPersonalCostsub}
WHERE d.ACCOUNTS_ID = #{accountsId}
</update>
</mapper> </mapper>
\ No newline at end of file
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