fanxw 9 ヶ月 前
コミット
47b605146e

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

@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
16 16
 import com.chinaitop.depot.business.model.BusinessNoticeReceive;
17 17
 import com.chinaitop.depot.business.service.ReceiveNoticeService;
18 18
 import com.chinaitop.depot.business.service.SystemOutsideDataService;
19
+import com.fasterxml.jackson.databind.ObjectMapper;
19 20
 import com.github.pagehelper.PageInfo;
20 21
 
21 22
 import io.swagger.annotations.Api;
@@ -184,4 +185,29 @@ public class ReceiveNoticeController {
184 185
 		return map;
185 186
 	}
186 187
     
188
+	/*@RequestMapping(value="/test", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET)
189
+    @ApiOperation(value="测试接口", notes = "")
190
+	@ApiImplicitParams({
191
+        @ApiImplicitParam(name = "datas", value = "数据对象", paramType = "query")
192
+    })
193
+	public Map<String, Object> test(String datas) {
194
+		Map<String, Object> map = new HashMap<>();
195
+		try {
196
+			ObjectMapper mapper = new ObjectMapper();
197
+			BusinessNoticeReceive receiveNotice = (BusinessNoticeReceive)mapper.readValue(datas, BusinessNoticeReceive.class);
198
+			receiveNoticeService.retSptMeagess(receiveNotice);
199
+		} catch (Exception e) {
200
+			logger.error("性质转变单生成异常");
201
+			logger.error(e.getMessage());
202
+			map.put("status", "error");
203
+			map.put("msg", "接口异常,请联系管理员!");
204
+		}
205
+		return map;
206
+	}
207
+	
208
+	@RequestMapping(value="/testT", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
209
+    @ApiOperation(value="测试接口", notes = "")
210
+	public void testT(String crklx, String ysid) {
211
+		System.out.println("crklx:---"+crklx+"--,ysid:---"+ysid);
212
+	}*/
187 213
 }

+ 6 - 1
src/main/java/com/chinaitop/depot/business/service/ReceiveNoticeService.java

@@ -1,7 +1,6 @@
1 1
 package com.chinaitop.depot.business.service;
2 2
 
3 3
 
4
-import java.math.BigDecimal;
5 4
 import java.util.List;
6 5
 import java.util.Map;
7 6
 
@@ -47,5 +46,11 @@ public interface ReceiveNoticeService {
47 46
 	 * @return
48 47
 	 */
49 48
 	Map<String, Object> scRkxzzbd(String sptId, String cblx, String ysid);
49
+
50
+	/**
51
+	 * 给给市平台发送性质转变成功通知
52
+	 * @param receiveNotice
53
+	 */
54
+	void retSptMeagess(BusinessNoticeReceive receiveNotice);
50 55
 			
51 56
 }

+ 65 - 7
src/main/java/com/chinaitop/depot/business/service/impl/ReceiveNoticeServiceImpl.java

@@ -532,12 +532,56 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
532 532
 
533 533
     	//必须是入库,并且不是通知单,只是性质转变单
534 534
     	if ("1".equals(receiveNotice.getIsNotice()) && "1".equals(receiveNotice.getIsSheet()) && "1".equals(receiveNotice.getCrktype())) {
535
-    		restLsxz(receiveNotice.getId());
535
+    		boolean flag = restLsxz(receiveNotice.getId());
536
+    		
537
+    		if (flag) {
538
+    			//转储成功后把信息给市平台
539
+    			retSptMeagess(receiveNotice);
540
+    		}
536 541
     	}
537 542
 	}
538 543
 
539
-	public void restLsxz(Integer id) {
540
-		/* 先调用出入库接口生成转储的业务的台账信息,生成失败不可保存转储数据***start */
544
+	/**
545
+	 * 给给市平台发送性质转变成功通知
546
+	 * @param receiveNotice
547
+	 */
548
+	@Override
549
+	public void retSptMeagess(BusinessNoticeReceive receiveNotice) {
550
+		String result = "";
551
+
552
+		//获取请求的URL地址
553
+		String path;
554
+		try {
555
+			path = sysCodeService.getSVal(10, "xzzzxxts");
556
+			if (null != receiveNotice.getCblx() && null != receiveNotice.getYsid()) {
557
+				
558
+				//组装请求参数
559
+				Map<String, String> params = new HashMap<>();
560
+				params.put("crklx", receiveNotice.getCblx());
561
+				params.put("ysid", receiveNotice.getYsid());
562
+				
563
+				logger.info("给给市平台发送性质转变成功通知信息:"+params.toString());
564
+				
565
+				//给市平台发送请求
566
+				result = HTTPUtils.doPost(path, params);
567
+				
568
+				//保存推送合同引用状态的消息和返回结果
569
+				systemOutsideDataService.addlogger("xzzzxx_result", params.toString(), result);
570
+			}
571
+		} catch (Exception e) {
572
+			e.printStackTrace();
573
+		}
574
+	}
575
+
576
+	/**
577
+	 * 调用出入库接口改变粮食性质
578
+	 * @param id 性质转变单数据ID
579
+	 * @return
580
+	 */
581
+	public boolean restLsxz(Integer id) {
582
+		
583
+		boolean flag = false;
584
+
541 585
 		BusinessNoticeReceive receiveNotice = businessNoticeReceiveMapper.selectByPrimaryKey(id);
542 586
 		Object[] parameters = new Object[9];
543 587
 		parameters[0] = receiveNotice.getOrgId() + "";
@@ -549,11 +593,11 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
549 593
 		} else {
550 594
 			parameters[4] = receiveNotice.getHouseId() + "";//油罐
551 595
 		}
552
-		parameters[5] = receiveNotice.getHzqlsxzdm() + "";
553
-		parameters[6] = receiveNotice.getGrainAttribute() + "";
554
-		parameters[7] = Integer.parseInt(receiveNotice.getLssl())*1000 + "";
596
+		parameters[5] = receiveNotice.getHzqlsxzdm() + "";//要转换的粮食性质
597
+		parameters[6] = receiveNotice.getGrainAttribute() + "";//原来的粮食性质
598
+		parameters[7] = Integer.parseInt(receiveNotice.getLssl())*1000 + "";//数量
555 599
 		parameters[8] = 1 + ""; //1:新增;2:修改;3:删除
556
-		
600
+
557 601
 		String crkurl = depotSystemFeignService.getUrl(receiveNotice.getOrgId().toString(), "2");
558 602
 	    if (StringUtils.isNotBlank(crkurl)) {
559 603
 	    	String url_id = crkurl.substring(0, crkurl.lastIndexOf("Base")-1);
@@ -561,7 +605,11 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
561 605
 	    	sbf.append(url_id).append(url);
562 606
 	    	String str = createKC.createKC("ChangeGrainAttribute", sbf.toString(), parameters);
563 607
 	    	systemOutsideDataService.addlogger("rkxzzb", JSON.toJSONString(parameters), str);
608
+	    	if ("true".equals(str)) {
609
+	    		flag = true;
610
+			}
564 611
 	    }
612
+	    return flag;
565 613
 	}
566 614
 
567 615
 	@Override
@@ -639,6 +687,7 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
639 687
 
640 688
 
641 689
 
690
+	@SuppressWarnings("unused")
642 691
 	@Override
643 692
 	public Map<String, Object> scRkxzzbd(String sptId, String cblx, String ysid) {
644 693
 		Map<String, Object> result_map = new HashMap<>();
@@ -707,6 +756,12 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
707 756
 	            BigDecimal kcslKg = kcslBig.divide(s);
708 757
 	            businessNoticeReceive.setLssl(kcslKg.toString());//库存数量
709 758
 	            
759
+	            if ("1".equals(cblx)) {//市储
760
+	            	businessNoticeReceive.setHzqlsxzdm(6877);
761
+	            }
762
+	            if ("2".equals(cblx)) {//区储
763
+	            	businessNoticeReceive.setHzqlsxzdm(6878);
764
+	            }
710 765
 	            businessNoticeReceive.setHzqlsxzdm(3052);//商品粮 转后,划转后粮食性质
711 766
 	            StringBuffer sbf = new StringBuffer(50);
712 767
 	            Date thisdate = new Date();
@@ -720,6 +775,9 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
720 775
 	            businessNoticeReceive.setIsNotice(1);//0是可以引用的通知单,1不是
721 776
 	            businessNoticeReceive.setIsSheet(0);//0代表是性质转变单
722 777
 	            businessNoticeReceiveMapper.insert(businessNoticeReceive);
778
+	            
779
+	            result_map.put("msg", "操作成功");
780
+            	result_map.put("status", "success");
723 781
 			} else {
724 782
 				result_map.put("msg", "根据所传信息没有查到对应库存信息");
725 783
             	result_map.put("status", "error");