fanxw 2 gadi atpakaļ
vecāks
revīzija
a9c10deb89

+ 6 - 0
pom.xml

@@ -153,6 +153,12 @@
153 153
 		    <artifactId>annotations</artifactId>
154 154
 		    <version>20.1.0</version>
155 155
 		</dependency>
156
+		<!-- OKHTTP集成 -->
157
+		<dependency>
158
+		    <groupId>com.squareup.okhttp3</groupId>
159
+		    <artifactId>okhttp</artifactId>
160
+		    <version>3.14.9</version>
161
+		</dependency>
156 162
     </dependencies>
157 163
 
158 164
     <!-- 导入Spring Cloud的依赖管理 -->

+ 3 - 3
src/main/java/com/chinaitop/depot/fumigation/controller/FumigationForRecordController.java

@@ -658,7 +658,7 @@ public class FumigationForRecordController {
658 658
             String jx =null;
659 659
             BigDecimal nd =null;
660 660
             String syff = null;
661
-            Integer lqsl = null;
661
+            BigDecimal lqsl = null;
662 662
             BigDecimal lddwyyl = null;
663 663
             BigDecimal kjdwyyl = null;
664 664
             BigDecimal zyyl = null;
@@ -737,7 +737,7 @@ public class FumigationForRecordController {
737 737
             }
738 738
             if(detail.get("getNumber")!=null){
739 739
                 //领取数量
740
-                lqsl = (Integer)detail.get("getNumber");
740
+                lqsl = new BigDecimal(detail.get("getNumber").toString());
741 741
             }
742 742
             if(detail.get("grainDosage")!=null){
743 743
                 //堆粮单位用药量
@@ -925,7 +925,7 @@ public class FumigationForRecordController {
925 925
             fumigationForrecord.setSyff(syff);//施药方式
926 926
             if(lqsl!=null){
927 927
                 //领取数量
928
-                fumigationForrecord.setLqsl(new BigDecimal(lqsl));//领取数量
928
+                fumigationForrecord.setLqsl(lqsl);//领取数量
929 929
             }
930 930
             fumigationForrecord.setLddwyyl(lddwyyl);//粮堆单位用药量
931 931
             fumigationForrecord.setKjdwyyl(kjdwyyl);//空间单位用药量

+ 7 - 11
src/main/java/com/chinaitop/depot/risk/controller/ContentPreControlAndViolationWarningAlarmController.java

@@ -1,24 +1,20 @@
1 1
 package com.chinaitop.depot.risk.controller;
2 2
 
3
-import com.alibaba.druid.support.json.JSONUtils;
4
-import com.alibaba.fastjson.JSONObject;
5
-import com.chinaitop.depot.risk.model.RiskManagement;
3
+import org.springframework.http.MediaType;
4
+import org.springframework.web.bind.annotation.RequestBody;
5
+import org.springframework.web.bind.annotation.RequestMapping;
6
+import org.springframework.web.bind.annotation.RequestMethod;
7
+import org.springframework.web.bind.annotation.RestController;
8
+
6 9
 import com.chinaitop.depot.risk.request.ContentPreControlAndViolationWarningAlarmReq;
7 10
 import com.chinaitop.depot.risk.service.ContentPreControlAndViolationWarningAlarmService;
8 11
 import com.chinaitop.depot.unissoft.model.ResponseEntity;
12
+
9 13
 import io.swagger.annotations.Api;
10 14
 import io.swagger.annotations.ApiImplicitParam;
11 15
 import io.swagger.annotations.ApiOperation;
12 16
 import lombok.RequiredArgsConstructor;
13 17
 import lombok.extern.slf4j.Slf4j;
14
-import org.apache.commons.lang.StringUtils;
15
-import org.springframework.http.MediaType;
16
-import org.springframework.web.bind.annotation.RequestBody;
17
-import org.springframework.web.bind.annotation.RequestMapping;
18
-import org.springframework.web.bind.annotation.RequestMethod;
19
-import org.springframework.web.bind.annotation.RestController;
20
-
21
-import javax.validation.Valid;
22 18
 
23 19
 /**
24 20
  * class

+ 62 - 0
src/main/java/com/chinaitop/depot/sptData/controller/SptController.java

@@ -0,0 +1,62 @@
1
+package com.chinaitop.depot.sptData.controller;
2
+
3
+import javax.annotation.Resource;
4
+
5
+import org.springframework.web.bind.annotation.RequestMapping;
6
+import org.springframework.web.bind.annotation.RequestMethod;
7
+import org.springframework.web.bind.annotation.RestController;
8
+
9
+import com.chinaitop.depot.sptData.model.SptDataVO;
10
+import com.chinaitop.depot.sptData.service.SptService;
11
+
12
+import io.swagger.annotations.Api;
13
+import io.swagger.annotations.ApiImplicitParam;
14
+import io.swagger.annotations.ApiImplicitParams;
15
+import io.swagger.annotations.ApiOperation;
16
+import lombok.extern.slf4j.Slf4j;
17
+
18
+@RequestMapping(value="/spt")
19
+@Api(tags="市平台接口")
20
+@RestController
21
+@Slf4j
22
+public class SptController {
23
+
24
+	@Resource
25
+	private SptService sptService;
26
+	
27
+	@RequestMapping(value="/getSxtgzsList", method = RequestMethod.GET)
28
+	@ApiOperation(value="获取市平台摄像头故障数列表", notes = "支持分页")
29
+	@ApiImplicitParams({
30
+		@ApiImplicitParam(name = "pageNum", value = "页码", paramType = "query"),
31
+        @ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "query"),
32
+        @ApiImplicitParam(name = "kqmc", value = "组织机构ID", paramType = "query"),
33
+        @ApiImplicitParam(name = "bjsj", value = "开始日期", paramType = "query")
34
+	})
35
+	public SptDataVO getSxtgzsList(Integer pageNum, Integer pageSize, String kqmc, String bjsj) {
36
+		SptDataVO sptDataVO = null;
37
+		try {
38
+			sptDataVO = sptService.getSxtgzsList(pageNum, pageSize, kqmc, bjsj);
39
+		} catch (Exception e) {
40
+			log.error(e.getMessage(), e);
41
+		}
42
+		return sptDataVO;
43
+	}
44
+	
45
+	@RequestMapping(value="/getCwdgzsList", method = RequestMethod.GET)
46
+	@ApiOperation(value="获取市平台测温点故障数列表", notes = "支持分页")
47
+	@ApiImplicitParams({
48
+		@ApiImplicitParam(name = "pageNum", value = "页码", paramType = "query"),
49
+        @ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "query"),
50
+        @ApiImplicitParam(name = "kqmc", value = "组织机构ID", paramType = "query"),
51
+        @ApiImplicitParam(name = "bjsj", value = "开始日期", paramType = "query")
52
+	})
53
+	public SptDataVO getCwdgzsList(Integer pageNum, Integer pageSize, String kqmc, String bjsj) {
54
+		SptDataVO sptDataVO = null;
55
+		try {
56
+			sptDataVO = sptService.getCwdgzsList(pageNum, pageSize, kqmc, bjsj);
57
+		} catch (Exception e) {
58
+			log.error(e.getMessage(), e);
59
+		}
60
+		return sptDataVO;
61
+	}
62
+}

+ 38 - 0
src/main/java/com/chinaitop/depot/sptData/model/SptDataVO.java

@@ -0,0 +1,38 @@
1
+package com.chinaitop.depot.sptData.model;
2
+
3
+import com.alibaba.fastjson.JSONObject;
4
+
5
+public class SptDataVO {
6
+
7
+	private String code;
8
+
9
+	private String msg;
10
+
11
+	private JSONObject data;
12
+
13
+	public String getCode() {
14
+		return code;
15
+	}
16
+
17
+	public void setCode(String code) {
18
+		this.code = code;
19
+	}
20
+
21
+	public String getMsg() {
22
+		return msg;
23
+	}
24
+
25
+	public void setMsg(String msg) {
26
+		this.msg = msg;
27
+	}
28
+
29
+	public JSONObject getData() {
30
+		return data;
31
+	}
32
+
33
+	public void setData(JSONObject data) {
34
+		this.data = data;
35
+	}
36
+	
37
+	
38
+}

+ 31 - 0
src/main/java/com/chinaitop/depot/sptData/service/SptService.java

@@ -0,0 +1,31 @@
1
+package com.chinaitop.depot.sptData.service;
2
+
3
+import java.util.Map;
4
+
5
+import com.chinaitop.depot.sptData.model.SptDataVO;
6
+import com.github.pagehelper.PageInfo;
7
+
8
+public interface SptService {
9
+
10
+	/**
11
+	 * 获取市平台摄像头故障数接口数据
12
+	 * @param pageNum
13
+	 * @param pageSize
14
+	 * @param kqmc 库区名称
15
+	 * @param bjsj 报警时间
16
+	 * @return
17
+	 * @throws Exception
18
+	 */
19
+	SptDataVO getSxtgzsList(Integer pageNum, Integer pageSize, String kqmc, String bjsj) throws Exception;
20
+
21
+	/**
22
+	 * 获取市平台测温点故障数接口数据
23
+	 * @param pageNum
24
+	 * @param pageSize
25
+	 * @param kqmc 库区名称
26
+	 * @param bjsj 报警时间
27
+	 * @return
28
+	 * @throws Exception
29
+	 */
30
+	SptDataVO getCwdgzsList(Integer pageNum, Integer pageSize, String kqmc, String bjsj) throws Exception;
31
+}

+ 77 - 0
src/main/java/com/chinaitop/depot/sptData/service/impl/SptServiceImpl.java

@@ -0,0 +1,77 @@
1
+package com.chinaitop.depot.sptData.service.impl;
2
+
3
+import javax.annotation.Resource;
4
+
5
+import org.apache.commons.lang.StringUtils;
6
+import org.springframework.stereotype.Service;
7
+
8
+import com.alibaba.fastjson.JSON;
9
+import com.chinaitop.depot.sptData.model.SptDataVO;
10
+import com.chinaitop.depot.sptData.service.SptService;
11
+import com.chinaitop.depot.system.service.SysCodeService;
12
+import com.chinaitop.depot.utils.OkHttpUtil;
13
+import com.fasterxml.jackson.databind.ObjectMapper;
14
+
15
+@Service
16
+@SuppressWarnings("all")
17
+public class SptServiceImpl implements SptService {
18
+
19
+	@Resource
20
+	private SysCodeService sysCodeService;
21
+
22
+	@Override
23
+	public SptDataVO getSxtgzsList(Integer pageNum, Integer pageSize, String kqmc, String bjsj)
24
+			throws Exception {
25
+
26
+		String path = sysCodeService.getSVal(10, "sxtgzs");
27
+		StringBuffer sbf = new StringBuffer(50);
28
+		if (null == pageNum) {
29
+			pageNum = 1;
30
+		}
31
+		if (null == pageSize) {
32
+			pageSize = 10;
33
+		}
34
+		sbf.append(path).append("/").append(pageNum).append("/").append(pageSize);
35
+		sbf.append("?").append("kqmc=");
36
+		if (StringUtils.isNotBlank(kqmc)) {
37
+			sbf.append(kqmc);
38
+		}
39
+		sbf.append("&bjsj=");
40
+		if (StringUtils.isNotBlank(bjsj)) {
41
+			sbf.append(bjsj);
42
+		}
43
+		String result_data = OkHttpUtil.get(sbf.toString());
44
+		ObjectMapper mapper = new ObjectMapper();
45
+		SptDataVO sptDataVO = mapper.readValue(result_data, SptDataVO.class);
46
+
47
+		return sptDataVO;
48
+	}
49
+
50
+	@Override
51
+	public SptDataVO getCwdgzsList(Integer pageNum, Integer pageSize, String kqmc, String bjsj)
52
+			throws Exception {
53
+		String path = sysCodeService.getSVal(10, "cwdgzs");
54
+		StringBuffer sbf = new StringBuffer(50);
55
+		if (null == pageNum) {
56
+			pageNum = 1;
57
+		}
58
+		if (null == pageSize) {
59
+			pageSize = 10;
60
+		}
61
+		sbf.append(path).append("/").append(pageNum).append("/").append(pageSize);
62
+		sbf.append("?").append("kqmc=");
63
+		if (StringUtils.isNotBlank(kqmc)) {
64
+			sbf.append(kqmc);
65
+		}
66
+		sbf.append("bjsj=");
67
+		if (StringUtils.isNotBlank(bjsj)) {
68
+			sbf.append(bjsj);
69
+		}
70
+		String result_data = OkHttpUtil.get(sbf.toString());
71
+		ObjectMapper mapper = new ObjectMapper();
72
+		SptDataVO sptDataVO = mapper.readValue(result_data, SptDataVO.class);
73
+
74
+		return sptDataVO;
75
+	}
76
+
77
+}

+ 31 - 0
src/main/java/com/chinaitop/depot/system/mapper/SysCodeMapper.java

@@ -0,0 +1,31 @@
1
+package com.chinaitop.depot.system.mapper;
2
+
3
+import com.chinaitop.depot.system.model.SysCode;
4
+import com.chinaitop.depot.system.model.SysCodeExample;
5
+import com.chinaitop.depot.system.model.SysCodeKey;
6
+import java.util.List;
7
+import org.apache.ibatis.annotations.Param;
8
+
9
+public interface SysCodeMapper {
10
+    int countByExample(SysCodeExample example);
11
+
12
+    int deleteByExample(SysCodeExample example);
13
+
14
+    int deleteByPrimaryKey(SysCodeKey key);
15
+
16
+    int insert(SysCode record);
17
+
18
+    int insertSelective(SysCode record);
19
+
20
+    List<SysCode> selectByExample(SysCodeExample example);
21
+
22
+    SysCode selectByPrimaryKey(SysCodeKey key);
23
+
24
+    int updateByExampleSelective(@Param("record") SysCode record, @Param("example") SysCodeExample example);
25
+
26
+    int updateByExample(@Param("record") SysCode record, @Param("example") SysCodeExample example);
27
+
28
+    int updateByPrimaryKeySelective(SysCode record);
29
+
30
+    int updateByPrimaryKey(SysCode record);
31
+}

+ 196 - 0
src/main/java/com/chinaitop/depot/system/mapper/SysCodeMapper.xml

@@ -0,0 +1,196 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3
+<mapper namespace="com.chinaitop.depot.system.mapper.SysCodeMapper" >
4
+  <resultMap id="BaseResultMap" type="com.chinaitop.depot.system.model.SysCode" >
5
+    <id column="org_id" property="orgId" jdbcType="INTEGER" />
6
+    <id column="s_code" property="sCode" jdbcType="VARCHAR" />
7
+    <result column="s_val" property="sVal" jdbcType="VARCHAR" />
8
+    <result column="updatetime" property="updatetime" jdbcType="TIMESTAMP" />
9
+  </resultMap>
10
+  <sql id="Example_Where_Clause" >
11
+    <where >
12
+      <foreach collection="oredCriteria" item="criteria" separator="or" >
13
+        <if test="criteria.valid" >
14
+          <trim prefix="(" suffix=")" prefixOverrides="and" >
15
+            <foreach collection="criteria.criteria" item="criterion" >
16
+              <choose >
17
+                <when test="criterion.noValue" >
18
+                  and ${criterion.condition}
19
+                </when>
20
+                <when test="criterion.singleValue" >
21
+                  and ${criterion.condition} #{criterion.value}
22
+                </when>
23
+                <when test="criterion.betweenValue" >
24
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
25
+                </when>
26
+                <when test="criterion.listValue" >
27
+                  and ${criterion.condition}
28
+                  <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
29
+                    #{listItem}
30
+                  </foreach>
31
+                </when>
32
+              </choose>
33
+            </foreach>
34
+          </trim>
35
+        </if>
36
+      </foreach>
37
+    </where>
38
+  </sql>
39
+  <sql id="Update_By_Example_Where_Clause" >
40
+    <where >
41
+      <foreach collection="example.oredCriteria" item="criteria" separator="or" >
42
+        <if test="criteria.valid" >
43
+          <trim prefix="(" suffix=")" prefixOverrides="and" >
44
+            <foreach collection="criteria.criteria" item="criterion" >
45
+              <choose >
46
+                <when test="criterion.noValue" >
47
+                  and ${criterion.condition}
48
+                </when>
49
+                <when test="criterion.singleValue" >
50
+                  and ${criterion.condition} #{criterion.value}
51
+                </when>
52
+                <when test="criterion.betweenValue" >
53
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
54
+                </when>
55
+                <when test="criterion.listValue" >
56
+                  and ${criterion.condition}
57
+                  <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
58
+                    #{listItem}
59
+                  </foreach>
60
+                </when>
61
+              </choose>
62
+            </foreach>
63
+          </trim>
64
+        </if>
65
+      </foreach>
66
+    </where>
67
+  </sql>
68
+  <sql id="Base_Column_List" >
69
+    org_id, s_code, s_val, updatetime
70
+  </sql>
71
+  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.chinaitop.depot.system.model.SysCodeExample" >
72
+    select
73
+    <if test="distinct" >
74
+      distinct
75
+    </if>
76
+    <include refid="Base_Column_List" />
77
+    from sys_code
78
+    <if test="_parameter != null" >
79
+      <include refid="Example_Where_Clause" />
80
+    </if>
81
+    <if test="orderByClause != null" >
82
+      order by ${orderByClause}
83
+    </if>
84
+  </select>
85
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="com.chinaitop.depot.system.model.SysCodeKey" >
86
+    select 
87
+    <include refid="Base_Column_List" />
88
+    from sys_code
89
+    where org_id = #{orgId,jdbcType=INTEGER}
90
+      and s_code = #{sCode,jdbcType=VARCHAR}
91
+  </select>
92
+  <delete id="deleteByPrimaryKey" parameterType="com.chinaitop.depot.system.model.SysCodeKey" >
93
+    delete from sys_code
94
+    where org_id = #{orgId,jdbcType=INTEGER}
95
+      and s_code = #{sCode,jdbcType=VARCHAR}
96
+  </delete>
97
+  <delete id="deleteByExample" parameterType="com.chinaitop.depot.system.model.SysCodeExample" >
98
+    delete from sys_code
99
+    <if test="_parameter != null" >
100
+      <include refid="Example_Where_Clause" />
101
+    </if>
102
+  </delete>
103
+  <insert id="insert" parameterType="com.chinaitop.depot.system.model.SysCode" >
104
+    insert into sys_code (org_id, s_code, s_val, 
105
+      updatetime)
106
+    values (#{orgId,jdbcType=INTEGER}, #{sCode,jdbcType=VARCHAR}, #{sVal,jdbcType=VARCHAR}, 
107
+      #{updatetime,jdbcType=TIMESTAMP})
108
+  </insert>
109
+  <insert id="insertSelective" parameterType="com.chinaitop.depot.system.model.SysCode" >
110
+    insert into sys_code
111
+    <trim prefix="(" suffix=")" suffixOverrides="," >
112
+      <if test="orgId != null" >
113
+        org_id,
114
+      </if>
115
+      <if test="sCode != null" >
116
+        s_code,
117
+      </if>
118
+      <if test="sVal != null" >
119
+        s_val,
120
+      </if>
121
+      <if test="updatetime != null" >
122
+        updatetime,
123
+      </if>
124
+    </trim>
125
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
126
+      <if test="orgId != null" >
127
+        #{orgId,jdbcType=INTEGER},
128
+      </if>
129
+      <if test="sCode != null" >
130
+        #{sCode,jdbcType=VARCHAR},
131
+      </if>
132
+      <if test="sVal != null" >
133
+        #{sVal,jdbcType=VARCHAR},
134
+      </if>
135
+      <if test="updatetime != null" >
136
+        #{updatetime,jdbcType=TIMESTAMP},
137
+      </if>
138
+    </trim>
139
+  </insert>
140
+  <select id="countByExample" parameterType="com.chinaitop.depot.system.model.SysCodeExample" resultType="java.lang.Integer" >
141
+    select count(*) from sys_code
142
+    <if test="_parameter != null" >
143
+      <include refid="Example_Where_Clause" />
144
+    </if>
145
+  </select>
146
+  <update id="updateByExampleSelective" parameterType="map" >
147
+    update sys_code
148
+    <set >
149
+      <if test="record.orgId != null" >
150
+        org_id = #{record.orgId,jdbcType=INTEGER},
151
+      </if>
152
+      <if test="record.sCode != null" >
153
+        s_code = #{record.sCode,jdbcType=VARCHAR},
154
+      </if>
155
+      <if test="record.sVal != null" >
156
+        s_val = #{record.sVal,jdbcType=VARCHAR},
157
+      </if>
158
+      <if test="record.updatetime != null" >
159
+        updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
160
+      </if>
161
+    </set>
162
+    <if test="_parameter != null" >
163
+      <include refid="Update_By_Example_Where_Clause" />
164
+    </if>
165
+  </update>
166
+  <update id="updateByExample" parameterType="map" >
167
+    update sys_code
168
+    set org_id = #{record.orgId,jdbcType=INTEGER},
169
+      s_code = #{record.sCode,jdbcType=VARCHAR},
170
+      s_val = #{record.sVal,jdbcType=VARCHAR},
171
+      updatetime = #{record.updatetime,jdbcType=TIMESTAMP}
172
+    <if test="_parameter != null" >
173
+      <include refid="Update_By_Example_Where_Clause" />
174
+    </if>
175
+  </update>
176
+  <update id="updateByPrimaryKeySelective" parameterType="com.chinaitop.depot.system.model.SysCode" >
177
+    update sys_code
178
+    <set >
179
+      <if test="sVal != null" >
180
+        s_val = #{sVal,jdbcType=VARCHAR},
181
+      </if>
182
+      <if test="updatetime != null" >
183
+        updatetime = #{updatetime,jdbcType=TIMESTAMP},
184
+      </if>
185
+    </set>
186
+    where org_id = #{orgId,jdbcType=INTEGER}
187
+      and s_code = #{sCode,jdbcType=VARCHAR}
188
+  </update>
189
+  <update id="updateByPrimaryKey" parameterType="com.chinaitop.depot.system.model.SysCode" >
190
+    update sys_code
191
+    set s_val = #{sVal,jdbcType=VARCHAR},
192
+      updatetime = #{updatetime,jdbcType=TIMESTAMP}
193
+    where org_id = #{orgId,jdbcType=INTEGER}
194
+      and s_code = #{sCode,jdbcType=VARCHAR}
195
+  </update>
196
+</mapper>

+ 41 - 0
src/main/java/com/chinaitop/depot/system/model/SysCode.java

@@ -0,0 +1,41 @@
1
+package com.chinaitop.depot.system.model;
2
+
3
+import java.util.Date;
4
+
5
+public class SysCode extends SysCodeKey {
6
+    private String sVal;
7
+
8
+    private Date updatetime;
9
+
10
+    /**
11
+     * null
12
+     * @return s_val null
13
+     */
14
+    public String getsVal() {
15
+        return sVal;
16
+    }
17
+
18
+    /**
19
+     * null
20
+     * @param sVal null
21
+     */
22
+    public void setsVal(String sVal) {
23
+        this.sVal = sVal == null ? null : sVal.trim();
24
+    }
25
+
26
+    /**
27
+     * null
28
+     * @return updatetime null
29
+     */
30
+    public Date getUpdatetime() {
31
+        return updatetime;
32
+    }
33
+
34
+    /**
35
+     * null
36
+     * @param updatetime null
37
+     */
38
+    public void setUpdatetime(Date updatetime) {
39
+        this.updatetime = updatetime;
40
+    }
41
+}

+ 479 - 0
src/main/java/com/chinaitop/depot/system/model/SysCodeExample.java

@@ -0,0 +1,479 @@
1
+package com.chinaitop.depot.system.model;
2
+
3
+import java.util.ArrayList;
4
+import java.util.Date;
5
+import java.util.List;
6
+
7
+public class SysCodeExample {
8
+    /**
9
+     * sys_code
10
+     */
11
+    protected String orderByClause;
12
+
13
+    /**
14
+     * sys_code
15
+     */
16
+    protected boolean distinct;
17
+
18
+    /**
19
+     * sys_code
20
+     */
21
+    protected List<Criteria> oredCriteria;
22
+
23
+    public SysCodeExample() {
24
+        oredCriteria = new ArrayList<Criteria>();
25
+    }
26
+
27
+    public void setOrderByClause(String orderByClause) {
28
+        this.orderByClause = orderByClause;
29
+    }
30
+
31
+    public String getOrderByClause() {
32
+        return orderByClause;
33
+    }
34
+
35
+    public void setDistinct(boolean distinct) {
36
+        this.distinct = distinct;
37
+    }
38
+
39
+    public boolean isDistinct() {
40
+        return distinct;
41
+    }
42
+
43
+    public List<Criteria> getOredCriteria() {
44
+        return oredCriteria;
45
+    }
46
+
47
+    public void or(Criteria criteria) {
48
+        oredCriteria.add(criteria);
49
+    }
50
+
51
+    public Criteria or() {
52
+        Criteria criteria = createCriteriaInternal();
53
+        oredCriteria.add(criteria);
54
+        return criteria;
55
+    }
56
+
57
+    public Criteria createCriteria() {
58
+        Criteria criteria = createCriteriaInternal();
59
+        if (oredCriteria.size() == 0) {
60
+            oredCriteria.add(criteria);
61
+        }
62
+        return criteria;
63
+    }
64
+
65
+    protected Criteria createCriteriaInternal() {
66
+        Criteria criteria = new Criteria();
67
+        return criteria;
68
+    }
69
+
70
+    public void clear() {
71
+        oredCriteria.clear();
72
+        orderByClause = null;
73
+        distinct = false;
74
+    }
75
+
76
+    /**
77
+     * sys_code 2023-07-31
78
+     */
79
+    protected abstract static class GeneratedCriteria {
80
+        protected List<Criterion> criteria;
81
+
82
+        protected GeneratedCriteria() {
83
+            super();
84
+            criteria = new ArrayList<Criterion>();
85
+        }
86
+
87
+        public boolean isValid() {
88
+            return criteria.size() > 0;
89
+        }
90
+
91
+        public List<Criterion> getAllCriteria() {
92
+            return criteria;
93
+        }
94
+
95
+        public List<Criterion> getCriteria() {
96
+            return criteria;
97
+        }
98
+
99
+        protected void addCriterion(String condition) {
100
+            if (condition == null) {
101
+                throw new RuntimeException("Value for condition cannot be null");
102
+            }
103
+            criteria.add(new Criterion(condition));
104
+        }
105
+
106
+        protected void addCriterion(String condition, Object value, String property) {
107
+            if (value == null) {
108
+                throw new RuntimeException("Value for " + property + " cannot be null");
109
+            }
110
+            criteria.add(new Criterion(condition, value));
111
+        }
112
+
113
+        protected void addCriterion(String condition, Object value1, Object value2, String property) {
114
+            if (value1 == null || value2 == null) {
115
+                throw new RuntimeException("Between values for " + property + " cannot be null");
116
+            }
117
+            criteria.add(new Criterion(condition, value1, value2));
118
+        }
119
+
120
+        public Criteria andOrgIdIsNull() {
121
+            addCriterion("org_id is null");
122
+            return (Criteria) this;
123
+        }
124
+
125
+        public Criteria andOrgIdIsNotNull() {
126
+            addCriterion("org_id is not null");
127
+            return (Criteria) this;
128
+        }
129
+
130
+        public Criteria andOrgIdEqualTo(Integer value) {
131
+            addCriterion("org_id =", value, "orgId");
132
+            return (Criteria) this;
133
+        }
134
+
135
+        public Criteria andOrgIdNotEqualTo(Integer value) {
136
+            addCriterion("org_id <>", value, "orgId");
137
+            return (Criteria) this;
138
+        }
139
+
140
+        public Criteria andOrgIdGreaterThan(Integer value) {
141
+            addCriterion("org_id >", value, "orgId");
142
+            return (Criteria) this;
143
+        }
144
+
145
+        public Criteria andOrgIdGreaterThanOrEqualTo(Integer value) {
146
+            addCriterion("org_id >=", value, "orgId");
147
+            return (Criteria) this;
148
+        }
149
+
150
+        public Criteria andOrgIdLessThan(Integer value) {
151
+            addCriterion("org_id <", value, "orgId");
152
+            return (Criteria) this;
153
+        }
154
+
155
+        public Criteria andOrgIdLessThanOrEqualTo(Integer value) {
156
+            addCriterion("org_id <=", value, "orgId");
157
+            return (Criteria) this;
158
+        }
159
+
160
+        public Criteria andOrgIdIn(List<Integer> values) {
161
+            addCriterion("org_id in", values, "orgId");
162
+            return (Criteria) this;
163
+        }
164
+
165
+        public Criteria andOrgIdNotIn(List<Integer> values) {
166
+            addCriterion("org_id not in", values, "orgId");
167
+            return (Criteria) this;
168
+        }
169
+
170
+        public Criteria andOrgIdBetween(Integer value1, Integer value2) {
171
+            addCriterion("org_id between", value1, value2, "orgId");
172
+            return (Criteria) this;
173
+        }
174
+
175
+        public Criteria andOrgIdNotBetween(Integer value1, Integer value2) {
176
+            addCriterion("org_id not between", value1, value2, "orgId");
177
+            return (Criteria) this;
178
+        }
179
+
180
+        public Criteria andSCodeIsNull() {
181
+            addCriterion("s_code is null");
182
+            return (Criteria) this;
183
+        }
184
+
185
+        public Criteria andSCodeIsNotNull() {
186
+            addCriterion("s_code is not null");
187
+            return (Criteria) this;
188
+        }
189
+
190
+        public Criteria andSCodeEqualTo(String value) {
191
+            addCriterion("s_code =", value, "sCode");
192
+            return (Criteria) this;
193
+        }
194
+
195
+        public Criteria andSCodeNotEqualTo(String value) {
196
+            addCriterion("s_code <>", value, "sCode");
197
+            return (Criteria) this;
198
+        }
199
+
200
+        public Criteria andSCodeGreaterThan(String value) {
201
+            addCriterion("s_code >", value, "sCode");
202
+            return (Criteria) this;
203
+        }
204
+
205
+        public Criteria andSCodeGreaterThanOrEqualTo(String value) {
206
+            addCriterion("s_code >=", value, "sCode");
207
+            return (Criteria) this;
208
+        }
209
+
210
+        public Criteria andSCodeLessThan(String value) {
211
+            addCriterion("s_code <", value, "sCode");
212
+            return (Criteria) this;
213
+        }
214
+
215
+        public Criteria andSCodeLessThanOrEqualTo(String value) {
216
+            addCriterion("s_code <=", value, "sCode");
217
+            return (Criteria) this;
218
+        }
219
+
220
+        public Criteria andSCodeLike(String value) {
221
+            addCriterion("s_code like", value, "sCode");
222
+            return (Criteria) this;
223
+        }
224
+
225
+        public Criteria andSCodeNotLike(String value) {
226
+            addCriterion("s_code not like", value, "sCode");
227
+            return (Criteria) this;
228
+        }
229
+
230
+        public Criteria andSCodeIn(List<String> values) {
231
+            addCriterion("s_code in", values, "sCode");
232
+            return (Criteria) this;
233
+        }
234
+
235
+        public Criteria andSCodeNotIn(List<String> values) {
236
+            addCriterion("s_code not in", values, "sCode");
237
+            return (Criteria) this;
238
+        }
239
+
240
+        public Criteria andSCodeBetween(String value1, String value2) {
241
+            addCriterion("s_code between", value1, value2, "sCode");
242
+            return (Criteria) this;
243
+        }
244
+
245
+        public Criteria andSCodeNotBetween(String value1, String value2) {
246
+            addCriterion("s_code not between", value1, value2, "sCode");
247
+            return (Criteria) this;
248
+        }
249
+
250
+        public Criteria andSValIsNull() {
251
+            addCriterion("s_val is null");
252
+            return (Criteria) this;
253
+        }
254
+
255
+        public Criteria andSValIsNotNull() {
256
+            addCriterion("s_val is not null");
257
+            return (Criteria) this;
258
+        }
259
+
260
+        public Criteria andSValEqualTo(String value) {
261
+            addCriterion("s_val =", value, "sVal");
262
+            return (Criteria) this;
263
+        }
264
+
265
+        public Criteria andSValNotEqualTo(String value) {
266
+            addCriterion("s_val <>", value, "sVal");
267
+            return (Criteria) this;
268
+        }
269
+
270
+        public Criteria andSValGreaterThan(String value) {
271
+            addCriterion("s_val >", value, "sVal");
272
+            return (Criteria) this;
273
+        }
274
+
275
+        public Criteria andSValGreaterThanOrEqualTo(String value) {
276
+            addCriterion("s_val >=", value, "sVal");
277
+            return (Criteria) this;
278
+        }
279
+
280
+        public Criteria andSValLessThan(String value) {
281
+            addCriterion("s_val <", value, "sVal");
282
+            return (Criteria) this;
283
+        }
284
+
285
+        public Criteria andSValLessThanOrEqualTo(String value) {
286
+            addCriterion("s_val <=", value, "sVal");
287
+            return (Criteria) this;
288
+        }
289
+
290
+        public Criteria andSValLike(String value) {
291
+            addCriterion("s_val like", value, "sVal");
292
+            return (Criteria) this;
293
+        }
294
+
295
+        public Criteria andSValNotLike(String value) {
296
+            addCriterion("s_val not like", value, "sVal");
297
+            return (Criteria) this;
298
+        }
299
+
300
+        public Criteria andSValIn(List<String> values) {
301
+            addCriterion("s_val in", values, "sVal");
302
+            return (Criteria) this;
303
+        }
304
+
305
+        public Criteria andSValNotIn(List<String> values) {
306
+            addCriterion("s_val not in", values, "sVal");
307
+            return (Criteria) this;
308
+        }
309
+
310
+        public Criteria andSValBetween(String value1, String value2) {
311
+            addCriterion("s_val between", value1, value2, "sVal");
312
+            return (Criteria) this;
313
+        }
314
+
315
+        public Criteria andSValNotBetween(String value1, String value2) {
316
+            addCriterion("s_val not between", value1, value2, "sVal");
317
+            return (Criteria) this;
318
+        }
319
+
320
+        public Criteria andUpdatetimeIsNull() {
321
+            addCriterion("updatetime is null");
322
+            return (Criteria) this;
323
+        }
324
+
325
+        public Criteria andUpdatetimeIsNotNull() {
326
+            addCriterion("updatetime is not null");
327
+            return (Criteria) this;
328
+        }
329
+
330
+        public Criteria andUpdatetimeEqualTo(Date value) {
331
+            addCriterion("updatetime =", value, "updatetime");
332
+            return (Criteria) this;
333
+        }
334
+
335
+        public Criteria andUpdatetimeNotEqualTo(Date value) {
336
+            addCriterion("updatetime <>", value, "updatetime");
337
+            return (Criteria) this;
338
+        }
339
+
340
+        public Criteria andUpdatetimeGreaterThan(Date value) {
341
+            addCriterion("updatetime >", value, "updatetime");
342
+            return (Criteria) this;
343
+        }
344
+
345
+        public Criteria andUpdatetimeGreaterThanOrEqualTo(Date value) {
346
+            addCriterion("updatetime >=", value, "updatetime");
347
+            return (Criteria) this;
348
+        }
349
+
350
+        public Criteria andUpdatetimeLessThan(Date value) {
351
+            addCriterion("updatetime <", value, "updatetime");
352
+            return (Criteria) this;
353
+        }
354
+
355
+        public Criteria andUpdatetimeLessThanOrEqualTo(Date value) {
356
+            addCriterion("updatetime <=", value, "updatetime");
357
+            return (Criteria) this;
358
+        }
359
+
360
+        public Criteria andUpdatetimeIn(List<Date> values) {
361
+            addCriterion("updatetime in", values, "updatetime");
362
+            return (Criteria) this;
363
+        }
364
+
365
+        public Criteria andUpdatetimeNotIn(List<Date> values) {
366
+            addCriterion("updatetime not in", values, "updatetime");
367
+            return (Criteria) this;
368
+        }
369
+
370
+        public Criteria andUpdatetimeBetween(Date value1, Date value2) {
371
+            addCriterion("updatetime between", value1, value2, "updatetime");
372
+            return (Criteria) this;
373
+        }
374
+
375
+        public Criteria andUpdatetimeNotBetween(Date value1, Date value2) {
376
+            addCriterion("updatetime not between", value1, value2, "updatetime");
377
+            return (Criteria) this;
378
+        }
379
+    }
380
+
381
+    /**
382
+     * sys_code
383
+     */
384
+    public static class Criteria extends GeneratedCriteria {
385
+
386
+        protected Criteria() {
387
+            super();
388
+        }
389
+    }
390
+
391
+    /**
392
+     * sys_code 2023-07-31
393
+     */
394
+    public static class Criterion {
395
+        private String condition;
396
+
397
+        private Object value;
398
+
399
+        private Object secondValue;
400
+
401
+        private boolean noValue;
402
+
403
+        private boolean singleValue;
404
+
405
+        private boolean betweenValue;
406
+
407
+        private boolean listValue;
408
+
409
+        private String typeHandler;
410
+
411
+        public String getCondition() {
412
+            return condition;
413
+        }
414
+
415
+        public Object getValue() {
416
+            return value;
417
+        }
418
+
419
+        public Object getSecondValue() {
420
+            return secondValue;
421
+        }
422
+
423
+        public boolean isNoValue() {
424
+            return noValue;
425
+        }
426
+
427
+        public boolean isSingleValue() {
428
+            return singleValue;
429
+        }
430
+
431
+        public boolean isBetweenValue() {
432
+            return betweenValue;
433
+        }
434
+
435
+        public boolean isListValue() {
436
+            return listValue;
437
+        }
438
+
439
+        public String getTypeHandler() {
440
+            return typeHandler;
441
+        }
442
+
443
+        protected Criterion(String condition) {
444
+            super();
445
+            this.condition = condition;
446
+            this.typeHandler = null;
447
+            this.noValue = true;
448
+        }
449
+
450
+        protected Criterion(String condition, Object value, String typeHandler) {
451
+            super();
452
+            this.condition = condition;
453
+            this.value = value;
454
+            this.typeHandler = typeHandler;
455
+            if (value instanceof List<?>) {
456
+                this.listValue = true;
457
+            } else {
458
+                this.singleValue = true;
459
+            }
460
+        }
461
+
462
+        protected Criterion(String condition, Object value) {
463
+            this(condition, value, null);
464
+        }
465
+
466
+        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
467
+            super();
468
+            this.condition = condition;
469
+            this.value = value;
470
+            this.secondValue = secondValue;
471
+            this.typeHandler = typeHandler;
472
+            this.betweenValue = true;
473
+        }
474
+
475
+        protected Criterion(String condition, Object value, Object secondValue) {
476
+            this(condition, value, secondValue, null);
477
+        }
478
+    }
479
+}

+ 39 - 0
src/main/java/com/chinaitop/depot/system/model/SysCodeKey.java

@@ -0,0 +1,39 @@
1
+package com.chinaitop.depot.system.model;
2
+
3
+public class SysCodeKey {
4
+    private Integer orgId;
5
+
6
+    private String sCode;
7
+
8
+    /**
9
+     * null
10
+     * @return org_id null
11
+     */
12
+    public Integer getOrgId() {
13
+        return orgId;
14
+    }
15
+
16
+    /**
17
+     * null
18
+     * @param orgId null
19
+     */
20
+    public void setOrgId(Integer orgId) {
21
+        this.orgId = orgId;
22
+    }
23
+
24
+    /**
25
+     * null
26
+     * @return s_code null
27
+     */
28
+    public String getsCode() {
29
+        return sCode;
30
+    }
31
+
32
+    /**
33
+     * null
34
+     * @param sCode null
35
+     */
36
+    public void setsCode(String sCode) {
37
+        this.sCode = sCode == null ? null : sCode.trim();
38
+    }
39
+}

+ 24 - 0
src/main/java/com/chinaitop/depot/system/service/SysCodeService.java

@@ -0,0 +1,24 @@
1
+package com.chinaitop.depot.system.service;
2
+
3
+import com.chinaitop.depot.system.model.SysCode;
4
+
5
+public interface SysCodeService {
6
+
7
+	/**
8
+	 * 按主键查询一条系统配置数据
9
+	 * @param orgId
10
+	 * @param sCode
11
+	 * @return
12
+	 * @throws Exception
13
+	 */
14
+	public SysCode querySysCode(Integer orgId, String sCode) throws Exception;
15
+	
16
+	/**
17
+	 * 按主键查询一条系统配置数据并返回配置value
18
+	 * @param orgId
19
+	 * @param sCode
20
+	 * @return
21
+	 * @throws Exception
22
+	 */
23
+	public String getSVal(Integer orgId, String sCode) throws Exception;
24
+}

+ 51 - 0
src/main/java/com/chinaitop/depot/system/service/impl/SysCodeServiceImpl.java

@@ -0,0 +1,51 @@
1
+package com.chinaitop.depot.system.service.impl;
2
+
3
+import javax.annotation.Resource;
4
+
5
+import org.apache.commons.lang3.StringUtils;
6
+import org.springframework.stereotype.Service;
7
+
8
+import com.chinaitop.depot.system.mapper.SysCodeMapper;
9
+import com.chinaitop.depot.system.model.SysCode;
10
+import com.chinaitop.depot.system.model.SysCodeKey;
11
+import com.chinaitop.depot.system.service.SysCodeService;
12
+
13
+@Service
14
+public class SysCodeServiceImpl implements SysCodeService {
15
+
16
+	@Resource
17
+	private SysCodeMapper sysCodeMapper;
18
+
19
+	@Override
20
+	public SysCode querySysCode(Integer orgId, String sCode) throws Exception {
21
+		SysCodeKey sysCodeKey = new SysCodeKey();
22
+		sysCodeKey.setOrgId(orgId);
23
+		sysCodeKey.setsCode(sCode);
24
+		SysCode en = sysCodeMapper.selectByPrimaryKey(sysCodeKey);
25
+		return en;
26
+	}
27
+
28
+	@Override
29
+	public String getSVal(Integer orgId, String sCode) throws Exception {
30
+		String val = "";
31
+		StringBuffer sbf = new StringBuffer(100);
32
+		if (StringUtils.isBlank(sCode)) {
33
+			sbf.append("code不能为空!");
34
+		}
35
+		if (null == orgId) {
36
+			sbf.append("orgId不能为空!");
37
+		}
38
+		if (sbf.toString().length() > 0) {
39
+			val = sbf.toString();
40
+		} else {
41
+			SysCode sysCode = querySysCode(orgId, sCode);
42
+			if (null != sysCode) {
43
+				val = sysCode.getsVal();
44
+			} else {
45
+				val = "无此配置";
46
+			}
47
+		}
48
+		return val;
49
+	}
50
+
51
+}

+ 35 - 0
src/main/java/com/chinaitop/depot/utils/OkHttpUtil.java

@@ -0,0 +1,35 @@
1
+package com.chinaitop.depot.utils;
2
+
3
+import java.io.IOException;
4
+
5
+import okhttp3.MediaType;
6
+import okhttp3.OkHttpClient;
7
+import okhttp3.Request;
8
+import okhttp3.RequestBody;
9
+import okhttp3.Response;
10
+
11
+public class OkHttpUtil {
12
+    // get请求
13
+    public static String get(String url) throws IOException {
14
+        OkHttpClient client = new OkHttpClient();
15
+        Request request = new Request.Builder()
16
+            .url(url)
17
+            .build();
18
+        
19
+        Response response = client.newCall(request).execute();
20
+        return response.body().string();
21
+    }
22
+
23
+    // post请求
24
+    public static String post(String url, String params) throws IOException {
25
+        OkHttpClient client = new OkHttpClient();
26
+        RequestBody body = RequestBody.create(MediaType.parse("application/x-www-form-urlencoded"), params);
27
+        Request request = new Request.Builder()
28
+            .url(url) 
29
+            .post(body)
30
+            .build();
31
+            
32
+        Response response = client.newCall(request).execute();
33
+        return response.body().string();
34
+    }
35
+}