Commit 9786ed95 authored by zhangch's avatar zhangch

提交修改

parent 2976a61b
......@@ -3,7 +3,6 @@ package com.hungraim.ltc.governance.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.governance.service.SrvTaskService;
import com.hungraim.ltc.pojo.vo.governance.*;
import com.hungraim.ltc.util.DateUtils;
import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode;
import lombok.extern.slf4j.Slf4j;
......@@ -15,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -131,11 +129,6 @@ public class SrvTaskController {
if (srvTaskInfoVO.getTaskDetails() == null || srvTaskInfoVO.getTaskDetails().size() <= 0) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
List<Date> dates = new ArrayList<>();
for (String detail : srvTaskInfoVO.getTaskDetails()) {
Date date = DateUtils.strToDate(detail);
dates.add(date);
}
}
srvTaskService.addOrUpdateSrvTask(param);
} catch (RuntimeException e) {
......@@ -144,43 +137,4 @@ public class SrvTaskController {
return Result.success();
}
/**
* 修改服务计划
*/
@RequestMapping("/updateSrvTask")
public Result<Object> updateSrvTask(SrvTaskInfoListVO param) {
String programId = param.getProgramId();
List<SrvTaskInfoVO> taskList = param.getTaskList();
if (StringUtils.isBlank(programId) || taskList == null || taskList.size() <= 0) {
return Result.failed("参数错误!");
}
try {
for (int i = 0; i < taskList.size(); i++) {
String taskId = taskList.get(i).getSrvTaskId();
String srvEmpId = taskList.get(i).getSrvEmpId();
List<String> taskDetails = taskList.get(i).getTaskDetails();
if (StringUtils.isBlank(taskId)) {
return Result.failed("taskId不能为空!");
}
if (StringUtils.isBlank(srvEmpId)) {
return Result.failed("护理人员id不能为空!");
}
if (taskDetails == null || taskDetails.size() <= 0) {
return Result.failed("具体护理日期不能为空!");
}
List<Date> dates = new ArrayList<>();
for (String detail : taskDetails) {
Date date = DateUtils.strToDate(detail);
dates.add(date);
}
srvTaskService.updateSrvTask(taskId, Long.parseLong(srvEmpId), dates);
}
} catch (RuntimeException e) {
//修改失败
return Result.failed(e.getMessage());
}
//修改成功
List<SrvTaskInfoVO> taskInfos = srvTaskService.getSrvTaskInfoList(programId);
return Result.success(taskInfos);
}
}
......@@ -18,10 +18,6 @@ public interface SrvTaskService {
List<SrvTaskInfoVO> getSrvTaskInfoList(String programId);
void addSrvTask(Long programId, Long srvEmpId, List<Date> dates);
void updateSrvTask(String taskId, Long srvEmpId, List<Date> dates);
Page<OrganEmpVO> getSrvOrganEmpList(Page<OrganEmpVO> page, String organId, String name, String certiType, String certifNum);
Page<SrvTaskDetailVO> getSrvTaskDetailList(Page<SrvTaskDetailVO> page, Integer organId, String disableName, String disableTel, String empName, String certifNum, Date startTime, Date endTime, String status, String modeId);
......
......@@ -128,64 +128,6 @@ public class SrvTaskServiceImpl implements SrvTaskService {
}
}
@Transactional(rollbackFor = Exception.class)
@Override
public void addSrvTask(Long programId, Long srvEmpId, List<Date> dates) {
try {
//添加服务计划
ChSrvTask chSrvTask = new ChSrvTask();
chSrvTask.setEffTime(new Date());//创建时间
chSrvTask.setProgramId(programId);//服务方案id
chSrvTask.setSrvEmpId(srvEmpId);//服务人员id
chSrvTask.setStatus((short) 0);//状态 未分配:0;已分配:1
int insert = srvTaskMapper.insert(chSrvTask);
if (insert <= 0) {
throw new RuntimeException("添加服务计划失败!");
}
//添加服务计划详情
for (Date date : dates) {
ChSrvTaskDetail chSrvTaskDetail = new ChSrvTaskDetail();
chSrvTaskDetail.setSrvTaskId(chSrvTask.getSrvTaskId());//taskId
chSrvTaskDetail.setSrvDate(date);//服务开始时间
chSrvTaskDetail.setStatus((short) 0);//状态 未执行:0;执行中:1;已执行:2;已失效:3已完成4
int insert1 = chSrvTaskDetailMapper.insert(chSrvTaskDetail);
if (insert1 <= 0) {
throw new RuntimeException("添加服务计划详情失败!");
}
}
} catch (Exception e) {
throw new RuntimeException("系统繁忙,请稍后再试!");
}
}
@Transactional(rollbackFor = Exception.class)
@Override
public void updateSrvTask(String taskId, Long srvEmpId, List<Date> dates) {
//修改服务计划服务人员
ChSrvTask chSrvTask = srvTaskMapper.selectById(taskId);
if (chSrvTask == null) {
throw new RuntimeException("修改失败,不存在的服务计划!");
}
chSrvTask.setSrvEmpId(srvEmpId);
int i = srvTaskMapper.updateById(chSrvTask);
if (i <= 0) {
throw new RuntimeException("修改服务计划服务人员失败!");
}
//修改服务计划详情计划详情
chSrvTaskDetailMapper.delete(new QueryWrapper<ChSrvTaskDetail>().eq("srv_task_id", taskId));//删除原来的计划详情
for (Date date : dates) {
//新增计划详情
ChSrvTaskDetail chSrvTaskDetail = new ChSrvTaskDetail();
chSrvTaskDetail.setSrvTaskId(chSrvTask.getSrvTaskId());//taskId
chSrvTaskDetail.setSrvDate(date);//服务开始时间
chSrvTaskDetail.setStatus((short) 0);//状态 未执行:0;执行中:1;已执行:2;已失效:3已完成4
int insert1 = chSrvTaskDetailMapper.insert(chSrvTaskDetail);
if (insert1 <= 0) {
throw new RuntimeException("添加服务计划详情失败!");
}
}
}
@Override
public Page<OrganEmpVO> getSrvOrganEmpList(Page<OrganEmpVO> page, String organId, String name, String certiType, String certifNum) {
return srvTaskMapper.getSrvOrganEmpList(page, organId, name, certiType, certifNum);
......
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