Commit c906c8b3 authored by 董天德's avatar 董天德

Merge branch 'dev_nursing_records_20230214' into uat_ch_master

# Conflicts: # apply/apply-service/src/main/java/com/hungraim/ltc/service/SrvOrganEmpService.java
parents 89a67068 db2c539d
......@@ -6,7 +6,6 @@ import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
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.service.impl.ServiceImpl;
import com.hungraim.ltc.account.dao.*;
......@@ -27,7 +26,6 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -653,6 +651,10 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
// 二级及以上医疗机构其限额为 100 元/人/天,由长期护理保险基金支付 70%,个人支付 30%;
} else if ("医疗".equals(srvModeName) && (!"1".equals(accountsVO.getLevelCode()))) {
limit = BigDecimal.valueOf(100);
} else if ("上门".equals(srvModeName)) {
overallPercent = BigDecimal.valueOf(0.8);
personalPercent = BigDecimal.valueOf(0.2);
limit = BigDecimal.valueOf(75);
}
// 根据护理机构、结算月份、失能人员id和服务方式查询表里是否有值
ChDisabDetailAccounts chDisabDetailAccountsDTO = chDisabAccountsDetailMapper.queryDisabDetailAccounts(srvOrganId, DateUtils.dateToStrYm(accountsTime), disabInfoId, srvModeName);
......@@ -992,6 +994,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
//退回
@Override
@Transactional(rollbackFor = Exception.class)
public Result accountReturn(SrvTaskRespVO srvTaskRespVO){
Long taskDetailId = srvTaskRespVO.getTaskDetailId();
String disabInfoId = srvTaskRespVO.getDisabInfoId();
......@@ -999,11 +1002,17 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
String srvPlanTime = srvTaskRespVO.getSrvDate();
Date date = DateUtils.strToDate(srvPlanTime);
String srvOrganId = srvTaskRespVO.getSrvOrganId();
Long itemId = srvTaskRespVO.getItemId();
ChDisabDetailAccounts chDisabDetailAccounts = chDisabAccountsDetailMapper.queryDisabDetailAccounts(String.valueOf(srvOrganId), DateUtils.dateToStrYm(date), disabInfoId, srvModeName);
Short status = chDisabDetailAccounts.getStatus();
if(status != 0){
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<>();
queryWrapper.eq(ChSrvPlan::getTaskDetailId,taskDetailId);
queryWrapper.eq(ChSrvPlan::getIsStatus, (short) 4);
......@@ -1015,8 +1024,15 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chSrvPlan.setIsStatus(0L);
chSrvPlan.setPlanID(srvTaskRespVO.getPlanId());
chSrvPlanMapper.updateById(chSrvPlan);
ChSrvTaskDetail ca = new ChSrvTaskDetail();
ca.setStatus((short) 0);
ca.setTaskDetailId(Long.valueOf(taskDetailId));
chSrvTaskDetailMapper.updateById(ca);
if(size == 1){
BigDecimal accountsAllCost = chDisabDetailAccounts.getAccountsAllCost();
if (accountsAllCost.compareTo(BigDecimal.ZERO) == 0) {
return Result.success("当前费用为0,不再进行费用退回");
}
BigDecimal accountsOverallCost = chDisabDetailAccounts.getAccountsOverallCost();
BigDecimal accountsPersonalCost = chDisabDetailAccounts.getAccountsPersonalCost();
BigDecimal allCost = new BigDecimal(0);
......@@ -1036,6 +1052,10 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
allCost = BigDecimal.valueOf(100);
overCost = BigDecimal.valueOf(70);
personCost = BigDecimal.valueOf(30);
} else if ("上门".equals(srvModeName)) {
allCost = BigDecimal.valueOf(75);
overCost = BigDecimal.valueOf(60);
personCost = BigDecimal.valueOf(15);
}
BigDecimal allCostSubtract = accountsAllCost.subtract(allCost);
BigDecimal overCostSubtract = accountsOverallCost.subtract(overCost);
......@@ -1044,6 +1064,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabDetailAccounts.setAccountsOverallCost(overCostSubtract);
chDisabDetailAccounts.setAccountsPersonalCost(personCostSubtract);
chDisabAccountsDetailMapper.updateById(chDisabDetailAccounts);
}
} catch (Exception e) {
log.error("==============accountReturn error:{}",e);
......
......@@ -39,7 +39,7 @@
and d.status = #{req.accountsStatus}
</if>
<if test="req.realName != null and req.realName != ''">
and info.real_name = #{req.realName}
AND info.real_name LIKE CONCAT('%',CONCAT(#{req.realName},'%'))
</if>
<if test="req.srvOrganId != null and req.srvOrganId != '' and req.srvOrganId!=0">
and d.SRV_ORGAN_ID = #{req.srvOrganId}
......
......@@ -394,6 +394,7 @@ public class DisableController {
if (chDisableApply.getMedicalType() == null) {
return Result.failed("医保类型不能为空!");
}
chDisableApply.setRealName(chDisableApply.getRealName().trim());
return disableService.addDisable(chDisableApply);
}
......@@ -575,4 +576,21 @@ public class DisableController {
return Result.success();
}
@GetMapping("/selectDisableInfoByEmp")
public Result selectDisableInfoByEmp(String srvEmpId){
if (StringUtils.isEmpty(srvEmpId)) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
return disableService.selectDisableInfoByEmp(srvEmpId);
}
@GetMapping("/selectProgram")
public Result selectProgram(String disabInfoId,String srvOrganId){
if (StringUtils.isEmpty(disabInfoId) || StringUtils.isEmpty(srvOrganId)) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
return disableService.selectProgram(disabInfoId,srvOrganId);
}
}
......@@ -19,6 +19,7 @@ import com.hungraim.ltc.util.ResultCode;
import com.hungraim.ltc.util.TokenParsingUtil;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.web.bind.annotation.*;
......@@ -323,4 +324,14 @@ public class SrvOrganController {
return srvOrganEmpService.chSrvTaskDetailDelete(taskDetailId,userName);
}
@GetMapping("/selectEmpBySrvOrganId")
public Result selectEmpBySrvOrganId(String srvOrganId){
if (StringUtils.isEmpty(srvOrganId)) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
return srvOrganEmpService.selectEmpBySrvOrganId(srvOrganId);
}
}
......@@ -6,6 +6,8 @@ import com.hungraim.ltc.pojo.entity.disable.ChDisableInfo;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvProgram;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvSend;
import com.hungraim.ltc.pojo.vo.disable.DisableInfoListVo;
import com.hungraim.ltc.pojo.vo.disable.DisableInfoRespDTO;
import com.hungraim.ltc.pojo.vo.disable.ProgramRespDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
......@@ -33,6 +35,8 @@ public interface DisableInfoMapper extends BaseMapper<ChDisableInfo> {
List<DisableInfoListVo> getDisableExitList();
List<ProgramRespDTO> selectProgram(String disabInfoId, String srvOrganId);
int updateSrvProgramById(ChSrvProgram chSrvProgram);
......@@ -40,5 +44,7 @@ public interface DisableInfoMapper extends BaseMapper<ChDisableInfo> {
int updateSrvSendById(ChSrvSend chSrvSend);
List<DisableInfoRespDTO> selectDisableInfoByEmp(String srvEmpId);
}
......@@ -60,6 +60,8 @@ public interface DisableService {
*/
List<SrvModeVo> cfgSrvModeList();
Result selectProgram(String disabInfoId, String srvOrganId);
/**
* 查询机构下所有护理机构
*
......@@ -192,4 +194,6 @@ public interface DisableService {
Integer selectByCertiCode(String certiCode);
void disableExitTask();
Result selectDisableInfoByEmp(String srvEmpId);
}
......@@ -74,5 +74,7 @@ public interface SrvOrganEmpService {
Result chSrvTaskDetailDelete(long taskDetailId, String userName);
Result selectEmpBySrvOrganId(String srvOrganId);
Workbook chSrvTaskDetailExport(Long empId, String empName,String status,String sevrTime);
}
......@@ -4,6 +4,7 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
......@@ -30,11 +31,13 @@ import com.hungraim.ltc.util.ResultCode;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.hssf.record.common.FeatSmartTag;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.*;
......@@ -361,6 +364,7 @@ public class DisableServiceImpl implements DisableService {
return srvModeMapper.selectAll();
}
@Override
public List<ChSrvOrgan> srvOrganList(String organId,Long srvOrganId, Boolean isInvolveChild) {
// zhangch 2021-11-04 修改查询条件 new QueryWrapper<ChSrvOrgan>().eq("organ_id", organId).eq("STATUS", (short) 0)
......@@ -728,4 +732,23 @@ public class DisableServiceImpl implements DisableService {
@Override
public Result selectDisableInfoByEmp(String srvEmpId) {
List<DisableInfoRespDTO> disableInfoRespDTOS = disableInfoMapper.selectDisableInfoByEmp(srvEmpId);
if (CollectionUtils.isEmpty(disableInfoRespDTOS)) {
return Result.failed("没有找到相应的服务计划,请检查");
}
return Result.success(disableInfoRespDTOS);
}
@Override
public Result selectProgram(String disabInfoId, String srvOrganId) {
List<ProgramRespDTO> programRespDTOS = disableInfoMapper.selectProgram(disabInfoId, srvOrganId);
if (CollectionUtil.isEmpty(programRespDTOS)) {
return Result.success("没有找到相应的服务方案,请检查");
}
ProgramRespDTO programRespDTO = programRespDTOS.get(0);
return Result.success(programRespDTO);
}
}
......@@ -3,8 +3,8 @@ package com.hungraim.ltc.service.impl;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.api.AttachFeignService;
import com.hungraim.ltc.dao.*;
......@@ -72,6 +72,8 @@ public class SrvOrganEmpServiceImpl implements SrvOrganEmpService {
return chSrvOrganEmpMapper.getSrvOrganEmpListVo(page, organIds, empName, srvOrganName, certifNum, isLock, empType,srvOrganId);
}
@Override
public int updateSrvEmpStatus(Long empId, Short isLock,String certifNum) {
int queryResult = 0;
......@@ -300,4 +302,18 @@ public class SrvOrganEmpServiceImpl implements SrvOrganEmpService {
}
}
@Override
public Result selectEmpBySrvOrganId(String srvOrganId){
LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<ChSrvOrganEmp>()
.eq(ChSrvOrganEmp::getSrvOrganId,Long.valueOf(srvOrganId))
.eq(ChSrvOrganEmp::getIsLock,(short)0);
List<ChSrvOrganEmp> list = chSrvOrganEmpMapper.selectList(lambdaQueryWrapper);
return Result.success(list);
}
}
......@@ -4,7 +4,7 @@
<select id="getDisableInfoList" resultType="com.hungraim.ltc.pojo.vo.disable.DisableInfoListVo">
SELECT distinct T2.DISAB_INFO_ID disabInfoId,
T1.PROGRAM_ID programId,
T6.SRV_ORGAN_ID srvOrganId,
T1.SRV_ORGAN_ID srvOrganId,
T5.DISTRICT_PROVINCIAL districtProvincial,
T5.DISTRICT_CITY districtCity,
T2.REAL_NAME realName,
......@@ -16,7 +16,8 @@
T2.ACPT_AREA acptArea,
T2.ACPT_STREET acptStreet,
T2.ACPT_ADDRESS acptAddress,
T7.MODE_NAME svrModelName,
-- T7.MODE_NAME svrModelName,
DECODE(T1.SRV_MODE_ID, '1','医疗','2', '养老','3','上门', '4', '异地') srvModeName,
T5.SRV_ORGAN_NAME svrOrganName,
T1.PROG_STATUS progStatus,
T1.EFF_TIME effTime,
......@@ -30,14 +31,14 @@
T2.EXIT_FLAG exitFlag,
T2.EXIT_REASON_ID exitReasonId
FROM CH_DISABLE_INFO T2
inner join (select * from CH_SRV_SEND where STATUS in(1,3)) T6 on T6.DISAB_INFO_ID = T2.DISAB_INFO_ID
-- inner join (select * from CH_SRV_SEND where STATUS in(1,3)) T6 on T6.DISAB_INFO_ID = T2.DISAB_INFO_ID
LEFT JOIN CH_SRV_PROGRAM T1 ON T1.DISAB_INFO_ID = T2.DISAB_INFO_ID
LEFT JOIN CH_CFG_SRV_MODE T7 ON T2.SRV_MODE_ID = T7.MODE_ID
LEFT JOIN CH_SRV_ORGAN T5 ON T6.SRV_ORGAN_ID = T5.SRV_ORGAN_ID
-- LEFT JOIN CH_CFG_SRV_MODE T7 ON T2.SRV_MODE_ID = T7.MODE_ID
LEFT JOIN CH_SRV_ORGAN T5 ON T1.SRV_ORGAN_ID = T5.SRV_ORGAN_ID
<where>
1=1
<if test="srvOrganId != null and srvOrganId != '' and srvOrganId!=0">
and T5.SRV_ORGAN_ID = #{srvOrganId}
and T1.SRV_ORGAN_ID = #{srvOrganId}
</if>
<if test="certiCode != null and certiCode != ''">
and T2.CERTI_CODE = #{certiCode}
......@@ -46,7 +47,7 @@
and T2.real_name like CONCAT(CONCAT('%',#{realName}) ,'%')
</if>
<if test="svrModelId != null and svrModelId != ''">
and T7.MODE_ID = #{svrModelId}
and T1.SRV_MODE_ID = #{svrModelId}
</if>
</where>
......@@ -104,6 +105,15 @@
s.DISAB_INFO_ID = #{disabInfoId}
</update>
<select id="selectDisableInfoByEmp" resultType="com.hungraim.ltc.pojo.vo.disable.DisableInfoRespDTO">
select i.REAL_NAME realName,i.DISAB_INFO_ID disabInfoId,i.SRV_MODE_ID srvModeId,t.SRV_TASK_ID srvTaskId from CH_DISABLE_INFO i left join ch_srv_task t
on i.DISAB_INFO_ID = t.DISAB_INFO_ID where t.SRV_EMP_ID = #{srvEmpId} and <![CDATA[ t.STATUS<> 2 ]]>
</select>
<select id="selectProgram" resultType="com.hungraim.ltc.pojo.vo.disable.ProgramRespDTO">
select * from CH_SRV_PROGRAM t where t.DISAB_INFO_ID = #{disabInfoId} and t.srv_organ_id = #{srvOrganId} and
<![CDATA[ t.PROG_STATUS<> 2 ]]> order by t.FCD desc
</select>
</mapper>
\ No newline at end of file
......@@ -244,5 +244,11 @@ public class ChSrvTaskDetail implements Serializable {
*/
private String srvStartPic2;
private Short isClock;
private String clockReason;
private String clockOperator;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.hungraim.ltc.pojo.vo.disable;
import lombok.Data;
/**
* @author zwl
* @ClassName DisableInfoRespDTO
* @description
* @date 2023/4/12 16:42
**/
@Data
public class DisableInfoRespDTO {
private Long disabInfoId;
private String realName;
private String srvModeId;
private String srvTaskId;
}
package com.hungraim.ltc.pojo.vo.disable;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @author zwl
* @ClassName ProgramRespDTO
* @description
* @date 2023/4/12 16:49
**/
@Data
public class ProgramRespDTO {
/**
* 方案生效时间
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date programDate;
/**
* 方案终止时间
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date programEdnDate;
}
package com.hungraim.ltc.pojo.vo.governance;
import lombok.Data;
/**
* @author zwl
* @ClassName ItemDTO
* @description
* @date 2023/4/13 10:52
**/
@Data
public class ItemDTO {
private String itemId;
private String itemName;
}
package com.hungraim.ltc.pojo.vo.governance;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @author zwl
* @ClassName SrvPlanInputVO
* @description
* @date 2023/4/12 11:08
**/
@Data
public class SrvPlanInputVO {
private Long srvOrganId;
private Long disabInfoId;
private Long modeId;
private Long empId;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date srvPlanTime;
/**
* 服务项目ids
*/
private String[] itemIds;
/**
* 操作人
*/
private String admin;
/**
* 补卡原因
*/
private String clockReason;
private Long srvTaskId;
}
......@@ -5,6 +5,7 @@ import com.hungraim.ltc.governance.service.SrvTaskService;
import com.hungraim.ltc.pojo.vo.governance.*;
import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode;
import com.hungraim.ltc.util.TokenParsingUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -154,4 +155,29 @@ public class SrvTaskController {
return Result.success();
}
/**
* 补卡
**/
@PostMapping("/saveApplyCard")
public Result saveApplyCard(@RequestHeader("Authorization") String token,SrvPlanInputVO srvPlanInputVO){
if (srvPlanInputVO.getDisabInfoId() == null) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
Integer userId = TokenParsingUtil.TokenParsing(token, "userId");
srvPlanInputVO.setAdmin(String.valueOf(userId));
return srvTaskService.saveApplyCard(srvPlanInputVO);
}
/**
* 根据护理机构查询项目
**/
@GetMapping("/queryItem")
public Result queryItem(Long srvOrganId){
if (srvOrganId == null) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
return srvTaskService.queryItemBySrvOrganId(srvOrganId);
}
}
......@@ -3,6 +3,7 @@ package com.hungraim.ltc.governance.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hungraim.ltc.pojo.entity.governance.ChSrvPlan;
import com.hungraim.ltc.pojo.vo.governance.ItemDTO;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
......@@ -13,4 +14,6 @@ import java.util.List;
public interface ChSrvPlanMapper extends BaseMapper<ChSrvPlan> {
List<ChSrvPlan> queryPlan(String programId,String srvPlanTime);
List<ItemDTO> queryItem(Long srvOrganId);
}
package com.hungraim.ltc.governance.service;
import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.pojo.vo.account.SrvTaskReqVO;
import com.hungraim.ltc.pojo.vo.account.SrvTaskRespVO;
import com.hungraim.ltc.pojo.vo.governance.*;
import com.hungraim.ltc.util.Result;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
......@@ -35,4 +38,8 @@ public interface SrvTaskService {
void timeAllocationSrvTask(String dateStr);
// 补卡
Result saveApplyCard(SrvPlanInputVO srvPlanInputVO);
Result queryItemBySrvOrganId(Long srvOrganId);
}
......@@ -3,6 +3,7 @@ package com.hungraim.ltc.governance.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -14,13 +15,13 @@ import com.hungraim.ltc.governance.service.SrvTaskService;
import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
import com.hungraim.ltc.pojo.entity.governance.ChSrvPlan;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvProgram;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvSend;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTask;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetail;
import com.hungraim.ltc.pojo.vo.governance.*;
import com.hungraim.ltc.pojo.vo.system.AttachUpdateVo;
import com.hungraim.ltc.util.AttachType;
import com.hungraim.ltc.util.DateUtils;
import com.hungraim.ltc.util.Result;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
......@@ -265,4 +266,90 @@ public class SrvTaskServiceImpl implements SrvTaskService {
}
}
// 补卡
@Transactional(rollbackFor = Exception.class)
@Override
public Result saveApplyCard(SrvPlanInputVO srvPlanInputVO){
Long taskDetailId = null;
// 先查询是否有计划,有计划了不再生成计划
List<ChSrvTaskDetail> chSrvTaskDetailList = chSrvTaskDetailMapper.selectList(new LambdaQueryWrapper<ChSrvTaskDetail>()
.eq(ChSrvTaskDetail::getSrvTaskId, srvPlanInputVO.getSrvTaskId())
.eq(ChSrvTaskDetail::getSrvDate, srvPlanInputVO.getSrvPlanTime()));
Long modeId = srvPlanInputVO.getModeId();
if (CollectionUtil.isNotEmpty(chSrvTaskDetailList)) {
if(modeId == 3){
int status = chSrvTaskDetailList.stream().map(ChSrvTaskDetail::getStatus).findFirst().orElse((short)0);
if(status == 1 || status == 4) {
return Result.failed("手机app已有任务,不可重复生成");
}
}
ChSrvTaskDetail chSrvTaskDetail = chSrvTaskDetailList.get(0);
taskDetailId = chSrvTaskDetail.getTaskDetailId();
List<ChSrvPlan> srvPlanList = chSrvPlanMapper.selectList(new LambdaQueryWrapper<ChSrvPlan>()
.eq(ChSrvPlan::getDisabInfoId, srvPlanInputVO.getDisabInfoId())
.eq(ChSrvPlan::getSrvPlanTime, srvPlanInputVO.getSrvPlanTime())
.eq(ChSrvPlan::getModeId, srvPlanInputVO.getModeId()));
if(CollectionUtil.isNotEmpty(srvPlanList)){
return Result.failed("任务列表已有计划,不可重复生成");
}
}else {
// 插入计划表
ChSrvTaskDetail chSrvTaskDetail = new ChSrvTaskDetail();
// taskId
chSrvTaskDetail.setSrvTaskId(srvPlanInputVO.getSrvTaskId());
// 服务开始时间
chSrvTaskDetail.setSrvDate(srvPlanInputVO.getSrvPlanTime());
// 状态 未执行:0;执行中:1;已执行:2;已失效:3已完成4
chSrvTaskDetail.setStatus((short) 0);
// 补卡标识
chSrvTaskDetail.setIsClock((short) 1);
chSrvTaskDetail.setClockReason(srvPlanInputVO.getClockReason());
chSrvTaskDetail.setClockOperator(srvPlanInputVO.getAdmin());
chSrvTaskDetail.setFcd(new Date());
int insert = chSrvTaskDetailMapper.insert(chSrvTaskDetail);
if(insert == 0){
return Result.failed("补卡失败,请重新提交");
}
taskDetailId = chSrvTaskDetail.getTaskDetailId();
}
try {
log.info("=======SrvTaskServiceImpl.saveApplyCard.taskDetailId:{}",taskDetailId);
String[] itemIds = srvPlanInputVO.getItemIds();
List<ItemDTO> itemDTOS = chSrvPlanMapper.queryItem(srvPlanInputVO.getSrvOrganId());
for (String r : itemIds) {
ChSrvPlan chSrvPlan = new ChSrvPlan();
chSrvPlan.setItemId(Long.valueOf(r));
if (CollectionUtil.isNotEmpty(itemDTOS)) {
String itemName = itemDTOS.stream().filter(s -> s.getItemId().equals(r)).map(ItemDTO::getItemName).findFirst().orElse(null);
chSrvPlan.setItemName(itemName);
}
chSrvPlan.setSrvOrganId(srvPlanInputVO.getSrvOrganId());
chSrvPlan.setModeId(srvPlanInputVO.getModeId());
chSrvPlan.setCreationTime(new Date());
chSrvPlan.setDisabInfoId(srvPlanInputVO.getDisabInfoId());
chSrvPlan.setEmpId(srvPlanInputVO.getEmpId());
chSrvPlan.setSrvPlanTime(srvPlanInputVO.getSrvPlanTime());
chSrvPlan.setTaskDetailId(taskDetailId);
chSrvPlan.setIsStatus(Long.valueOf(0));
int insert1 = chSrvPlanMapper.insert(chSrvPlan);
if(insert1==0){
return Result.failed("补卡失败,请重新提交");
}
}
} catch (Exception e) {
log.error("=======SrvTaskServiceImpl error {}",e);
return Result.failed("补卡失败");
}
return Result.success();
}
@Override
public Result queryItemBySrvOrganId(Long srvOrganId){
List<ItemDTO> itemDTOS = chSrvPlanMapper.queryItem(srvOrganId);
return Result.success(itemDTOS);
}
}
......@@ -36,6 +36,13 @@
</select>
<select id="queryItem" resultType="com.hungraim.ltc.pojo.vo.governance.ItemDTO">
select CSOP.PROJECT_ID itemId,service.SERVICE_TYPE_DETAILED_NAME itemName from CH_SRV_ORGAN_PROJECT CSOP
left join CH_SERVICE_TYPE_DETAILED service on service.SERVICE_TYPE_DETAILED_ID = CSOP.ITEM_NAME
where SRV_ORGAN_ID = #{srvOrganId}
</select>
</mapper>
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