Commit 88df379b authored by 蔡镇泽's avatar 蔡镇泽

添加服务方案及服务计划附件上传查询

parent 5b04e95a
......@@ -194,9 +194,7 @@ public class TaskServiceImpl implements TaskService {
chAprReport.setEvaluateTime(evaluateDate);
aprReportMapper.updateById(chAprReport);
//附件上传
if (fileDataList != null && fileDataList.size() > 0) {
this.updateAttachs(fileDataList, chAprReport.getReportId().longValue());
}
this.updateAttachs(fileDataList, chAprReport.getReportId().longValue());
//修改鉴定报告人员(有就update,没有就insert)
List<ChAprPersonInfo> personInfos = personInfoMapper.selectList(new QueryWrapper<ChAprPersonInfo>().eq("report_id", reportId).orderByDesc("info_id"));
if (person1 != null) {
......@@ -445,8 +443,8 @@ public class TaskServiceImpl implements TaskService {
public Result<List<AttachVo>> reportFileList(Long reportId) {
Result<List<AttachVo>> listResult = null;
try {
// 新增返回对应的附件列表
listResult = attachFeignService.selectAttachs(reportId, (short) 1);
// 返回对应的附件列表
listResult = attachFeignService.selectAttachs(reportId, AttachType.TASK.getUploadType());
if (!listResult.getCode().equals(ResultCode.SUCCESS.getCode())) {
log.info("请求获取附件列表错误:错误码{},错误信息:{}", listResult.getCode(), listResult.getMsg());
}
......
package com.hungraim.ltc.pojo.vo.governance;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
......@@ -141,5 +142,9 @@ public class ProgramDetailVo {
*/
private List<ProgramSetAndProjectVo> programSetAndProjectVos;
/**
* 服务方案附件
*/
private List<ChFndAttach> fileDataList;
}
package com.hungraim.ltc.pojo.vo.governance;
import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
import com.hungraim.ltc.pojo.vo.system.AttachVo;
import com.hungraim.ltc.util.Result;
import lombok.Data;
import java.io.Serializable;
......@@ -48,4 +51,12 @@ public class SrvTaskInfoVO implements Serializable {
* 服务计划状态
*/
private String taskStatus;
/**
* 服务计划附件VO
*/
private Result<List<AttachVo>> listResult;
/**
* 服务计划附件
*/
private List<ChFndAttach> listAttach;
}
......@@ -28,6 +28,18 @@
<version>2.2.5.RELEASE</version>
</dependency>
<!--feign服务调用-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<!--系统服务api-->
<dependency>
<groupId>com.hungraim.ltc</groupId>
<artifactId>system-api</artifactId>
<version>0.0.1</version>
</dependency>
<!--基础包-->
<dependency>
......
......@@ -8,6 +8,7 @@ import com.hungraim.ltc.pojo.vo.governance.ProgramDetailVo;
import com.hungraim.ltc.pojo.vo.governance.ProgramListVo;
import com.hungraim.ltc.pojo.vo.governance.ProgramSetAndProjectVo;
import com.hungraim.ltc.pojo.vo.governance.SvrSendListVo;
import com.hungraim.ltc.pojo.vo.system.AttachVo;
import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode;
import lombok.extern.slf4j.Slf4j;
......@@ -81,6 +82,20 @@ public class SrvProgramController {
}
/**
* 查询服务计划附件列表
*
* @param programId 服务计划id
*/
@RequestMapping("/programFileList")
public Result<List<AttachVo>> reportFileList(Long programId) {
Result<List<AttachVo>> listResult = srvProgramService.programFileList(programId);
if (!listResult.getCode().equals(ResultCode.SUCCESS.getCode())) {
return Result.failed("请求获取附件列表错误:错误码{" + listResult.getCode() + "},错误信息:{" + listResult.getMsg() + "}");
}
return listResult;
}
/**
* 查看服务方案详情
*
* @param programId 方案id
......
......@@ -91,7 +91,7 @@ public class SrvTaskController {
}
/**
* 查询服务计划制定详情列表
* 查询服务计划制定详情及附件列表
*
* @param programId 服务方案id
*/
......
......@@ -5,6 +5,8 @@ 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 com.hungraim.ltc.pojo.vo.system.AttachVo;
import com.hungraim.ltc.util.Result;
import java.util.List;
......@@ -61,6 +63,7 @@ public interface SrvProgramService {
/**
* 添加或者修改服务方案
*
* @param programDetailVo 包装对象
*/
void addProgramAndProgramSetList(ProgramDetailVo programDetailVo);
......@@ -72,4 +75,12 @@ public interface SrvProgramService {
* @param endReason 终止原因
*/
void endProgram(Long programId, String endReason);
/**
* 查询服务计划附件列表
*
* @param programId 服务计划id
*/
Result<List<AttachVo>> programFileList(Long programId);
}
......@@ -2,16 +2,24 @@ package com.hungraim.ltc.governance.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.api.AttachFeignService;
import com.hungraim.ltc.governance.dao.ChSrvProgramMapper;
import com.hungraim.ltc.governance.dao.ChSrvProgramSetMapper;
import com.hungraim.ltc.governance.dao.ChSrvSendMapper;
import com.hungraim.ltc.governance.service.SrvProgramService;
import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvProgram;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvProgramSet;
import com.hungraim.ltc.pojo.vo.governance.ProgramDetailVo;
import com.hungraim.ltc.pojo.vo.governance.ProgramListVo;
import com.hungraim.ltc.pojo.vo.governance.ProgramSetAndProjectVo;
import com.hungraim.ltc.pojo.vo.governance.SvrSendListVo;
import com.hungraim.ltc.pojo.vo.system.AttachUpdateVo;
import com.hungraim.ltc.pojo.vo.system.AttachVo;
import com.hungraim.ltc.util.AttachType;
import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -21,6 +29,7 @@ import java.util.List;
@Service
@Slf4j
public class SrvProgramServiceImpl implements SrvProgramService {
@Autowired
......@@ -32,6 +41,9 @@ public class SrvProgramServiceImpl implements SrvProgramService {
@Autowired
private ChSrvProgramSetMapper chSrvProgramSetMapper;
@Autowired
private AttachFeignService attachFeignService;
@Override
public Page<SvrSendListVo> getProgramList(Page<SvrSendListVo> page, Long srvOrganId, String realName, String realTel, String programStatus) {
return chSrvSendMapper.selectSrvSendList(page, srvOrganId, realName, realTel, programStatus);
......@@ -77,6 +89,7 @@ public class SrvProgramServiceImpl implements SrvProgramService {
chSrvProgram.setProgStatus(0);
chSrvProgram.setEffTime(date);
chSrvProgramMapper.insert(chSrvProgram);
programId = chSrvProgram.getProgramId();
// 2.使用服务方案记录的id来添加服务方案项目记录
Long newProgramId = chSrvProgram.getProgramId();
List<ProgramSetAndProjectVo> programSetAndProjectVos = programDetailVo.getProgramSetAndProjectVos();
......@@ -115,7 +128,8 @@ public class SrvProgramServiceImpl implements SrvProgramService {
}
}
}
//修改附件
this.updateAttachs(programDetailVo.getFileDataList(), programId);
}
@Override
......@@ -127,6 +141,22 @@ public class SrvProgramServiceImpl implements SrvProgramService {
chSrvProgramMapper.updateById(chSrvProgram);
}
@Override
public Result<List<AttachVo>> programFileList(Long programId) {
Result<List<AttachVo>> listResult = null;
try {
// 返回对应的附件列表
listResult = attachFeignService.selectAttachs(programId, AttachType.PROGRAM.getUploadType());
if (!listResult.getCode().equals(ResultCode.SUCCESS.getCode())) {
log.info("请求获取附件列表错误:错误码{},错误信息:{}", listResult.getCode(), listResult.getMsg());
}
} catch (Exception e) {
log.error(e.getMessage());
e.printStackTrace();
}
return listResult;
}
private void addProgramSet(ProgramDetailVo programDetailVo, Date date, Long newProgramId, ProgramSetAndProjectVo programSetAndProjectVo) {
ChSrvProgramSet chSrvProgramSet = new ChSrvProgramSet();
chSrvProgramSet.setItemId(programSetAndProjectVo.getProjectId());
......@@ -142,4 +172,17 @@ public class SrvProgramServiceImpl implements SrvProgramService {
chSrvProgramSet.setRemark(programSetAndProjectVo.getRemark());
chSrvProgramSetMapper.insert(chSrvProgramSet);
}
/**
* 调用feign api来修改附件数据
*/
private void updateAttachs(List<ChFndAttach> fileDataList, Long ctrlId) {
// 新增附件修改逻辑
AttachUpdateVo attachUpdateVo = new AttachUpdateVo();
attachUpdateVo.setCtrlId(ctrlId);
attachUpdateVo.setAttachType(AttachType.PROGRAM.getUploadType());
attachUpdateVo.setChFndAttachs(fileDataList);
attachFeignService.updateAttachs(attachUpdateVo);
}
}
......@@ -3,14 +3,22 @@ package com.hungraim.ltc.governance.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.api.AttachFeignService;
import com.hungraim.ltc.governance.dao.ChSrvTaskDetailMapper;
import com.hungraim.ltc.governance.dao.SrvTaskMapper;
import com.hungraim.ltc.governance.service.SrvTaskService;
import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
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.pojo.vo.system.AttachVo;
import com.hungraim.ltc.util.AttachType;
import com.hungraim.ltc.util.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -22,11 +30,12 @@ import java.util.List;
* 服务计划ServiceImpl
*/
@Service
@Slf4j
@AllArgsConstructor
public class SrvTaskServiceImpl implements SrvTaskService {
@Autowired
private SrvTaskMapper srvTaskMapper;
@Autowired
private ChSrvTaskDetailMapper chSrvTaskDetailMapper;
private final SrvTaskMapper srvTaskMapper;
private final ChSrvTaskDetailMapper chSrvTaskDetailMapper;
private final AttachFeignService attachFeignService;
/**
* 服务计划制定列表
......@@ -67,6 +76,21 @@ public class SrvTaskServiceImpl implements SrvTaskService {
@Override
public List<SrvTaskInfoVO> getSrvTaskInfoList(String programId) {
List<SrvTaskInfoVO> srvTaskInfoList = srvTaskMapper.getSrvTaskInfoList(programId);
//查询服务计划附件
try {
for (SrvTaskInfoVO vo : srvTaskInfoList) {
// 返回对应的附件列表
Result<List<AttachVo>> listResult = attachFeignService.selectAttachs(Long.parseLong(programId), AttachType.AUDIT.getUploadType());
if (!listResult.getCode().equals(ResultCode.SUCCESS.getCode())) {
log.info("请求获取附件列表错误:错误码{},错误信息:{}", listResult.getCode(), listResult.getMsg());
} else {
vo.setListResult(listResult);
}
}
} catch (Exception e) {
log.error(e.getMessage());
e.printStackTrace();
}
//具体服务日期
for (SrvTaskInfoVO vo : srvTaskInfoList) {
List<ChSrvTaskDetail> taskDetails = chSrvTaskDetailMapper.selectList(new QueryWrapper<ChSrvTaskDetail>().eq("srv_task_id", vo.getSrvTaskId()));
......@@ -81,6 +105,18 @@ public class SrvTaskServiceImpl implements SrvTaskService {
return srvTaskInfoList;
}
/**
* 调用feign api来修改附件数据
*/
private void updateAttachs(List<ChFndAttach> fileDataList, Long ctrlId) {
// 新增附件修改逻辑
AttachUpdateVo attachUpdateVo = new AttachUpdateVo();
attachUpdateVo.setCtrlId(ctrlId);
attachUpdateVo.setAttachType(AttachType.AUDIT.getUploadType());
attachUpdateVo.setChFndAttachs(fileDataList);
attachFeignService.updateAttachs(attachUpdateVo);
}
@Transactional(rollbackFor = Exception.class)
@Override
public void addOrUpdateSrvTask(SrvTaskInfoListVO param) {
......@@ -99,23 +135,25 @@ public class SrvTaskServiceImpl implements SrvTaskService {
chSrvTask.setSrvEmpId(Long.parseLong(srvTaskInfoVO.getSrvEmpId()));//服务人员id
chSrvTask.setStatus((short) 1);//状态 未分配:0;已分配:1;已终止2
srvTaskMapper.insert(chSrvTask);
//添加服务计划详情
Long newSrvTaskId = chSrvTask.getSrvTaskId();
insertTaskDetail(newSrvTaskId, taskDetails);
this.insertTaskDetail(newSrvTaskId, taskDetails);
//修改附件
this.updateAttachs(srvTaskInfoVO.getListAttach(), Long.parseLong(srvTaskId));
} else {
// 修改服务计划
ChSrvTask chSrvTask = new ChSrvTask();
chSrvTask.setSrvTaskId(Long.parseLong(srvTaskId));
chSrvTask.setStatus(Short.parseShort(srvTaskInfoVO.getTaskStatus()));
srvTaskMapper.updateById(chSrvTask);
chSrvTaskDetailMapper.delete(new QueryWrapper<ChSrvTaskDetail>().eq("srv_task_id", Long.parseLong(srvTaskId)));//删除原来的计划详情
insertTaskDetail(Long.parseLong(srvTaskId), taskDetails);
this.insertTaskDetail(Long.parseLong(srvTaskId), taskDetails);
//修改附件
this.updateAttachs(srvTaskInfoVO.getListAttach(), Long.parseLong(srvTaskId));
}
}
}
/**
* 插入服务计划详情数据
* @param srvTaskId 服务计划id
*
* @param srvTaskId 服务计划id
* @param taskDetails 服务时间集合,时间格式yyyy-MM-dd
*/
private void insertTaskDetail(Long srvTaskId, List<String> taskDetails) {
......
spring:
main:
#允许存在多个Feign调用相同Service的接口
allow-bean-definition-overriding: true
devtools:
restart:
enabled: true
......
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