larry преди 5 години
родител
ревизия
dae8267b1d

+ 13 - 0
src/main/java/com/chinaitop/depot/pushs/service/PushsService.java

@@ -0,0 +1,13 @@
1
+package com.chinaitop.depot.pushs.service;
2
+
3
+
4
+public interface PushsService {
5
+
6
+
7
+	//出入库将倒仓通知单记录传回库级平台进行展示
8
+	String updateChangeStorageHouse(String ChangeStorageHouseData);
9
+
10
+	//出入库取库级平台倒仓通知单数据
11
+	String getContractDatas(String orgId, String ids);
12
+
13
+}

+ 71 - 0
src/main/java/com/chinaitop/depot/pushs/service/impl/PushServiceImpl.java

@@ -0,0 +1,71 @@
1
+package com.chinaitop.depot.pushs.service.impl;
2
+
3
+
4
+import com.alibaba.fastjson.JSON;
5
+import com.chinaitop.depot.pushs.service.PushsService;
6
+import com.chinaitop.depot.storage.mapper.StorageChangeStoragehouseDefaultMapper;
7
+import com.chinaitop.depot.storage.model.StorageChangeStoragehouseRop;
8
+import com.chinaitop.depot.storage.service.StorageChangeStoragehouseRopService;
9
+import com.chinaitop.depot.storage.utils.ParameterUtil;
10
+import com.chinaitop.depot.storage.utils.ResponseEntity;
11
+import com.fasterxml.jackson.databind.ObjectMapper;
12
+import org.slf4j.Logger;
13
+import org.slf4j.LoggerFactory;
14
+import org.springframework.stereotype.Service;
15
+import org.springframework.transaction.annotation.Transactional;
16
+
17
+import javax.annotation.Resource;
18
+import java.io.IOException;
19
+import java.util.Arrays;
20
+import java.util.HashMap;
21
+import java.util.List;
22
+import java.util.Map;
23
+
24
+@Service
25
+public class PushServiceImpl implements PushsService {
26
+	
27
+    final static Logger logger  =  LoggerFactory.getLogger(PushServiceImpl.class );
28
+
29
+
30
+	@Resource
31
+	private StorageChangeStoragehouseDefaultMapper storageChangeStoragehouseDefaultMapper;
32
+
33
+	@Resource
34
+	private StorageChangeStoragehouseRopService storageChangeStoragehouseRopService;
35
+
36
+	@Transactional(rollbackFor = Exception.class)
37
+	@Override
38
+	public String updateChangeStorageHouse(String ChangeStorageHouseData) {
39
+		String retS = "Success";
40
+		try {
41
+			ObjectMapper mapper = new ObjectMapper();
42
+			StorageChangeStoragehouseRop storageChangeStoragehouseRop = (StorageChangeStoragehouseRop) mapper.readValue(ChangeStorageHouseData, StorageChangeStoragehouseRop.class);
43
+			storageChangeStoragehouseRopService.insertChangeStorageHouse(storageChangeStoragehouseRop);
44
+		} catch (IOException e) {
45
+			return retS = "error";
46
+		}
47
+		return retS;
48
+	}
49
+
50
+
51
+
52
+	@Transactional(rollbackFor = Exception.class)
53
+	@Override
54
+	public String getContractDatas(String orgId, String ids) {
55
+		//查出数据
56
+		Map<String,Object> mapCondition = new HashMap<String, Object>();
57
+		if(ParameterUtil.isnotnull(ids)){
58
+			List<String> conList = Arrays.asList(ids.split(","));
59
+			mapCondition.put("ids",conList);
60
+		}
61
+		if(ParameterUtil.isnotnull(orgId)){
62
+			mapCondition.put("orgId",orgId);
63
+		}
64
+		List<Map<String,Object>> mainList =storageChangeStoragehouseDefaultMapper.contractData(mapCondition);
65
+
66
+		Map<String,Object> mapData = new HashMap<String, Object>();
67
+		mapData.put("status", "success");
68
+		mapData.put("mainData", mainList);
69
+		return JSON.toJSONString(ResponseEntity.ok(mapData));
70
+	}
71
+}

+ 98 - 0
src/main/java/com/chinaitop/depot/unissoft/model/ResponseEntity.java

@@ -0,0 +1,98 @@
1
+package com.chinaitop.depot.unissoft.model;
2
+
3
+
4
+
5
+import java.io.Serializable;
6
+
7
+//返回基类
8
+public class ResponseEntity<T> implements Serializable {
9
+
10
+    private static final long serialVersionUID = -2825436079063723409L;
11
+
12
+    //成功
13
+    private static final String OK = "200";
14
+    //失败
15
+    private static final String FAILED = "600";
16
+    private static final String BUSSINESS_FAILED = "550";
17
+    private static final String UNAUTHENTICATION = "401";
18
+
19
+    private String retCode;
20
+    private String message;
21
+    private T data;
22
+
23
+    public String getRetCode() {
24
+        return retCode;
25
+    }
26
+
27
+    public void setRetCode(String retCode) {
28
+        this.retCode = retCode;
29
+    }
30
+
31
+    public String getMessage() {
32
+        return message;
33
+    }
34
+
35
+    public void setMessage(String message) {
36
+        this.message = message;
37
+    }
38
+
39
+    public T getData() {
40
+        return data;
41
+    }
42
+
43
+    public void setData(T data) {
44
+        this.data = data;
45
+    }
46
+
47
+    private static <T> ResponseEntity<T> buildResponse(String retCode, String message, T data){
48
+        ResponseEntity<T> responseEntity = new ResponseEntity<T>();
49
+        responseEntity.retCode = retCode;
50
+        responseEntity.message = message;
51
+        responseEntity.data = data;
52
+        return responseEntity;
53
+    }
54
+
55
+    public static <T> ResponseEntity<T> ok(){
56
+        return buildResponse(ResponseEntity.OK,"success",null);
57
+    }
58
+    public static <T> ResponseEntity<T> ok(T data){
59
+        return buildResponse(ResponseEntity.OK,"success",data);
60
+
61
+    }
62
+    public static <T> ResponseEntity<T> ok(String message, T data){
63
+        return buildResponse(ResponseEntity.OK,message,data);
64
+    }
65
+
66
+
67
+    public static <T> ResponseEntity<T> failed(String message){
68
+        return buildResponse(ResponseEntity.FAILED,message,null);
69
+    }
70
+
71
+    public static <T> ResponseEntity<T> businessFailed(String message){
72
+        return buildResponse(ResponseEntity.BUSSINESS_FAILED,message,null);
73
+    }
74
+
75
+    public static <T> ResponseEntity<T> unauthentication(String message){
76
+        return buildResponse(ResponseEntity.UNAUTHENTICATION,message,null);
77
+    }
78
+
79
+    private String state;
80
+    private String msg;
81
+
82
+    public String getState() {
83
+        return state;
84
+    }
85
+
86
+    public void setState(String state) {
87
+        this.state = state;
88
+    }
89
+
90
+    public String getMsg() {
91
+        return msg;
92
+    }
93
+
94
+    public void setMsg(String msg) {
95
+        this.msg = msg;
96
+    }
97
+}
98
+

+ 54 - 0
src/main/java/com/chinaitop/depot/unissoft/serviceconfig/CxfConfig.java

@@ -0,0 +1,54 @@
1
+package com.chinaitop.depot.unissoft.serviceconfig;
2
+
3
+
4
+
5
+import org.apache.cxf.Bus;
6
+import org.apache.cxf.bus.spring.SpringBus;
7
+import org.apache.cxf.jaxws.EndpointImpl;
8
+import org.springframework.context.annotation.Bean;
9
+import org.springframework.context.annotation.Configuration;
10
+
11
+import com.chinaitop.depot.unissoft.webservice.ContractPassService;
12
+import com.chinaitop.depot.unissoft.webservice.ContractPassServiceImpl;
13
+import com.chinaitop.depot.unissoft.webservice.NoticePassService;
14
+import com.chinaitop.depot.unissoft.webservice.NoticePassServiceImpl;
15
+
16
+import javax.xml.ws.Endpoint;
17
+
18
+
19
+@Configuration
20
+public class CxfConfig {
21
+	/*
22
+	 * @Bean public ServletRegistrationBean dispatcherServlet() { return new
23
+	 * ServletRegistrationBean(new CXFServlet(),"/business/*"); }
24
+	 */
25
+    @Bean(name = Bus.DEFAULT_BUS_ID)
26
+    public SpringBus springBus() {
27
+        return new SpringBus();
28
+    }
29
+
30
+    //倒仓
31
+    @Bean
32
+    public ContractPassService contractPassService() {
33
+        return new ContractPassServiceImpl();
34
+    }
35
+    @Bean
36
+    public Endpoint uploadContractData() {
37
+        EndpointImpl endpoint = new EndpointImpl(springBus(), contractPassService());
38
+        endpoint.publish("/selectContractData");
39
+        return endpoint;
40
+    }
41
+
42
+    //出入库-库级平台
43
+    @Bean
44
+    public NoticePassService noticePassService() {
45
+        return  new NoticePassServiceImpl();
46
+    }
47
+    @Bean
48
+    public Endpoint uploadNoticeData() {
49
+        EndpointImpl endpoint = new EndpointImpl(springBus(), noticePassService());
50
+        endpoint.publish("/updateChangeStorageHouse");
51
+        return endpoint;
52
+    }
53
+
54
+}

+ 15 - 0
src/main/java/com/chinaitop/depot/unissoft/webservice/ContractPassService.java

@@ -0,0 +1,15 @@
1
+package com.chinaitop.depot.unissoft.webservice;
2
+
3
+
4
+
5
+import javax.jws.WebParam;
6
+import javax.jws.WebService;
7
+
8
+
9
+@WebService
10
+public interface ContractPassService {
11
+
12
+    //倒仓通知单接口-(市平台-库级平台-出入库)
13
+    public String getContractDatas(@WebParam(name = "orgId") String orgId, @WebParam(name = "ids") String ids);
14
+
15
+}

+ 21 - 0
src/main/java/com/chinaitop/depot/unissoft/webservice/ContractPassServiceImpl.java

@@ -0,0 +1,21 @@
1
+package com.chinaitop.depot.unissoft.webservice;
2
+
3
+
4
+import org.springframework.stereotype.Service;
5
+
6
+import javax.annotation.Resource;
7
+import com.chinaitop.depot.pushs.service.PushsService;
8
+
9
+@Service
10
+@SuppressWarnings("all")
11
+public class ContractPassServiceImpl implements ContractPassService {
12
+
13
+	@Resource
14
+	private PushsService PushsService;
15
+
16
+
17
+	@Override
18
+	public String getContractDatas(String orgId, String ids) {
19
+		return PushsService.getContractDatas(orgId, ids);
20
+	}
21
+}

+ 16 - 0
src/main/java/com/chinaitop/depot/unissoft/webservice/NoticePassService.java

@@ -0,0 +1,16 @@
1
+package com.chinaitop.depot.unissoft.webservice;
2
+
3
+
4
+
5
+import javax.jws.WebParam;
6
+import javax.jws.WebService;
7
+
8
+
9
+@WebService
10
+public interface NoticePassService {
11
+
12
+	//倒仓通知单记录接口-(出入库-库级平台)
13
+	//changeStorageHouseData  出入库数据以json格式传给库级平台
14
+    public String updateContractStatus(@WebParam(name = "changeStorageHouseData") String changeStorageHouseData);
15
+
16
+}

+ 22 - 0
src/main/java/com/chinaitop/depot/unissoft/webservice/NoticePassServiceImpl.java

@@ -0,0 +1,22 @@
1
+package com.chinaitop.depot.unissoft.webservice;
2
+
3
+
4
+import com.chinaitop.depot.pushs.service.PushsService;
5
+import org.springframework.stereotype.Service;
6
+
7
+import javax.annotation.Resource;
8
+
9
+@Service
10
+@SuppressWarnings("all")
11
+public class NoticePassServiceImpl implements NoticePassService {
12
+
13
+	@Resource
14
+	private PushsService PushsService;
15
+
16
+	@Override
17
+	public String updateContractStatus(String changeStorageHouseData) {
18
+		// TODO Auto-generated method stub
19
+		return PushsService.updateChangeStorageHouse(changeStorageHouseData);
20
+	}
21
+	
22
+}