fanxw 1 ay önce
ebeveyn
işleme
61cdb57662

+ 1 - 1
src/main/java/com/chinaitop/depot/business/controller/BusinessMergeNoticeController.java

@@ -107,7 +107,7 @@ public class BusinessMergeNoticeController {
107 107
 		}
108 108
         return pageInfo;
109 109
     }
110
-	
110
+
111 111
 	@RequestMapping(value="/findByTzdidQueryList",produces = MediaType.APPLICATION_JSON_VALUE,  method=RequestMethod.GET)
112 112
 	@ApiOperation(value="按照通知单ID查询通知单合并记录", notes = "")
113 113
 	@ApiImplicitParams({

+ 4 - 3
src/main/java/com/chinaitop/depot/business/service/impl/ReceiveNoticeServiceImpl.java

@@ -329,12 +329,13 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
329 329
                     					businessNoticeReceive.setGrainAnnual(Integer.parseInt(scnf));//收获年度
330 330
                     				}
331 331
                                 }
332
+                                businessNoticeReceive.setIsSheet(1);//入库类型的只有在市级企业端提交了入库验收申请,才会生成入库性质转变单
332 333
                                 //入库兜底类型的不需要审批性质转变单
333
-                                if (ObjectUtils.toString(jsonObject.getString("ywlx")).equals("3")) {
334
+                                /*if (ObjectUtils.toString(jsonObject.getString("ywlx")).equals("3")) {
334 335
                                 	businessNoticeReceive.setIsSheet(1);
335 336
                                 } else {
336 337
                                 	businessNoticeReceive.setIsSheet(0);
337
-                                }
338
+                                }*/
338 339
                                 //businessNoticeReceive.setHzqlsxzdm(3052);//商品粮 转后,划转后粮食性质
339 340
                 				businessNoticeReceive.setLsxzzbdh(jsonObject.getString("tzdid"));//粮食性质转变单单号
340 341
                 				//SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd :hh:mm:ss");
@@ -352,7 +353,7 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
352 353
                 				//businessNoticeReceive.setSfzswtzd("0"); //接收通知单菜单不展示该数据
353 354
                 				String ytzdid = jsonObject.getString("ytzdid");
354 355
                 				if (StringUtils.isNotBlank(ytzdid)) {//有值的话就代表是变更的通知单,不需要生成性质转变单
355
-                					businessNoticeReceive.setIsSheet(1);//这是属于通知单变更,不需要重新生成性质转变单
356
+                					//businessNoticeReceive.setIsSheet(1);//这是属于通知单变更,不需要重新生成性质转变单
356 357
                 					businessNoticeReceive.setYtzdid(ytzdid);
357 358
                 				}
358 359
                 				businessNoticeReceiveMapper.insert(businessNoticeReceive);

+ 144 - 13
src/main/java/com/chinaitop/depot/pushs/service/impl/PushServiceImpl.java

@@ -1,14 +1,14 @@
1 1
 package com.chinaitop.depot.pushs.service.impl;
2 2
 
3 3
 import java.math.BigDecimal;
4
-import java.util.*;
4
+import java.util.ArrayList;
5
+import java.util.Arrays;
6
+import java.util.HashMap;
7
+import java.util.List;
8
+import java.util.Map;
5 9
 
6 10
 import javax.annotation.Resource;
7 11
 
8
-import com.chinaitop.depot.business.mapper.BusinessStoreWareDetailMapper;
9
-import com.chinaitop.depot.business.model.*;
10
-import com.chinaitop.depot.business.service.ReceiveNoticeService;
11
-import com.chinaitop.depot.utils.ParameterUtil;
12 12
 import org.apache.commons.lang.ArrayUtils;
13 13
 import org.slf4j.Logger;
14 14
 import org.slf4j.LoggerFactory;
@@ -19,9 +19,21 @@ import com.alibaba.fastjson.JSON;
19 19
 import com.chinaitop.depot.business.mapper.BusinessContractMapper;
20 20
 import com.chinaitop.depot.business.mapper.BusinessDeliveryStorageNoticeMapper;
21 21
 import com.chinaitop.depot.business.mapper.BusinessLadingMapper;
22
+import com.chinaitop.depot.business.mapper.BusinessMergeNoticeMapper;
22 23
 import com.chinaitop.depot.business.mapper.BusinessNoticeReceiveMapper;
24
+import com.chinaitop.depot.business.mapper.BusinessStoreWareDetailMapper;
25
+import com.chinaitop.depot.business.model.BusinessContract;
26
+import com.chinaitop.depot.business.model.BusinessContractExample;
27
+import com.chinaitop.depot.business.model.BusinessDeliveryStorageNotice;
28
+import com.chinaitop.depot.business.model.BusinessDeliveryStorageNoticeExample;
29
+import com.chinaitop.depot.business.model.BusinessMergeNoticeDetail;
30
+import com.chinaitop.depot.business.model.BusinessNoticeReceive;
31
+import com.chinaitop.depot.business.model.BusinessStoreWareDetail;
32
+import com.chinaitop.depot.business.model.BusinessStoreWareDetailExample;
33
+import com.chinaitop.depot.business.service.ReceiveNoticeService;
23 34
 import com.chinaitop.depot.pushs.service.PushsService;
24 35
 import com.chinaitop.depot.unissoft.model.ResponseEntity;
36
+import com.chinaitop.depot.utils.ParameterUtil;
25 37
 
26 38
 @Service
27 39
 public class PushServiceImpl implements PushsService{
@@ -41,6 +53,8 @@ public class PushServiceImpl implements PushsService{
41 53
 	private ReceiveNoticeService receiveNoticeService;
42 54
 	@Resource
43 55
 	private BusinessNoticeReceiveMapper receiveNoticeMapper;
56
+	@Resource
57
+	private BusinessMergeNoticeMapper businessMergeNoticeMapper;
44 58
 
45 59
 
46 60
 
@@ -217,19 +231,136 @@ public class PushServiceImpl implements PushsService{
217 231
 		
218 232
 		List<Map<String,Object>> mainList1 =businessDeliveryStorageNoticeMapper.getNoticeData(mapCondition1);
219 233
 		//再根据主数据id查出相关的从数据插入
220
-				for (Map<String,Object> mains : mainList1) {
221
-					//单位转化为公斤
222
-					BigDecimal bignum = new BigDecimal(1000);
223
-					//数量转化为公斤
224
-					if(mains.get("shiping_count")!=null && !mains.get("shiping_count").equals("")){
225
-						BigDecimal count = new BigDecimal(mains.get("shiping_count").toString());
226
-						mains.put("shiping_count", count.multiply(bignum).toString());
234
+		for (Map<String,Object> mains : mainList1) {
235
+			//单位转化为公斤
236
+			BigDecimal bignum = new BigDecimal(1000);
237
+			//数量转化为公斤
238
+			if(mains.get("shiping_count")!=null && !mains.get("shiping_count").equals("")){
239
+				BigDecimal count = new BigDecimal(mains.get("shiping_count").toString());
240
+				mains.put("shiping_count", count.multiply(bignum).toString());
241
+			}
242
+		}
243
+
244
+		//查所有合并过的数据
245
+		BusinessMergeNoticeDetail detailObj = new BusinessMergeNoticeDetail();
246
+		detailObj.setOrgId(Integer.parseInt(orgId));
247
+
248
+		List<Map<String,Object>> mainList2 = new ArrayList<>();
249
+		List<BusinessMergeNoticeDetail> hbtzdList = businessMergeNoticeMapper.findByZidDetailList(detailObj);
250
+		if (null != hbtzdList && hbtzdList.size() > 0) {
251
+			List<Integer> tzdids = new ArrayList<>();
252
+			for (BusinessMergeNoticeDetail detail : hbtzdList) {
253
+				tzdids.add(Integer.parseInt(detail.getTzdid()));
254
+			}
255
+			Map<String,Object> mapCondition2 = new HashMap<String, Object>();
256
+			mapCondition2.put("ids", tzdids);
257
+			
258
+			mainList2 = businessDeliveryStorageNoticeMapper.getNoticeData(mapCondition2);
259
+			//再根据主数据id查出相关的从数据插入
260
+			for (Map<String,Object> mains : mainList2) {
261
+				BusinessStoreWareDetailExample businessStoreWareDetailExample = new BusinessStoreWareDetailExample();
262
+				BusinessStoreWareDetailExample.Criteria criteria = businessStoreWareDetailExample.createCriteria();
263
+				criteria.andZidEqualTo(Integer.valueOf(mains.get("id").toString()));
264
+				criteria.andTypeEqualTo("notice");//默认查询通知单类型数据
265
+				List<BusinessStoreWareDetail> json = businessStoreWareDetailMapper.selectByExample(businessStoreWareDetailExample);
266
+				//单位转化为公斤
267
+				BigDecimal bignum = new BigDecimal(1000);
268
+				if(json.size()>0 && json!=null){
269
+					if(mains.get("bill_type").toString().equals("2")){
270
+						for (int i = 0; i < json.size(); i++) {
271
+							if(null != json.get(i).getInCount() && !json.get(i).getInCount().equals("")){
272
+								BigDecimal bignum1 = new BigDecimal(json.get(i).getInCount()); 
273
+								BigDecimal inCount = bignum1.multiply(bignum);
274
+								json.get(i).setInCount(inCount.toString());
275
+							}
276
+							if(null != json.get(i).getOutCount() && !json.get(i).getOutCount().equals("")){
277
+								BigDecimal bignum2 = new BigDecimal(json.get(i).getOutCount()); 
278
+								BigDecimal outCount = bignum2.multiply(bignum);
279
+								json.get(i).setOutCount(outCount.toString());
280
+							}
281
+						}
282
+					}else{
283
+						for (int i = 0; i < json.size(); i++) {
284
+							if(null != json.get(i).getInCount() && !json.get(i).getInCount().equals("") && !json.get(i).getInPrice().equals("") && null != json.get(i).getInPrice()){
285
+								BigDecimal bignum1 = new BigDecimal(json.get(i).getInCount()); 
286
+								BigDecimal biginprice1 = new BigDecimal(json.get(i).getInPrice()); 
287
+								BigDecimal inCount = bignum1.multiply(bignum);
288
+								//BigDecimal inDetailTotalPrice = inCount.multiply(biginprice1);
289
+								BigDecimal inPrice = biginprice1.divide(bignum);
290
+								json.get(i).setInCount(inCount.toString());
291
+								json.get(i).setInPrice(inPrice.toString());
292
+							}
293
+							if(null != json.get(i).getOutCount() && !json.get(i).getOutCount().equals("") && null != json.get(i).getOutPrice() &&  !json.get(i).getOutPrice().equals("")){
294
+								BigDecimal bignum2 = new BigDecimal(json.get(i).getOutCount()); 
295
+								BigDecimal biginprice2 = new BigDecimal(json.get(i).getOutPrice()); 
296
+								BigDecimal outCount = bignum2.multiply(bignum);
297
+								//BigDecimal outDetailTotalPrice = outCount.multiply(biginprice2);
298
+								BigDecimal outPrice = biginprice2.divide(bignum);
299
+								json.get(i).setOutCount(outCount.toString());
300
+								json.get(i).setOutPrice(outPrice.toString());
301
+							}
302
+						}
227 303
 					}
304
+
305
+					//判断出库期限 储备粮通知单
306
+					if(mains.containsKey("create_unit") && mains.get("bill_type").toString().equals("3")){
307
+						if(mains.get("create_unit").toString().equals("1")){ //取储备粮的通知单
308
+							for (int j = 0; j < json.size(); j++) {
309
+								if(json.get(j).getJstzdId().length()>0 && json.get(j).getJstzdId()!=null){
310
+									BusinessNoticeReceive noticeReceive = receiveNoticeMapper.selectByPrimaryKey(Integer.valueOf(json.get(j).getJstzdId()));
311
+									json.get(j).setOutboundExpirationDate(noticeReceive.getOutgoingPeriod());
312
+								}
313
+							}
314
+						}
315
+					}
316
+					
228 317
 				}
229
-		
318
+
319
+				mains.put("fromData",json);//从表数据以json形式插入主表数据
320
+				
321
+				//数量转化为公斤
322
+				if(mains.get("shiping_count")!=null && !mains.get("shiping_count").equals("")){
323
+					BigDecimal count = new BigDecimal(mains.get("shiping_count").toString());
324
+					mains.put("shiping_count", count.multiply(bignum).toString());
325
+				}
326
+
327
+				//处理储备粮中的通知单 
328
+				if(null != mains.get("create_unit")){
329
+					if(mains.get("create_unit").equals(1)){
330
+						//传字段 计划文件号 和摘要 用于分仓保管账
331
+						for (BusinessStoreWareDetail businessStoreWareDetail : json) {
332
+							BusinessNoticeReceive businessNoticeReceive =new BusinessNoticeReceive();
333
+							businessNoticeReceive.setHouseId(businessStoreWareDetail.getHouseId());
334
+							businessNoticeReceive.setWareHouseId(businessStoreWareDetail.getWareHouseId());
335
+							businessNoticeReceive.setGrainKind(businessStoreWareDetail.getGrainKind());
336
+							businessNoticeReceive.setGrainAttribute(businessStoreWareDetail.getGrainAttribute());
337
+							businessNoticeReceive.setOrgId(businessStoreWareDetail.getOrgId());
338
+							List<BusinessNoticeReceive> noticeRecevieList = receiveNoticeService.queryByExample(null, null, businessNoticeReceive, null,null);
339
+							if(null != noticeRecevieList && noticeRecevieList.size()>0){
340
+								String jhwjh = noticeRecevieList.get(0).getNoticeNumber();
341
+								String zy = noticeRecevieList.get(0).getYwtype();
342
+								if(("1").equals(zy)){ //1收储 2 销售 3轮换
343
+									zy = "收储";
344
+								}else if(("2").equals(zy)){
345
+									zy = "销售";
346
+								}else if(("3").equals(zy)){
347
+									zy = "轮换";
348
+								}
349
+								mains.put("jhwjh", jhwjh);
350
+								mains.put("zy", zy);
351
+							}
352
+						}
353
+					}
354
+					
355
+				}
356
+			}
357
+			
358
+		}
359
+
230 360
         Map<String,Object> mapData = new HashMap<String, Object>();
231 361
 		mapData.put("mainData", mainList);
232 362
 		mapData.put("mainData1", mainList1);
363
+		mapData.put("mainData2", mainList2);
233 364
 		mapData.put("status", "success");
234 365
 		return JSON.toJSONString(ResponseEntity.ok(mapData));
235 366
 	}