Kaynağa Gözat

出库通知单提示

fanxw 3 ay önce
ebeveyn
işleme
ae12d7d813

+ 38 - 14
src/main/java/com/chinaitop/depot/business/controller/GrainNoticeController.java

@@ -1,6 +1,23 @@
1 1
 package com.chinaitop.depot.business.controller;
2 2
 
3 3
 
4
+import java.io.IOException;
5
+import java.util.ArrayList;
6
+import java.util.HashMap;
7
+import java.util.List;
8
+import java.util.Map;
9
+
10
+import javax.annotation.Resource;
11
+import javax.servlet.http.HttpServletRequest;
12
+
13
+import org.apache.commons.lang3.StringUtils;
14
+import org.slf4j.Logger;
15
+import org.slf4j.LoggerFactory;
16
+import org.springframework.http.MediaType;
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
+
4 21
 import com.chinaitop.depot.business.model.BusinessDeliveryStorageNotice;
5 22
 import com.chinaitop.depot.business.model.BusinessStoreWareDetail;
6 23
 import com.chinaitop.depot.business.model.enums.AuditType;
@@ -8,28 +25,17 @@ import com.chinaitop.depot.business.model.enums.StoreWareType;
8 25
 import com.chinaitop.depot.business.model.vo.BusinessDeliveryStorageNoticeAuditVO;
9 26
 import com.chinaitop.depot.business.service.BusinessStoreWareDetailService;
10 27
 import com.chinaitop.depot.business.service.GrainNoticeService;
28
+import com.chinaitop.depot.business.service.SystemOutsideDataService;
11 29
 import com.fasterxml.jackson.core.JsonParseException;
12 30
 import com.fasterxml.jackson.core.type.TypeReference;
13 31
 import com.fasterxml.jackson.databind.JsonMappingException;
14 32
 import com.fasterxml.jackson.databind.ObjectMapper;
15 33
 import com.github.pagehelper.PageInfo;
34
+
16 35
 import io.swagger.annotations.Api;
17 36
 import io.swagger.annotations.ApiImplicitParam;
18 37
 import io.swagger.annotations.ApiImplicitParams;
19 38
 import io.swagger.annotations.ApiOperation;
20
-import org.apache.commons.lang3.StringUtils;
21
-import org.springframework.http.MediaType;
22
-import org.springframework.web.bind.annotation.RequestMapping;
23
-import org.springframework.web.bind.annotation.RequestMethod;
24
-import org.springframework.web.bind.annotation.RestController;
25
-
26
-import javax.annotation.Resource;
27
-import javax.servlet.http.HttpServletRequest;
28
-import java.io.IOException;
29
-import java.util.ArrayList;
30
-import java.util.HashMap;
31
-import java.util.List;
32
-import java.util.Map;
33 39
 
34 40
 /**
35 41
  * 储备粮管理-通知单
@@ -41,11 +47,13 @@ import java.util.Map;
41 47
 @Api(value= "GrainNoticeController", description = "储备粮管理-出入库通知单管理")
42 48
 
43 49
 public class GrainNoticeController {
44
-    
50
+	public static final Logger logger = LoggerFactory.getLogger(GrainNoticeController.class);
45 51
     @Resource
46 52
     private GrainNoticeService deliveryStorageNoticeService;
47 53
     @Resource
48 54
     private BusinessStoreWareDetailService businessStoreWareDetailService;
55
+    @Resource
56
+	private SystemOutsideDataService systemOutsideDataService;
49 57
     
50 58
     /**
51 59
      * 申请列表.
@@ -617,4 +625,20 @@ public class GrainNoticeController {
617 625
         }
618 626
         return modelMap;
619 627
     }
628
+    
629
+    @RequestMapping(value="/pushCktzdts",produces = MediaType.APPLICATION_JSON_VALUE,  method=RequestMethod.GET)
630
+   	@ApiOperation(value="给市平台推送出库通知单提示消息", notes = "")
631
+   	@ApiImplicitParams({
632
+   		@ApiImplicitParam(name = "fsr", value = "发送人", paramType = "query"),
633
+   		@ApiImplicitParam(name = "fsdw", value = "发送单位", paramType = "query")
634
+   	})
635
+    public void pushCktzdts(String fsr, String fsdw) {
636
+    	try {
637
+			String resultStr = deliveryStorageNoticeService.pushCktzdts(fsr, fsdw);
638
+			systemOutsideDataService.addlogger("cktzdts", fsr+"_"+fsdw, resultStr);
639
+		} catch (Exception e) {
640
+			logger.error(e.getMessage(), e);
641
+			systemOutsideDataService.addlogger("cktzdts", fsr+"_"+fsdw, e.getMessage());
642
+		}
643
+    }
620 644
 }

+ 2 - 2
src/main/java/com/chinaitop/depot/business/controller/ReceiveNoticeController.java

@@ -216,8 +216,8 @@ public class ReceiveNoticeController {
216 216
 			BusinessNoticeReceive receiveNotice = (BusinessNoticeReceive)mapper.readValue(datas, BusinessNoticeReceive.class);
217 217
 			receiveNoticeService.retSptMeagess(receiveNotice);
218 218
 		} catch (Exception e) {
219
-			logger.error("性质转变单生成异常");
220
-			logger.error(e.getMessage());
219
+			logger.error("推送性质转变单库级审批结束信息给市平台时代码异常");
220
+			logger.error(e.getMessage(), e);
221 221
 			map.put("status", "error");
222 222
 			map.put("msg", "接口异常,请联系管理员!");
223 223
 		}

+ 9 - 1
src/main/java/com/chinaitop/depot/business/service/GrainNoticeService.java

@@ -115,6 +115,14 @@ public interface GrainNoticeService {
115 115
 
116 116
 	List<BusinessDeliveryStorageNotice> getAuditPassList(Integer pageNum, Integer pageSize,
117 117
 			BusinessDeliveryStorageNotice notice);
118
-			
118
+
119
+	/**
120
+	 * 给市平台推送出库通知单提示消息
121
+	 * @param fsr
122
+	 * @param fsdw
123
+	 * @return
124
+	 * @throws Exception
125
+	 */
126
+	String pushCktzdts(String fsr, String fsdw) throws Exception;
119 127
 
120 128
 }

+ 33 - 1
src/main/java/com/chinaitop/depot/business/service/impl/GrainNoticeServiceImpl.java

@@ -11,12 +11,15 @@ import java.util.Map;
11 11
 import javax.annotation.Resource;
12 12
 
13 13
 import org.apache.commons.lang.StringUtils;
14
+import org.slf4j.Logger;
15
+import org.slf4j.LoggerFactory;
14 16
 import org.springframework.stereotype.Service;
15 17
 import org.springframework.transaction.annotation.Transactional;
16 18
 
17 19
 import com.alibaba.fastjson.JSONObject;
18 20
 import com.chinaitop.depot.act.service.ActTaskService;
19 21
 import com.chinaitop.depot.agile.model.BusinessScedule;
22
+import com.chinaitop.depot.business.controller.GrainNoticeController;
20 23
 import com.chinaitop.depot.business.mapper.BusinessDeliveryStorageNoticeMapper;
21 24
 import com.chinaitop.depot.business.model.BusinessApproval;
22 25
 import com.chinaitop.depot.business.model.BusinessContract;
@@ -41,6 +44,8 @@ import com.chinaitop.depot.business.service.FeignAgileService;
41 44
 import com.chinaitop.depot.business.service.GrainContractService;
42 45
 import com.chinaitop.depot.business.service.GrainNoticeService;
43 46
 import com.chinaitop.depot.business.service.UserInfoService;
47
+import com.chinaitop.depot.system.service.SysCodeService;
48
+import com.chinaitop.depot.utils.HTTPUtils;
44 49
 import com.github.pagehelper.PageHelper;
45 50
 import com.github.pagehelper.PageInfo;
46 51
 import com.google.common.collect.Maps;
@@ -48,7 +53,8 @@ import com.google.common.collect.Maps;
48 53
 
49 54
 @Service
50 55
 public class GrainNoticeServiceImpl implements GrainNoticeService {
51
-    @Resource
56
+	public static final Logger logger = LoggerFactory.getLogger(GrainNoticeServiceImpl.class);
57
+	@Resource
52 58
     private BusinessDeliveryStorageNoticeMapper businessDeliveryStorageNoticeMapper;
53 59
     @Resource
54 60
     private BusinessStoreWareDetailService businessStoreWareDetailService;
@@ -67,6 +73,8 @@ public class GrainNoticeServiceImpl implements GrainNoticeService {
67 73
     private UserInfoService userInfoService;
68 74
     @Resource
69 75
 	private FeignAgileService feignAgileService;
76
+    @Resource
77
+	private SysCodeService sysCodeService;
70 78
     
71 79
     // 入库通知单枚举id,出入库系统使用.
72 80
     private static Integer STORAGENOTICEENUMID = 2816;
@@ -1233,5 +1241,29 @@ public class GrainNoticeServiceImpl implements GrainNoticeService {
1233 1241
             List<BusinessDeliveryStorageNotice> list = businessDeliveryStorageNoticeMapper.selectByExample(example);
1234 1242
             return list;
1235 1243
 		}
1244
+
1245
+
1246
+		@Override
1247
+		public String pushCktzdts(String fsr, String fsdw) throws Exception {
1248
+			String path = sysCodeService.getSVal(10, "cktzdts");
1249
+			logger.info("查到的配置接口数据是:"+path);
1250
+			String result = null;
1251
+			if (StringUtils.isNotBlank(path)) {
1252
+				//组装请求参数
1253
+				Map<String, String> params = new HashMap<>();
1254
+				params.put("fsr", fsr);
1255
+				params.put("fsdw", fsdw);
1256
+
1257
+				logger.info("给给市平台发送出库通知单提示信息参数是:"+params.toString());
1258
+				logger.info("给给市平台发送出库通知单提示信息地址是:"+path);
1259
+
1260
+				//给市平台发送请求
1261
+				result = HTTPUtils.doPost(path, params);
1262
+
1263
+				//保存推送合同引用状态的消息和返回结果
1264
+				//systemOutsideDataService.addlogger("cktzdts", params.toString(), result);
1265
+			}
1266
+			return result;
1267
+		}
1236 1268
     
1237 1269
 }