anderx пре 4 година
родитељ
комит
578c1894ba
1 измењених фајлова са 56 додато и 57 уклоњено
  1. 56 57
      src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

+ 56 - 57
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -87,13 +87,13 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 	@Autowired
 	private TOrderMidMapper	tOrderMidMapper;
 	@Autowired
-	private TOrderRefundMapper	tOrderRefundMapper;	
+	private TOrderRefundMapper	tOrderRefundMapper;
 	@Autowired
 	private TOrderBackMapper	tOrderBackMapper;
 	@Autowired
 	private OrganizationContactBookMapper	organizationContactBookMapper;
 	@Autowired
-	private OrganizationManagementMapper 	organizationManagementMapper ; 
+	private OrganizationManagementMapper 	organizationManagementMapper ;
 	@Autowired
 	private JDBCIdGenerator	idGenerator;
 	@Autowired
@@ -136,21 +136,21 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 	private PushOrderService pushOrderService;
 	@Autowired
 	private BusinessProjectMapper businessProjectMapper;
-	
+
 	@Value(value = "${mobileRemindCodeTemplate}")
 	private String					mobileRemindCodeTemplate	= null;
 	@Value(value = "${upload.path}")
 	private String 					uploadPath 			= null;
-	
+
 	@Value(value = "${accessKey}")
 	private String					accessKey			= null;
 
 	@Value(value = "${accessSecret}")
 	private String					accessSecret		= null;
-	
+
 	Logger							logger	= LoggerFactory.getLogger(OrderNewServiceImpl.class);
 
-	
+
 	@Override
 	public int createServiceOrder(String uid, Integer orderType) {
 		BigDecimal initial = new BigDecimal(0);
@@ -183,7 +183,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		te.setOrderNo(orderNo);
 		te.setServiceStatus(0);
 		tOrderExtendMapper.insertSelective(te);
-		return tOrderNewMapper.insertSelective(t); 
+		return tOrderNewMapper.insertSelective(t);
 	}
 
 
@@ -213,7 +213,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 	}
 
 	public void checkOrder(TOrderNew order,TOrderTask t){
-		if(order == null) 
+		if(order == null)
 			 throw new BusinessException(new Error(ErrorConstants.ORDER_NOT_EXIST, "" ,""));
 		if(order.getDeleteSign() == ActiveState.ABOLISH.getCode())
 			 throw new BusinessException(new Error(ErrorConstants.ORDER_ALREADY_FREEZE, order.getOrderNo(),""));
@@ -222,14 +222,13 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		List<LockingReleaseBo> list=userLockReleaseMapper.checkTask(order.getBuyerId(),t.getCommodityId());
 		if (list.size()>0) {
 			for (LockingReleaseBo lockingReleaseBo : list) {
-				System.out.println(lockingReleaseBo.getAid() +"======="+order.getSalesmanId());
 				if (!lockingReleaseBo.getAid().equals(order.getSalesmanId())) {
 					throw new BusinessException(new Error( "该业务已经被其他人锁定","该业务已经被其他人锁定"));
 				}
 			}
-			
+
 		}
-		
+
 	}
 
 
@@ -280,7 +279,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		if (flag) {
 			patentNewService.updateCostReduction(t.getId());
 		}
-		return i; 
+		return i;
 	}
 
 
@@ -387,7 +386,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 			tOrderBackMapper.updateByOrderNoAndBackStatus(t.getOrderNo());
 		}
 		// 0 相等
-		// -1 小于 
+		// -1 小于
 		// 1 大于
 		//liquidation_status 清算状态 0-首付待付请,1-尾款待付清,2-已付请,3-部分退款,4-全部退款
 		//settlement_amount 已付  total_amount 总价格   first_amount首付
@@ -399,7 +398,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 			} else if(t2.getSettlementAmount().compareTo(t.getFirstAmount()) < 0){//如果小于首付
 				t.setLiquidationStatus(LiquidationNewState.WAIT_PAY_FIRST_BALANCE.getCode());
 			}
-			
+
 		}
 		return tOrderNewMapper.updateByPrimaryKeySelective(t);
 	}
@@ -429,7 +428,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		}else {
 			tOrderMidMapper.insertSelective(tm);
 		}
-		
+
 	}
 
 
@@ -454,7 +453,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		}else {
 			//根据前缀查询最大编号
 			String max=organizationManagementMapper.getMaxAbbreviation(dep.getAbbreviation()+"-");
-			
+
 			String sno=null;
 			if (StringUtils.isBlank(max)||max.length()<13) {
 				String cn=""+dep.getAbbreviation()+"-"+y+"0001";
@@ -463,7 +462,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 			}else {
 				int ty=Integer.parseInt(max.substring(max.indexOf("-")+1, max.length()-4));
 				int no=Integer.parseInt(max.substring(max.length()-4, max.length()));
-				
+
 				//得出字符串
 				sno = countNo(dep.getAbbreviation(), sno, ty, no);
 				//迭代得出最后编码
@@ -477,9 +476,9 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 			}
 		}
 	}
-		
-	
-	
+
+
+
 
 	private String iterationNo(String sno ,Object mp, int ty, int no) {
 		if (tOrderNewMapper.checkContractNo(sno)>0) {
@@ -505,13 +504,13 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		}
 		return sno;
 	}
-	
+
 
 	public void addOrderLog(TOrderLog tl, String reason) {
 		tl.setAid(TokenManager.getAdminId());
 		if(reason!=null)tl.setRemarks(reason);
 		tOrderLogMapper.insertSelective(tl);
-		
+
 	}
 
 
@@ -543,7 +542,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 				}else {
 					tOrderDunMapper.updateByPrimaryKeySelective(t);
 				}
-				
+
 			}
 		}
 		boolean flag=true;
@@ -561,7 +560,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 				}
 				flag=true;
 			}
-			
+
 		}
 		return 1;
 	}
@@ -611,7 +610,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		return p;
 	}
 
-	
+
 
 	@Override
 	public int updateOrderNew(String orderNo, Integer orderStatus,String reason,Integer outsource, TOrderOutsource o) {
@@ -637,9 +636,9 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 					tl.setOrderNo(orderNo);
 					tl.setProcess(OrderLogProcess.FQWB.getCode());
 					addOrderLog(tl,reason);
-					
+
 				}
-			
+
 			type=NoticeStatus.ORDER_YES.getCode();
 			tl.setOrderNo(orderNo);
 			tl.setProcess(OrderLogProcess.SH.getCode());
@@ -670,14 +669,14 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		t.setOrderStatus(orderStatus);
 		tOrderNewMapper.updateByPrimaryKeySelective(t);
 		if (aids.isEmpty()) {
-			throw new BusinessException(new Error( "邮件发送失败,对方设置邮箱错误","邮件发送失败,对方设置邮箱错误")); 
+			throw new BusinessException(new Error( "邮件发送失败,对方设置邮箱错误","邮件发送失败,对方设置邮箱错误"));
 		}
 		pushGeneralSendNoticeAndEmail(aids, type,t2.getOrderNo(), TokenManager.getAdminId(),t2.getApproval());
-		return 1; 
+		return 1;
 	}
 
 
-	
+
 	public void pushOrderDun(String orderNo) {
 		TOrderNew b=tOrderNewMapper.selectByPrimaryKey(orderNo);
 		if(b.getApproval()==0){
@@ -740,8 +739,8 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 			throw new BusinessException(new Error("邮件发送错误。"));
 		}
 	}
-	
-	
+
+
 	public void  NewDunsendEmail(String orderNo,Integer dunId,AdminListBo a,TOrderNewBo b) throws UnsupportedEncodingException, MessagingException{
 		NewOrderDun ob=newOrderDunMapper.selectByPrimaryKey(dunId);
 		AdminListBo a2 = adminMapper.getDeptNameByAid(b.getSalesmanId());
@@ -759,7 +758,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 					asyncUtils.patentSend(bo);
 				}
 	     }
-			
+
 
 	}
 
@@ -860,7 +859,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		//t.setAccept("1");
 		t.setAccept(order.getFinanceId());
 		t.setResult("");
-		TOrderNew tOrder=new TOrderNew(); 
+		TOrderNew tOrder=new TOrderNew();
 		tOrder.setOrderNo(t.getOrderNo());
 		tOrder.setOrderStatus(OrderNewState.TDZ.getCode());
 		tOrderNewMapper.updateByPrimaryKeySelective(tOrder);
@@ -904,7 +903,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		addOrderLog(tl,reason);
 		pushGeneralSendNoticeAndEmail(aids, type,t2.getOrderNo(), TokenManager.getAdminId(),t2.getApproval());
 		//新增特批催款信息
-		
+
 		return tOrderNewMapper.updateByPrimaryKeySelective(t);
 	}
 
@@ -1028,7 +1027,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 			if (StringUtils.isNotBlank(endTime)) params.put("endTime", endTime+" 23:59:59");
 			Pagination<TOrderRefundBo> p = (Pagination<TOrderRefundBo>)findPage("selectOrderRefundListByPage", "selectOrderRefundListCount", params, pageNo, pageSize);
 			return p;
-		
+
 	}
 
 
@@ -1051,14 +1050,14 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		}else {
 			return false;
 		}
-		
+
 	}
-	
+
 
 
 	/**
 	 * 获取催款数据
-	 * @throws IOException 
+	 * @throws IOException
 	 */
 	@Override
 	public void exportOrderDunData(String name,String orderNo,String contractNo,String starTime,String endTime,Integer specially,String aid,String adminName,
@@ -1068,7 +1067,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 			@SuppressWarnings("unchecked")
 			List<outOrderDunListBo> list=(List<outOrderDunListBo>) dunOrderNewList( name,  orderNo, contractNo, starTime,  endTime,specially,
 					 aid,  adminName, depId,newStatus, pageNo,  pageSize).getList();
-			
+
     		String[] comment = {"合同编号","订单编号","客户名称","订单负责人","订单部门","订单状态","签单金额","应收款","已收款","拨款比例","结算状态","未收款","项目状态","催收科目","催款状态","催款启动时间","签单时间"};
     		String fileName ="催款信息记录表" + new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date()) + ".xls";
     		//type 0 变更
@@ -1107,20 +1106,20 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
     			}
     		}
     		//返回名称及参数
-			 response.addHeader("Content-Disposition", "attachment;filename="  + new String(fileName.getBytes(),"iso-8859-1"));  
+			 response.addHeader("Content-Disposition", "attachment;filename="  + new String(fileName.getBytes(),"iso-8859-1"));
 			 response.setContentType("application/octet-stream;charset=utf-8");
     		 // 返回数据流
-			 wb.write(out); 
+			 wb.write(out);
 			 out.flush();
 			 out.close();
 		} catch (Exception e) {
 			e.printStackTrace();
 			throw new BusinessException(new Error("表格生成错误。"));
 		}finally {
-			out.flush(); 
-			out.close(); 
+			out.flush();
+			out.close();
 		}
-		
+
 	}
 
 	private String bigToString (BigDecimal o){
@@ -1149,7 +1148,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		t.setSettlementTime(new Date());
 		return tOrderNewMapper.updateByPrimaryKeySelective(t);
 	}
-	
+
 	@Override
 	public OrderRefundDetailBo orderRefundDetail(String id) {
 		return tOrderNewMapper.orderRefundDetail(id);
@@ -1188,7 +1187,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		//if(t.getDeleteSign()==2) throw new BusinessException(new Error(ErrorConstants.ORDER_ALREADY_REVOKE, t.getOrderNo(),""));
 		return t;
 	}
-	
+
 	@Override
 	public List<OrderDunTaskBo> selectAllOrderDun() {
 		return tOrderDunMapper.getTaskAllOrderDun();
@@ -1200,11 +1199,11 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 	public void updateOrderDun(TOrderDun tDun) {
 		 tOrderDunMapper.updateByPrimaryKeySelective(tDun);
 	}
-	
 
 
-	
-	
+
+
+
 	@Override
 	public void addNoticAndSendEmail(String orderNo,OrderDunTaskBo t,Integer type)
 			throws UnsupportedEncodingException, MessagingException {
@@ -1215,7 +1214,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		if (type==NoticeStatus.ORDER_APPROVA_NO.getCode())  id=TokenManager.getAdminId()==null?"1":TokenManager.getAdminId();
 		AdminListBo a = adminMapper.getDeptNameByAid(id);
 		 sendEmail( t==null?null:t.getId(), a, b);
-		 
+
 		 addNotic(type,a, b);
 	}
 	public void addNotic(Integer type,AdminListBo a,TOrderNewBo b) {
@@ -1230,7 +1229,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		n.setReaded(0);//未读
 		asyncUtils.addNotice(n);
 	}
-	public void  sendEmail(String dunId,AdminListBo a,TOrderNewBo b) throws UnsupportedEncodingException, MessagingException{
+	public void  sendEmail(String dunId,AdminListBo a,TOrderNewBo b){
 		LoggerUtils.debug(logger, "======================邮件信息发送===================");
 		String content = "<div>客户名称: "+ b.getUserName() +"</div><div>订单编号: " + b.getOrderNo() + "</div><div>合同编号: " + b.getContractNo() + "</div>";
 		String tite="订单驳回";
@@ -1264,10 +1263,10 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		return tOrderLogMapper.selectOrderByNo(orderNo);
 	}
 
-	
 
 
-    
+
+
 	public  void pushGeneralSendNoticeAndEmail(List<String> alist, Integer type,String orderNo,String adminId,Integer approval) {
 		AdminListBo a = adminMapper.getDeptNameByAid(adminId);
 		String approvalType="";
@@ -1300,11 +1299,11 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 			}
 		}
 	}
-    
 
 
 
-	
+
+
 
 
 
@@ -1358,7 +1357,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 
 	/**
 	 * 发起外包时,通过计算获取项目的成本,订单的成本
-	 * 
+	 *
 	 * @param tid 项目编号
 	 * @param type 0外包 1供应商
 	 */