From e9491aef23ef853e5b342a326291cde01e21ba5b Mon Sep 17 00:00:00 2001
From: YYC <1833023622@qq.com>
Date: 星期五, 15 九月 2023 14:10:09 +0800
Subject: [PATCH] 熏蒸备案修改
---
igds-recir/src/main/java/com/ld/igds/models/DrugLogApply.java | 7 -
igds-recir/src/main/java/com/ld/igds/models/DrugLogDtl.java | 17 -----
igds-recir/src/main/java/com/ld/igds/models/DrugLogPeople.java | 16 ----
igds-recir/src/main/java/com/ld/igds/drug/service/HDrugLogApplyService.java | 88 +++++++++++++----------------
igds-recir/src/main/java/com/ld/igds/models/DrugLogWay.java | 18 -----
5 files changed, 47 insertions(+), 99 deletions(-)
diff --git a/igds-recir/src/main/java/com/ld/igds/drug/service/HDrugLogApplyService.java b/igds-recir/src/main/java/com/ld/igds/drug/service/HDrugLogApplyService.java
index f2e7b8f..79420de 100644
--- a/igds-recir/src/main/java/com/ld/igds/drug/service/HDrugLogApplyService.java
+++ b/igds-recir/src/main/java/com/ld/igds/drug/service/HDrugLogApplyService.java
@@ -1,14 +1,13 @@
package com.ld.igds.drug.service;
-import com.bstek.bdf2.core.model.DefaultDept;
import com.bstek.bdf2.core.orm.hibernate.HibernateDao;
import com.bstek.dorado.data.provider.Page;
import com.ld.igds.constant.RedisConst;
import com.ld.igds.models.*;
import com.ld.igds.util.ContextUtil;
import com.ld.igds.util.RedisUtil;
-import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.time.DateFormatUtils;
import org.hibernate.Session;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -47,7 +46,7 @@
if (null != param) {
buildHql(hql, param, args);
}
- hql.append(" order by id ");
+ hql.append(" order by xzbm ");
String countHql = "select count(*) " + hql.toString();
this.pagingQuery(page, String.valueOf(hql), countHql, args);
}
@@ -69,7 +68,7 @@
data.setUpdateTime(new Date());
try {
if (null == data.getXzbm()) {
- String id = createId(data.getCompanyId());
+ String id = createId(data.getCompanyId(), data.getTbrq());
data.setXzbm(id);
}
if (StringUtils.isEmpty(data.getDtlId())) {
@@ -78,27 +77,26 @@
if (StringUtils.isEmpty(data.getWayId())) {
data.setWayId(ContextUtil.getUUID());
}
- //娣诲姞绮儏瀛愯〃
- saveDtl(data);
- //娣诲姞澶囨鏂瑰紡瀛愯〃
- saveWay(data);
//娣诲姞涓昏〃
session.saveOrUpdate(data);
if (!CollectionUtils.isEmpty(data.getDrugLogPeople())) {
for (DrugLogPeople drugLogPeople : data.getDrugLogPeople()) {
if (null == drugLogPeople.getPropleId()) {
- String tbrq = DateFormatUtils.format(data.getTbrq(), "yyyyMMdd");
drugLogPeople.setPropleId(ContextUtil.getUUID());
- drugLogPeople.setId(data.getDeptId() + tbrq + data.getXzbm());
- drugLogPeople.setTbrq(data.getTbrq());
drugLogPeople.setDrugLogId(data.getXzbm());
- drugLogPeople.setDeptId(data.getDeptId());
}
session.saveOrUpdate(drugLogPeople);
- session.flush();
}
}
+ DrugLogWay way = new DrugLogWay();
+ BeanUtils.copyProperties(data, way);
+ way.setDrugLogId(data.getXzbm());
+ session.saveOrUpdate(way);
+ DrugLogDtl dtl = new DrugLogDtl();
+ BeanUtils.copyProperties(data, dtl);
+ way.setDrugLogId(data.getXzbm());
+ session.saveOrUpdate(dtl);
} catch (Exception e) {
e.printStackTrace();
} finally {
@@ -115,8 +113,6 @@
DrugLogWay way = new DrugLogWay();
BeanUtils.copyProperties(data, way);
way.setWayId(ContextUtil.getUUID());
- String tbrq = DateFormatUtils.format(data.getTbrq(), "yyyyMMdd");
- way.setId(data.getDeptId() + tbrq + data.getXzbm());
session.saveOrUpdate(way);
} catch (Exception e) {
e.printStackTrace();
@@ -136,8 +132,6 @@
try {
DrugLogDtl dtl = new DrugLogDtl();
BeanUtils.copyProperties(data, dtl);
- String tbrq = DateFormatUtils.format(data.getTbrq(), "yyyyMMdd");
- dtl.setId(data.getDeptId() + tbrq + data.getXzbm());
session.saveOrUpdate(dtl);
} catch (Exception e) {
e.printStackTrace();
@@ -183,9 +177,10 @@
hql.append(" from " + DrugLogApply.class.getName() + " where companyId=:companyId");
args.put("companyId", ContextUtil.getCompanyId());
if (null != param) {
+
buildHql(hql, param, args);
}
- hql.append(" order by id desc");
+ hql.append(" order by xzbm desc");
return this.query(String.valueOf(hql), args);
}
@@ -211,13 +206,10 @@
* @return
*/
public String saveDrugLogDtl(DrugLogDtl data) {
- if (null == data.getDeptId()) {
- data.setDeptId(ContextUtil.subDeptId(null));
- }
Session session = this.getSessionFactory().openSession();
try {
- if (null == data.getId()) {
- data.setId(ContextUtil.getUUID());
+ if (null == data.getDtlId()) {
+ data.setDtlId(ContextUtil.getUUID());
session.save(data);
} else {
session.update(data);
@@ -241,7 +233,7 @@
public String delDrugLogDtl(DrugLogDtl data) {
Session session = this.getSessionFactory().openSession();
try {
- if (null != data.getId()) {
+ if (null != data.getDtlId()) {
session.delete(data);
}
} catch (Exception e) {
@@ -284,13 +276,10 @@
* @return
*/
public String saveDrugLogPeople(DrugLogPeople data) {
- if (null == data.getDeptId()) {
- data.setDeptId(ContextUtil.subDeptId(null));
- }
Session session = this.getSessionFactory().openSession();
try {
- if (null == data.getId()) {
- data.setId(ContextUtil.getUUID());
+ if (null == data.getPropleId()) {
+ data.setPropleId(ContextUtil.getUUID());
session.save(data);
} else {
session.update(data);
@@ -314,7 +303,7 @@
public String delDrugLogPeople(DrugLogPeople data) {
Session session = this.getSessionFactory().openSession();
try {
- if (null != data.getId()) {
+ if (null != data.getPropleId()) {
session.delete(data);
}
} catch (Exception e) {
@@ -338,11 +327,8 @@
if (null != param) {
String xzbm = (String) param.get("xzbm");
- String deptId = (String) param.get("deptId");
- String tbrq = DateFormatUtils.format((Date) param.get("tbsj"), "yyMMdd");
- String id = xzbm + deptId + tbrq;
hql.append(" from " + DrugLogWay.class.getName() + " where id=:id");
- args.put("id", id);
+ args.put("id", xzbm);
buildHql(hql, param, args);
}
return this.query(String.valueOf(hql), args);
@@ -356,13 +342,10 @@
* @return
*/
public String saveDrugLogWay(DrugLogWay data) {
- if (null == data.getDeptId()) {
- data.setDeptId(ContextUtil.subDeptId(null));
- }
Session session = this.getSessionFactory().openSession();
try {
- if (null == data.getId()) {
- data.setId(ContextUtil.getUUID());
+ if (null == data.getWayId()) {
+ data.setWayId(ContextUtil.getUUID());
session.save(data);
} else {
session.update(data);
@@ -385,7 +368,7 @@
public String delDrugLogWay(DrugLogWay data) {
Session session = this.getSessionFactory().openSession();
try {
- if (null != data.getId()) {
+ if (null != data.getWayId()) {
session.delete(data);
}
} catch (Exception e) {
@@ -410,6 +393,11 @@
hql.append(" and drugLogId=:drugLogId");
args.put("drugLogId", str);
}
+ str = (String) param.get("id");
+ if (StringUtils.isNotEmpty(str)) {
+ hql.append(" and xzbm like:id");
+ args.put("id", str + "%");
+ }
str = (String) param.get("depotId");
if (StringUtils.isNotEmpty(str)) {
hql.append(" and depotId=:depotId");
@@ -427,25 +415,27 @@
}
}
- public String createId(String companyId) throws Exception {
+ public String createId(String companyId, Date time) throws Exception {
+ String timeKey = DateFormatUtils.format(time, "yyyyMMdd");
// 浠庣紦瀛樹腑鑾峰彇宸叉湁鐨勭粍缁囩紪鐮�
String cacheKey = RedisConst.buildKey(companyId, HDrugLogApplyService.CACHE_DRUG_LOG_APPLY_ID);
String cacheId = (String) redisUtil.get(cacheKey);
-
- if (null != cacheId) {
- Integer i = Integer.valueOf(cacheId);
- cacheId = String.format("%04d", ++i);
+ if (null != cacheId && cacheId.indexOf(timeKey) >= 0) {
+ String temp = cacheId.substring(cacheId.length() - 4);
+ Integer i = Integer.valueOf(temp);
+ cacheId = timeKey + String.format("%04d", ++i);
} else {
- List<DrugLogApply> drugLogApplies = this.drugLogApplyList(null);
+ Map<String, Object> param = new HashMap<>();
+ param.put("id", timeKey);
+ List<DrugLogApply> drugLogApplies = this.drugLogApplyList(param);
if (null == drugLogApplies || drugLogApplies.size() == 0) {
- cacheId = "0001";
+ cacheId = timeKey + "0001";
} else {
-
String temp = drugLogApplies.get(0).getXzbm();
Integer i = Integer.valueOf(temp);
- cacheId = String.format("%04d", ++i);
+ cacheId = timeKey + String.format("%04d", ++i);
}
}
// 鏇存柊缂撳瓨
diff --git a/igds-recir/src/main/java/com/ld/igds/models/DrugLogApply.java b/igds-recir/src/main/java/com/ld/igds/models/DrugLogApply.java
index 5b7cd4d..d1e8ef5 100644
--- a/igds-recir/src/main/java/com/ld/igds/models/DrugLogApply.java
+++ b/igds-recir/src/main/java/com/ld/igds/models/DrugLogApply.java
@@ -20,11 +20,10 @@
public class DrugLogApply implements Serializable {
@Id
- @Column(name = "xzbm", length = 4)
- @PropertyDef(label = "鐔忚捀澶囨缂栧彿", description = "4浣嶉『搴忓彿")
+ @Column(name = "xzbm", length = 12)
+ @PropertyDef(label = "鐔忚捀澶囨缂栧彿", description = "濉姤鏃ユ湡yyyyMMdd+4浣嶉『搴忓彿")
private String xzbm;
- @Id
@Column(name = "DEPT_ID_", length = 21)
@PropertyDef(label = "搴撳尯浠g爜")
private String deptId;
@@ -33,7 +32,6 @@
@PropertyDef(label = "缁勭粐缂栫爜")
private String companyId;
- @Id
@Column(name = "tbrq")
@PropertyDef(label = "濉姤鏃ユ湡")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
@@ -152,7 +150,6 @@
/**
* 鍌ㄧ伯绮儏鏄庣粏琛�
- *
*/
@Transient
private List<DrugLogDtl> drugLogDtls;
diff --git a/igds-recir/src/main/java/com/ld/igds/models/DrugLogDtl.java b/igds-recir/src/main/java/com/ld/igds/models/DrugLogDtl.java
index f44e71d..ca89998 100644
--- a/igds-recir/src/main/java/com/ld/igds/models/DrugLogDtl.java
+++ b/igds-recir/src/main/java/com/ld/igds/models/DrugLogDtl.java
@@ -26,22 +26,9 @@
@PropertyDef(label = "dtlId")
private String dtlId;
- @Column(name = "ID_", length = 40)
- @PropertyDef(label = "id", description = "搴撳尯浠g爜+濉姤鏃ユ湡+鐔忚捀缂栧彿")
- private String id;
-
- @Column(name = "DRUG_LOG_ID_", length = 4)
- @PropertyDef(label = "鐔忚捀澶囨缂栧彿", description = "4浣嶉『搴忓彿")
+ @Column(name = "DRUG_LOG_ID_", length = 12)
+ @PropertyDef(label = "鐔忚捀澶囨缂栧彿", description = "濉姤鏃ユ湡yyyyMMdd+4浣嶉『搴忓彿")
private String drugLogId;
-
- @Column(name = "DEPT_ID_", length = 21)
- @PropertyDef(label = "搴撳尯浠g爜")
- private String deptId;
-
- @Column(name = "tbrq")
- @PropertyDef(label = "濉姤鏃ユ湡")
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
- private Date tbrq;
@Column(name = "DEPOT_ID_", length = 50)
@PropertyDef(label = "浠撴埧/娌圭綈浠g爜")
diff --git a/igds-recir/src/main/java/com/ld/igds/models/DrugLogPeople.java b/igds-recir/src/main/java/com/ld/igds/models/DrugLogPeople.java
index 1ad403f..1a97371 100644
--- a/igds-recir/src/main/java/com/ld/igds/models/DrugLogPeople.java
+++ b/igds-recir/src/main/java/com/ld/igds/models/DrugLogPeople.java
@@ -26,22 +26,10 @@
@PropertyDef(label = "propleId")
private String propleId;
- @Column(name = "ID_", length = 40)
- @PropertyDef(label = "id", description = "搴撳尯浠g爜+濉姤鏃ユ湡+鐔忚捀缂栧彿")
- private String id;
- @Column(name = "DRUG_LOG_ID_", length = 4)
- @PropertyDef(label = "鐔忚捀澶囨缂栧彿", description = "4浣嶉『搴忓彿")
+ @Column(name = "DRUG_LOG_ID_", length = 12)
+ @PropertyDef(label = "鐔忚捀澶囨缂栧彿", description = "濉姤鏃ユ湡yyyyMMdd+4浣嶉『搴忓彿")
private String drugLogId;
-
- @Column(name = "DEPT_ID_", length = 21)
- @PropertyDef(label = "搴撳尯浠g爜")
- private String deptId;
-
- @Column(name = "tbrq")
- @PropertyDef(label = "濉姤鏃ユ湡")
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
- private Date tbrq;
@Column(name = "mx", length = 20)
@PropertyDef(label = "濮撳悕")
diff --git a/igds-recir/src/main/java/com/ld/igds/models/DrugLogWay.java b/igds-recir/src/main/java/com/ld/igds/models/DrugLogWay.java
index d58e009..c272226 100644
--- a/igds-recir/src/main/java/com/ld/igds/models/DrugLogWay.java
+++ b/igds-recir/src/main/java/com/ld/igds/models/DrugLogWay.java
@@ -27,23 +27,9 @@
@PropertyDef(label = "wayId")
private String wayId;
- @Column(name = "ID_", length = 40)
- @PropertyDef(label = "id", description = "涓庡妗堜俊鎭叧鑱擨D锛屽簱鍖轰唬鐮�+鐔忚捀缂栫爜+濉姤鏃ユ湡")
- private String id;
-
- @Column(name = "DRUG_LOG_ID_", length = 4)
- @PropertyDef(label = "鐔忚捀澶囨缂栧彿", description = "4浣嶉『搴忓彿")
+ @Column(name = "DRUG_LOG_ID_", length = 12)
+ @PropertyDef(label = "鐔忚捀澶囨缂栧彿", description = "濉姤鏃ユ湡yyyyMMdd+4浣嶉『搴忓彿")
private String drugLogId;
-
- @Column(name = "DEPT_ID_", length = 21)
- @PropertyDef(label = "搴撳尯浠g爜")
- @JSONField
- private String deptId;
-
- @Column(name = "tbrq")
- @PropertyDef(label = "濉姤鏃ユ湡")
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
- private Date tbrq;
@Column(name = "xznd", precision = 20, scale = 3)
@PropertyDef(label = "璁惧畾鐔忚捀娴撳害", description = "鍗曚綅锛歮l/m鲁")
--
Gitblit v1.9.3