fanxw месяцев назад: 9
Родитель
Сommit
49eef52b8d

+ 26 - 7
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;
@@ -171,25 +172,43 @@ public class ReceiveNoticeController {
171 172
     })
172 173
 	public Map<String, Object> scRkxzzbd(String sptId, String crklx, String ysid) {
173 174
 		Map<String, Object> map = new HashMap<>();
175
+		String jssj = "sptId="+sptId+"&crklx="+crklx+"&ysid="+ysid;
174 176
 		try {
175 177
 			map = receiveNoticeService.scRkxzzbd(sptId, crklx, ysid);
176
-			systemOutsideDataService.addlogger("rkxzzbd", sptId, map.toString());
178
+			systemOutsideDataService.addlogger("rkxzzbd", jssj, map.toString());
177 179
 		} catch (Exception e) {
178 180
 			logger.error("性质转变单生成异常");
179 181
 			logger.error(e.getMessage());
180 182
 			map.put("status", "error");
181 183
 			map.put("msg", "接口异常,请联系管理员!");
182
-			systemOutsideDataService.addlogger("rkxzzbd", sptId, map.toString());
184
+			systemOutsideDataService.addlogger("rkxzzbd", jssj, map.toString());
183 185
 		}
184 186
 		return map;
185 187
 	}
186
-    
187
-	/*@RequestMapping(value="/test", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET)
188
-    @ApiOperation(value="测试接口", notes = "")
188
+
189
+	@RequestMapping(value="/updateNoticeReceiveAuditState", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET)
190
+    @ApiOperation(value="接收市平台调用修改入库性质转变单状态和划转时间", notes = "")
191
+	@ApiImplicitParams({
192
+        @ApiImplicitParam(name = "cblx", value = "储备类型(1市储,2区储)", paramType = "query"),
193
+        @ApiImplicitParam(name = "ysid", value = "市平台验收数据ID", paramType = "query"),
194
+        @ApiImplicitParam(name = "hzsj", value = "划转时间", paramType = "query")
195
+    })
196
+	public void updateNoticeReceiveAuditState(String cblx, String ysid, String hzsj) {
197
+		try {
198
+			String param = "cblx="+cblx+"&ysid="+ysid+"&hzsj="+hzsj;
199
+			systemOutsideDataService.addlogger("update_rkxzzbd_zt_and_hzsj", param, null);
200
+			receiveNoticeService.updateNoticeReceiveAuditState(cblx, ysid, hzsj);
201
+		} catch (Exception e) {
202
+			e.printStackTrace();
203
+		}
204
+	}
205
+
206
+	@RequestMapping(value="/retSptMeagess", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET)
207
+    @ApiOperation(value="给给市平台发送性质转变单5部审批完的通知", notes = "")
189 208
 	@ApiImplicitParams({
190 209
         @ApiImplicitParam(name = "datas", value = "数据对象", paramType = "query")
191 210
     })
192
-	public Map<String, Object> test(String datas) {
211
+	public Map<String, Object> retSptMeagess(String datas) {
193 212
 		Map<String, Object> map = new HashMap<>();
194 213
 		try {
195 214
 			ObjectMapper mapper = new ObjectMapper();
@@ -202,7 +221,7 @@ public class ReceiveNoticeController {
202 221
 			map.put("msg", "接口异常,请联系管理员!");
203 222
 		}
204 223
 		return map;
205
-	}*/
224
+	}
206 225
 	
207 226
 	@RequestMapping(value="/testT", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
208 227
     @ApiOperation(value="测试接口", notes = "")

+ 10 - 0
src/main/java/com/chinaitop/depot/business/model/BusinessNoticeReceiveExample.java

@@ -1465,6 +1465,16 @@ public class BusinessNoticeReceiveExample {
1465 1465
             addCriterion("receive_time not between", value1, value2, "receiveTime");
1466 1466
             return (Criteria) this;
1467 1467
         }
1468
+
1469
+        public Criteria andCblxEqualTo(String value) {
1470
+            addCriterion("cblx =", value, "cblx");
1471
+            return (Criteria) this;
1472
+        }
1473
+        
1474
+        public Criteria andYsidEqualTo(String value) {
1475
+            addCriterion("ysid =", value, "ysid");
1476
+            return (Criteria) this;
1477
+        }
1468 1478
     }
1469 1479
 
1470 1480
     /**

+ 8 - 0
src/main/java/com/chinaitop/depot/business/service/ReceiveNoticeService.java

@@ -58,4 +58,12 @@ public interface ReceiveNoticeService {
58 58
 	 * @param receiveNotice
59 59
 	 */
60 60
 	public void updateQualitycheckHwxz(BusinessNoticeReceive receiveNotice);
61
+
62
+	/**
63
+	 * 修改入库性质转变单状态
64
+	 * @param cblx 储备类型(1市储,2区储)
65
+	 * @param ysid 市平台验收数据ID
66
+	 * @param hzsj 划转时间
67
+	 */
68
+	void updateNoticeReceiveAuditState(String cblx, String ysid, String hzsj);
61 69
 }

+ 51 - 24
src/main/java/com/chinaitop/depot/business/service/impl/ReceiveNoticeServiceImpl.java

@@ -530,19 +530,17 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
530 530
         	businessNoticeReceiveMapper.updateByPrimaryKeySelective(receiveNotice);
531 531
 
532 532
         }
533
-       //增加审批表数据
533
+        //增加审批表数据
534 534
     	businessApprovalService.add(businessApproval);
535 535
 
536
-    	//必须是入库,并且不是通知单,只是性质转变单
537
-    	if ("1".equals(receiveNotice.getIsNotice()) && "1".equals(receiveNotice.getIsSheet()) && "1".equals(receiveNotice.getCrktype())) {
538
-    		boolean flag = restLsxz(receiveNotice.getId());
539
-    		
540
-    		if (flag) {
541
-    			//转储成功后把信息给市平台
542
-    			retSptMeagess(receiveNotice);
543
-    			//把对应的粮情卡所挂载的粮食性质改为储备粮
544
-    			updateQualitycheckHwxz(receiveNotice);
545
-    		}
536
+    	System.out.println("5".equals(receiveNotice.getAuditState().toString()));
537
+    	System.out.println("1".equals(receiveNotice.getIsNotice().toString()));
538
+    	System.out.println("0".equals(receiveNotice.getIsSheet().toString()));
539
+    	System.out.println("1".equals(receiveNotice.getCrktype()));
540
+    	//必须是入库,库级和市级都审批完成,并且不是通知单,只是性质转变单
541
+    	if ("5".equals(receiveNotice.getAuditState().toString()) && "1".equals(receiveNotice.getIsNotice().toString()) && "0".equals(receiveNotice.getIsSheet().toString()) && "1".equals(receiveNotice.getCrktype())) {
542
+			//转储成功后把信息给市平台
543
+			retSptMeagess(receiveNotice);
546 544
     	}
547 545
 	}
548 546
 
@@ -595,20 +593,22 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
595 593
 		boolean flag = false;
596 594
 
597 595
 		BusinessNoticeReceive receiveNotice = businessNoticeReceiveMapper.selectByPrimaryKey(id);
598
-		Object[] parameters = new Object[9];
596
+		Object[] parameters = new Object[11];
599 597
 		parameters[0] = receiveNotice.getOrgId() + "";
600 598
 		parameters[1] = receiveNotice.getGrainKind() + "";
601
-		//parameters[2] = null;
599
+		//parameters[2] = null;//明细品种
602 600
 		parameters[3] = receiveNotice.getHouseId() + "";
603 601
 		if (StringUtils.isNotBlank(receiveNotice.getWareHouseId()+"")) {//粮仓
604 602
 			parameters[4] = receiveNotice.getWareHouseId() + "";
605 603
 		} else {
606 604
 			parameters[4] = receiveNotice.getHouseId() + "";//油罐
607 605
 		}
608
-		parameters[5] = receiveNotice.getHzqlsxzdm() + "";//要转换的粮食性质
609
-		parameters[6] = receiveNotice.getGrainAttribute() + "";//原来的粮食性质
606
+		parameters[5] = receiveNotice.getHzqlsxzdm() + "";//变更后粮油性质
607
+		parameters[6] = receiveNotice.getGrainAttribute() + "";//变更前粮油性质x
610 608
 		parameters[7] = Integer.parseInt(receiveNotice.getLssl())*1000 + "";//数量
611
-		parameters[8] = 1 + ""; //1:新增;2:修改;3:删除
609
+		parameters[8] = receiveNotice.getLsxzzbdh(); //文件号(性质转变单号)
610
+		//parameters[9] = null;//损益原因
611
+		parameters[10] = 1 + ""; //1:新增;2:修改;3:删除
612 612
 
613 613
 		String crkurl = depotSystemFeignService.getUrl(receiveNotice.getOrgId().toString(), "2");
614 614
 	    if (StringUtils.isNotBlank(crkurl)) {
@@ -655,12 +655,12 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
655 655
 	@Override
656 656
 	public Map<String, Object> updateReceiveNotice(String notice) throws Exception {
657 657
 		Map<String, Object> map = new HashMap<>();
658
-		
658
+
659 659
 		BusinessNoticeReceive businessNoticeReceive = formatObject(notice);
660 660
 		businessNoticeReceiveMapper.updateByPrimaryKeySelective(businessNoticeReceive);
661 661
 		map.put("status", 200);
662 662
 		map.put("msg", "操作成功");
663
-		
663
+
664 664
 		return map;
665 665
 	}
666 666
 
@@ -740,15 +740,21 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
740 740
             	result_map.put("status", "error");
741 741
                 return result_map;
742 742
             }
743
-            
744
-            Map<String, Object> kcmap = feignAgileService.getDateByChHwh(businessNoticeReceive.getOrgId(), businessNoticeReceive.getHouseId(), businessNoticeReceive.getWareHouseId());
745
-            logger.info("根据orgId="+businessNoticeReceive.getOrgId()+",houseId="+businessNoticeReceive.getHouseId()+",warehouseId="+businessNoticeReceive.getWareHouseId()+"  获取到的库存数据如下:");
743
+
744
+            Map<String, Object> kcmap = null;
745
+            if (null == businessNoticeReceive.getWareHouseId()) {
746
+            	kcmap = feignAgileService.getDateByChHwh(businessNoticeReceive.getOrgId(), businessNoticeReceive.getHouseId(), businessNoticeReceive.getHouseId());
747
+            	logger.info("根据orgId="+businessNoticeReceive.getOrgId()+",houseId="+businessNoticeReceive.getHouseId()+",warehouseId="+businessNoticeReceive.getHouseId()+"  获取到的库存数据如下:");
748
+            } else {
749
+            	kcmap = feignAgileService.getDateByChHwh(businessNoticeReceive.getOrgId(), businessNoticeReceive.getHouseId(), businessNoticeReceive.getWareHouseId());
750
+            	logger.info("根据orgId="+businessNoticeReceive.getOrgId()+",houseId="+businessNoticeReceive.getHouseId()+",warehouseId="+businessNoticeReceive.getWareHouseId()+"  获取到的库存数据如下:");
751
+            }
746 752
 			logger.info(kcmap+"");
747
-			if (null != kcmap) {
753
+			if (null != kcmap && !"0".equals(kcmap.get("hwxz"))) {
748 754
 				String inputTime = kcmap.get("rq")+""; //入库时间
749 755
 	            Double kcsl = (Double) kcmap.get("kcsl");//千克
750 756
 	            Date date = null;
751
-	            if(inputTime!=null){
757
+	            if(StringUtils.isNotBlank(inputTime)){
752 758
 	                date = ParameterUtil.string2datetime(inputTime);
753 759
 	                businessNoticeReceive.setInputTime(date);//入库时间
754 760
 	            }
@@ -779,7 +785,7 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
779 785
 	            Date thisdate = new Date();
780 786
 	            sbf.append("RKXZZBD").append(String.format("%03d", businessNoticeReceive.getOrgId())).append(ParameterUtil.getDateYMDHMS(thisdate));
781 787
 	            businessNoticeReceive.setLsxzzbdh(sbf.toString());//粮食性质转变单单号
782
-	            businessNoticeReceive.setHzrq(thisdate);//划转时间
788
+	            //businessNoticeReceive.setHzrq(thisdate);//划转时间
783 789
 	            businessNoticeReceive.setCount(businessNoticeReceive.getLssl()); //计划数量(吨)
784 790
 	            businessNoticeReceive.setInApplication(1); //启用
785 791
 	            businessNoticeReceive.setAuditState(0);//下达未审批
@@ -803,4 +809,25 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
803 809
 		return result_map;
804 810
 	}
805 811
 
812
+	@Override
813
+	public void updateNoticeReceiveAuditState(String cblx, String ysid, String hzsj) {
814
+		BusinessNoticeReceiveExample example = new BusinessNoticeReceiveExample();
815
+        Criteria createCriteria = example.createCriteria();
816
+        createCriteria.andCblxEqualTo(cblx);
817
+        createCriteria.andYsidEqualTo(ysid);
818
+        List<BusinessNoticeReceive> list = businessNoticeReceiveMapper.selectByExample(example);
819
+        if (null != list && list.size() > 0) {
820
+        	BusinessNoticeReceive obj = list.get(0);
821
+        	obj.setAuditState(6);//入库的审批通过
822
+        	obj.setHzrq(ParameterUtil.string2datetime(hzsj));//划转时间
823
+        	businessNoticeReceiveMapper.updateByPrimaryKey(obj);
824
+
825
+        	//把对应的粮情卡所挂载的粮食性质改为储备粮
826
+			updateQualitycheckHwxz(obj);
827
+
828
+        	boolean flag = restLsxz(obj.getId());
829
+        	System.out.println("性质转变单调用出入库接口结果:"+flag);
830
+        }
831
+	}
832
+
806 833
 }

+ 7 - 0
src/main/java/com/chinaitop/depot/utils/createKC.java

@@ -2,11 +2,15 @@ package com.chinaitop.depot.utils;
2 2
 
3 3
 import javax.xml.namespace.QName;
4 4
 
5
+import org.apache.commons.lang3.ArrayUtils;
6
+import org.apache.commons.lang3.StringUtils;
5 7
 import org.apache.cxf.endpoint.Endpoint;
6 8
 import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
7 9
 import org.apache.cxf.service.model.BindingInfo;
8 10
 import org.apache.cxf.service.model.BindingOperationInfo;
9 11
 
12
+import com.alibaba.fastjson.JSON;
13
+
10 14
 import net.sf.json.JSONObject;
11 15
 
12 16
 public class createKC {
@@ -32,8 +36,11 @@ public class createKC {
32 36
 		Object[] res = null;
33 37
 		String ret = "";
34 38
 		try {
39
+			System.out.println("webservice调用url是:"+url);
35 40
 			res = client.invoke(opName, parameters);
41
+			System.out.println("webservice调用发送的消息:"+ArrayUtils.toString(parameters, ","));
36 42
 			JSONObject object = JSONObject.fromObject(res[0]);
43
+			System.out.println("webservice调用返回消息:"+JSON.toJSONString(object));
37 44
 			ret = object.getString("success");
38 45
 		} catch (Exception e) {
39 46
 			e.printStackTrace();