Commit dde5c814 authored by zhangch's avatar zhangch

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

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