fanxw 1 yıl önce
ebeveyn
işleme
af73b44f79

+ 17 - 0
src/main/java/com/chinaitop/depot/business/controller/BusinessContractReceiveController.java

@@ -106,4 +106,21 @@ public class BusinessContractReceiveController {
106 106
 		}
107 107
 		return result.toString();
108 108
 	}
109
+
110
+	@RequestMapping(value="/updateYjssl",produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.POST)
111
+	@ApiOperation(value="修改已结算数量", notes = "")
112
+	@ApiImplicitParams({
113
+		@ApiImplicitParam(name = "htid", value = "合同ID", dataType="int", paramType = "form"),
114
+		@ApiImplicitParam(name = "bcjssl", value = "本次结算数量(吨)", dataType="String", paramType = "form")
115
+	})
116
+	public Map<String, String> updateYjssl(Integer htid, String bcjssl) {
117
+		Map<String, String> map = null;
118
+		try {
119
+			map = businessContractReceiveService.updateYjssl(htid, bcjssl);
120
+		} catch (Exception e) {
121
+			logger.error(e.getMessage(), e);
122
+		}
123
+		return map;
124
+	}
125
+
109 126
 }

+ 16 - 1
src/main/java/com/chinaitop/depot/business/service/BusinessContractReceiveService.java

@@ -33,6 +33,21 @@ public interface BusinessContractReceiveService {
33 33
 	 * @throws Exception
34 34
 	 */
35 35
 	BusinessContractReceive findbyParmaryKey(Integer id) throws Exception;
36
-	
36
+
37
+	/**
38
+	 * 修改或新增一条数据
39
+	 * @param businessContractReceive
40
+	 * @throws Exception
41
+	 */
37 42
 	void updateOrSave(BusinessContractReceive businessContractReceive) throws Exception;
43
+
44
+	/**
45
+	 * 修改已结算数量
46
+	 * @param htid 接到到的市平台下发的合同ID
47
+	 * @param bcjssl 本次结算数量
48
+	 * @return
49
+	 * @throws Exception
50
+	 */
51
+	Map<String, String> updateYjssl(Integer htid, String bcjssl) throws Exception;
52
+
38 53
 }

+ 21 - 1
src/main/java/com/chinaitop/depot/business/service/impl/BusinessContractReceiveServiceImpl.java

@@ -320,12 +320,32 @@ public class BusinessContractReceiveServiceImpl implements BusinessContractRecei
320 320
 
321 321
 		//没有符合的就新增,有的话就修改
322 322
 		if (null == list || list.size() == 0) {
323
+			businessContractReceive.setYjssl(new BigDecimal(0));
323 324
 			businessContractReceiveMapper.insert(businessContractReceive);
324 325
 		} else {
325 326
 			businessContractReceive.setId(list.get(0).getId());
326 327
 			businessContractReceive.setUpdateTime(new Date());
327
-			businessContractReceive.setYjssl(new BigDecimal(0));
328 328
 			businessContractReceiveMapper.updateByExample(businessContractReceive, example);
329 329
 		}
330 330
 	}
331
+
332
+	@Override
333
+	public Map<String, String> updateYjssl(Integer htid, String bcjssl) throws Exception {
334
+		Map<String, String> map = new HashMap<String, String>();
335
+		BusinessContractReceive businessContractReceive = businessContractReceiveMapper.selectByPrimaryKey(htid);
336
+		if (null == businessContractReceive) {
337
+			map.put("status", "500");
338
+			map.put("msg", "未检测到原合同信息,请联系管理员");
339
+			return map;
340
+		} else {
341
+			BigDecimal new_bcjssl = new BigDecimal(bcjssl);//本次结算数量
342
+			BigDecimal yjssl = businessContractReceive.getYjssl();
343
+			yjssl = yjssl.add(new_bcjssl);
344
+			businessContractReceive.setYjssl(yjssl);
345
+			businessContractReceiveMapper.updateByPrimaryKey(businessContractReceive);
346
+			map.put("status", "200");
347
+			map.put("msg", "操作成功");
348
+		}
349
+		return map;
350
+	}
331 351
 }