From 374fb9d9369271b9b858e11a8612850ad3560936 Mon Sep 17 00:00:00 2001
From: kongzy <kongzy>
Date: 星期三, 11 十月 2023 10:22:40 +0800
Subject: [PATCH] 新增试剂供应商变更需求

---
 src/main/java/com/nanometer/smartlab/controller/ApplyMngController.java |   27 +++++---
 src/main/webapp/WEB-INF/guotai/guotai.properties                        |    6 +-
 src/main/webapp/WEB-INF/spring-db.xml                                   |   10 +++
 src/main/java/com/nanometer/smartlab/controller/BaseController.java     |   12 ++++
 readme.md                                                               |   58 +++++++++++++++++++
 src/main/webapp/apply_mng.xhtml                                         |    1 
 src/main/webapp/WEB-INF/config.properties                               |    2 
 pom.xml                                                                 |    4 
 src/main/webapp/index.xhtml                                             |    3 
 src/main/java/com/nanometer/smartlab/service/OpeOrderServiceImpl.java   |    2 
 src/main/webapp/WEB-INF/test/test.properties                            |    2 
 src/main/webapp/login.xhtml                                             |    2 
 12 files changed, 108 insertions(+), 21 deletions(-)

diff --git a/pom.xml b/pom.xml
index 4eb06f0..a5b08b2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -227,6 +227,7 @@
       <groupId>mysql</groupId>
       <artifactId>mysql-connector-java</artifactId>
       <version>5.1.40</version>
+<!--      <version>8.0.20</version>-->
     </dependency>
     <dependency>
       <groupId>commons-beanutils</groupId>
@@ -394,7 +395,7 @@
     <profile>
       <id>test</id>
       <properties>
-        <profile.active>cq</profile.active>
+        <profile.active>sin</profile.active>
       </properties>
       <activation>
         <activeByDefault>true</activeByDefault>
@@ -524,7 +525,6 @@
   <build>
     <finalName>smartlab</finalName>
     <filters>
-
       <filter>src/main/webapp/WEB-INF/${profile.active}/${profile.active}.properties</filter>
     </filters>
     <plugins>
diff --git a/readme.md b/readme.md
new file mode 100644
index 0000000..b4e2892
--- /dev/null
+++ b/readme.md
@@ -0,0 +1,58 @@
+需求:
+1、所有厂家是国药的试剂,供应商为国药试剂;
+2、 如果是管制品,厂家不是国药是的试剂,供应商为福得科技;
+3、 其他所有试剂厂家为思锐达
+
+
+select id from base_meta where group_id='product_name' and meta_value='国药试剂'
+
+select id from sys_supplier where name="国药集团化学试剂苏州有限公司"
+
+select id from sys_supplier where name="苏州福得科技有限公司"
+
+select id from sys_supplier where name="上海思锐达化学科技有限公司"
+
+
+
+select * from sys_reagent a
+inner join base_meta b on a.product_home=b.id
+where b.group_id='product_name' and b.meta_value='国药试剂' and a.type=1
+
+
+
+select * from sys_reagent a
+where a.product_home not in (select id from base_meta where group_id='product_name' and meta_value='国药试剂')
+and (a.control_products is not null and a.control_products!='') and a.type=1
+
+
+
+select * from sys_reagent a
+where a.product_home not in (select id from base_meta where group_id='product_name' and meta_value='国药试剂')
+and (a.control_products is  null or a.control_products='') and a.type=1
+
+select a.* from sys_reagent a
+left join base_meta b on b.id=a.control_products
+where a.product_home not in (select id from base_meta where group_id='product_name' and meta_value='国药试剂')
+and (b.meta_value='' or b.meta_value is null) and a.type=1
+
+
+
+update sys_reagent set supplier_id =(select id from sys_supplier where name="国药集团化学试剂苏州有限公司")
+where id in (select bb.id from (select a.id from sys_reagent a
+inner join base_meta b on a.product_home=b.id
+where b.group_id='product_name' and b.meta_value='国药试剂' and a.type=1) as bb)
+
+
+update sys_reagent set supplier_id =(select id from sys_supplier where name="苏州福得科技有限公司")
+where id in (select bb.id from (select a.id from sys_reagent a
+left join base_meta b on b.id=a.control_products
+where a.product_home not in (select id from base_meta where group_id='product_name' and meta_value='国药试剂')
+and (a.control_products is not null and a.control_products!='') and a.type=1
+and b.meta_value!='' and b.meta_value is not null) as bb)
+
+
+update sys_reagent set supplier_id =(select id from sys_supplier where name="上海思锐达化学科技有限公司" limit 1)
+where id in (select bb.id from (select a.id from sys_reagent a
+left join base_meta b on b.id=a.control_products
+where a.product_home not in (select id from base_meta where group_id='product_name' and meta_value='国药试剂')
+and (b.meta_value='' or b.meta_value is null) and a.type=1) as bb)
\ No newline at end of file
diff --git a/src/main/java/com/nanometer/smartlab/controller/ApplyMngController.java b/src/main/java/com/nanometer/smartlab/controller/ApplyMngController.java
index 4fcfea1..b49b41a 100644
--- a/src/main/java/com/nanometer/smartlab/controller/ApplyMngController.java
+++ b/src/main/java/com/nanometer/smartlab/controller/ApplyMngController.java
@@ -255,6 +255,7 @@
             headerList.add("含税售价");
             headerList.add("CAS号");
             headerList.add("危险性质");
+            headerList.add("供应商");
             headerList.add("厂家");
             headerList.add("试剂类型");
             headerList.add("申购数量");
@@ -266,6 +267,7 @@
             headerList.add("二级审批者");
             headerList.add("订单状态");
             headerList.add("审批批注");
+
             HSSFWorkbook hssfWorkbook =exportExcelNew(headerList, realDataList);
             hssfWorkbook.write(out);
             out.flush();
@@ -342,24 +344,27 @@
             dataRow.createCell(6).setCellValue(dataList.get(i).getReagent().getPrice()== null ? "": String.valueOf(dataList.get(i).getReagent().getPrice()));
             dataRow.createCell(7).setCellValue(dataList.get(i).getReagent().getCas()== null ? "": String.valueOf(dataList.get(i).getReagent().getCas()));
             dataRow.createCell(8).setCellValue(dataList.get(i).getReagent().getReagentCharacter()== null ? "": String.valueOf(baseMetaService.getBaseMetaValue(dataList.get(i).getReagent().getReagentCharacter())));
-            dataRow.createCell(9).setCellValue(dataList.get(i).getReagent().getProductHomeName()== null ? "": String.valueOf(dataList.get(i).getReagent().getProductHomeName()));
-            dataRow.createCell(10).setCellValue(dataList.get(i).getReagent().getReagentType()== null ? "": String.valueOf(baseMetaService.getBaseMetaValue(dataList.get(i).getReagent().getReagentType())));
-            dataRow.createCell(11).setCellValue(String.valueOf(dataList.get(i).getNum()));
-            dataRow.createCell(12).setCellValue(String.valueOf(dataList.get(i).getApplyUserName()));
-            dataRow.createCell(13).setCellValue(dataList.get(i).getApplyUserProject() == null?"":String.valueOf(dataList.get(i).getApplyUserProject()));
-            dataRow.createCell(14).setCellValue(dataList.get(i).getApplyUserDepartment() == null?"":String.valueOf(dataList.get(i).getApplyUserDepartment()));
+            dataRow.createCell(9).setCellValue(dataList.get(i).getReagent().getSupplierName()== null ? "": String.valueOf(dataList.get(i).getReagent().getSupplierName()));
 
 
-            dataRow.createCell(15).setCellValue(String.valueOf(dataList.get(i).getCreateTime()));
+            dataRow.createCell(10).setCellValue(dataList.get(i).getReagent().getProductHomeName()== null ? "": String.valueOf(dataList.get(i).getReagent().getProductHomeName()));
+            dataRow.createCell(11).setCellValue(dataList.get(i).getReagent().getReagentType()== null ? "": String.valueOf(baseMetaService.getBaseMetaValue(dataList.get(i).getReagent().getReagentType())));
+            dataRow.createCell(12).setCellValue(String.valueOf(dataList.get(i).getNum()));
+            dataRow.createCell(13).setCellValue(String.valueOf(dataList.get(i).getApplyUserName()));
+            dataRow.createCell(14).setCellValue(dataList.get(i).getApplyUserProject() == null?"":String.valueOf(dataList.get(i).getApplyUserProject()));
+            dataRow.createCell(15).setCellValue(dataList.get(i).getApplyUserDepartment() == null?"":String.valueOf(dataList.get(i).getApplyUserDepartment()));
+
+
+            dataRow.createCell(16).setCellValue(String.valueOf(dataList.get(i).getCreateTime()));
            // SysUser u=sysUserService.getSysUser(dataList.get(i).getApproveUserId());
-            dataRow.createCell(16).setCellValue(String.valueOf(dataList.get(i).getFirName()));
+            dataRow.createCell(17).setCellValue(String.valueOf(dataList.get(i).getFirName()));
             if(dataList.get(i).getBeforeApproveUserId()!=null && !dataList.get(i).getBeforeApproveUserId().equals("")){
                 //u=sysUserService.getSysUser(dataList.get(i).getBeforeApproveUserId());
-                dataRow.createCell(17).setCellValue(String.valueOf(dataList.get(i).getApproveUserName()));
+                dataRow.createCell(18).setCellValue(String.valueOf(dataList.get(i).getApproveUserName()));
             }
             //dataRow.createCell(14).setCellValue(String.valueOf(u.getName()));
-            dataRow.createCell(18).setCellValue(String.valueOf(dataList.get(i).getStatus().getText()));
-            dataRow.createCell(19).setCellValue(dataList.get(i).getMemo()==null ?"":String.valueOf(dataList.get(i).getMemo()));
+            dataRow.createCell(19).setCellValue(String.valueOf(dataList.get(i).getStatus().getText()));
+            dataRow.createCell(20).setCellValue(dataList.get(i).getMemo()==null ?"":String.valueOf(dataList.get(i).getMemo()));
         }
 
         return hssfWorkbook;
diff --git a/src/main/java/com/nanometer/smartlab/controller/BaseController.java b/src/main/java/com/nanometer/smartlab/controller/BaseController.java
index f844bc3..0598a46 100644
--- a/src/main/java/com/nanometer/smartlab/controller/BaseController.java
+++ b/src/main/java/com/nanometer/smartlab/controller/BaseController.java
@@ -5,6 +5,7 @@
 import org.apache.commons.lang.StringUtils;
 import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.subject.Subject;
+import org.springframework.beans.factory.annotation.Value;
 
 import java.io.Serializable;
 
@@ -12,6 +13,10 @@
  * Created by johnny on 15/12/24.
  */
 public class BaseController implements Serializable {
+
+
+    @Value("${institute.name}")
+    private String title;
 
     public Subject getSubject() {
         return SecurityUtils.getSubject();
@@ -63,4 +68,11 @@
         }
         return null;
     }
+
+    public String getTitle(){
+        if(StringUtils.isBlank(this.title)){
+            return "中国科学院苏州纳米技术与纳米仿生研究所";
+        }
+        return this.title;
+    }
 }
diff --git a/src/main/java/com/nanometer/smartlab/service/OpeOrderServiceImpl.java b/src/main/java/com/nanometer/smartlab/service/OpeOrderServiceImpl.java
index ea1518d..9f6172b 100644
--- a/src/main/java/com/nanometer/smartlab/service/OpeOrderServiceImpl.java
+++ b/src/main/java/com/nanometer/smartlab/service/OpeOrderServiceImpl.java
@@ -301,6 +301,8 @@
                 opeWarehouseReserve.setReagentId(opeApply.getReagent().getId());
                 opeWarehouseReserve.setArticleNumber(opeApply.getArticleNumber());
                 opeWarehouseReserve.setReserve(0);
+                opeWarehouseReserve.setWarehouseId(opeApply.getHouseId());
+                opeWarehouseReserve.setContainerId(opeApply.getContainerId());
             }
             opeWarehouseReserve.setReserve(opeWarehouseReserve.getReserve() + opeApply.getArrivalNum());
             if (StringUtils.isBlank(opeWarehouseReserve.getId())) {
diff --git a/src/main/webapp/WEB-INF/config.properties b/src/main/webapp/WEB-INF/config.properties
index 0d6e156..97a1f1a 100644
--- a/src/main/webapp/WEB-INF/config.properties
+++ b/src/main/webapp/WEB-INF/config.properties
@@ -4,6 +4,8 @@
 #jdbc.username=root
 #jdbc.password=123456
 ##
+
+
 jdbc.url=${jdbc.url}
 jdbc.username=${jdbc.username}
 jdbc.password=${jdbc.password}
diff --git a/src/main/webapp/WEB-INF/guotai/guotai.properties b/src/main/webapp/WEB-INF/guotai/guotai.properties
index 8acc6ca..0ce4e48 100644
--- a/src/main/webapp/WEB-INF/guotai/guotai.properties
+++ b/src/main/webapp/WEB-INF/guotai/guotai.properties
@@ -1,14 +1,14 @@
-jdbc.url=jdbc:mysql://sinanoaq.com:23306/safeplatform.smartlab.guotai?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
+jdbc.url=jdbc:mysql://sinanoaq.com:23306/safeplatform.smartlab.guotai?useUnicode=true&amp;characterEncoding=utf-8&amp;serverTimezone=Asia/Shanghai&amp;useSSL=false
 jdbc.username=root
 jdbc.password=NMS@uss20201!
 
 institute.id = 10
-institute.name = \u65b0\u7586\u56fd\u6cf0\u65b0\u534e\u5316\u5de5\u6709\u9650\u8d23\u4efb\u516c\u53f8
+institute.name = \u65B0\u7586\u56FD\u6CF0\u65B0\u534E\u5316\u5DE5\u6709\u9650\u8D23\u4EFB\u516C\u53F8
 institute.url  = http://222.92.213.22:18001
 institute.app.id = wxef5464cb3cd407ea
 institute.app.secret = f0b8dec4bc340a9863ed7de08cf2dcf1
 alarm.url =
 reagent.detail.price.api =
-institute.copyright= Copyright\u00A92022 \u65b0\u7586\u56fd\u6cf0\u65b0\u534e\u5316\u5de5\u6709\u9650\u8d23\u4efb\u516c\u53f8
+institute.copyright= Copyright\u00A92022 \u65B0\u7586\u56FD\u6CF0\u65B0\u534E\u5316\u5DE5\u6709\u9650\u8D23\u4EFB\u516C\u53F8
 
 message.url= https://sinanoaq.com:8095/api/sendmessage
diff --git a/src/main/webapp/WEB-INF/spring-db.xml b/src/main/webapp/WEB-INF/spring-db.xml
index d96b143..81821fc 100644
--- a/src/main/webapp/WEB-INF/spring-db.xml
+++ b/src/main/webapp/WEB-INF/spring-db.xml
@@ -13,10 +13,18 @@
     <!--配数据源 -->
     <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"
           init-method="init" destroy-method="close">
+        <!--mysql 5连接驱动-->
         <property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
-        <property name="url" value="jdbc:mysql://124.221.143.185:23306/smartlb?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true&amp;useSSL=false" />
+        <property name="url" value="jdbc:mysql://124.221.143.185:23306/smartlb?useUnicode=true&amp;characterEncoding=utf-8&amp;serverTimezone=Asia/Shanghai&amp;useSSL=false" />
+
+<!--        <property name="url" value="jdbc:mysql://124.221.143.185:23306/smartlb?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true&amp;useSSL=false" />-->
         <property name="username" value="smartlb" />
         <property name="password" value="kabAG6TmMhrmB7MJ" />
+        <!--mysql 8连接驱动-->
+<!--        <property name="driverClassName" value="com.mysql.cj.jdbc.Driver"/>-->
+<!--        <property name="url" value="jdbc:mysql://127.0.0.1:3306/smartlb?useUnicode=true&amp;characterEncoding=utf-8&amp;serverTimezone=Asia/Shanghai&amp;useSSL=false" />-->
+<!--        <property name="username" value="root" />-->
+<!--        <property name="password" value="password" />-->
 
         <!-- 初始化连接大小 -->
         <property name="initialSize" value="1" />
diff --git a/src/main/webapp/WEB-INF/test/test.properties b/src/main/webapp/WEB-INF/test/test.properties
index 021a362..f3fd83a 100644
--- a/src/main/webapp/WEB-INF/test/test.properties
+++ b/src/main/webapp/WEB-INF/test/test.properties
@@ -1,6 +1,6 @@
 jdbc.url=jdbc:mysql://localhost:3306/smartlabdb?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true&amp;useSSL=false
 jdbc.username=root
-jdbc.password=123456
+jdbc.password=password
 
 institute.id = 2
 institute.name = \u4E2D\u56FD\u79D1\u5B66\u9662\u82CF\u5DDE\u7EB3\u7C73\u6280\u672F\u4E0E\u7EB3\u7C73\u4EFF\u751F\u7814\u7A76\u6240
diff --git a/src/main/webapp/apply_mng.xhtml b/src/main/webapp/apply_mng.xhtml
index dbd9554..e1fa86b 100644
--- a/src/main/webapp/apply_mng.xhtml
+++ b/src/main/webapp/apply_mng.xhtml
@@ -147,7 +147,6 @@
                 <p:column headerText="危险性质" width="79px;">
                     <h:outputText value="#{baseMetaService.getBaseMetaValue(row.reagent.reagentCharacter)}" style="white-space: normal;font-size: 13px;"></h:outputText>
                 </p:column>
-
                 <p:column headerText="厂家">
                     <h:outputText value="#{row.reagent!=null?row.reagent.productHomeName:''}"></h:outputText>
                 </p:column>
diff --git a/src/main/webapp/index.xhtml b/src/main/webapp/index.xhtml
index 3c7456f..d7ac4d7 100644
--- a/src/main/webapp/index.xhtml
+++ b/src/main/webapp/index.xhtml
@@ -23,7 +23,8 @@
                         <p:graphicImage value="/resources/images/logo.png" style="width: 80px;height: 80px"></p:graphicImage>
                     </p:column>
                     <p:column styleClass="header-title">
-                        <p:outputLabel value="中国科学院苏州纳米技术与纳米仿生研究所"></p:outputLabel>
+                        <p:outputLabel value="#{loginController.title}"></p:outputLabel>
+<!--                        <p:outputLabel value="中国科学院苏州纳米技术与纳米仿生研究所"></p:outputLabel>-->
                         <br/>
                         <p:outputLabel value="智慧实验室试剂全过程安全管理系统" style="color: #ffd74a"></p:outputLabel>
 <!--                        <p:outputLabel value="智能安全危险化学品全生命周期管控系统" style="color: #ffd74a"></p:outputLabel>-->
diff --git a/src/main/webapp/login.xhtml b/src/main/webapp/login.xhtml
index 506c332..a152e44 100644
--- a/src/main/webapp/login.xhtml
+++ b/src/main/webapp/login.xhtml
@@ -26,7 +26,7 @@
 							<p:graphicImage value="/resources/images/logo.png" style="width: 80px;height: 80px"></p:graphicImage>
 						</p:column>
 						<p:column styleClass="header-title">
-							<p:outputLabel value="中国科学院苏州纳米技术与纳米仿生研究所"></p:outputLabel>
+							<p:outputLabel value="#{loginController.title}"></p:outputLabel>
 							<br />
 							<p:outputLabel value="智慧实验室试剂全过程安全管理系统" style="color: #ffd74a"></p:outputLabel>
 <!--							<p:outputLabel value="智能安全危险化学品全生命周期管控系统" style="color: #ffd74a"></p:outputLabel>-->

--
Gitblit v1.9.2