Commit dde5c814 authored by zhangch's avatar zhangch

服务方案新增修改接口调整,服务方案终止接口

parent 10ec04ee
package com.hungraim.ltc.pojo.vo.governance; package com.hungraim.ltc.pojo.vo.governance;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
...@@ -60,6 +61,7 @@ public class ProgramDetailVo { ...@@ -60,6 +61,7 @@ public class ProgramDetailVo {
/** /**
* 失能人员生日 * 失能人员生日
*/ */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd")
private Date birthday; private Date birthday;
...@@ -101,6 +103,7 @@ public class ProgramDetailVo { ...@@ -101,6 +103,7 @@ public class ProgramDetailVo {
/** /**
* 评定完成日期 * 评定完成日期
*/ */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd")
private Date assessDate; private Date assessDate;
...@@ -117,12 +120,14 @@ public class ProgramDetailVo { ...@@ -117,12 +120,14 @@ public class ProgramDetailVo {
/** /**
* 方案生效时间 * 方案生效时间
*/ */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd")
private Date programDate; private Date programDate;
/** /**
* 方案结束时间 * 方案结束时间
*/ */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd")
private Date programEndDate; private Date programEndDate;
......
...@@ -3,6 +3,7 @@ package com.hungraim.ltc.governance.controller; ...@@ -3,6 +3,7 @@ package com.hungraim.ltc.governance.controller;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.governance.service.SrvProgramService; import com.hungraim.ltc.governance.service.SrvProgramService;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvProgram;
import com.hungraim.ltc.pojo.vo.governance.ProgramDetailVo; import com.hungraim.ltc.pojo.vo.governance.ProgramDetailVo;
import com.hungraim.ltc.pojo.vo.governance.ProgramListVo; import com.hungraim.ltc.pojo.vo.governance.ProgramListVo;
import com.hungraim.ltc.pojo.vo.governance.ProgramSetAndProjectVo; import com.hungraim.ltc.pojo.vo.governance.ProgramSetAndProjectVo;
...@@ -110,6 +111,12 @@ public class SrvProgramController { ...@@ -110,6 +111,12 @@ public class SrvProgramController {
return Result.success(programDetail); return Result.success(programDetail);
} }
/**
* 添加服务方案接口
*
* @param programDetailVo 添加服务方案包装对象
* @return 返回结果
*/
@PostMapping("/programAndProgramSetList") @PostMapping("/programAndProgramSetList")
public Result programAndProgramSetList(ProgramDetailVo programDetailVo) { public Result programAndProgramSetList(ProgramDetailVo programDetailVo) {
log.info(JSONUtil.toJsonStr(programDetailVo)); log.info(JSONUtil.toJsonStr(programDetailVo));
...@@ -128,12 +135,28 @@ public class SrvProgramController { ...@@ -128,12 +135,28 @@ public class SrvProgramController {
} else { } else {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR); return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
} }
Integer count = srvProgramService.getProgramSetCountByProgStatus(programDetailVo.getDisabInfoId(), programDetailVo.getSrvOrganId(), "2"); // 添加的话,需要校验其它服务方案是否已终止
if (count > 0) { if (programDetailVo.getProgramId() == null) {
return Result.failed(ResultCode.REQUEST_PROGRAM_ADD_ERROR); List<ChSrvProgram> srvPrograms = srvProgramService.getProgramSetCountByProgStatus(programDetailVo.getDisabInfoId(), programDetailVo.getSrvOrganId(), "2");
if (srvPrograms.size() > 0) {
return Result.failed(ResultCode.REQUEST_PROGRAM_ADD_ERROR);
}
} }
// 进行添加或者修改操作 // 进行添加或者修改操作
srvProgramService.addProgramAndProgramSetList(programDetailVo); srvProgramService.addProgramAndProgramSetList(programDetailVo);
return Result.success(); return Result.success();
} }
/**
* 终止服务方案
*
* @param programId 服务方案id
* @param endReason 终止原因
* @return 返回请求结果
*/
@PutMapping("/endProgram")
public Result endProgram(Long programId, String endReason) {
srvProgramService.endProgram(programId, endReason);
return Result.success();
}
} }
package com.hungraim.ltc.governance.service; package com.hungraim.ltc.governance.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvProgram;
import com.hungraim.ltc.pojo.vo.governance.ProgramDetailVo; import com.hungraim.ltc.pojo.vo.governance.ProgramDetailVo;
import com.hungraim.ltc.pojo.vo.governance.ProgramListVo; import com.hungraim.ltc.pojo.vo.governance.ProgramListVo;
import com.hungraim.ltc.pojo.vo.governance.SvrSendListVo; import com.hungraim.ltc.pojo.vo.governance.SvrSendListVo;
import java.util.List;
public interface SrvProgramService { public interface SrvProgramService {
/** /**
...@@ -37,7 +40,7 @@ public interface SrvProgramService { ...@@ -37,7 +40,7 @@ public interface SrvProgramService {
* @param programStatus 服务方案状态 0:未生效、1:已生效、2:已终止 * @param programStatus 服务方案状态 0:未生效、1:已生效、2:已终止
* @return 返回条数 * @return 返回条数
*/ */
Integer getProgramSetCountByProgStatus(Long disabInfoId, Long srvOrganId, String programStatus); List<ChSrvProgram> getProgramSetCountByProgStatus(Long disabInfoId, Long srvOrganId, String programStatus);
/** /**
* 查看服务方案详情 * 查看服务方案详情
...@@ -56,5 +59,17 @@ public interface SrvProgramService { ...@@ -56,5 +59,17 @@ public interface SrvProgramService {
*/ */
ProgramDetailVo getProgramDetailWithAdd(Long disabInfoId, Long srvOrganId); ProgramDetailVo getProgramDetailWithAdd(Long disabInfoId, Long srvOrganId);
/**
* 添加或者修改服务方案
* @param programDetailVo 包装对象
*/
void addProgramAndProgramSetList(ProgramDetailVo programDetailVo); void addProgramAndProgramSetList(ProgramDetailVo programDetailVo);
/**
* 终止服务方案
*
* @param programId 服务方案id
* @param endReason 终止原因
*/
void endProgram(Long programId, String endReason);
} }
...@@ -14,6 +14,7 @@ import com.hungraim.ltc.governance.dao.ChSrvSendMapper; ...@@ -14,6 +14,7 @@ import com.hungraim.ltc.governance.dao.ChSrvSendMapper;
import com.hungraim.ltc.governance.service.SrvProgramService; import com.hungraim.ltc.governance.service.SrvProgramService;
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 java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -42,11 +43,11 @@ public class SrvProgramServiceImpl implements SrvProgramService { ...@@ -42,11 +43,11 @@ public class SrvProgramServiceImpl implements SrvProgramService {
} }
@Override @Override
public Integer getProgramSetCountByProgStatus(Long disabInfoId, Long srvOrganId, String programStatus) { public List<ChSrvProgram> getProgramSetCountByProgStatus(Long disabInfoId, Long srvOrganId, String programStatus) {
QueryWrapper<ChSrvProgram> queryWrapper = new QueryWrapper<>(); QueryWrapper<ChSrvProgram> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("DISAB_INFO_ID", disabInfoId).eq("SRV_ORGAN_ID", srvOrganId).ne("PROG_STATUS", programStatus); queryWrapper.eq("DISAB_INFO_ID", disabInfoId).eq("SRV_ORGAN_ID", srvOrganId).ne("PROG_STATUS", programStatus);
Integer count = chSrvProgramMapper.selectCount(queryWrapper); List<ChSrvProgram> chSrvPrograms = chSrvProgramMapper.selectList(queryWrapper);
return count; return chSrvPrograms;
} }
@Override @Override
...@@ -59,6 +60,7 @@ public class SrvProgramServiceImpl implements SrvProgramService { ...@@ -59,6 +60,7 @@ public class SrvProgramServiceImpl implements SrvProgramService {
return chSrvProgramMapper.getProgramDetailWithAdd(disabInfoId, srvOrganId); return chSrvProgramMapper.getProgramDetailWithAdd(disabInfoId, srvOrganId);
} }
@Transactional(rollbackFor = Exception.class)
@Override @Override
public void addProgramAndProgramSetList(ProgramDetailVo programDetailVo) { public void addProgramAndProgramSetList(ProgramDetailVo programDetailVo) {
Date date = new Date(); Date date = new Date();
...@@ -94,6 +96,7 @@ public class SrvProgramServiceImpl implements SrvProgramService { ...@@ -94,6 +96,7 @@ public class SrvProgramServiceImpl implements SrvProgramService {
if (programSetAndProjectVo.getSetId() != null) { if (programSetAndProjectVo.getSetId() != null) {
if (isConf.intValue() == 0) { if (isConf.intValue() == 0) {
// 没有配置这条服务方案,直接删除对应的记录 // 没有配置这条服务方案,直接删除对应的记录
chSrvProgramSetMapper.deleteById(programSetAndProjectVo.getSetId());
} }
// 修改原有的服务方案项目 // 修改原有的服务方案项目
ChSrvProgramSet chSrvProgramSet = new ChSrvProgramSet(); ChSrvProgramSet chSrvProgramSet = new ChSrvProgramSet();
...@@ -115,6 +118,15 @@ public class SrvProgramServiceImpl implements SrvProgramService { ...@@ -115,6 +118,15 @@ public class SrvProgramServiceImpl implements SrvProgramService {
} }
@Override
public void endProgram(Long programId, String endReason) {
ChSrvProgram chSrvProgram = new ChSrvProgram();
chSrvProgram.setProgramId(programId);
chSrvProgram.setEndReason(endReason);
chSrvProgram.setProgStatus(2);
chSrvProgramMapper.updateById(chSrvProgram);
}
private void addProgramSet(ProgramDetailVo programDetailVo, Date date, Long newProgramId, ProgramSetAndProjectVo programSetAndProjectVo) { private void addProgramSet(ProgramDetailVo programDetailVo, Date date, Long newProgramId, ProgramSetAndProjectVo programSetAndProjectVo) {
ChSrvProgramSet chSrvProgramSet = new ChSrvProgramSet(); ChSrvProgramSet chSrvProgramSet = new ChSrvProgramSet();
chSrvProgramSet.setItemId(programSetAndProjectVo.getProjectId()); chSrvProgramSet.setItemId(programSetAndProjectVo.getProjectId());
......
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