Commit 682ad102 authored by 竹天卫's avatar 竹天卫

优化委托流程 产值计算功能

parent d4b376b3
......@@ -116,7 +116,9 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
@Autowired
private WeiXinService weiXinService;
@Autowired
IPrecipriceService iNormProductionService;
private INormProductionService iNormProductionService;
@Autowired
private IPrecipriceService iPrecipriceService;
/**
......@@ -949,6 +951,15 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
.setStatus(0)
.setAlias(handle.getName());
sampleHandleEnclosureList.add(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("联系管理员.配置产值信息!");
}
}
sampleHandleEnclosureService.saveBatch(sampleHandleEnclosureList);
}
......@@ -1236,7 +1247,11 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
if (sampleHandle.getContent() != null) {
String[] handIdS = sampleHandle.getContent().split("、");
for (String handleId : handIdS) {
iNormProductionService.createPreciprice(sampleHandle.getUserId(),entrust.getId(),Integer.valueOf(handleId),0,sample.getId());
try {
iPrecipriceService.createPreciprice(sampleHandle.getUserId(),entrust.getId(),Integer.valueOf(handleId),0,sample.getId());
}catch (Exception e){
return BaseResponse.errorMsg(e.getMessage());
}
}
}
QueryWrapper<SampleHandle> sampleHandleWrapper = new QueryWrapper<>();
......@@ -1329,6 +1344,16 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
.setStatus(0)
.setCreateTime(LocalDateTime.now());
sampleDistributionList.add(sampleDistribution);
//获取产值信息
QueryWrapper<NormProduction> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("assess_id", distributionTeamQuery.getTeamGroupId());
queryWrapper.eq("type", 1);
queryWrapper.eq("status", 1);
NormProduction normProduction = iNormProductionService.getOne(queryWrapper);
if(normProduction == null){
return BaseResponse.errorMsg("联系管理员.配置产值信息!");
}
//消息推送
BaseResponse wrapper = userMessageService.sendMessage(distributionTeamQuery.getUserId(), "您有一条样品检测信息等待接受",entrust.getId(), SysUserMessage.MessageType.ENTRUST);
if(wrapper.getCode() != 200){
......@@ -1593,7 +1618,11 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
List<SampleDistributionTeamVo> sampleDistributionTeamGroupVoList = distributionMapper.getDistributionTeamGroupList(sample.getId(), loginUser.getId());
if (sampleDistributionTeamGroupVoList != null && sampleDistributionTeamGroupVoList.size() > 0) {
for (SampleDistributionTeamVo sdVo : sampleDistributionTeamGroupVoList) {
iNormProductionService.createPreciprice(sdVo.getUserId(),entrust.getId(),sdVo.getTeamGroupId(),1,sample.getId());
try {
iPrecipriceService.createPreciprice(sdVo.getUserId(),entrust.getId(),sdVo.getTeamGroupId(),1,sample.getId());
}catch (Exception e){
return BaseResponse.errorMsg(e.getMessage());
}
}
}
sampleIdS.add(sample.getId());
......
......@@ -153,7 +153,7 @@ public class PrecipriceServiceImpl extends ServiceImpl<PrecipriceMapper, Precipr
if (BeanUtil.isEmpty(normProduction)) {
log.debug("产值记录新增失败,产值信息没找到!");
throw new IllegalArgumentException("处理项产值未配置配置!");
throw new IllegalArgumentException("联系管理员.配置产值信息!");
}
preciprice.setAnalyseRate(BigDecimal.valueOf(normProduction.getAnalyseRate()));
preciprice.setAssessRate(BigDecimal.valueOf(normProduction.getAssessId()));
......
......@@ -50,24 +50,24 @@ public class WeiXinService {
System.out.println("==================code===================");
System.out.println(code);
try {
/*String accessToken = null;
if (type.equals("PC")) {
accessToken = getAccessToken();
} else if (type.equals("APP")) {
accessToken = getPCAccessToken();
} else {
return BaseResponse.errorMsg("参数错误");
}
String param = "access_token=%s&code=%s";
param = String.format(param, accessToken, code);
JSONObject jsonObject = WeixinInterfaceUtil.doGet(Global.USERINFOURL, param);
if (jsonObject.get("errcode").toString().equals("40029")) {
return BaseResponse.errorMsg("code失效!");
}
String UserId = jsonObject.getString("UserId");
System.out.println("==================UserId===================");
System.out.println(UserId);
JSONObject userJson = getUser(accessToken, UserId);*/
// String accessToken = null;
// if (type.equals("PC")) {
// accessToken = getAccessToken();
// } else if (type.equals("APP")) {
// accessToken = getPCAccessToken();
// } else {
// return BaseResponse.errorMsg("参数错误");
// }
// String param = "access_token=%s&code=%s";
// param = String.format(param, accessToken, code);
// JSONObject jsonObject = WeixinInterfaceUtil.doGet(Global.USERINFOURL, param);
// if (jsonObject.get("errcode").toString().equals("40029")) {
// return BaseResponse.errorMsg("code失效!");
// }
// String UserId = jsonObject.getString("UserId");
// System.out.println("==================UserId===================");
// System.out.println(UserId);
// JSONObject userJson = getUser(accessToken, UserId);
QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
// wrapper.eq("phone", userJson.get("mobile"));
wrapper.eq("phone", code); //暂时用手机号代替code
......
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