From 4417a8d3799a03afc5e9c7333914359f0e3052be Mon Sep 17 00:00:00 2001
From: gdg <764716047@qq.com>
Date: 星期三, 30 十二月 2020 11:02:10 +0800
Subject: [PATCH] 修改库存个数bug问题
---
src/main/java/com/nanometer/smartlab/service/InterfaceServiceImpl.java | 35 ++++++++++++++++++++++++++++++-----
1 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/src/main/java/com/nanometer/smartlab/service/InterfaceServiceImpl.java b/src/main/java/com/nanometer/smartlab/service/InterfaceServiceImpl.java
index 081911c..1e79b44 100644
--- a/src/main/java/com/nanometer/smartlab/service/InterfaceServiceImpl.java
+++ b/src/main/java/com/nanometer/smartlab/service/InterfaceServiceImpl.java
@@ -1025,6 +1025,15 @@
return list;
}
+ @Override
+ public List<SysUser> getUserListByContainerCodeNew(String containerCode, String startTime, String endTime) throws ApiException{
+ if (containerCode==null||containerCode.isEmpty()) {
+ throw new ApiException(ApiStatus.PARAM_NO_EXIST, ApiStatus.PARAM_NO_EXIST.getRetMsg() + "[containerCode]");
+ }
+
+ return sysUserDao.getUserListByContainerCodeNew(containerCode, startTime, endTime);
+ }
+
@Override
@Transactional(propagation = Propagation.REQUIRED)
@@ -1338,7 +1347,7 @@
// 人员违规预警接口
@Override
- public void alarmperson(JSONObject jsonObject) throws ApiException, IOException {
+ public void alarmperson(JSONObject jsonObject) throws Exception {
JSONArray dataArr = jsonObject.getJSONArray("data");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -1397,12 +1406,19 @@
Timestamp warnTime;
try {
Date warningTime = sdf.parse(warningTimeStr);
+ //不接收时间超过现在的数据
+ if (warningTime.after(new Date())) {
+ throw new Exception("柜子时间发生错误");
+ }
warnTime = new Timestamp(warningTime.getTime());
sysAlarmPerson.setWarningTime(warnTime);
} catch (ParseException e) {
throw new ApiException(ApiStatus.PARAM_ERR);
- }
- // 将人员违规预警记录保存到数据库表
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new Exception(e.getMessage());
+ }
+ // 将人员违规预警记录保存到数据库表
int count = sysAlarmPersonDao.repeatedJudgment(containerCode, warningLevelInt, warnTime);
if (count<1){
//获取实验室条码和具体地点
@@ -1451,7 +1467,7 @@
logger.info(resData2);
}
}
- sysAlarmPersonDao.insertSysAlarmPerson(sysAlarmPerson);
+
if(enable && "2".equals(warningId) ) {
List<Map> personsInCharge = sysLaboratoryContainer.getContainerPersonInCharge(containerCode);
Map param = new HashMap();
@@ -1481,7 +1497,9 @@
});
}
if (phones.length() >0){
- phones.deleteCharAt(phones.length() - 1);}
+ phones.deleteCharAt(phones.length() - 1);
+
+ }
String suffix = String.format("?head=%s&signature=%s&content=%s&telnumber=%s", head, signature, content, phones.toString().replace(" ", ""));
CloseableHttpClient client = HttpClients.createDefault();
@@ -1489,9 +1507,16 @@
post.setHeader("Content-Type", "application/json;charset=UTF-8");
CloseableHttpResponse response = client.execute(post);
String resData = EntityUtils.toString(response.getEntity(),"UTF-8");
+ client.close();
+ JSONObject res = JSONObject.parseObject(resData);
+ if ("200".equals(res.getString("code")) && phones.length() >0){
+ String memo = String.format("短信已发送[%s]", phones);
+ sysAlarmPerson.setMemo(memo);
+ }
logger.info(resData);
}
+ sysAlarmPersonDao.insertSysAlarmPerson(sysAlarmPerson);
}
// 将人员扣分更新到人员表
if (warningPoint == null) {
--
Gitblit v1.9.2