Browse Source

Merge branch 'master' of
http://git.jishutao.com/jishutao/kede-server.git

Conflicts:
src/main/resources/props/config_local.properties

limin 7 years ago
parent
commit
599b16038b

+ 1 - 1
src/main/java/com/goafanti/admin/controller/AdminSuperviserApiController.java

@@ -334,7 +334,7 @@ public class AdminSuperviserApiController extends CertifyApiController {
 	}
 	
 	/**新增获取ID**/
-	@RequestMapping(value = "/newId", method = RequestMethod.POST)
+	@RequestMapping(value = "/newId", method = RequestMethod.GET)
 	public Result newId(){
 		Result res = new Result();		
 		res.setData(UUID.randomUUID().toString());		

+ 5 - 3
src/main/java/com/goafanti/admin/service/impl/NewAdminServiceImpl.java

@@ -4,6 +4,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
+import java.util.UUID;
 
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -254,10 +255,11 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 
 	@Override
 	public int insertNewAdmin(Admin ad ,List<String> roleIds) {
-		ad.setStatus("正常");		
-		String sdepNo=adminMapper.selectUserNoBySuperiorId(ad.getSuperiorId());
+		ad.setStatus("正常");
+		ad.setId(UUID.randomUUID().toString());
+		/*String sdepNo=adminMapper.selectUserNoBySuperiorId(ad.getSuperiorId());
 		int Count=adminMapper.selectCountBySuperiorId(ad.getSuperiorId());
-		/*if(Count<10){
+		if(Count<10){
 			String dep=sdepNo+"0"+Count;
 			String sid=adminMapper.selectIdByUserNo(dep);
 			while(sid!=null){

+ 1 - 1
src/main/java/com/goafanti/common/dao/OrganizationManagementMapper.java

@@ -67,7 +67,7 @@ public interface OrganizationManagementMapper {
 	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
 	 */
 	int updateByPrimaryKey(OrganizationManagement record);
-	List<OrganizationListOut> selectSuperId();
+	List<OrganizationListOut> selectSuperId(@Param("sort")int sort);
 	/**
 	 * 根据组织名称查组织编号
 	 */

+ 4 - 1
src/main/java/com/goafanti/common/mapper/OrganizationManagementMapper.xml

@@ -449,12 +449,15 @@
 			AND om.dep_no=#{depNo,jdbcType=VARCHAR}
 		</if>	
 	</select>
-	<select id="selectSuperId" resultType="com.goafanti.organization.bo.OrganizationListOut">
+	<select id="selectSuperId"  resultType="com.goafanti.organization.bo.OrganizationListOut">
 		select
 		id,name,dep_no as depNo
 		from department
 		where
 		status ='0'
+		<if test="sort ==1" >
+		limit 10	
+		</if>
 	</select>
 	<insert id="insert1" parameterType="com.goafanti.organization.bo.OrganizationListOut">
 		insert into department(

+ 7 - 1
src/main/java/com/goafanti/common/mapper/TOrderMapper.xml

@@ -1064,6 +1064,9 @@
 			a.technician_id = e.id left join department f on 
 			c.department_id = f.id
 		where a.order_type = 0 and a.delete_sign != 1
+		<if test="deleteStatus==1">
+		and a.delete_sign = 0
+		</if>
 		<if test="orderNo != null">
 			and a.order_no= #{orderNo,jdbcType=VARCHAR}
 		</if>
@@ -1138,7 +1141,10 @@
 			a.finance_id = d.id left join admin e on
 			a.technician_id = e.id left join department f on 
 			c.department_id = f.id
-		where a.order_type = 0
+		where a.order_type = 0 and a.delete_sign != 1
+		<if test="deleteStatus==1">
+		and a.delete_sign = 0
+		</if>
 		<if test="orderNo != null">
 			and a.order_no= #{orderNo,jdbcType=VARCHAR}
 		</if>

+ 42 - 0
src/main/java/com/goafanti/core/auth/HttpComponentsClientHttpRequestFactoryDigestAuth.java

@@ -0,0 +1,42 @@
+package com.goafanti.core.auth;
+
+
+import java.net.URI;
+import org.apache.http.HttpHost;
+import org.apache.http.client.AuthCache;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.protocol.ClientContext;
+import org.apache.http.impl.auth.DigestScheme;
+import org.apache.http.impl.client.BasicAuthCache;
+import org.apache.http.protocol.BasicHttpContext;
+import org.apache.http.protocol.HttpContext;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
+ 
+public class HttpComponentsClientHttpRequestFactoryDigestAuth extends HttpComponentsClientHttpRequestFactory {
+	 
+	public HttpComponentsClientHttpRequestFactoryDigestAuth(HttpClient client) {
+        super(client);
+    }
+ 
+    @Override
+    protected HttpContext createHttpContext(HttpMethod httpMethod, URI uri) {
+        return createHttpContext(uri);
+    }
+ 
+    private HttpContext createHttpContext(URI uri) {
+        // Create AuthCache instance
+        AuthCache authCache = new BasicAuthCache();
+        // Generate DIGEST scheme object, initialize it and add it to the local auth cache
+        DigestScheme digestAuth = new DigestScheme();
+        // If we already know the realm name
+        digestAuth.overrideParamter("realm", "myrealm");
+        HttpHost targetHost = new HttpHost(uri.getHost(), uri.getPort());
+        authCache.put(targetHost, digestAuth);
+ 
+        // Add AuthCache to the execution context
+        BasicHttpContext localcontext = new BasicHttpContext();
+        localcontext.setAttribute(ClientContext.AUTH_CACHE, authCache);
+        return localcontext;
+    }
+}

+ 43 - 0
src/main/java/com/goafanti/core/auth/RestClient.java

@@ -0,0 +1,43 @@
+package com.goafanti.core.auth;
+
+import java.util.Base64;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.client.RestTemplate;
+
+public class RestClient {
+	private final String BS_HOST= "http://localhost:8090/";
+	//@Test
+	public void whenSecuredRestApiIsConsumed_then200OK() {
+	    RestTemplate restTemplate = new RestTempleteConfig().getRestTemplate();
+	    ResponseEntity<String> entity = restTemplate.exchange(BS_HOST, HttpMethod.GET, null, String.class);
+	    System.out.println(entity.getStatusCode());
+	    System.out.println(entity.getBody());
+	}
+	private HttpHeaders getHeaders(){
+		String plainCredentials="dev:123456";
+		String base64Credentials = Base64.getEncoder().encodeToString(plainCredentials.getBytes());
+		HttpHeaders headers = new HttpHeaders();
+		headers.add("Authorization", "Basic " + base64Credentials);
+		return headers;
+	}
+ 
+	public String sendToBs(String apiUrl,HttpMethod method,LinkedMultiValueMap<String, String> params) {
+		RestTemplate restTemplate = new RestTemplate();
+		HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<MultiValueMap<String, String>>(params,getHeaders());
+		ResponseEntity<String> response = restTemplate.exchange(BS_HOST + "/" + apiUrl, method,request, String.class);
+		
+		return response.getBody();
+	}
+	
+	@Test
+	public void testLogin() {
+		System.out.println(sendToBs("login", HttpMethod.GET, null));
+	}
+}

+ 29 - 0
src/main/java/com/goafanti/core/auth/RestTempleteConfig.java

@@ -0,0 +1,29 @@
+package com.goafanti.core.auth;
+
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.UsernamePasswordCredentials;
+import org.apache.http.client.CredentialsProvider;
+import org.apache.http.impl.client.BasicCredentialsProvider;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.springframework.web.client.RestTemplate;
+
+
+public class RestTempleteConfig {
+	public RestTemplate getRestTemplate() {
+		CloseableHttpClient client = HttpClientBuilder.create().setDefaultCredentialsProvider(provider())
+				.useSystemProperties().build();
+		HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactoryDigestAuth(
+				client);
+ 
+		return new RestTemplate(requestFactory);
+	}
+ 
+	private CredentialsProvider provider() {
+		CredentialsProvider provider = new BasicCredentialsProvider();
+		UsernamePasswordCredentials credentials = new UsernamePasswordCredentials("dev", "123456");
+		provider.setCredentials(AuthScope.ANY, credentials);
+		return provider;
+	}
+}

+ 1 - 0
src/main/java/com/goafanti/order/service/impl/OrderServiceImpl.java

@@ -1317,6 +1317,7 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 		if(bo.getOrderStatus() != null) params.put("orderStatus", bo.getOrderStatus());
 		if(StringUtils.isNotBlank(startDate)) params.put("startDate", startDate);
 		if(StringUtils.isNotBlank(endDate)) params.put("endDate", endDate);
+		params.put("deleteStatus", 1);
 		return  (Pagination<OrderListBo>)findPage("selectServiceOrderByPage","selectServiceOrderCount", 
 				params, pageNo, pageSize);
 	}

+ 1 - 1
src/main/java/com/goafanti/organization/service/OrganizationService.java

@@ -17,7 +17,7 @@ public interface OrganizationService {
 	Pagination<OrganizationListOut> 
 	listOrganizationManagement(OrganizationListOut olo,Integer pageNo, Integer pageSize);
 	/**组织名称查上级组织*/
-	List<OrganizationListOut> selectSuperId();
+	List<OrganizationListOut> selectSuperId(Integer i);
 	/**
 	 * 
 	 * @param name 组织名称

+ 2 - 2
src/main/java/com/goafanti/organization/service/impl/OrganizationServiceImpl.java

@@ -48,8 +48,8 @@ public class OrganizationServiceImpl extends BaseMybatisDao<OrganizationManageme
 		return params;
 	}
 	@Override
-	public List<OrganizationListOut> selectSuperId() {
-		return organizationManagementMapper.selectSuperId();
+	public List<OrganizationListOut> selectSuperId(Integer i) {
+		return organizationManagementMapper.selectSuperId(i);
 	}
 	/**
 	 *   XXIn form 提交 ,bo包中

+ 2 - 2
src/main/resources/props/config_local.properties

@@ -1,7 +1,7 @@
 #Driver
 jdbc.driverClassName=com.mysql.jdbc.Driver
 #\u6570\u636e\u5e93\u94fe\u63a5\uff0c
-jdbc.url=jdbc:mysql://192.168.0.17:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+jdbc.url=jdbc\:mysql\://192.168.0.17\:3306/aft?useUnicode\=true&characterEncoding\=UTF-8&autoReconnect\=true&useSSL\=false
 #\u5e10\u53f7
 jdbc.username=dev
 #\u5bc6\u7801
@@ -76,4 +76,4 @@ easemob.client.secret=YXA61NHE0renI5N8gEgizoI5ivM9SYE
 
 jiguang.appKey=dbcea43366e038073452a04e
 jiguang.masterSecret=59792298288e4f635c737def
-jiguang.pushUrl=https://api.jpush.cn/v3/push
+jiguang.pushUrl=https://api.jpush.cn/v3/push

+ 4 - 4
src/main/resources/props/config_test.properties

@@ -54,10 +54,10 @@ session.validate.timespan=18000000
 app.name=AFT
 template.cacheable=false
 
-static.host=//static.jishutao.com/1.0.50
-portal.host=//static.jishutao.com/portal/2.0.6
-avatar.host=//static.jishutao.com
-avatar.upload.host=//static.jishutao.com/upload
+static.host=//static.kedexinxi.com/1.0.50
+portal.host=//static.kedexinxi.com/portal/2.0.6
+avatar.host=//static.kedexinxi.com
+avatar.upload.host=//static.kedexinxi.com/upload
 
 upload.path=/data/static/public/upload
 upload.private.path=/data/static/private/upload