fanxw 2 달 전
부모
커밋
5521f2dd6e

+ 4 - 0
pom.xml

@@ -54,6 +54,10 @@
54 54
 			<artifactId>commons-lang3</artifactId>
55 55
 			<version>3.7</version>
56 56
 		</dependency>
57
+		<dependency>  
58
+		    <groupId>org.springframework.boot</groupId>  
59
+		    <artifactId>spring-boot-starter-security</artifactId>  
60
+		</dependency>
57 61
 
58 62
 		<!-- swagger2 -->
59 63
 		<dependency>

+ 24 - 0
src/main/java/com/chinaitop/depot/WebSecurityConfig.java

@@ -0,0 +1,24 @@
1
+package com.chinaitop.depot;
2
+
3
+import org.springframework.context.annotation.Configuration;
4
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
5
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
6
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
7
+
8
+@Configuration
9
+@EnableWebSecurity
10
+public class WebSecurityConfig 
11
+extends WebSecurityConfigurerAdapter 
12
+{
13
+
14
+	@Override
15
+    protected void configure(HttpSecurity http) throws Exception {
16
+		http.authorizeRequests()
17
+		.antMatchers("/**")
18
+		.permitAll() //允许所有用户访问所有资源
19
+        .and()
20
+        .csrf().disable(); // 禁用CSRF(防止伪造的跨域攻击)
21
+
22
+        super.configure(http);
23
+    }
24
+}

+ 1 - 0
src/main/java/com/chinaitop/depot/device/controller/DSblxxjyController.java

@@ -99,6 +99,7 @@ public class DSblxxjyController {
99 99
             // 生成设备器材编码
100 100
             if (StringUtils.isBlank(dSbxxsjy.getSbbh())) {
101 101
                 dSbxxsjy.setSbbh(GeneratingEncodUtils.gotSbbh(dSbxxsjy.getSzdwdm()));
102
+                dSbxxsjy.setCreateTime(new Date());
102 103
                 sblxxjyService.save(dSbxxsjy); // 新增
103 104
             } else {
104 105
                 sblxxjyService.update(dSbxxsjy); // 修改

+ 27 - 4
src/main/java/com/chinaitop/depot/device/mapper/DSbxxsjyMapper.xml

@@ -64,6 +64,8 @@
64 64
     <result column="shsj" property="shsj" jdbcType="DATE" />
65 65
     <result column="jddw" property="jddw" jdbcType="VARCHAR" />
66 66
     <result column="jdsj" property="jdsj" jdbcType="VARCHAR" />
67
+    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
68
+    <result column="sbyqid" property="sbyqid" jdbcType="INTEGER" />
67 69
   </resultMap>
68 70
   <sql id="Example_Where_Clause" >
69 71
     <where >
@@ -129,7 +131,7 @@
129 131
     creator_code, create_date, refresher, refresher_code, refresh_time, remark, sfba, 
130 132
     szdwmc, szdwdm, jszt, sbsl, jscs, sblx, mqzt, sfzc, ccbm, sbbm, qyrq, ssfl, jg_id, 
131 133
     fzd, sbdwmc, zcbh, scrq, rkrq, sbflbh, pzr, cgr, wxdh, bxqx, sblxbh, sbazr, shrmc, 
132
-    shyj, shsj, jddw, jdsj
134
+    shyj, shsj, jddw, jdsj, create_time, sbyqid
133 135
   </sql>
134 136
   <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.chinaitop.depot.device.model.DSbxxsjyExample" >
135 137
     select
@@ -169,7 +171,7 @@
169 171
       zcbh, scrq, rkrq, sbflbh, 
170 172
       pzr, cgr, wxdh, bxqx, 
171 173
       sblxbh, sbazr, shrmc, 
172
-      shyj, shsj, jddw, jdsj)
174
+      shyj, shsj, jddw, jdsj, create_time, sbyqid)
173 175
     values (#{sbbh,jdbcType=VARCHAR}, #{sbyqmc,jdbcType=VARCHAR}, #{kddm,jdbcType=VARCHAR}, 
174 176
       #{sbggxh,jdbcType=VARCHAR}, #{sbms,jdbcType=VARCHAR}, #{sbzt,jdbcType=VARCHAR}, 
175 177
       #{sbfl,jdbcType=VARCHAR}, #{sccj,jdbcType=VARCHAR}, #{cgjg,jdbcType=VARCHAR}, #{sbglz,jdbcType=VARCHAR}, 
@@ -187,7 +189,8 @@
187 189
       #{zcbh,jdbcType=VARCHAR}, #{scrq,jdbcType=DATE}, #{rkrq,jdbcType=DATE}, #{sbflbh,jdbcType=VARCHAR}, 
188 190
       #{pzr,jdbcType=VARCHAR}, #{cgr,jdbcType=VARCHAR}, #{wxdh,jdbcType=VARCHAR}, #{bxqx,jdbcType=VARCHAR}, 
189 191
       #{sblxbh,jdbcType=VARCHAR}, #{sbazr,jdbcType=VARCHAR}, #{shrmc,jdbcType=VARCHAR}, 
190
-      #{shyj,jdbcType=VARCHAR}, #{shsj,jdbcType=DATE}, #{jddw,jdbcType=VARCHAR}, #{jdsj,jdbcType=VARCHAR})
192
+      #{shyj,jdbcType=VARCHAR}, #{shsj,jdbcType=DATE}, #{jddw,jdbcType=VARCHAR}, #{jdsj,jdbcType=VARCHAR},
193
+      #{createTime,jdbcType=TIMESTAMP}, #{sbyqid,jdbcType=INTEGER})
191 194
   </insert>
192 195
   <insert id="insertSelective" parameterType="com.chinaitop.depot.device.model.DSbxxsjy" >
193 196
     insert into d_sbxxsjy
@@ -378,6 +381,12 @@
378 381
       <if test="jdsj != null">
379 382
         jdsj,
380 383
       </if>
384
+      <if test="createTime != null">
385
+        create_time,
386
+      </if>
387
+      <if test="sbyqid != null">
388
+        sbyqid,
389
+      </if>
381 390
     </trim>
382 391
     <trim prefix="values (" suffix=")" suffixOverrides="," >
383 392
       <if test="sbbh != null" >
@@ -566,6 +575,12 @@
566 575
       <if test="jdsj != null">
567 576
         #{jdsj,jdbcType=VARCHAR},
568 577
       </if>
578
+      <if test="createTime != null">
579
+        #{createTime,jdbcType=TIMESTAMP},
580
+      </if>
581
+      <if test="sbyqid != null">
582
+        #{sbyqid,jdbcType=INTEGER},
583
+      </if>
569 584
     </trim>
570 585
   </insert>
571 586
   <select id="countByExample" parameterType="com.chinaitop.depot.device.model.DSbxxsjyExample" resultType="java.lang.Integer" >
@@ -763,6 +778,12 @@
763 778
       <if test="record.jdsj != null">
764 779
         jdsj = #{record.jdsj,jdbcType=VARCHAR},
765 780
       </if>
781
+      <if test="record.createTime != null">
782
+        create_time = #{record.createTime,jdbcType=TIMESTAMP},
783
+      </if>
784
+      <if test="record.sbyqid != null">
785
+        sbyqid = #{record.sbyqid,jdbcType=INTEGER},
786
+      </if>
766 787
     </set>
767 788
     <if test="_parameter != null" >
768 789
       <include refid="Update_By_Example_Where_Clause" />
@@ -831,7 +852,9 @@
831 852
       shyj = #{record.shyj,jdbcType=VARCHAR},
832 853
       shsj = #{record.shsj,jdbcType=DATE},
833 854
       jddw = #{record.jddw,jdbcType=VARCHAR},
834
-      jdsj = #{record.jdsj,jdbcType=VARCHAR}
855
+      jdsj = #{record.jdsj,jdbcType=VARCHAR},
856
+      create_time = #{record.createTime,jdbcType=TIMESTAMP},
857
+      sbyqid = #{record.sbyqid,jdbcType=INTEGER}
835 858
     <if test="_parameter != null" >
836 859
       <include refid="Update_By_Example_Where_Clause" />
837 860
     </if>

+ 39 - 1
src/main/java/com/chinaitop/depot/device/model/DSbxxsjy.java

@@ -127,9 +127,15 @@ public class DSbxxsjy {
127 127
 
128 128
     private String jddw;
129 129
 
130
-    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
130
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
131 131
     private Date jdsj;
132 132
 
133
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
134
+    private Date createTime;
135
+
136
+    //设备仪器id
137
+    private Integer sbyqid;
138
+
133 139
     /**
134 140
      * 设备编号
135 141
      * @return sbbh 设备编号
@@ -1122,4 +1128,36 @@ public class DSbxxsjy {
1122 1128
 		this.jdsj = jdsj;
1123 1129
 	}
1124 1130
 
1131
+	/**
1132
+	 * 创建时间
1133
+	 * @return
1134
+	 */
1135
+	public Date getCreateTime() {
1136
+		return createTime;
1137
+	}
1138
+
1139
+	/**
1140
+	 * 创建时间
1141
+	 * @param createTime
1142
+	 */
1143
+	public void setCreateTime(Date createTime) {
1144
+		this.createTime = createTime;
1145
+	}
1146
+
1147
+	/**
1148
+	 * 设备仪器ID
1149
+	 * @return
1150
+	 */
1151
+	public Integer getSbyqid() {
1152
+		return sbyqid;
1153
+	}
1154
+
1155
+	/**
1156
+	 * 设备仪器ID
1157
+	 * @param sbyqid
1158
+	 */
1159
+	public void setSbyqid(Integer sbyqid) {
1160
+		this.sbyqid = sbyqid;
1161
+	}
1162
+
1125 1163
 }

+ 1 - 1
src/main/java/com/chinaitop/depot/device/service/impl/StorageJsglServiceImpl.java

@@ -94,7 +94,7 @@ public class StorageJsglServiceImpl implements StorageJsglService {
94 94
 		} else {
95 95
 			updateStorageJsgl(storageJsgl);
96 96
 		}
97
-		if ("1".equals(storageJsgl.getDataStatus())) {
97
+		if ("1".equals(storageJsgl.getDataStatus()) && "1".equals(storageJsgl.getYwlx())) {
98 98
 			depotBusinessFeignService.updateYjssl(Integer.parseInt(storageJsgl.getHtid()), storageJsgl.getBcjssl().toString());
99 99
 		}
100 100
 	}

+ 7 - 2
src/main/resources/bootstrap.yml

@@ -9,7 +9,7 @@ mybatis:
9 9
 eureka:
10 10
   client:
11 11
     service-url:
12
-      defaultZone: http://localhost:9001/eureka/
12
+      defaultZone: http://tj_admin:Admin_1234@${eureka.instance.hostname}:9001/eureka/
13 13
   instance:
14 14
     hostname: 172.16.0.16
15 15
     prefer-ip-address: true
@@ -18,6 +18,11 @@ eureka:
18 18
     # 告知服务端30秒还未收到心跳的话,就将该服务移除列表(默认90s)
19 19
     lease-expiration-duration-in-seconds: 30
20 20
     status-page-url: http://${eureka.instance.hostname}:${server.port}/swagger-ui.html
21
+
22
+management:
23
+  server:
24
+    port: -1
25
+
21 26
 spring:
22 27
   application:
23 28
     name: depot-device
@@ -54,4 +59,4 @@ spring:
54 59
     date-format: yyyy-MM-dd
55 60
     time-zone: GMT+8
56 61
 web:
57
-  upload-path: /home/depot/depot-web/apache-tomcat-8.0.53/webapps/ROOT/WEB-INF/classes/static
62
+  upload-path: /home/depot/depot-web/depot-file