gaodandan 6 роки тому
батько
коміт
d8bc6c62d1

+ 26 - 7
pom.xml

@@ -14,7 +14,7 @@
14 14
 	<parent>
15 15
 		<groupId>org.springframework.boot</groupId>
16 16
 		<artifactId>spring-boot-starter-parent</artifactId>
17
-		<version>2.0.0.RELEASE</version>
17
+		<version>2.0.4.RELEASE</version>
18 18
 		<relativePath/> <!-- lookup parent from repository -->
19 19
 	</parent>
20 20
 
@@ -22,7 +22,7 @@
22 22
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
23 23
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
24 24
         <java.version>1.8</java.version>
25
-        <spring-cloud.version>Finchley.M8</spring-cloud.version>
25
+        <spring-cloud.version>Finchley.RELEASE</spring-cloud.version>
26 26
     </properties>
27 27
 
28 28
 	<dependencies>
@@ -46,6 +46,12 @@
46 46
 		    <artifactId>spring-boot-autoconfigure</artifactId>
47 47
 		</dependency>
48 48
 		
49
+		<dependency>
50
+		    <groupId>org.springframework.boot</groupId>
51
+		    <artifactId>spring-boot-devtools</artifactId>
52
+		    <optional>true</optional>
53
+		</dependency>
54
+
49 55
 		
50 56
 		<!--activiti新增的jar包   开始  -->
51 57
 		<dependency>
@@ -114,11 +120,16 @@
114 120
 		</dependency>
115 121
 		
116 122
 		<!--添加webservice-->
123
+		<dependency>
124
+		   <groupId>org.apache.cxf</groupId>
125
+		   <artifactId>cxf-spring-boot-starter-jaxws</artifactId>
126
+		   <version>3.2.4</version>
127
+        </dependency>
117 128
         <dependency>
118 129
             <groupId>org.springframework.boot</groupId>
119 130
             <artifactId>spring-boot-starter-web-services</artifactId>
120 131
         </dependency>
121
-        <dependency>
132
+        <!-- <dependency>
122 133
             <groupId>org.apache.cxf</groupId>
123 134
             <artifactId>cxf-rt-frontend-jaxws</artifactId>
124 135
             <version>3.1.6</version>
@@ -127,7 +138,7 @@
127 138
             <groupId>org.apache.cxf</groupId>
128 139
             <artifactId>cxf-rt-transports-http</artifactId>
129 140
             <version>3.1.6</version>
130
-        </dependency>
141
+        </dependency> -->
131 142
         <!--添加webservice end-->
132 143
         
133 144
 		<!-- 引入spring boot自带的pagehelper插件 -->
@@ -147,6 +158,12 @@
147 158
             <groupId>org.springframework.cloud</groupId>
148 159
             <artifactId>spring-cloud-starter-config</artifactId>
149 160
         </dependency>
161
+        
162
+        <!-- <dependency>
163
+          <groupId>org.springframework.cloud</groupId>
164
+        	   <artifactId>spring-cloud-starter-openfeign</artifactId>
165
+        </dependency> -->
166
+
150 167
 		<dependency>
151 168
 			<groupId>org.apache.commons</groupId>
152 169
 			<artifactId>commons-lang3</artifactId>
@@ -186,11 +203,10 @@
186 203
 			<version>3.9</version>
187 204
 		</dependency>
188 205
 		
189
-		<!--<dependency>
206
+		<dependency>
190 207
 		    <groupId>org.apache.httpcomponents</groupId>
191 208
 		    <artifactId>httpclient</artifactId>
192
-		    <version>4.5.3</version>
193
-		</dependency>-->
209
+		</dependency>
194 210
 		
195 211
 		<dependency>  
196 212
 	       <groupId>log4j</groupId>  
@@ -238,6 +254,9 @@
238 254
 			<plugin>
239 255
 				<groupId>org.springframework.boot</groupId>
240 256
 				<artifactId>spring-boot-maven-plugin</artifactId>
257
+				<configuration>
258
+                    <fork>true</fork>
259
+                </configuration>
241 260
 			</plugin>
242 261
 			<!-- <plugin>
243 262
             	<groupId>org.apache.maven.plugins</groupId>

+ 4 - 4
src/main/java/com/chinaitop/depot/DepotBusinessApplication.java

@@ -40,7 +40,7 @@ public class DepotBusinessApplication {
40 40
 	/**
41 41
 	 * 注册一个dispatcherServlet,解决增加ws之后https接口访问不了问题
42 42
 	 */
43
-	@Bean
43
+	/*@Bean
44 44
 	public ServletRegistrationBean restServlet(){
45 45
 		//注解扫描上下文
46 46
 		AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext();
@@ -57,11 +57,11 @@ public class DepotBusinessApplication {
57 57
 		registrationBean.setName("rest");
58 58
 		return registrationBean;
59 59
 	}
60
-
61
-	@Bean
60
+*/
61
+	/*@Bean
62 62
 	public ThreadPoolTaskScheduler threadPoolTaskScheduler() {
63 63
 		return new ThreadPoolTaskScheduler();
64
-	}
64
+	}*/
65 65
 	
66 66
 
67 67
 }

+ 3 - 5
src/main/java/com/chinaitop/depot/act/controller/ActTemplateController.java

@@ -2,12 +2,10 @@ package com.chinaitop.depot.act.controller;
2 2
 
3 3
 import java.io.UnsupportedEncodingException;
4 4
 
5
-import javax.servlet.http.HttpServletRequest;
6 5
 import javax.xml.stream.XMLStreamException;
7 6
 
8 7
 import org.apache.commons.lang3.StringUtils;
9 8
 import org.springframework.beans.factory.annotation.Autowired;
10
-import org.springframework.http.MediaType;
11 9
 import org.springframework.web.bind.annotation.RequestMapping;
12 10
 import org.springframework.web.bind.annotation.RequestMethod;
13 11
 import org.springframework.web.bind.annotation.RestController;
@@ -21,15 +19,15 @@ public class ActTemplateController {
21 19
 	@Autowired
22 20
 	private ActTemplateService actTemplateService;
23 21
 	
24
-	@RequestMapping(value = "/deploy", method=RequestMethod.POST)
25
-	public String deploy( MultipartFile file, RedirectAttributes redirectAttributes, HttpServletRequest request) {
22
+	@RequestMapping(value = "/actDeploy",method=RequestMethod.POST)
23
+	public String deploy(MultipartFile file,RedirectAttributes redirectAttributes, Integer orgId) {
26 24
 
27 25
 		String fileName = file.getOriginalFilename();
28 26
 		
29 27
 		if (StringUtils.isBlank(fileName)){
30 28
 			redirectAttributes.addFlashAttribute("message", "请选择要部署的流程文件");
31 29
 		}else{
32
-			String message = actTemplateService.deploy(file,request);
30
+			String message = actTemplateService.deploy(file,orgId);
33 31
 			return message;
34 32
 		}
35 33
 		return null;

+ 3 - 5
src/main/java/com/chinaitop/depot/act/service/ActTemplateService.java

@@ -38,7 +38,7 @@ public class ActTemplateService {
38 38
 	 * @return
39 39
 	 */
40 40
 	@Transactional(readOnly = false)
41
-	public String deploy(MultipartFile file, HttpServletRequest request) {
41
+	public String deploy(MultipartFile file,Integer orgId) {
42 42
 
43 43
 		String message = "";
44 44
 		
@@ -64,13 +64,11 @@ public class ActTemplateService {
64 64
 			
65 65
 			List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).list();
66 66
 			
67
-			Integer depotId =(Integer) request.getSession().getAttribute("depotId");
68
-			
69 67
 				// 设置流程分类
70 68
 			for (ProcessDefinition processDefinition : list) {
71 69
 	//				ActUtils.exportDiagramToFile(repositoryService, processDefinition, exportDir);
72
-				repositoryService.setProcessDefinitionCategory(processDefinition.getId(), depotId.toString());
73
-				message += "部署成功,流程ID=" + processDefinition.getId() + "<br/>";
70
+				repositoryService.setProcessDefinitionCategory(processDefinition.getId(), orgId.toString());
71
+				message += "部署成功,流程ID=" + processDefinition.getId();
74 72
 			}
75 73
 			if (list.size() == 0){
76 74
 				message = "部署失败,没有流程。";

+ 47 - 0
src/main/java/com/chinaitop/depot/business/controller/RoleInfoController.java

@@ -0,0 +1,47 @@
1
+package com.chinaitop.depot.business.controller;
2
+
3
+import com.chinaitop.depot.business.model.RoleInfo;
4
+import com.chinaitop.depot.business.model.RoleInfoExample;
5
+import com.chinaitop.depot.business.model.RoleInfoExample.Criteria;
6
+import com.chinaitop.depot.business.service.RoleInfoService;
7
+import com.github.pagehelper.PageHelper;
8
+import com.github.pagehelper.PageInfo;
9
+import org.apache.commons.lang3.StringUtils;
10
+import org.springframework.web.bind.annotation.RequestMapping;
11
+import org.springframework.web.bind.annotation.RestController;
12
+
13
+import javax.annotation.Resource;
14
+import javax.servlet.http.HttpServletRequest;
15
+
16
+import java.util.List;
17
+
18
+@RestController
19
+@RequestMapping(value="/roleInfo")
20
+public class RoleInfoController {
21
+	
22
+	@Resource
23
+	private RoleInfoService roleInfoService;
24
+	
25
+	
26
+	/**
27
+	 * 查找角色信息
28
+	 * @param pageNum	页码
29
+	 * @param pageSize	每页条数
30
+	 * @return
31
+	 */
32
+	@RequestMapping(value="/getRole")
33
+	public PageInfo<RoleInfo> getRoleInfo(HttpServletRequest request) {
34
+		RoleInfoExample example = new RoleInfoExample();
35
+		Criteria criteria = example.createCriteria();
36
+		Integer orgId = (Integer)request.getSession().getAttribute("orgId");
37
+		if (orgId != null) {
38
+			criteria.andOrgIdEqualTo(orgId);
39
+		}
40
+		List<RoleInfo> list = roleInfoService.queryByExample(example);	
41
+		PageInfo<RoleInfo> pageInfo = new PageInfo<RoleInfo>(list);
42
+		return pageInfo;
43
+	}
44
+
45
+	
46
+
47
+}

+ 5 - 74
src/main/java/com/chinaitop/depot/business/controller/UserInfoController.java

@@ -77,86 +77,17 @@ public class UserInfoController {
77 77
 	 */
78 78
 	@RequestMapping(value="/getUser", method = RequestMethod.GET)
79 79
 	@ApiOperation(value="查询用户信息", notes = "查询用户信息列表,支持分页")
80
-	@ApiImplicitParams({
81
-			@ApiImplicitParam(name = "pageNum", value = "页码", paramType = "query"),
82
-			@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "query"),
83
-			@ApiImplicitParam(name = "username", value = "用户名", paramType = "query"),
84
-			@ApiImplicitParam(name = "realName", value = "用户真实姓名", paramType = "query")
85
-	})
86
-	public PageInfo<UserInfo> getUserInfo(HttpServletRequest request, Integer pageNum, Integer pageSize,
87
-                                          String username, String realName, Integer roleId, String orgIds) {
88
-		
89
-		if (pageNum!=null && pageSize!=null) {
90
-			PageHelper.startPage(pageNum, pageSize);
91
-		}
92
-		
80
+	public PageInfo<UserInfo> getUserInfo(HttpServletRequest request) {
81
+                                          
93 82
 		HashMap<Object, Object> map = new HashMap<Object, Object>();
94
-		map.put("username", username);
95
-		map.put("realName", realName);
96
-		map.put("roleId", roleId);
83
+		Integer orgId = (Integer)request.getSession().getAttribute("orgId");
84
+		map.put("orgIds", orgId);
97 85
 		List<UserInfo> listAll=userInfoService.queryAll(map);
98 86
 		PageInfo<UserInfo> pageInfo = new PageInfo<UserInfo>(listAll);
99 87
 		return pageInfo;
100 88
 	}
101 89
 
102
-	/**
103
-	 * 用户登录
104
-	 * @param request
105
-	 * @param username	用户名
106
-	 * @param password	密码
107
-	 * @return
108
-	 */
109
-	@RequestMapping(value="/login", method = RequestMethod.POST)
110
-	@ApiOperation(value="用户登录", notes = "用户登录")
111
-	@ApiImplicitParams({
112
-			@ApiImplicitParam(name = "username", value = "用户名", paramType = "form"),
113
-			@ApiImplicitParam(name = "password", value = "密码", paramType = "form"),
114
-			@ApiImplicitParam(name = "yzm", value = "验证码", paramType = "form"),
115
-			@ApiImplicitParam(name = "from", value = "来源,app代表来自于移动端", paramType = "form")
116
-	})
117
-	public Map<String, Object> Login(HttpServletRequest request, String username, String password, String yzm, String from) {
118
-		Map<String, Object> map = new HashMap<String, Object>();
119
-		if (StringUtils.isBlank(from) || from.compareTo("app")!=0) {
120
-			String yzm_code = (String) request.getSession().getAttribute("Service_Code");
121
-			if (!yzm_code.equals(yzm)) {
122
-				map.put("status", false);
123
-				map.put("success", "验证码输入错误!");
124
-				return map;
125
-			}
126
-		}
127
-		UserInfo userInfo = userInfoService.valid(username, password);
128
-		if (userInfo != null) {
129
-			//把对象转变成一个json
130
-			ObjectMapper mapper = new ObjectMapper();
131
-			try {
132
-				String userInfoObject = mapper.writeValueAsString(userInfo);
133
-				// 当前登录用户
134
-				request.getSession().setAttribute("userInfo", userInfoObject);
135
-				// 当前登录用户id
136
-				request.getSession().setAttribute("userId", userInfo.getUserId());
137
-				// 当前组织信息
138
-				OrgInfo orgInfo = orgInfoService.findById(userInfo.getOrgId());
139
-				String orgInfoObject = mapper.writeValueAsString(orgInfo);
140
-				request.getSession().setAttribute("orgInfo", orgInfoObject);
141
-				// 当前用户所属的库信息及库编号
142
-				OrgInfo depotInfo = orgInfoService.getDepotInfo(orgInfo);
143
-				if(depotInfo!=null){
144
-					String depotInfoObject = mapper.writeValueAsString(depotInfo);
145
-					request.getSession().setAttribute("depotInfo", depotInfoObject);
146
-					request.getSession().setAttribute("depotId", depotInfo.getOrgId());
147
-				}
148
-			} catch (JsonProcessingException e) {
149
-				e.printStackTrace();
150
-			}
151
-			map.put("status", true);
152
-			map.put("userInfo", userInfo);
153
-		} else {
154
-			map.put("status", false);
155
-			map.put("success", "用户名或密码错误,登录失败!");
156
-		}
157
-		return map;
158
-	}
159
-
90
+	
160 91
 	/**
161 92
 	 * 获取用户登录信息,包括当前用户、当前组织、当前库、当前库编号
162 93
 	 * @param request

+ 2 - 4
src/main/java/com/chinaitop/depot/unissoft/serviceconfig/CxfConfig.java

@@ -7,8 +7,6 @@ import com.chinaitop.depot.unissoft.webservice.NoticePassServiceImpl;
7 7
 import org.apache.cxf.Bus;
8 8
 import org.apache.cxf.bus.spring.SpringBus;
9 9
 import org.apache.cxf.jaxws.EndpointImpl;
10
-import org.apache.cxf.transport.servlet.CXFServlet;
11
-import org.springframework.boot.web.servlet.ServletRegistrationBean;
12 10
 import org.springframework.context.annotation.Bean;
13 11
 import org.springframework.context.annotation.Configuration;
14 12
 
@@ -16,10 +14,10 @@ import javax.xml.ws.Endpoint;
16 14
 
17 15
 @Configuration
18 16
 public class CxfConfig {
19
-    @Bean
17
+    /*@Bean
20 18
     public ServletRegistrationBean dispatcherServlet() {
21 19
         return new ServletRegistrationBean(new CXFServlet(),"/business/*");
22
-    }
20
+    }*/
23 21
     @Bean(name = Bus.DEFAULT_BUS_ID)
24 22
     public SpringBus springBus() {
25 23
         return new SpringBus();

+ 144 - 0
src/main/java/com/chinaitop/depot/utils/DataSynchronization.java

@@ -0,0 +1,144 @@
1
+package com.chinaitop.depot.utils;
2
+
3
+import java.text.SimpleDateFormat;
4
+/*import java.util.Date;
5
+import java.util.HashMap;
6
+import java.util.List;
7
+import java.util.Map;
8
+
9
+import org.apache.commons.lang.ObjectUtils;
10
+
11
+import com.chinaitop.depot.business.model.BusinessContract;
12
+import com.google.gson.Gson;*/
13
+
14
+public class DataSynchronization {
15
+	private static String urls = "http://192.168.123.123:14100";
16
+	private static SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
17
+	
18
+	/**
19
+	 * 查询合同信息
20
+	 *//*
21
+	public static List queryContractInfo() {
22
+		Gson gson = new Gson();
23
+		Map<String,Object> params = new HashMap<String,Object>();
24
+		//json对象转换成json字符串
25
+		String jsonStr = gson.toJson(params);
26
+		String result = HttpClientUtil.doPostJson(urls+"/contractList", jsonStr);
27
+		System.out.print(result);
28
+		params = gson.fromJson(result, Map.class);
29
+		List list = (List)params.get("data");
30
+		return list;
31
+	}
32
+	
33
+	*//**
34
+	 * 合同信息同步---插入
35
+	 *//*
36
+	public static void businessContractSynchronizationInsert(BusinessContract contract) {
37
+		Gson gson = new Gson();
38
+		Map<String,Object> params = new HashMap<String,Object>();
39
+		params.put("createDate",contract.getCreateTime()==null?"":format.format(contract.getCreateTime()));
40
+		params.put("creator",contract.getCreater());
41
+		params.put("creatorCode","");
42
+		params.put("htbh",contract.getContractNumber());
43
+		params.put("htbzje",0);
44
+		params.put("htbzxx",contract.getRemark());
45
+		params.put("htjctj",contract.getDissolutionConditions());
46
+		params.put("htmc",contract.getContractTitle());
47
+		params.put("htqsdd","");
48
+		params.put("htqssj",contract.getSigningTime()==null?"":format.format(contract.getSigningTime()));
49
+		params.put("htsxjzsj",contract.getDisableDate()==null?"":format.format(contract.getDisableDate()));
50
+		params.put("htsxkssj",contract.getEnableDate()==null?"":format.format(contract.getEnableDate()));
51
+		params.put("htwyzr",contract.getBreachLiability());
52
+		params.put("htxxid",contract.getId());
53
+		params.put("htzdj",0);
54
+		params.put("htzje",contract.getMoneyQuantity());
55
+		params.put("htzsl",contract.getGrainQuantity());
56
+		params.put("jfkdbm",0);
57
+		params.put("jfkdmc",0);
58
+		params.put("jfkhh",0);
59
+		params.put("jflxdh",0);
60
+		params.put("jfqydm",0);
61
+		params.put("jfqymc",0);
62
+		params.put("jfqyr",0);
63
+		params.put("jfqzzt",0);
64
+		params.put("jfyhzh",0);
65
+		params.put("jhjssj",0);
66
+		params.put("jhkssj",0);
67
+		params.put("lsdjbm",0);
68
+		params.put("lsdjmc",0);
69
+		params.put("lspzbm",0);
70
+		params.put("lspzhm",contract.getPlanNumber());
71
+		params.put("lspzid",contract.getPlanBid());
72
+		params.put("lspzmc","");
73
+		params.put("refreshTime",contract.getChangeTime()==null?"":format.format(contract.getChangeTime()));
74
+		params.put("refresher","");
75
+		params.put("refresherCode","");
76
+		params.put("remark",contract.getRemark());
77
+		params.put("spzt",contract.getAuditState());
78
+		params.put("status",0);
79
+		params.put("yfkdbm",0);
80
+		params.put("yfkdmc",0);
81
+		params.put("yfkhh",0);
82
+		params.put("yflxdh",0);
83
+		params.put("yfqydm",0);
84
+		params.put("yfqymc",0);
85
+		params.put("yfqyr",0);
86
+		params.put("yfqzzt",0);
87
+		params.put("yfyhzh",0);
88
+		params.put("ysfs",contract.getShippingType());
89
+		params.put("zffs",contract.getContractPayType());
90
+		params.put("zxzt",0);
91
+		params.put("zyjjfs",contract.getDisputeSettlementMethod());
92
+		
93
+		
94
+		
95
+		//json对象转换成json字符串
96
+		String jsonStr = gson.toJson(params);
97
+		String result = HttpClientUtil.doPostJson(urls+"/sinkpoint", jsonStr);
98
+		System.out.print(result);
99
+	}
100
+	
101
+	*//**
102
+	 * 库点信息同步---更新
103
+	 *//*
104
+	public static void orgInfoSynchronizationUpdate(Map<String,Object> params,OrgInfo orgInfo) {
105
+		Gson gson = new Gson();
106
+		params.put("jcrq",orgInfo.getCompleteDate()==null?"":format.format(orgInfo.getCompleteDate()));
107
+		params.put("kdcz",orgInfo.getFax());
108
+		params.put("kddh",orgInfo.getContact());
109
+		params.put("kddm",orgInfo.getOrgId());
110
+		params.put("kddz",orgInfo.getAddress());
111
+		params.put("kdjc",orgInfo.getBriefIntroduction());
112
+		params.put("kdjd",orgInfo.getLongitude());
113
+		params.put("kdmc",orgInfo.getOrgName());
114
+		params.put("kdmj",orgInfo.getDepotArea());
115
+		params.put("kdqyxz",orgInfo.getCompanyNature());
116
+		params.put("kdwd",orgInfo.getLatitude());
117
+		params.put("kdyb",orgInfo.getPost());
118
+		params.put("kdyxcr",orgInfo.getEffectiveCapacity());
119
+		params.put("lklb",orgInfo.getOrgClassId());
120
+		params.put("qymc",orgInfo.getOrgName());
121
+		params.put("refreshTime",orgInfo.getUpdateTime()==null?"":format.format(orgInfo.getUpdateTime()));
122
+		params.put("remark",orgInfo.getRemark());
123
+		params.put("sjcr",orgInfo.getDesignCapacity());
124
+		params.put("status",orgInfo.getStatus());
125
+		params.put("tyshxydm",orgInfo.getCompanyOrgCode());
126
+		params.put("xzqhdm",orgInfo.getAreaCode());
127
+		params.put("xzqhmc",orgInfo.getAreaName());
128
+		//json对象转换成json字符串
129
+		String jsonStr = gson.toJson(params);
130
+		String result = HttpClientUtil.doPutJson(urls+"/sinkpoint", jsonStr);
131
+		System.out.print(result);
132
+	}
133
+	
134
+	*//**
135
+	 * 库点信息同步---删除
136
+	 *//*
137
+	public static void orgInfoSynchronizationDelete(OrgInfo orgInfo) {
138
+		Map<String,String> params = new HashMap<String,String>();
139
+		params.put("kddm",ObjectUtils.toString(orgInfo.getOrgId(),""));
140
+		//json对象转换成json字符串
141
+		String result = HttpClientUtil.doDelete(urls+"/sinkpoint", params);
142
+		System.out.print(result);
143
+	}*/
144
+}

+ 234 - 0
src/main/java/com/chinaitop/depot/utils/HttpClientUtil.java

@@ -0,0 +1,234 @@
1
+package com.chinaitop.depot.utils;
2
+
3
+import java.io.IOException;
4
+import java.net.URI;
5
+import java.util.ArrayList;
6
+import java.util.List;
7
+import java.util.Map;
8
+
9
+import org.apache.http.NameValuePair;
10
+import org.apache.http.client.entity.UrlEncodedFormEntity;
11
+import org.apache.http.client.methods.CloseableHttpResponse;
12
+import org.apache.http.client.methods.HttpDelete;
13
+import org.apache.http.client.methods.HttpGet;
14
+import org.apache.http.client.methods.HttpPost;
15
+import org.apache.http.client.methods.HttpPut;
16
+import org.apache.http.client.utils.URIBuilder;
17
+import org.apache.http.entity.ContentType;
18
+import org.apache.http.entity.StringEntity;
19
+import org.apache.http.impl.client.CloseableHttpClient;
20
+import org.apache.http.impl.client.HttpClients;
21
+import org.apache.http.message.BasicNameValuePair;
22
+import org.apache.http.util.EntityUtils;
23
+
24
+public class HttpClientUtil {
25
+	/**
26
+	 * 带参数的get请求
27
+	 * @param url
28
+	 * @param param
29
+	 * @return String
30
+	 */
31
+	public static String doGet(String url, Map<String, String> param) {
32
+		// 创建Httpclient对象
33
+		CloseableHttpClient httpclient = HttpClients.createDefault();
34
+ 
35
+		String resultString = "";
36
+		CloseableHttpResponse response = null;
37
+		try {
38
+			// 创建uri
39
+			URIBuilder builder = new URIBuilder(url);
40
+			if (param != null) {
41
+				for (String key : param.keySet()) {
42
+					builder.addParameter(key, param.get(key));
43
+				}
44
+			}
45
+			URI uri = builder.build();
46
+			// 创建http GET请求
47
+			HttpGet httpGet = new HttpGet(uri);
48
+			// 执行请求
49
+			response = httpclient.execute(httpGet);
50
+			// 判断返回状态是否为200
51
+			if (response.getStatusLine().getStatusCode() == 200) {
52
+				resultString = EntityUtils.toString(response.getEntity(), "UTF-8");
53
+			}
54
+		} catch (Exception e) {
55
+			e.printStackTrace();
56
+		} finally {
57
+			try {
58
+				if (response != null) {
59
+					response.close();
60
+				}
61
+				httpclient.close();
62
+			} catch (IOException e) {
63
+				e.printStackTrace();
64
+			}
65
+		}
66
+		return resultString;
67
+	}
68
+	
69
+	/**
70
+	 * 不带参数的get请求
71
+	 * @param url
72
+	 * @return String
73
+	 */
74
+	public static String doGet(String url) {
75
+		return doGet(url, null);
76
+	}
77
+ 
78
+	/**
79
+	 * 带参数的post请求
80
+	 * @param url
81
+	 * @param param
82
+	 * @return String
83
+	 */
84
+	public static String doPost(String url, Map<String, String> param) {
85
+		// 创建Httpclient对象
86
+		CloseableHttpClient httpClient = HttpClients.createDefault();
87
+		CloseableHttpResponse response = null;
88
+		String resultString = "";
89
+		try {
90
+			// 创建Http Post请求
91
+			HttpPost httpPost = new HttpPost(url);
92
+			// 创建参数列表
93
+			if (param != null) {
94
+				List<NameValuePair> paramList = new ArrayList<>();
95
+				for (String key : param.keySet()) {
96
+					paramList.add(new BasicNameValuePair(key, param.get(key)));
97
+				}
98
+				// 模拟表单
99
+				UrlEncodedFormEntity entity = new UrlEncodedFormEntity(paramList);
100
+				httpPost.setEntity(entity);
101
+			}
102
+			// 执行http请求
103
+			response = httpClient.execute(httpPost);
104
+			resultString = EntityUtils.toString(response.getEntity(), "utf-8");
105
+		} catch (Exception e) {
106
+			e.printStackTrace();
107
+		} finally {
108
+			try {
109
+				response.close();
110
+			} catch (IOException e) {
111
+				e.printStackTrace();
112
+			}
113
+		}
114
+		return resultString;
115
+	}
116
+ 
117
+	/**
118
+	 * 不带参数的post请求
119
+	 * @param url
120
+	 * @return String
121
+	 */
122
+	public static String doPost(String url) {
123
+		return doPost(url, null);
124
+	}
125
+	
126
+	/**
127
+	 * 传送json类型的post请求
128
+	 * @param url
129
+	 * @param json
130
+	 * @return String
131
+	 */
132
+	public static String doPostJson(String url, String json) {
133
+		// 创建Httpclient对象
134
+		CloseableHttpClient httpClient = HttpClients.createDefault();
135
+		CloseableHttpResponse response = null;
136
+		String resultString = "";
137
+		try {
138
+			// 创建Http Post请求
139
+			HttpPost httpPost = new HttpPost(url);
140
+			// 创建请求内容
141
+			StringEntity entity = new StringEntity(json, ContentType.APPLICATION_JSON);
142
+			httpPost.setEntity(entity);
143
+			// 执行http请求
144
+			response = httpClient.execute(httpPost);
145
+			resultString = EntityUtils.toString(response.getEntity(), "utf-8");
146
+		} catch (Exception e) {
147
+			e.printStackTrace();
148
+		} finally {
149
+			try {
150
+				response.close();
151
+			} catch (IOException e) {
152
+				e.printStackTrace();
153
+			}
154
+		}
155
+		return resultString;
156
+	}
157
+	
158
+	/**
159
+	 * 传送json类型的put请求
160
+	 * @param url
161
+	 * @param json
162
+	 * @return String
163
+	 */
164
+	public static String doPutJson(String url, String json) {
165
+		// 创建Httpclient对象
166
+		CloseableHttpClient httpClient = HttpClients.createDefault();
167
+		CloseableHttpResponse response = null;
168
+		String resultString = "";
169
+		try {
170
+			// 创建Http Put请求
171
+			HttpPut httpPut = new HttpPut(url);
172
+			// 创建请求内容
173
+			StringEntity entity = new StringEntity(json, ContentType.APPLICATION_JSON);
174
+			httpPut.setEntity(entity);
175
+			// 执行http请求
176
+			response = httpClient.execute(httpPut);
177
+			resultString = EntityUtils.toString(response.getEntity(), "utf-8");
178
+		} catch (Exception e) {
179
+			e.printStackTrace();
180
+		} finally {
181
+			try {
182
+				response.close();
183
+			} catch (IOException e) {
184
+				e.printStackTrace();
185
+			}
186
+		}
187
+		return resultString;
188
+	}
189
+	
190
+	/**
191
+	 * 带参数的delete请求
192
+	 * @param url
193
+	 * @param param
194
+	 * @return String
195
+	 */
196
+	public static String doDelete(String url, Map<String, String> param) {
197
+		// 创建Httpclient对象
198
+		CloseableHttpClient httpclient = HttpClients.createDefault();
199
+ 
200
+		String resultString = "";
201
+		CloseableHttpResponse response = null;
202
+		try {
203
+			// 创建uri
204
+			URIBuilder builder = new URIBuilder(url);
205
+			if (param != null) {
206
+				for (String key : param.keySet()) {
207
+					builder.addParameter(key, param.get(key));
208
+				}
209
+			}
210
+			URI uri = builder.build();
211
+			// 创建http Delete请求
212
+			HttpDelete httpDelete = new HttpDelete(uri);
213
+			// 执行请求
214
+			response = httpclient.execute(httpDelete);
215
+			// 判断返回状态是否为200
216
+			if (response.getStatusLine().getStatusCode() == 200) {
217
+				resultString = EntityUtils.toString(response.getEntity(), "UTF-8");
218
+			}
219
+		} catch (Exception e) {
220
+			e.printStackTrace();
221
+		} finally {
222
+			try {
223
+				if (response != null) {
224
+					response.close();
225
+				}
226
+				httpclient.close();
227
+			} catch (IOException e) {
228
+				e.printStackTrace();
229
+			}
230
+		}
231
+		return resultString;
232
+	}
233
+
234
+}

+ 27 - 16
src/main/resources/bootstrap.yml

@@ -14,16 +14,25 @@ eureka:
14 14
     lease-renewal-interval-in-seconds: 10
15 15
     # 告知服务端30秒还未收到心跳的话,就将该服务移除列表(默认90s)
16 16
     lease-expiration-duration-in-seconds: 30
17
- 
17
+    
18
+
18 19
 spring:
19 20
   application:
20 21
     name: depot-business
21 22
   # 数据库配置
22 23
   datasource:
23
-    driver-class-name: com.mysql.jdbc.Driver
24
-    url: jdbc:mysql://192.168.123.38:3306/depot_shanxi?useUnicode=true&characterEncoding=utf-8
25
-    username: root
26
-    password: 123456
24
+    depot:
25
+      driver-class-name: com.mysql.jdbc.Driver
26
+      jdbcUrl: jdbc:mysql://192.168.123.38:3306/depot_shanxi?useUnicode=true&characterEncoding=utf-8&useSSL=false
27
+      username: root
28
+      password: 123456
29
+    agile:
30
+      driver-class-name: com.mysql.jdbc.Driver
31
+      jdbcUrl: jdbc:mysql://192.168.123.38:3306/lsreport_ts_shanxi?useUnicode=true&characterEncoding=utf-8&useSSL=false
32
+      username: root
33
+      password: 123456
34
+  activiti:
35
+    check-process-definitions: false
27 36
   # 缓存配置
28 37
   session:
29 38
     store-type: redis
@@ -39,20 +48,22 @@ spring:
39 48
         max-wait: -1
40 49
         max-idle: 8
41 50
         min-idle: 0
51
+  # 静态资源配置
52
+  resources:
53
+    static-locations: classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/,file:${web.upload-path}
42 54
   servlet:
43 55
     multipart:
44 56
       max-file-size: 10Mb
45 57
       max-request-size: 10Mb
46
-      
47
-  jackson:
48
-    date-format: yyyy-MM-dd
49
-    time-zone: GMT+8
50
-  
58
+  devtools:
59
+    restart:
60
+      enabled: true  #设置开启热部署
61
+      additional-paths: src/main/java #重启目录
62
+  freemarker:
63
+    cache: false    #页面不加载缓存,修改即时生效
64
+reportUrl: http://192.168.123.132:88/api
65
+
51 66
 web:
52 67
   upload-path: /home/depot/depot-web/apache-tomcat-8.0.53/webapps/ROOT/WEB-INF/classes/static
53
-
54
-
55
-        
56
-
57
-
58
-      
68
+cxf:
69
+  path: /business