Commit 82d2d6f6 authored by 竹天卫's avatar 竹天卫

委托流程更改完成 发送样品处理 合并到评审按钮中

parent f2148030
...@@ -160,18 +160,18 @@ public class EntrustController { ...@@ -160,18 +160,18 @@ public class EntrustController {
return BaseResponse.errorMsg("失败!"); return BaseResponse.errorMsg("失败!");
} }
@ApiOperation(value = "委托评审") @ApiOperation(value = "委托评审+发送样品处理任务")
@PostMapping("/approval") @PostMapping("/approval")
public BaseResponse approval(@RequestBody ApprovalQuery query) { public BaseResponse approval(@RequestBody ApprovalQuery query) {
try { try {
return entrustService.approval(query); return entrustService.approval(query);
} catch (Exception e) { } catch (Exception e) {
log.debug("委托评审{}", e); log.debug("委托评审+发送样品处理任务{}", e);
} }
return BaseResponse.errorMsg("失败!"); return BaseResponse.errorMsg("失败!");
} }
@ApiOperation(value = "发送样品处理任务") /*@ApiOperation(value = "发送样品处理任务")
@PostMapping("/handle") @PostMapping("/handle")
public BaseResponse handle(@RequestBody HandleQuery query) { public BaseResponse handle(@RequestBody HandleQuery query) {
try { try {
...@@ -180,7 +180,7 @@ public class EntrustController { ...@@ -180,7 +180,7 @@ public class EntrustController {
log.debug("发送样品处理任务{}", e); log.debug("发送样品处理任务{}", e);
} }
return BaseResponse.errorMsg("失败!"); return BaseResponse.errorMsg("失败!");
} }*/
@ApiOperation(value = "样品处理任务分页") @ApiOperation(value = "样品处理任务分页")
@ApiImplicitParams(value = { @ApiImplicitParams(value = {
......
...@@ -59,7 +59,7 @@ public class Entrust implements Serializable { ...@@ -59,7 +59,7 @@ public class Entrust implements Serializable {
@ApiModelProperty("委托日期") @ApiModelProperty("委托日期")
private LocalDate entrustDate; private LocalDate entrustDate;
@ApiModelProperty("拟定完成日期") @ApiModelProperty("样品处理要求完成日期")
private LocalDate finishDate; private LocalDate finishDate;
@ApiModelProperty("申请委托人id") @ApiModelProperty("申请委托人id")
......
...@@ -41,8 +41,8 @@ public class SampleHandle implements Serializable { ...@@ -41,8 +41,8 @@ public class SampleHandle implements Serializable {
@ApiModelProperty("处理人id") @ApiModelProperty("处理人id")
private Integer userId; private Integer userId;
@ApiModelProperty("样品处理项id 例子:1、2、3") @ApiModelProperty("样品处理项id")
private String content; private Integer handleId;
@ApiModelProperty("要求完成日期(计划完成日期)") @ApiModelProperty("要求完成日期(计划完成日期)")
private LocalDate planFinishDate; private LocalDate planFinishDate;
......
...@@ -43,7 +43,7 @@ public interface IEntrustService extends IService<Entrust> { ...@@ -43,7 +43,7 @@ public interface IEntrustService extends IService<Entrust> {
BaseResponse<String> approval(ApprovalQuery query); BaseResponse<String> approval(ApprovalQuery query);
BaseResponse<String> handle(HandleQuery query); // BaseResponse<String> handle(HandleQuery query);
BaseResponse<IPage<EntrustVo>> getSampleHandlePage(PageQuery pageQuery, String projectCode); BaseResponse<IPage<EntrustVo>> getSampleHandlePage(PageQuery pageQuery, String projectCode);
......
...@@ -27,6 +27,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; ...@@ -27,6 +27,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sun.org.apache.xpath.internal.operations.Bool; import com.sun.org.apache.xpath.internal.operations.Bool;
import io.swagger.models.auth.In;
import lombok.Data; import lombok.Data;
import net.bytebuddy.description.field.FieldDescription; import net.bytebuddy.description.field.FieldDescription;
import org.apache.commons.io.filefilter.FalseFileFilter; import org.apache.commons.io.filefilter.FalseFileFilter;
...@@ -896,6 +897,84 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -896,6 +897,84 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
String entrustCode = entrust.getProjectCode()+"_"+query.getSampleList().get(0).getCementCode(); String entrustCode = entrust.getProjectCode()+"_"+query.getSampleList().get(0).getCementCode();
entrust.setEntrustCode(entrustCode); entrust.setEntrustCode(entrustCode);
logsService.saveLog(SysLogs.ObjType.ENTRUST_LOG, entrust.getId(), "修改评审状态为“通过”", null); logsService.saveLog(SysLogs.ObjType.ENTRUST_LOG, entrust.getId(), "修改评审状态为“通过”", null);
//*****************************以上为评审接口******************
//*****************************样品处理派发合并到评审接口中******************
List<Sample> sampleList = sampleMapper.getSampleList(entrustVo.getId());
String userIds = "";
for (Sample sample : sampleList) {
//样品的处理项
List<Integer> handleUserIds = new ArrayList<>();
String teamIds = sample.getTeamIds();
if (teamIds != null) {
String[] teamIdS = teamIds.split("、");
List<Integer> handleIds = new ArrayList<>();
for (String teamId : teamIdS) {
TeamVo teamVo = teamMapper.getDetail(Integer.valueOf(teamId));
if (teamVo != null) {
HandleVo handleVo = handleMapper.getDetail(teamVo.getHandleId());
if(handleVo != null && !handleUserIds.contains(handleVo.getUserId())){
handleUserIds.add(handleVo.getUserId());
}
//样品处理表 同一个样品多个相同处理项时 去重。
if(handleVo != null && !handleIds.contains(handleVo.getId())){
SampleHandle sampleHandle = new SampleHandle();
sampleHandle.setSampleId(sample.getId())
.setUserId(handleVo.getUserId())
.setHandleId(handleVo.getId())
.setPlanFinishDate(null) //样品处理要求完成放到了委托表,评审的时候直接设定
.setStatus(0)
.setCreateTime(LocalDateTime.now());
sampleHandleMapper.insert(sampleHandle);
if(sampleHandle.getHandleId() != null){
Handle handle = handleMapper.selectById(sampleHandle.getHandleId());
if (handle == null) {
return BaseResponse.errorMsg("选择的处理项信息有误");
}
SampleHandleEnclosure sampleHandleEnclosure = new SampleHandleEnclosure();
sampleHandleEnclosure.setSampleHandleId(sampleHandle.getId())
.setHandleId(handle.getId())
.setUserId(sampleHandle.getUserId())
.setCreateTime(LocalDateTime.now())
.setStatus(0)
.setAlias(handle.getName());
sampleHandleEnclosureMapper.insert(sampleHandleEnclosure);
//获取产值信息
QueryWrapper<NormProduction> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("assess_id", handle.getId());
queryWrapper.eq("type", 0);
queryWrapper.eq("status", 1);
NormProduction normProduction = iNormProductionService.getOne(queryWrapper);
if(normProduction == null){
return BaseResponse.errorMsg("联系管理员.配置产值信息!");
}
}
//消息推送
BaseResponse wrapper = userMessageService.sendMessage(sampleHandle.getUserId(), "您有一条样品处理信息等待处理",entrust.getId(), SysUserMessage.MessageType.ENTRUST);
if(wrapper.getCode() != 200){
return wrapper;
}
SysUser handleUser = userService.getById(sampleHandle.getUserId());
if(handleUser == null){
return BaseResponse.errorMsg("样品处理人信息错误");
}
if(StringUtils.isNotBlank(handleUser.getWxId()) && !handleUserIds.contains(handleUser.getId())){
userIds = userIds.equals("")?handleUser.getWxId():userIds+"|"+handleUser.getWxId();
}
}
}
}
}
}
//委托表改成已发送样品处理,状态改为样品处理状态中
entrust.setIsHandle(1)
.setStatus(3);
logsService.saveLog(SysLogs.ObjType.ENTRUST_LOG, entrust.getId(), "发送样品处理任务", null);
//发送企业微信消息内容
String content="你好!您有一条新的样品处理任务,请前往\n"+Global.systemUrl +"进行接受。";
weiXinService.sendTextMessage(userIds, content);
} else if (query.getIsAgree() == 2) { //驳回 } else if (query.getIsAgree() == 2) { //驳回
entrust.setStatus(2); entrust.setStatus(2);
logsService.saveLog(SysLogs.ObjType.ENTRUST_LOG, entrust.getId(), "修改评审状态为“驳回”", null); logsService.saveLog(SysLogs.ObjType.ENTRUST_LOG, entrust.getId(), "修改评审状态为“驳回”", null);
...@@ -923,7 +1002,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -923,7 +1002,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
* @param query * @param query
* @return * @return
*/ */
@Transactional /*@Transactional
@Override @Override
public BaseResponse<String> handle(HandleQuery query) { public BaseResponse<String> handle(HandleQuery query) {
if (query.getId() == null) { if (query.getId() == null) {
...@@ -1014,7 +1093,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -1014,7 +1093,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
weiXinService.sendTextMessage(userIds, content); weiXinService.sendTextMessage(userIds, content);
return BaseResponse.okMsg("已发送样品处理任务"); return BaseResponse.okMsg("已发送样品处理任务");
} }
*/
/** /**
* 样品处理任务分页 * 样品处理任务分页
* *
...@@ -1054,14 +1133,12 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -1054,14 +1133,12 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
List<SampleHandle> shList = sampleHandleMapper.selectList(shWrapper); List<SampleHandle> shList = sampleHandleMapper.selectList(shWrapper);
if (shList != null && shList.size() > 0) { if (shList != null && shList.size() > 0) {
for (SampleHandle sampleHandle : shList) { for (SampleHandle sampleHandle : shList) {
if (sampleHandle.getContent() != null) { if (sampleHandle.getHandleId() != null) {
String[] handleIdS = sampleHandle.getContent().split("、"); Handle handle = handleMapper.selectById(sampleHandle.getHandleId());
for (String handelId : handleIdS) {
Handle handle = handleMapper.selectById(Integer.valueOf(handelId));
if (handle != null) { if (handle != null) {
handleNames = handleNames.equals("") ? handle.getName() : (handleNames + "、" + handle.getName()); handleNames = handleNames.equals("") ? handle.getName() : (handleNames + "、" + handle.getName());
} }
}
} }
} }
} }
...@@ -1268,18 +1345,13 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -1268,18 +1345,13 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
return BaseResponse.errorMsg("委托信息错误"); return BaseResponse.errorMsg("委托信息错误");
} }
//计算产值 //计算产值
if (sampleHandle.getContent() != null) { if (sampleHandle.getHandleId() != null) {
String[] handIdS = sampleHandle.getContent().split("、");
String illMessage = "";
for (String handleId : handIdS) {
try { try {
iPrecipriceService.createPreciprice(sampleHandle.getUserId(),entrust.getId(),Integer.valueOf(handleId),0,sample.getId()); iPrecipriceService.createPreciprice(sampleHandle.getUserId(),entrust.getId(),sampleHandle.getHandleId(),0,sample.getId());
}catch (Exception e){ }catch (Exception e){
System.out.println(e.getMessage()); System.out.println(e.getMessage());
return BaseResponse.errorMsg(e.getMessage()); return BaseResponse.errorMsg(e.getMessage());
} }
}
} }
QueryWrapper<SampleHandle> sampleHandleWrapper = new QueryWrapper<>(); QueryWrapper<SampleHandle> sampleHandleWrapper = new QueryWrapper<>();
sampleHandleWrapper.eq("sample_id", sample.getId()); sampleHandleWrapper.eq("sample_id", sample.getId());
......
...@@ -715,12 +715,8 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper, ...@@ -715,12 +715,8 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
List<Integer> handleIds = new ArrayList<>(); List<Integer> handleIds = new ArrayList<>();
//处理项id //处理项id
sampleHandles.forEach(arg -> { sampleHandles.forEach(arg -> {
String idsStr = arg.getContent();
String[] split = idsStr.split("、");
try { try {
for (String idStr : split) { handleIds.add(arg.getHandleId());
handleIds.add(Integer.parseInt(idStr));
}
} catch (NumberFormatException ex) { } catch (NumberFormatException ex) {
throw new RuntimeException("处理项目的id传的有问题呀!"); throw new RuntimeException("处理项目的id传的有问题呀!");
} }
...@@ -739,13 +735,9 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper, ...@@ -739,13 +735,9 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
continue; continue;
} }
//处理项是多个处理ids 、分割 //处理项是多个处理ids 、分割
String content = sampleHandle.getContent(); List<Integer> ids = new ArrayList<>();
String[] split = content.split("、");
List<Integer> ids = new ArrayList<>(split.length);
try { try {
for (String idStr : split) { ids.add(sampleHandle.getHandleId());
ids.add(Integer.parseInt(idStr));
}
} catch (NumberFormatException ex) { } catch (NumberFormatException ex) {
throw new RuntimeException("处理项目的id传的有问题呀!"); throw new RuntimeException("处理项目的id传的有问题呀!");
} }
......
...@@ -25,7 +25,7 @@ public interface Global { ...@@ -25,7 +25,7 @@ public interface Global {
public final static String backUrl = "https%3a%2f%2fccdcmtl.sinoma-tianjin.com%2flab-system"; public final static String backUrl = "https%3a%2f%2fccdcmtl.sinoma-tianjin.com%2flab-system";
//实验室管理系统链接 //实验室管理系统链接
public final static String systemUrl = public final static String systemUrl =
"<a href=\"https://open.weixin.qq.com/connect/oauth2/authorize?appid="+corpId+"&redirect_uri="+backUrl+"%2f&response_type=code&scope=snsapi_base&state=#wechat_redirect\">天津院实验室管理系统" + "</a>,"; "<a href=\"https://open.weixin.qq.com/connect/oauth2/authorize?appid="+corpId+"&redirect_uri="+backUrl+"%2f&response_type=code&scope=snsapi_base&state=#wechat_redirect\">物化检测流程" + "</a>,";
/** /**
* 微信公众平台,获取AccessToken的接口地址,Https请求方式:GET * 微信公众平台,获取AccessToken的接口地址,Https请求方式:GET
......
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