Browse Source

会员子项目未通过显示BUG修复

anderx 3 years ago
parent
commit
72a396be2e

+ 57 - 36
src/main/java/com/goafanti/order/service/impl/OrderChangeServiceImpl.java

@@ -763,42 +763,10 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 	}
 
 	private void pushTaskAndDun(Integer id,TOrderNew o) {
-		List<TChangeTaskOut> listct=tChangeTaskMapper.selectByCid(id,null);
-		for (TChangeTaskOut cd : listct) {
-			TOrderTask ot=new TOrderTask();
-			if (cd.getType()==1) {
-			ot.setOrderNo(cd.getOrderNo());
-			ot.setCommodityId(cd.getCommodityId());
-			ot.setOrderNo(cd.getOrderNo());
-			ot.setCommodityName(cd.getCommodityName());
-			ot.setCommodityPrice(cd.getCommodityPrice());
-			ot.setCommodityQuantity(cd.getCommodityQuantity());
-			ot.setTaskComment(cd.getTaskComment());
-			ot.setMain(cd.getMain());
-			ot.setTaskStatus(0);
-			if (cd.getDeclarationBatch()!=null)ot.setDeclarationBatch(cd.getDeclarationBatch());
-			if (cd.getPatentType()!=null)ot.setPatentType(cd.getPatentType());
-			tOrderTaskMapper.insertSelective(ot);
-			if (cd.getServiceLife()!=null){
-				addTaskMember(ot.getId(),cd.getServiceLife(),cd.getServiceYear(),cd.getYearSum(),cd.getContractTerm());
-			}
-			cd.setTid(ot.getId());
-			tChangeTaskMapper.updateByPrimaryKeySelective(cd);
-			tChangeDunMapper.updateByCTid(cd.getId(), ot.getId());
-			}else if (cd.getType()==2) {
-				ot.setId(cd.getTid());
-				ot.setCommodityPrice(cd.getCommodityPrice());
-				ot.setCommodityQuantity(cd.getCommodityQuantity());
-				if (cd.getDeclarationBatch()!=null)ot.setDeclarationBatch(cd.getDeclarationBatch());
-				if (cd.getPatentType()!=null)ot.setPatentType(cd.getPatentType());
-				tOrderTaskMapper.updateByPrimaryKeySelective(ot);
-				if (cd.getServiceLife()!=null){
-					updateTaskMember(ot.getId(),cd.getServiceLife(),cd.getServiceYear(),cd.getYearSum(),cd.getContractTerm());
-				}
-			}else if(cd.getType()==3) {
-				tOrderTaskMapper.deleteByPrimaryKey(cd.getTid());
-			}
-		}
+		List<TChangeTaskOut> listct=tChangeTaskMapper.selectByCid(id,3);
+		HashMap<Integer, Integer> map=changeAddOrderTask(listct,0,null);
+		List<TChangeTaskOut> listct2=tChangeTaskMapper.selectByCid(id,2);
+		changeAddOrderTask(listct2,1 ,map);
 
 		List<TChangeDunOut> listcd=tChangeDunMapper.selectByCid(id);
 		for (TChangeDunOut cd : listcd) {
@@ -831,6 +799,59 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 		}
 	}
 
+	/**
+	 *
+	 * @param listct 数据
+	 * @param type 0普通数据处理 1子集数据处理
+	 */
+	private HashMap<Integer, Integer> changeAddOrderTask(List<TChangeTaskOut> listct, Integer type,HashMap<Integer, Integer> input) {
+		HashMap<Integer, Integer> map = new HashMap<>();
+		for (TChangeTaskOut cd : listct) {
+			TOrderTask ot=new TOrderTask();
+			if (cd.getType()==1) {
+				ot.setOrderNo(cd.getOrderNo());
+				ot.setCommodityId(cd.getCommodityId());
+				ot.setOrderNo(cd.getOrderNo());
+				ot.setCommodityName(cd.getCommodityName());
+				ot.setCommodityPrice(cd.getCommodityPrice());
+				ot.setCommodityQuantity(cd.getCommodityQuantity());
+				ot.setTaskComment(cd.getTaskComment());
+				ot.setMain(cd.getMain());
+				ot.setTaskStatus(0);
+				if (cd.getSplitStatus()==2){
+					Integer tid=map.get(cd.getChangeSplitSuper());
+					if (tid==null)tid=tChangeTaskMapper.selectByPrimaryKey(cd.getChangeSplitSuper()).getTid();
+					ot.setSplitSuper(tid);
+				}
+				if (cd.getDeclarationBatch()!=null)ot.setDeclarationBatch(cd.getDeclarationBatch());
+				if (cd.getPatentType()!=null)ot.setPatentType(cd.getPatentType());
+				tOrderTaskMapper.insertSelective(ot);
+				if (cd.getSplitStatus()==1){
+					map.put(cd.getId(),ot.getId());
+				}
+				if (cd.getServiceLife()!=null){
+					addTaskMember(ot.getId(),cd.getServiceLife(),cd.getServiceYear(),cd.getYearSum(),cd.getContractTerm());
+				}
+				cd.setTid(ot.getId());
+				tChangeTaskMapper.updateByPrimaryKeySelective(cd);
+				tChangeDunMapper.updateByCTid(cd.getId(), ot.getId());
+			}else if (cd.getType()==2) {
+				ot.setId(cd.getTid());
+				ot.setCommodityPrice(cd.getCommodityPrice());
+				ot.setCommodityQuantity(cd.getCommodityQuantity());
+				if (cd.getDeclarationBatch()!=null)ot.setDeclarationBatch(cd.getDeclarationBatch());
+				if (cd.getPatentType()!=null)ot.setPatentType(cd.getPatentType());
+				tOrderTaskMapper.updateByPrimaryKeySelective(ot);
+				if (cd.getServiceLife()!=null){
+					updateTaskMember(ot.getId(),cd.getServiceLife(),cd.getServiceYear(),cd.getYearSum(),cd.getContractTerm());
+				}
+			}else if(cd.getType()==3) {
+				tOrderTaskMapper.deleteByPrimaryKey(cd.getTid());
+			}
+		}
+		return map;
+	}
+
 	private void updateTaskMember(Integer id, String serviceLife, String serviceYear, Integer yearSum,String contractTerm) {
 		TTaskMember ttm=new TTaskMember();
 		ttm.setTid(id);