Browse Source

催款提醒时间修改(带打印)

Signed-off-by: anderx <312518615@qq.com>
anderx 5 years ago
parent
commit
9047d0701c

+ 1 - 1
src/main/java/com/goafanti/common/mapper/NewOrderDunMapper.xml

@@ -465,7 +465,7 @@
   a.effective_count effectiveCount, a.aid, a.create_time createTime,b.approval,a.customize_time customizeTime
   ,date_format(a.customize_time,'%Y-%m-%d') customizeTimes, a.customize_name customizeName
   from new_order_dun a left join  t_order_new b on a.order_no=b.order_no
-  where 1=1 and a.status=0 and b.process_status &gt; 1
+  where 1=1 and a.status=0 and b.process_status &gt; 4
   </select>
   <select id="selectByTid" resultType="com.goafanti.order.bo.OutNewOrderDunBo">
     select a.id, a.order_no orderNo, a.tid, a.project_type projectType, a.dun_type dunType, a.wait_day waitDay, 

+ 7 - 1
src/main/java/com/goafanti/common/task/OrderDunTask.java

@@ -82,12 +82,18 @@ public class OrderDunTask {
   		
   		List<OutNewOrderDunBo> list= newOrderDunService.selectAllOrderDun();
   		Calendar calendar=Calendar.getInstance();   
-  		calendar.setTime(new Date()); 
+  		calendar.setTime(new Date());
+  		System.out.println(DateUtils.formatDate(new Date(), AFTConstants.YYYYMMDDHHMMSS));
+  		System.out.println(DateUtils.formatDate(calendar.getTime(), AFTConstants.YYYYMMDDHHMMSS));
   		Calendar calendar2=Calendar.getInstance();   
   		for (OutNewOrderDunBo o : list) {
   			calendar2.setTime(o.getCreateTime());
   			if (o!=null&&o.getApproval()!=null&&o.getApproval()!=0&&o.getDunType()==1&&o.getWaitDay()!=null) {
   					calendar2.add(Calendar.DATE, o.getWaitDay());
+  					System.out.println(o.getOrderNo());
+  					System.out.println(DateUtils.formatDate(new Date(), AFTConstants.YYYYMMDDHHMMSS));
+  					System.out.println(DateUtils.formatDate(calendar.getTime(), AFTConstants.YYYYMMDDHHMMSS));
+  					System.out.println(DateUtils.formatDate(calendar2.getTime(), AFTConstants.YYYYMMDDHHMMSS));
   					if (calendar.getTimeInMillis() > calendar2.getTimeInMillis()) {//当前时间大于计算后时间则触发
   						updateOrderDun(o);
   						Thread.sleep(2000);

+ 2 - 1
src/main/java/com/goafanti/order/service/OrderNewService.java

@@ -186,7 +186,7 @@ public interface OrderNewService {
 	
 	void addNoticAndSendEmail(String orderNo, OrderDunTaskBo t, Integer code)throws UnsupportedEncodingException, MessagingException;
 	
-	void addNewDunNoticAndSendEmail(TOrderNew t2, OutNewOrderDunBo o);
+	void addNewDunNoticAndSendEmail(String orderNo, OutNewOrderDunBo o);
 	
 	void addTimingTaskNewDunNoticAndSendEmail(TOrderNew t2, OutNewOrderDunBo o);
 	
@@ -201,5 +201,6 @@ public interface OrderNewService {
 	int pushOutsourceProjectAudit(TOrderOutsource o);
 	Pagination<OutArrearsDunListBo> arrearsDunList(InputArrearsDunListBo in);
 	void exportArrearsDunListData(InputArrearsDunListBo in, HttpServletResponse response) throws IOException;
+	void pushOrderDun(String orderNo);
 	
 }

+ 13 - 14
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -572,7 +572,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 				//修改项目为外包项目
 				tOrderTaskMapper.updateByOutsourceToOrderNo(orderNo,1);
 			}
-			pushOrderDun(t2);
+//			pushOrderDun(t2);
 		}else if (orderStatus==OrderNewState.QDSHJJ.getCode()) {//如果不通过新增驳回
 				if (outsource==0) {//非外包
 				t.setProcessStatus(ProcessStatus.YPYXY.getCode());
@@ -592,39 +592,39 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 
 
 
-	public void pushOrderDun(TOrderNew t2) {
-			List<OutNewOrderDunBo> list=newOrderDunMapper.selectListNewOrderDun(t2.getOrderNo(),null,0);
+	public void pushOrderDun(String orderNo) {
+			List<OutNewOrderDunBo> list=newOrderDunMapper.selectListNewOrderDun(orderNo,null,0);
 			for (OutNewOrderDunBo o : list) {
 				if (o.getDunType()==1) {	
 					o.setStatus(1);
 					o.setStartTime(new Date());
 					newOrderDunMapper.updateByPrimaryKeySelective(o);
 					tOrderMidMapper.addOrderReceivables(o.getOrderNo(),o.getMoney());
-					TOrderMid tm=tOrderMidMapper.selectByOrderNo(t2.getOrderNo());
+					TOrderMid tm=tOrderMidMapper.selectByOrderNo(orderNo);
 						TArrearsDun t=new TArrearsDun();
 						t.setOrderArrears(tm.getOrderArrears());
 						t.setOrderReceivables(tm.getOrderReceivables());
-						if (tArrearsDunMapper.checkOrderNo(t2.getOrderNo(),null)<1) {
-							t.setOrderNo(t2.getOrderNo());
+						if (tArrearsDunMapper.checkOrderNo(orderNo,null)<1) {
+							t.setOrderNo(orderNo);
 							tArrearsDunMapper.insertSelective(t);
-						}else if(tArrearsDunMapper.checkOrderNo(t2.getOrderNo(),0)>0){
-							Integer i=tArrearsDunMapper.selectByStatus(t2.getOrderNo(), 0);
+						}else if(tArrearsDunMapper.checkOrderNo(orderNo,0)>0){
+							Integer i=tArrearsDunMapper.selectByStatus(orderNo, 0);
 							t.setId(i);
 							tArrearsDunMapper.updateByPrimaryKeySelective(t);
 						}
-					addNewDunNoticAndSendEmail(t2,o);
+					addNewDunNoticAndSendEmail(orderNo,o);
 				}
 			}
 	}
 
 
 
-	public void addNewDunNoticAndSendEmail(TOrderNew t2, OutNewOrderDunBo o) {
+	public void addNewDunNoticAndSendEmail(String  orderNo, OutNewOrderDunBo o) {
 		AdminListBo a = adminMapper.getDeptNameByAid(TokenManager.getAdminId()==null?"1":TokenManager.getAdminId());
-		TOrderNewBo b  = tOrderNewMapper.getSaleIdByOno(t2.getOrderNo());
-		addNotic(t2.getOrderNo(),NoticeStatus.ORDER_DUN.getCode(),a, b);
+		TOrderNewBo b  = tOrderNewMapper.getSaleIdByOno(orderNo);
+		addNotic(orderNo,NoticeStatus.ORDER_DUN.getCode(),a, b);
 		try {
-			NewDunsendEmail(t2.getOrderNo(),o.getId(), a, b);
+			NewDunsendEmail(orderNo,o.getId(), a, b);
 		} catch (UnsupportedEncodingException | MessagingException e) {
 			throw new BusinessException(new Error("邮件发送错误。"));
 		}
@@ -1375,6 +1375,5 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 
 
 
-
 	
 }

+ 7 - 2
src/main/java/com/goafanti/order/service/impl/OrderProjectServiceImpl.java

@@ -139,6 +139,9 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 			addOrderLog(t.getOrderNo(), OrderLogProcess.XMDDPD.getCode(),remarks);
 			t.setManagerId(taskReceiverId);
 			t.setConsultantId(null);
+			//设置催款触发
+			TOrderNew b=tOrderNewMapper.selectByPrimaryKey(t.getOrderNo());
+			if(b.getApproval()==0)orderNewService.pushOrderDun(t.getOrderNo());
 		}else if (specially==0) {
 			addOrderLog(t.getOrderNo(), OrderLogProcess.XMPD.getCode(),remarks);
 			t.setConsultantId(taskReceiverId);
@@ -153,6 +156,9 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 		checkProjiectAllocation(t.getOrderNo());
 		return 1;
 	}
+	
+	
+	
 	public TOrderNew checkDeleteSign(String orderNo) {
 		TOrderNew t=tOrderNewMapper.selectByPrimaryKey(orderNo);
 		if(t.getDeleteSign()==2||t.getDeleteSign()==3) throw new BusinessException(new Error(ErrorConstants.ORDER_ALREADY_REVOKE, t.getOrderNo(),""));
@@ -435,7 +441,6 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 					}
 				} 
 					if(flag) {
-					TOrderNew tn=tOrderNewMapper.selectByPrimaryKey(t.getOrderNo());
 					//如果启动催款,则新增欠款与应收款
 					tOrderMidMapper.addOrderReceivables(t.getOrderNo(), ob.getMoney());
 					TOrderMid tm=tOrderMidMapper.selectByOrderNo(t.getOrderNo());
@@ -450,7 +455,7 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 							td.setId(i);
 							tArrearsDunMapper.updateByPrimaryKeySelective(td);
 						}
-					orderNewService.addNewDunNoticAndSendEmail(tn,ob);
+					orderNewService.addNewDunNoticAndSendEmail(t.getOrderNo(),ob);
 					ob.setStatus(1);
 					ob.setStartTime(new Date());
 					newOrderDunMapper.updateByPrimaryKeySelective(ob);