Commit a9eb8221 authored by 竹天卫's avatar 竹天卫

委托详情接口

parent f040d952
...@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.multipart.MultipartHttpServletRequest;
import sun.misc.BASE64Encoder;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -158,6 +159,9 @@ public class EntityEnclosureController { ...@@ -158,6 +159,9 @@ public class EntityEnclosureController {
byte[] by = FastDFSUtils.fileDownload(fileUrl); byte[] by = FastDFSUtils.fileDownload(fileUrl);
out.write(by); out.write(by);
out.close(); out.close();
// BASE64Encoder encoder = new BASE64Encoder();
// String data = encoder.encode(by);
// return BaseResponse.okMsg(data);
}else { }else {
return BaseResponse.errorMsg("登录信息失效"); return BaseResponse.errorMsg("登录信息失效");
} }
...@@ -168,6 +172,9 @@ public class EntityEnclosureController { ...@@ -168,6 +172,9 @@ public class EntityEnclosureController {
return BaseResponse.errorMsg("失败"); return BaseResponse.errorMsg("失败");
} }
@ApiOperation(value = "app扫描二维码下载") @ApiOperation(value = "app扫描二维码下载")
@GetMapping("/appDownload") @GetMapping("/appDownload")
public BaseResponse appDownload(String fileUrl){ public BaseResponse appDownload(String fileUrl){
......
...@@ -258,6 +258,37 @@ public class EntrustController { ...@@ -258,6 +258,37 @@ public class EntrustController {
return BaseResponse.errorMsg("失败!"); return BaseResponse.errorMsg("失败!");
} }
@ApiOperation(value = "详情-基本信息")
@GetMapping("/getBaseDtail/{id}")
public BaseResponse getBaseDtail(@PathVariable Integer id){
try {
return entrustService.getBaseDtail(id);
}catch (Exception e){
log.debug("详情-基本信息{}",e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "详情-样品处理信息")
@GetMapping("/getSampleHandleDtail/{id}")
public BaseResponse getSampleHandleDtail(@PathVariable Integer id){
try {
return entrustService.getSampleHandleDtail(id);
}catch (Exception e){
log.debug("详情-样品处理信息{}",e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "详情-检测任务信息")
@GetMapping("/getSampleCheckDtail/{id}")
public BaseResponse getSampleCheckDtail(@PathVariable Integer id){
try {
return entrustService.getSampleCheckDtail(id);
}catch (Exception e){
log.debug("详情-检测任务信息{}",e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "接受检测项目任务") @ApiOperation(value = "接受检测项目任务")
@PostMapping("/acceptDistribution") @PostMapping("/acceptDistribution")
......
...@@ -52,4 +52,7 @@ public interface SampleMapper extends BaseMapper<Sample> { ...@@ -52,4 +52,7 @@ public interface SampleMapper extends BaseMapper<Sample> {
@Select("select * from sample where entrust_id = #{entrustId} and cement_code = #{cementCode}") @Select("select * from sample where entrust_id = #{entrustId} and cement_code = #{cementCode}")
List<Sample> getByCementCode(@Param("entrustId") Integer entrustId, @Param("cementCode") String cementCode); List<Sample> getByCementCode(@Param("entrustId") Integer entrustId, @Param("cementCode") String cementCode);
@Select("select * from sample where entrust_id = #{entrustId} order by id asc")
List<Sample> getSampleCheckList(Integer entrustId);
} }
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
</sql> </sql>
<select id="getPage" resultType="cn.wise.sc.cement.business.model.vo.EntrustVo"> <select id="getPage" resultType="cn.wise.sc.cement.business.model.vo.EntrustVo">
select e.*, p.name as projectName, c.name as clientName, su.name as userName, select e.*, c.name as clientName, su.name as userName,
( (
CASE e.status CASE e.status
WHEN 0 THEN '未评审' WHEN 0 THEN '未评审'
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<mapper namespace="cn.wise.sc.cement.business.mapper.SampleMapper"> <mapper namespace="cn.wise.sc.cement.business.mapper.SampleMapper">
<sql id="where"> <sql id="where">
<where> <where>
and and s.parallel_code = s.cement_code
<if test="params.sampleName != null and params.sampleName != ''"> <if test="params.sampleName != null and params.sampleName != ''">
and s.name like concat('%', #{params.sampleName}, '%') and s.name like concat('%', #{params.sampleName}, '%')
</if> </if>
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
</sql> </sql>
<select id="getPage" resultType="cn.wise.sc.cement.business.model.vo.SampleVo"> <select id="getPage" resultType="cn.wise.sc.cement.business.model.vo.SampleVo">
select s.*, p.id as projectId, p.name as projectName, p.code as projectCode select s.*, p.id as projectId, p.name as projectName,p.code as projectCode
from sample s from sample s
left join entrust e on e.id = s.entrust_id left join entrust e on e.id = s.entrust_id
left join project p on p.id = e.project_id left join project p on p.id = e.project_id
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<select id="getDetail" resultType="cn.wise.sc.cement.business.model.vo.SampleVo"> <select id="getDetail" resultType="cn.wise.sc.cement.business.model.vo.SampleVo">
select sm.*,s.name as sampleName, s.cement_code as cementCode, s.weight as weight select s.*,s.name as sampleName, s.cement_code as cementCode, s.weight as weight
from sample s from sample s
left join entrust e on e.id = s.entrust_id left join entrust e on e.id = s.entrust_id
left join project p on p.id = e.project_id left join project p on p.id = e.project_id
......
...@@ -98,4 +98,16 @@ public interface IEntrustService extends IService<Entrust> { ...@@ -98,4 +98,16 @@ public interface IEntrustService extends IService<Entrust> {
void export(String startDate, String endDate, Integer status, void export(String startDate, String endDate, Integer status,
Integer clientId, String projectName, String projectCode, Integer clientId, String projectName, String projectCode,
String fileName, HttpServletResponse response); String fileName, HttpServletResponse response);
BaseResponse<EntrustVo> getBaseDtail(Integer id);
BaseResponse< List<SampleHandleVo>> getSampleHandleDtail(Integer id);
BaseResponse<List<SampleVo>> getSampleCheckDtail(Integer id);
} }
...@@ -358,6 +358,177 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -358,6 +358,177 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
return BaseResponse.okData(entrustVo); return BaseResponse.okData(entrustVo);
} }
/**
* 详情-基本信息
* @param id
* @return
*/
public BaseResponse<EntrustVo> getBaseDtail(Integer id) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
}
Integer approvalId = sysApprovalMapper.getApprovalId("委托评审");
if (approvalId == null) {
return BaseResponse.errorMsg("委托评审信息错误");
}
if (loginUser.getId() != approvalId) {
return BaseResponse.errorMsg("权限不足");
}
if (id == null) {
return BaseResponse.errorMsg("参数错误");
}
EntrustVo entrustVo = entrustMapper.getDetail(id);
if (entrustVo.getStatus() != 0) {
QueryWrapper<Sample> sampleWrapper = new QueryWrapper<>();
sampleWrapper.eq("entrust_id", entrustVo.getId());
sampleWrapper.orderByAsc("id");
List<Sample> sampleList = sampleService.list(sampleWrapper);
List<SampleVo> sampleVoList = new ArrayList<>();
if (sampleList != null && sampleList.size() > 0) {
for (Sample sample : sampleList) {
SampleVo sampleVo = new SampleVo();
BeanUtils.copyProperties(sample, sampleVo);
String teamIds = sample.getTeamIds();
String teamName = "";
List<SampleDistributionTeamVo> sampleNoDistributionTeamVoList = new ArrayList<>();
if (teamIds != null) {
String[] teamIdS = teamIds.split("、");
for (String teamId : teamIdS) {
TeamVo teamVo = teamMapper.getDetail(Integer.valueOf(teamId));
if (teamVo != null) {
teamName = teamName.equals("") ? teamVo.getName() : (teamName + "、" + teamVo.getName());
SampleDistributionTeamVo distributionTeamVo = new SampleDistributionTeamVo();
distributionTeamVo.setTeamGroupId(teamVo.getGroupId());
distributionTeamVo.setTeamGroupName(teamVo.getGroupName());
distributionTeamVo.setTeamId(teamVo.getId());
distributionTeamVo.setTeamName(teamVo.getName());
sampleNoDistributionTeamVoList.add(distributionTeamVo);
}
}
}
sampleVo.setTeamName(teamName);
sampleVoList.add(sampleVo);
}
}
entrustVo.setSampleList(sampleVoList);//样品列表(展示平行样样品)
}
return BaseResponse.okData(entrustVo);
}
/**
* 详情-样品处理信息
* @param id
* @return
*/
public BaseResponse< List<SampleHandleVo>> getSampleHandleDtail(Integer id) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
}
Integer approvalId = sysApprovalMapper.getApprovalId("委托评审");
if (approvalId == null) {
return BaseResponse.errorMsg("委托评审信息错误");
}
if (loginUser.getId() != approvalId) {
return BaseResponse.errorMsg("权限不足");
}
if (id == null) {
return BaseResponse.errorMsg("参数错误");
}
Map<String, Object> params = new HashMap<>();
params.put("id", id);
List<SampleHandleVo> sampleHandleList = sampleHandleMapper.getSampleHandleList(params);
Integer handleStatus = null;
if (sampleHandleList != null && sampleHandleList.size() > 0) {
for (SampleHandleVo shVo : sampleHandleList) {
if (handleStatus != null && handleStatus != shVo.getStatus()) {
return BaseResponse.errorMsg("接受或完成的状态信息错误");
}
handleStatus = shVo.getStatus() == 1 ? 1 : (shVo.getStatus() == 2 ? 2 : 0);
String contentName = "";
if (shVo.getContent() != null) {
String[] handIdS = shVo.getContent().split("、");
List<SampleHandleEnclosure> sampleHandleEnclosureList = new ArrayList<>();
for (String handleId : handIdS) {
Handle handle = handleMapper.selectById(Integer.valueOf(handleId));
if (handle == null) {
return BaseResponse.errorMsg("选择的处理项信息有误");
}
contentName = contentName.equals("") ? handle.getName() : contentName + "、" + handle.getName();
}
}
shVo.setContentName(contentName);
}
}
return BaseResponse.okData(sampleHandleList);
}
/**
* 详情-检测任务信息
* @param id
* @return
*/
public BaseResponse<List<SampleVo>> getSampleCheckDtail(Integer id) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
}
Integer approvalId = sysApprovalMapper.getApprovalId("委托评审");
if (approvalId == null) {
return BaseResponse.errorMsg("委托评审信息错误");
}
if (loginUser.getId() != approvalId) {
return BaseResponse.errorMsg("权限不足");
}
if (id == null) {
return BaseResponse.errorMsg("参数错误");
}
Entrust entrust = entrustMapper.selectById(id);
if (entrust == null) {
return BaseResponse.errorMsg("信息错误");
}
List<Sample> sampleList = sampleMapper.getSampleCheckList(id);
List<SampleVo> sampleVoList = new ArrayList<>();
if (sampleList != null && sampleList.size() > 0) {
for (Sample sample : sampleList) {
SampleVo sampleVo = new SampleVo();
BeanUtils.copyProperties(sample, sampleVo);
//判断是否为平行样
List<SampleDistributionTeamVo> sampleDistributionTeamVoList = null;
if (sample.getIsParallel() == 0) {
//检测人员只能看到自己则的检测内容
sampleDistributionTeamVoList =
distributionMapper.getDistributionTeamList(sample.getId(), null, null);
} else if (sample.getIsParallel() == 1) {
List<Sample> sampleList1 = sampleMapper.getByCementCode(entrust.getId(), sample.getCementCode());
//检测人员只能看到自己则的检测内容
if (sampleList1.size() == 2) {
sampleDistributionTeamVoList =
distributionMapper.getDistributionTeamList(sampleList1.get(0).getId(), sampleList1.get(1).getId(), null);
} else {
sampleDistributionTeamVoList =
distributionMapper.getDistributionTeamList(sample.getId(), null, null);
}
}
if (sampleDistributionTeamVoList != null && sampleDistributionTeamVoList.size() > 0) {
sampleVo.setSampleDistributionTeamVoList(sampleDistributionTeamVoList);
}
sampleVoList.add(sampleVo);
}
}
return BaseResponse.okData(sampleVoList);
}
/** /**
* 获取样品表里最大的平行样编号 * 获取样品表里最大的平行样编号
* *
...@@ -408,6 +579,16 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -408,6 +579,16 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
return BaseResponse.errorMsg("当前状态不允许评审"); return BaseResponse.errorMsg("当前状态不允许评审");
} }
Entrust entrust = entrustMapper.selectById(entrustVo.getId()); Entrust entrust = entrustMapper.selectById(entrustVo.getId());
//如果项目id或者项目编号为空,根据项目名称获取项目信息
if(StringUtils.isEmpty(entrust.getProjectCode())){
ProjectVo projectVo = projectMapper.getByName(entrust.getProjectName());
if(projectVo == null){
return BaseResponse.errorMsg("请添加项目信息");
}
entrust.setProjectId(projectVo.getId())
.setProjectCode(projectVo.getCode())
.setProjectName(projectVo.getName());
}
if (query.getIsAgree() == 1) { //通过 if (query.getIsAgree() == 1) { //通过
if (StringUtils.isEmpty(query.getProjectType())) { if (StringUtils.isEmpty(query.getProjectType())) {
return BaseResponse.errorMsg("请选择项目类型"); return BaseResponse.errorMsg("请选择项目类型");
......
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