From 306e2714266cef35638514f05cf4f643857608d9 Mon Sep 17 00:00:00 2001
From: YYC <1833023622@qq.com>
Date: 星期三, 26 七月 2023 19:06:34 +0800
Subject: [PATCH] 药剂管理

---
 igds-recir/src/main/java/com/ld/igds/drug/service/HDrugLogService.java |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/igds-recir/src/main/java/com/ld/igds/drug/service/HDrugLogService.java b/igds-recir/src/main/java/com/ld/igds/drug/service/HDrugLogService.java
index bf969f7..7b5a279 100644
--- a/igds-recir/src/main/java/com/ld/igds/drug/service/HDrugLogService.java
+++ b/igds-recir/src/main/java/com/ld/igds/drug/service/HDrugLogService.java
@@ -9,6 +9,7 @@
 import org.apache.commons.lang3.time.DateFormatUtils;
 import org.hibernate.Session;
 import org.springframework.stereotype.Service;
+
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -42,11 +43,11 @@
 
     }
 
-    private List<DrugLog> getDrugLogByTime(String companyId){
+    private List<DrugLog> getDrugLogByTime(String companyId) {
         String hql = " from " + DrugLog.class.getName()
                 + " where companyId =:companyId ";
 
-        Map<String,Object> args = new HashMap<String,Object>();
+        Map<String, Object> args = new HashMap<String, Object>();
         args.put("companyId", companyId);
 
         hql += " and updateTime >:startTime";
@@ -62,18 +63,18 @@
         return this.query(hql, args);
     }
 
-    public String getIndex(String companyId){
+    public String getIndex(String companyId) {
         List<DrugLog> list = getDrugLogByTime(companyId);
         String index = "001";
-        if(list != null && list.size() > 0){
+        if (list != null && list.size() > 0) {
             String id = list.get(0).getId().substring(8);
             int temp = Integer.valueOf(id) + 1;
             index = temp + "";
         }
-        if(index.length() == 1){
+        if (index.length() == 1) {
             index = "00" + index;
         }
-        if(index.length() == 2){
+        if (index.length() == 2) {
             index = "0" + index;
         }
         return index;
@@ -91,7 +92,7 @@
         data.setUpdateUser(ContextUtil.getLoginUserCName());
         try {
             if (null == data.getId()) {
-                data.setId(DateFormatUtils.format(new Date(), "yyyyMMdd") + getIndex(data.getCompanyId()));
+                data.setId(data.getDepotId() + DateFormatUtils.format(new Date(), "yyyyMMdd") + getIndex(data.getCompanyId()));
                 session.save(data);
             } else {
                 session.update(data);
@@ -103,6 +104,7 @@
             session.close();
         }
     }
+
     public String delData(DrugLog data) {
         Session session = this.getSessionFactory().openSession();
         try {

--
Gitblit v1.9.3