Переглянути джерело

Merge branch 'dev-2.4.0' of depot-qinghai/depot-storage-qinghai into dev

gdd 1 рік тому
батько
коміт
8ae29cee90

+ 31 - 0
.classpath

@@ -0,0 +1,31 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<classpath>
3
+	<classpathentry including="**/*.java" kind="src" output="target/classes" path="src/main/java">
4
+		<attributes>
5
+			<attribute name="optional" value="true"/>
6
+			<attribute name="maven.pomderived" value="true"/>
7
+		</attributes>
8
+	</classpathentry>
9
+	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
10
+		<attributes>
11
+			<attribute name="maven.pomderived" value="true"/>
12
+		</attributes>
13
+	</classpathentry>
14
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
15
+		<attributes>
16
+			<attribute name="optional" value="true"/>
17
+			<attribute name="maven.pomderived" value="true"/>
18
+		</attributes>
19
+	</classpathentry>
20
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
21
+		<attributes>
22
+			<attribute name="maven.pomderived" value="true"/>
23
+		</attributes>
24
+	</classpathentry>
25
+	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
26
+		<attributes>
27
+			<attribute name="maven.pomderived" value="true"/>
28
+		</attributes>
29
+	</classpathentry>
30
+	<classpathentry kind="output" path="target/classes"/>
31
+</classpath>

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
1
+/target/

+ 23 - 0
.project

@@ -0,0 +1,23 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<projectDescription>
3
+	<name>depot-storage-tianjin</name>
4
+	<comment></comment>
5
+	<projects>
6
+	</projects>
7
+	<buildSpec>
8
+		<buildCommand>
9
+			<name>org.eclipse.jdt.core.javabuilder</name>
10
+			<arguments>
11
+			</arguments>
12
+		</buildCommand>
13
+		<buildCommand>
14
+			<name>org.eclipse.m2e.core.maven2Builder</name>
15
+			<arguments>
16
+			</arguments>
17
+		</buildCommand>
18
+	</buildSpec>
19
+	<natures>
20
+		<nature>org.eclipse.jdt.core.javanature</nature>
21
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
22
+	</natures>
23
+</projectDescription>

+ 5 - 0
.settings/org.eclipse.core.resources.prefs

@@ -0,0 +1,5 @@
1
+eclipse.preferences.version=1
2
+encoding//src/main/java=UTF-8
3
+encoding//src/main/resources=UTF-8
4
+encoding//src/test/java=UTF-8
5
+encoding/<project>=UTF-8

+ 5 - 0
.settings/org.eclipse.jdt.core.prefs

@@ -0,0 +1,5 @@
1
+eclipse.preferences.version=1
2
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
3
+org.eclipse.jdt.core.compiler.compliance=1.8
4
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
5
+org.eclipse.jdt.core.compiler.source=1.8

+ 4 - 0
.settings/org.eclipse.m2e.core.prefs

@@ -0,0 +1,4 @@
1
+activeProfiles=
2
+eclipse.preferences.version=1
3
+resolveWorkspaceProjects=true
4
+version=1

+ 6 - 0
Dockerfile

@@ -0,0 +1,6 @@
1
+FROM 192.168.123.25:31104/unis/java:8
2
+
3
+ADD ./target/depot-storage.jar /root
4
+CMD ["sh", "-c", "cd /root; java -Djava.security.egd=file:/dev/./urandom -jar /root/depot-storage.jar --depot-storage.server.enable-self-preservation=false"]
5
+EXPOSE 9004
6
+

+ 8 - 0
LICENSE

@@ -0,0 +1,8 @@
1
+MIT License
2
+Copyright (c) <year> <copyright holders>
3
+
4
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
+
6
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7
+
8
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 3 - 0
README.md

@@ -0,0 +1,3 @@
1
+# depot-storage-tianjin
2
+
3
+仓储业务初始化

+ 6 - 0
src/main/java/com/chinaitop/depot/DepotStorageApplication.java

@@ -7,7 +7,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
7 7
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
8 8
 import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
9 9
 import org.springframework.cloud.openfeign.EnableFeignClients;
10
+import org.springframework.context.annotation.Bean;
10 11
 import org.springframework.transaction.annotation.EnableTransactionManagement;
12
+import org.springframework.web.client.RestTemplate;
11 13
 
12 14
 @EnableFeignClients
13 15
 @EnableEurekaClient
@@ -21,4 +23,8 @@ public class DepotStorageApplication {
21 23
         SpringApplication.run(DepotStorageApplication.class, args);
22 24
     }
23 25
 
26
+    @Bean
27
+    public RestTemplate restTemplate() {
28
+        return new RestTemplate();
29
+    }
24 30
 }

+ 2 - 0
src/main/java/com/chinaitop/depot/business/mapper/BusinessDrugStandingBookMapper.java

@@ -62,4 +62,6 @@ public interface BusinessDrugStandingBookMapper {
62 62
 
63 63
 	List<Map<String, Object>> getAllDataList(Map<String, Object> map);
64 64
 
65
+	Map<String, Object> getYjGjjDate(Integer id);
66
+
65 67
 }

+ 43 - 2
src/main/java/com/chinaitop/depot/business/mapper/BusinessDrugStandingBookMapper.xml

@@ -121,7 +121,7 @@
121 121
       <include refid="Example_Where_Clause" />
122 122
     </if>
123 123
   </delete>
124
-  <insert id="insert" parameterType="com.chinaitop.depot.business.model.BusinessDrugStandingBook" >
124
+  <insert id="insert" parameterType="com.chinaitop.depot.business.model.BusinessDrugStandingBook" useGeneratedKeys="true" keyProperty="id">
125 125
     insert into business_drug_standing_book (id, type, drug_info_id,
126 126
       drug_number, drug_kind, drug_name, 
127 127
       drug_type, drug_packing, drug_specification, 
@@ -139,7 +139,7 @@
139 139
       #{isLastShelfData,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{orgId,jdbcType=INTEGER}, 
140 140
       #{drugRestoreId,jdbcType=INTEGER}, #{updatetime,jdbcType=TIMESTAMP}, #{drugSpecificationUnit,jdbcType=INTEGER})
141 141
   </insert>
142
-  <insert id="insertSelective" parameterType="com.chinaitop.depot.business.model.BusinessDrugStandingBook" >
142
+  <insert id="insertSelective" parameterType="com.chinaitop.depot.business.model.BusinessDrugStandingBook" useGeneratedKeys="true" keyProperty="id">
143 143
     insert into business_drug_standing_book
144 144
     <trim prefix="(" suffix=")" suffixOverrides="," >
145 145
         id,
@@ -928,4 +928,45 @@ select
928 928
 		ORDER by drugkind
929 929
   </select>
930 930
   
931
+  <select id="getYjGjjDate" parameterType="java.lang.Integer" resultType="java.util.Map">
932
+  		select
933
+		d.drug_number id,
934
+		a.id sj_id,
935
+		b.kqbm||'0'||substr(d.drug_number, length(d.drug_number)-1, 2) yjbh	,
936
+		b.kqbm kqdm	,
937
+		b.tykqbm tykqbm,
938
+		b.credit_code dwdm	,
939
+		b.org_name kqmc	,
940
+		e1.enumname yjmc	,
941
+		case d.drug_packing when '5509' then '1' when '5511' then '2' else '3' end bzw	   , 
942
+		d.drug_specification||(case d.drug_unit when '5505' then 'L' when '5507' then 'kg' end) ggxh	,
943
+		d.aqsysms aqsysms, 
944
+		a.manufacturer sccj	,
945
+		c.cgly cgly	,
946
+		d.cctj cctj	,
947
+		d.ccdd ccdd	,
948
+		d.bzwclfs bzwclfs, 
949
+		d.syhclfs czclfs	,
950
+		TIMESTAMPDIFF(DAY, DATE_FORMAT(c.production_date,'%Y-%m-%d'), DATE_FORMAT(c.expire_date,'%Y-%m-%d')) AS bzq, 
951
+		DATE_FORMAT(c.create_time,'%Y-%m-%d') cgrq	,
952
+		case a.drug_specification_unit when '5505' then CAST(a.amount AS DECIMAL(20,3))*1000 else CAST(a.amount AS DECIMAL) end kcsl,
953
+		case a.drug_specification_unit when '5505' then '3' else '1' end kcsldw,  
954
+		DATE_FORMAT(a.updatetime, '%Y-%m-%d %H:%i:%s') zhgxsj   
955
+		from business_drug_standing_book a
956
+		left join org_info b on b.org_id=a.org_id
957
+		left join business_drug_info d on d.id=a.drug_info_id
958
+		left join (
959
+		  select * from (
960
+		    select 
961
+		      id drug_storage_id, drug_info_id, manufacturer, 
962
+		      row_number() over(partition by drug_info_id, manufacturer order by id desc) nums 
963
+		    from business_drug_storage where 1=1
964
+		  )  s
965
+		  where s.nums=1
966
+		) f on f.drug_info_id=a.drug_info_id and f.manufacturer=a.manufacturer
967
+		left join business_drug_storage c on c.id=f.drug_storage_id
968
+		left join basic_enum e1 on e1.enumid=d.drug_name
969
+		where a.is_last_shelf_data=1 and a.amount>0 and a.id = #{id};
970
+
971
+  </select>
931 972
 </mapper>

+ 62 - 0
src/main/java/com/chinaitop/depot/business/service/impl/BusinessDrugStandingBookServiceImpl.java

@@ -4,12 +4,20 @@ import com.chinaitop.depot.business.mapper.BusinessDrugStandingBookMapper;
4 4
 import com.chinaitop.depot.business.model.*;
5 5
 import com.chinaitop.depot.business.service.BusinessDrugStandingBookService;
6 6
 import com.chinaitop.depot.utils.ParameterUtil;
7
+import com.fasterxml.jackson.core.JsonProcessingException;
8
+import com.fasterxml.jackson.databind.ObjectMapper;
7 9
 import com.github.pagehelper.PageHelper;
8 10
 import org.apache.commons.lang.StringUtils;
9 11
 import org.springframework.beans.factory.annotation.Autowired;
12
+import org.springframework.beans.factory.annotation.Value;
13
+import org.springframework.context.annotation.Bean;
10 14
 import org.springframework.stereotype.Service;
11 15
 import org.springframework.transaction.annotation.Transactional;
16
+import org.springframework.util.LinkedMultiValueMap;
17
+import org.springframework.util.MultiValueMap;
18
+import org.springframework.web.client.RestTemplate;
12 19
 
20
+import javax.annotation.Resource;
13 21
 import javax.servlet.http.HttpServletRequest;
14 22
 import java.math.BigDecimal;
15 23
 import java.util.ArrayList;
@@ -35,6 +43,13 @@ public class BusinessDrugStandingBookServiceImpl implements BusinessDrugStanding
35 43
 
36 44
     @Autowired
37 45
     private BusinessDrugStandingBookMapper drugStandingBookMapper;
46
+    
47
+    @Resource
48
+    private RestTemplate restTemplate;
49
+    
50
+    @Value("${jsgjjsjUrl}")
51
+    private String jsgjjsjUrl;
52
+
38 53
 
39 54
     /**
40 55
      * 入库新增台账数据.
@@ -94,6 +109,7 @@ public class BusinessDrugStandingBookServiceImpl implements BusinessDrugStanding
94 109
             drugStandingBookBefore.setIsLastShelfData(0);
95 110
             drugStandingBookBefore.setUpdatetime(new Date());
96 111
             drugStandingBookMapper.updateByPrimaryKeySelective(drugStandingBookBefore);
112
+            this.gjjjk(drugStandingBook.getId(), drugStandingBook.getOrgId(), "u");
97 113
         } else {
98 114
             // 第一次,两个台账数量都等于入库数量.
99 115
             String new_amount = amount(amount, drugStorage.getStorageCount(), SCALE_ADD);//入库后的最新台账数量
@@ -103,6 +119,8 @@ public class BusinessDrugStandingBookServiceImpl implements BusinessDrugStanding
103 119
         // 新增.
104 120
         drugStandingBook.setUpdatetime(new Date());
105 121
         drugStandingBookMapper.insert(drugStandingBook);
122
+        
123
+        this.gjjjk(drugStandingBook.getId(), drugStandingBook.getOrgId(), "i");
106 124
     }
107 125
 
108 126
     @Override
@@ -171,6 +189,7 @@ public class BusinessDrugStandingBookServiceImpl implements BusinessDrugStanding
171 189
             drugStandingBookBefore.setIsLastShelfData(0);
172 190
             drugStandingBookBefore.setUpdatetime(new Date());
173 191
             drugStandingBookMapper.updateByPrimaryKeySelective(drugStandingBookBefore);
192
+            this.gjjjk(drugStandingBook.getId(), drugStandingBook.getOrgId(), "u");
174 193
         } else {
175 194
             // 第一次.
176 195
             throw new RuntimeException("没有对应的数据可以出库!");
@@ -178,6 +197,7 @@ public class BusinessDrugStandingBookServiceImpl implements BusinessDrugStanding
178 197
         // 新增.
179 198
         drugStandingBook.setUpdatetime(new Date());
180 199
         drugStandingBookMapper.insert(drugStandingBook);
200
+        this.gjjjk(drugStandingBook.getId(), drugStandingBook.getOrgId(), "i");
181 201
     }
182 202
 
183 203
     private String amount(String y_num, String rk_num, String type) {
@@ -322,6 +342,7 @@ public class BusinessDrugStandingBookServiceImpl implements BusinessDrugStanding
322 342
                     drugStandingBookBefore.setIsLastShelfData(0);
323 343
                     drugStandingBookBefore.setUpdatetime(new Date());
324 344
                     drugStandingBookMapper.updateByPrimaryKeySelective(drugStandingBookBefore);
345
+                    this.gjjjk(drugStandingBook.getId(), drugStandingBook.getOrgId(), "u");
325 346
                 }
326 347
 
327 348
             } else if (Double.parseDouble(checkCount) < Double.parseDouble(shelfAmount)) {
@@ -343,6 +364,7 @@ public class BusinessDrugStandingBookServiceImpl implements BusinessDrugStanding
343 364
                     drugStandingBookBefore.setIsLastShelfData(0);
344 365
                     drugStandingBookBefore.setUpdatetime(new Date());
345 366
                     drugStandingBookMapper.updateByPrimaryKeySelective(drugStandingBookBefore);
367
+                    this.gjjjk(drugStandingBook.getId(), drugStandingBook.getOrgId(), "u");
346 368
                 } else {
347 369
                     // 第一次.
348 370
                     throw new RuntimeException("没有对应的数据可以出库!");
@@ -354,6 +376,7 @@ public class BusinessDrugStandingBookServiceImpl implements BusinessDrugStanding
354 376
             // 新增台账.
355 377
             drugStandingBook.setUpdatetime(new Date());
356 378
             drugStandingBookMapper.insert(drugStandingBook);
379
+            this.gjjjk(drugStandingBook.getId(), drugStandingBook.getOrgId(), "i");
357 380
         }
358 381
     }
359 382
 
@@ -436,6 +459,7 @@ public class BusinessDrugStandingBookServiceImpl implements BusinessDrugStanding
436 459
             drugStandingBookBefore.setIsLastShelfData(0);
437 460
             drugStandingBookBefore.setUpdatetime(new Date());
438 461
             drugStandingBookMapper.updateByPrimaryKeySelective(drugStandingBookBefore);
462
+            this.gjjjk(drugStandingBook.getId(), drugStandingBook.getOrgId(), "u");
439 463
         } else {
440 464
             // 第一次.
441 465
             throw new RuntimeException("没有对应的数据可以归还!");
@@ -443,6 +467,7 @@ public class BusinessDrugStandingBookServiceImpl implements BusinessDrugStanding
443 467
         // 新增
444 468
         drugStandingBook.setUpdatetime(new Date());
445 469
         drugStandingBookMapper.insertSelective(drugStandingBook);
470
+        this.gjjjk(drugStandingBook.getId(), drugStandingBook.getOrgId(), "i");
446 471
     }
447 472
 
448 473
     /**
@@ -503,10 +528,14 @@ public class BusinessDrugStandingBookServiceImpl implements BusinessDrugStanding
503 528
             standingBookOld.setIsLastShelfData(0);
504 529
             standingBookOld.setUpdatetime(new Date());
505 530
             drugStandingBookMapper.updateByPrimaryKeySelective(standingBookOld);
531
+            this.gjjjk(drugStandingBook.getId(), drugStandingBook.getOrgId(), "u");
532
+
506 533
 
507 534
             // 新增.
508 535
             drugStandingBook.setUpdatetime(new Date());
509 536
             drugStandingBookMapper.insert(drugStandingBook);
537
+            this.gjjjk(drugStandingBook.getId(), drugStandingBook.getOrgId(), "i");
538
+
510 539
         } else {
511 540
             throw new IllegalArgumentException("没有相应的数据!");
512 541
         }
@@ -682,5 +711,38 @@ public class BusinessDrugStandingBookServiceImpl implements BusinessDrugStanding
682 711
 		
683 712
 		return list;
684 713
 	}
714
+	
715
+	
716
+	/**
717
+	 * 国家局数据
718
+	 */
719
+    public void gjjjk(Integer id, Integer orgId,String czbz) {
720
+        
721
+		Map<String, Object>  gjjMap = drugStandingBookMapper.getYjGjjDate(id);
722
+		gjjMap.put("czbz",czbz);
723
+		gjjMap.put("is_upload", 0);
724
+		String tableName = "ODS_UP_YJXXJK";
725
+		
726
+		/**
727
+         * restTemplate调用
728
+         */
729
+        //String url = "http://localhost:9022/recPublish/sendMessage";//
730
+        // 发送post请求,并打印结果,以String类型接收响应结果JSON字符串
731
+        MultiValueMap<String, Object> sendMap = new LinkedMultiValueMap<>();
732
+		//Map<String, Object>  sendMap = new HashMap<String, Object>();
733
+        ObjectMapper objectMapper = new ObjectMapper();
734
+        String jsonMap;
735
+        try {
736
+			 jsonMap = objectMapper.writeValueAsString(gjjMap);
737
+			 sendMap.add("gjjMapJson",jsonMap);
738
+		} catch (JsonProcessingException e) {
739
+			// TODO Auto-generated catch block
740
+			e.printStackTrace();
741
+		}
742
+		sendMap.add("tableName", tableName);
743
+		sendMap.add("orgId",orgId);
744
+
745
+       String result = (String) restTemplate.postForObject(jsgjjsjUrl, sendMap, String.class);
746
+    }
685 747
 
686 748
 }

+ 2 - 0
src/main/java/com/chinaitop/depot/risk/mapper/StorageSafeManageMapper.java

@@ -43,4 +43,6 @@ public interface StorageSafeManageMapper {
43 43
      * @return
44 44
      */
45 45
     Map<String, Object> getBasicEnumObj(Integer enumid);
46
+
47
+	Map<String, Object> getAqglGjjDate(Integer id);
46 48
 }

+ 39 - 0
src/main/java/com/chinaitop/depot/risk/mapper/StorageSafeManageMapper.xml

@@ -628,4 +628,43 @@
628 628
     select enumid,enumcode,gbcode,enumname from basic_enum
629 629
     where enumid = #{enumid,jdbcType=INTEGER}
630 630
   </select>
631
+  
632
+  <select id="getAqglGjjDate" parameterType="java.lang.Integer" resultType="java.util.Map">
633
+  		
634
+	select 
635
+	a.id id,
636
+	b.kqbm kqdm,
637
+	b.tykqbm tykqbm,
638
+	dw.dwdm dwdm,
639
+	e3.enumname || e4.enumname || e5.enumname || a.address dd,
640
+	a.fxdbm,
641
+	a.sbr,
642
+	a.hjbw,
643
+	TRIM(BOTH ' ' FROM REPLACE(REPLACE(a.fxxx, CHAR(13), ''), CHAR(10), '')) fxxx,
644
+	e1.gbcode fxlx,
645
+	e2.gbcode fxfj,
646
+	a.fxglcs,
647
+	TRIM(BOTH ' ' FROM REPLACE(REPLACE(a.yhxx, CHAR(13), ''), CHAR(10), '')) yhxx,
648
+	a.yhpcxx,
649
+	a.yhzgxx,
650
+	a.yhysxx,
651
+	a.sgjbxx,
652
+	a.zgsx,
653
+	a.zrdw,
654
+	a.zrr,
655
+	a.zgysxx,
656
+	a.fxgzjgzrr,
657
+	a.czbz,
658
+	a.zhgxsj
659
+	from storage_safe_manage a 
660
+	left join org_info b on b.org_id=a.org_id
661
+	left join basic_enum e1 on e1.enumid=a.fxlx
662
+	left join basic_enum e2 on e2.enumid=a.fxfj
663
+	left join basic_enum e3 on e3.enumid=b.zc_province
664
+	left join basic_enum e4 on e4.enumid=b.zc_city
665
+	left join basic_enum e5 on e5.enumid=b.zc_county
666
+	left join province_all.biz_unit_info dw on dw.id = b.unit_info_id
667
+	where 1=1 and a.id = #{id};
668
+
669
+  </select>
631 670
 </mapper>

+ 2 - 1
src/main/java/com/chinaitop/depot/risk/mapper/ViolationWarningAlarmMapper.java

@@ -1,6 +1,5 @@
1 1
 package com.chinaitop.depot.risk.mapper;
2 2
 
3
-import com.chinaitop.depot.risk.model.RiskManagement;
4 3
 import com.chinaitop.depot.risk.model.ViolationWarningAlarm;
5 4
 
6 5
 
@@ -19,4 +18,6 @@ public interface ViolationWarningAlarmMapper {
19 18
     ViolationWarningAlarm selectById(Integer id);
20 19
 
21 20
     void updateById(ViolationWarningAlarm riskManagement);
21
+
22
+	Map<String, Object> getWgyjGjjDate(Integer id);
22 23
 }

+ 25 - 0
src/main/java/com/chinaitop/depot/risk/mapper/ViolationWarningAlarmMapper.xml

@@ -127,5 +127,30 @@
127 127
         </set>
128 128
         where id = #{id,jdbcType=INTEGER}
129 129
     </update>
130
+    
131
+    
132
+    <select id="getWgyjGjjDate" parameterType="java.lang.Integer" resultType="java.util.Map">
133
+        
134
+		select 
135
+		a.id id,
136
+		CONCAT(org.kqbm,DATE_FORMAT(a.publish_time, '%Y%m%d'),case LENGTH(id) when '1' then CONCAT(00,id) when '2' then CONCAT(0,id) when '3' then id else SUBSTRING(id,LENGTH(id)-2,LENGTH(id)) end) yjxxdm,
137
+		DATE_FORMAT(a.publish_time, '%Y-%m-%d %H:%i:%s') fbsj,  
138
+		'01' wgztlx,
139
+		substr(org.kqbm, 1,18) qydm,  
140
+		org.tykqbm wgdwtybm,
141
+		offender wgxwr, 
142
+		org.org_name sjkd,  
143
+		'03' wglx,  
144
+		REPLACE(REPLACE(REPLACE(a.detail, char(10), ''), char(13), ''), ' ', '') wgqk,  
145
+		case a.status when '0' then '01' else '02' end czzt,  
146
+		a.dispose_content hxczqk,
147
+		a.disposer hxczr, 
148
+		DATE_FORMAT(a.dispose_time, '%Y-%m-%d %H:%i:%s') hxczsj,  
149
+		a.create_time zhgxsj 
150
+		from storage_pre_violation a
151
+		left join org_info org on org.org_id=a.org_id
152
+		where a.id = #{id};
153
+
154
+    </select>
130 155
 
131 156
 </mapper>

+ 51 - 0
src/main/java/com/chinaitop/depot/risk/service/impl/StorageSafeManageServiceImpl.java

@@ -6,7 +6,15 @@ import com.chinaitop.depot.risk.model.StorageSafeManageExample;
6 6
 import com.chinaitop.depot.risk.model.StorageSafeManageWithBLOBs;
7 7
 import com.chinaitop.depot.risk.service.StorageSafeManageService;
8 8
 import com.chinaitop.depot.utils.ParameterUtil;
9
+import com.fasterxml.jackson.core.JsonProcessingException;
10
+import com.fasterxml.jackson.databind.ObjectMapper;
11
+
12
+import org.springframework.beans.factory.annotation.Value;
13
+import org.springframework.context.annotation.Bean;
9 14
 import org.springframework.stereotype.Service;
15
+import org.springframework.util.LinkedMultiValueMap;
16
+import org.springframework.util.MultiValueMap;
17
+import org.springframework.web.client.RestTemplate;
10 18
 
11 19
 import javax.annotation.Resource;
12 20
 import java.util.List;
@@ -20,7 +28,13 @@ public class StorageSafeManageServiceImpl implements StorageSafeManageService {
20 28
     
21 29
     @Resource
22 30
     private BasicFeignClient basicFeignClient;
31
+    
32
+    @Resource
33
+    private RestTemplate restTemplate;
23 34
 
35
+    @Value("${jsgjjsjUrl}")
36
+    private String jsgjjsjUrl;
37
+    
24 38
     @Override
25 39
     public List<StorageSafeManageWithBLOBs> findbyConditions(Integer orgId, Integer fxlx, Integer fxfj) throws Exception {
26 40
 
@@ -63,6 +77,8 @@ public class StorageSafeManageServiceImpl implements StorageSafeManageService {
63 77
             //附件
64 78
             basicFeignClient.updateFile(fileIds, storageSafeManage.getId(),"safeManage");
65 79
             
80
+            this.gjjjk(storageSafeManage.getId(), storageSafeManage.getOrgId(), "u");
81
+            
66 82
         } else {
67 83
         	//新增
68 84
             //String uuid = UUID.randomUUID().toString().replace("-", "");
@@ -79,6 +95,7 @@ public class StorageSafeManageServiceImpl implements StorageSafeManageService {
79 95
             storageSafeManageMapper.insert(storageSafeManage);
80 96
             //附件
81 97
             basicFeignClient.updateFile(fileIds, id,"safeManage");
98
+            this.gjjjk(id, storageSafeManage.getOrgId(), "i");
82 99
         }
83 100
        
84 101
     }
@@ -86,6 +103,8 @@ public class StorageSafeManageServiceImpl implements StorageSafeManageService {
86 103
     @Override
87 104
     public void deleteById(String id) throws Exception {
88 105
         storageSafeManageMapper.deleteByPrimaryKey(id);
106
+        this.gjjjk(Integer.valueOf(id), Integer.valueOf(id), "d");
107
+
89 108
     }
90 109
 
91 110
     /**
@@ -111,4 +130,36 @@ public class StorageSafeManageServiceImpl implements StorageSafeManageService {
111 130
 
112 131
         return fxdbm;
113 132
     }
133
+    
134
+    /**
135
+   	 * 国家局数据
136
+   	 */
137
+       public void gjjjk(Integer id, Integer orgId,String czbz) {
138
+           
139
+   		Map<String, Object>  gjjMap = storageSafeManageMapper.getAqglGjjDate(id);
140
+   		gjjMap.put("czbz",czbz);
141
+   		gjjMap.put("is_upload", 0);
142
+   		String tableName = "ODS_UP_AQGLXXJK";
143
+   		
144
+   		/**
145
+            * restTemplate调用
146
+            */
147
+           //String url = "http://localhost:9022/recPublish/sendMessage";//
148
+           // 发送post请求,并打印结果,以String类型接收响应结果JSON字符串
149
+           MultiValueMap<String, Object> sendMap = new LinkedMultiValueMap<>();
150
+   		//Map<String, Object>  sendMap = new HashMap<String, Object>();
151
+           ObjectMapper objectMapper = new ObjectMapper();
152
+           String jsonMap;
153
+           try {
154
+   			 jsonMap = objectMapper.writeValueAsString(gjjMap);
155
+   			 sendMap.add("gjjMapJson",jsonMap);
156
+   		} catch (JsonProcessingException e) {
157
+   			// TODO Auto-generated catch block
158
+   			e.printStackTrace();
159
+   		}
160
+   		sendMap.add("tableName", tableName);
161
+   		sendMap.add("orgId",orgId);
162
+
163
+          String result = (String) restTemplate.postForObject(jsgjjsjUrl, sendMap, String.class);
164
+       }
114 165
 }

+ 54 - 0
src/main/java/com/chinaitop/depot/risk/service/impl/ViolationWarningAlarmServiceImpl.java

@@ -3,14 +3,23 @@ package com.chinaitop.depot.risk.service.impl;
3 3
 import com.chinaitop.depot.risk.mapper.ViolationWarningAlarmMapper;
4 4
 import com.chinaitop.depot.risk.model.ViolationWarningAlarm;
5 5
 import com.chinaitop.depot.risk.service.ViolationWarningAlarmService;
6
+import com.fasterxml.jackson.core.JsonProcessingException;
7
+import com.fasterxml.jackson.databind.ObjectMapper;
8
+
6 9
 import lombok.RequiredArgsConstructor;
7 10
 
11
+import org.springframework.context.annotation.Bean;
8 12
 import org.apache.commons.lang.StringUtils;
9 13
 import org.springframework.stereotype.Service;
14
+import org.springframework.util.LinkedMultiValueMap;
15
+import org.springframework.util.MultiValueMap;
16
+import org.springframework.web.client.RestTemplate;
10 17
 
11 18
 import java.util.List;
12 19
 import java.util.Map;
13 20
 
21
+import javax.annotation.Resource;
22
+
14 23
 /**
15 24
  * class
16 25
  *
@@ -22,6 +31,15 @@ import java.util.Map;
22 31
 public class ViolationWarningAlarmServiceImpl implements ViolationWarningAlarmService {
23 32
 
24 33
     private final ViolationWarningAlarmMapper violationWarningAlarmMapper;
34
+    
35
+    @Resource
36
+    private RestTemplate restTemplate;
37
+
38
+    @Bean
39
+    public RestTemplate restTemplate() {
40
+        return new RestTemplate();
41
+    }
42
+    
25 43
     @Override
26 44
     public List<ViolationWarningAlarm> selectListPage(Map<String, Object> queryMap) {
27 45
         return  violationWarningAlarmMapper.selectListPage(queryMap);
@@ -34,6 +52,9 @@ public class ViolationWarningAlarmServiceImpl implements ViolationWarningAlarmSe
34 52
 
35 53
     @Override
36 54
     public void updateDate(ViolationWarningAlarm violationWarningAlarm) {
55
+        violationWarningAlarmMapper.updateById(violationWarningAlarm);
56
+        this.gjjjk(violationWarningAlarm.getId(), violationWarningAlarm.getOrgId(), "u");
57
+        
37 58
     	if(StringUtils.isNotBlank(violationWarningAlarm.getDisposer())
38 59
                 && StringUtils.isNotBlank(violationWarningAlarm.getDisposeContent())
39 60
                 && StringUtils.isNotBlank(violationWarningAlarm.getDisposeTime())){
@@ -42,4 +63,37 @@ public class ViolationWarningAlarmServiceImpl implements ViolationWarningAlarmSe
42 63
                   violationWarningAlarmMapper.updateById(violationWarningAlarm);
43 64
         }
44 65
     }
66
+    
67
+    
68
+    /**
69
+   	 * 国家局数据
70
+   	 */
71
+       public void gjjjk(Integer id, Integer orgId,String czbz) {
72
+           
73
+   		Map<String, Object>  gjjMap = violationWarningAlarmMapper.getWgyjGjjDate(id);
74
+   		gjjMap.put("czbz",czbz);
75
+   		gjjMap.put("is_upload", 0);
76
+   		String tableName = "ODS_UP_WGYJXXJK";
77
+   		
78
+   		/**
79
+            * restTemplate调用
80
+            */
81
+           String url = "http://localhost:9022/recPublish/sendMessage";//
82
+           // 发送post请求,并打印结果,以String类型接收响应结果JSON字符串
83
+           MultiValueMap<String, Object> sendMap = new LinkedMultiValueMap<>();
84
+   		//Map<String, Object>  sendMap = new HashMap<String, Object>();
85
+           ObjectMapper objectMapper = new ObjectMapper();
86
+           String jsonMap;
87
+           try {
88
+   			 jsonMap = objectMapper.writeValueAsString(gjjMap);
89
+   			 sendMap.add("gjjMapJson",jsonMap);
90
+   		} catch (JsonProcessingException e) {
91
+   			// TODO Auto-generated catch block
92
+   			e.printStackTrace();
93
+   		}
94
+   		sendMap.add("tableName", tableName);
95
+   		sendMap.add("orgId",orgId);
96
+
97
+          String result = (String) restTemplate.postForObject(url, sendMap, String.class);
98
+       }
45 99
 }

+ 4 - 1
src/main/resources/bootstrap-dev.yml

@@ -48,4 +48,7 @@ api:
48 48
 reportUrl: http://101.36.160.140:8097
49 49
 logging:
50 50
   level:
51
-    com.chinaitop.depot.risk.mapper: debug
51
+    com.chinaitop.depot.risk.mapper: debug
52
+    
53
+jsgjjsjUrl: http://localhost:9022/recPublish/sendMessage
54
+    

+ 3 - 1
src/main/resources/bootstrap-prod.yml

@@ -43,4 +43,6 @@ api:
43 43
   safety:
44 44
     host: localhost
45 45
     port: 8765
46
-reportUrl: http://101.36.160.140:8097
46
+reportUrl: http://101.36.160.140:8097
47
+
48
+jsgjjsjUrl: http://localhost:9022/recPublish/sendMessage