Просмотр исходного кода

催款触发修改

Signed-off-by: anderx <312518615@qq.com>
anderx лет назад: 6
Родитель
Сommit
bce3114331

+ 2 - 2
src/main/java/com/goafanti/common/mapper/TOrderNewMapper.xml

@@ -1393,7 +1393,7 @@ where super_id is null ) e on e.order_no=a.order_no
   	and dep.id= #{depId,jdbcType=VARCHAR}
   	</if>
   	<if test="aid != null">
-  	and c.aid= #{aid,jdbcType=VARCHAR}
+  	and b.salesman_id= #{aid,jdbcType=VARCHAR}
   	</if>
   	<if test="starTime !=null and endTime !=null">
   	and b.sign_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
@@ -1429,7 +1429,7 @@ where super_id is null ) e on e.order_no=a.order_no
   	and a.order_no = #{orderNo,jdbcType=VARCHAR}
   	</if>
   	<if test="aid != null">
-  	and c.aid= #{aid,jdbcType=VARCHAR}
+  	and b.salesman_id= #{aid,jdbcType=VARCHAR}
   	</if>
   	<if test="starTime !=null and endTime !=null">
   	and b.sign_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}

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

@@ -19,8 +19,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.ResponseBody;
 
+import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.dao.TOrderNewMapper;
 import com.goafanti.common.model.TOrderNew;
+import com.goafanti.common.utils.DateUtils;
 import com.goafanti.common.utils.LoggerUtils;
 import com.goafanti.order.bo.InputNewOrderDunBo;
 import com.goafanti.order.bo.OutNewOrderDunBo;
@@ -28,8 +30,8 @@ import com.goafanti.order.enums.OrderDunProjectType;
 import com.goafanti.order.service.NewOrderDunService;
 import com.goafanti.order.service.OrderNewService;
 
-@Component
-//@Controller
+//@Component
+@Controller
 public class OrderDunTask {
 	@Autowired
 	private OrderNewService orderNewService;
@@ -45,9 +47,9 @@ public class OrderDunTask {
 	/**
 	 * 每天凌晨2点轮询处理需要催款的信息
 	 */
-//	@RequestMapping(value = "/open/updateorderDun", method = RequestMethod.GET)
-//	@ResponseBody
-	@Scheduled(cron = "0 0 2  * * ?") 
+	@RequestMapping(value = "/open/updateorderDun", method = RequestMethod.GET)
+	@ResponseBody
+//	@Scheduled(cron = "0 0 2  * * ?") 
   @Transactional(rollbackFor=Exception.class)
 	public void updateorderDun(){
   		try {
@@ -59,16 +61,17 @@ public class OrderDunTask {
   		Calendar calendar2=Calendar.getInstance();   
   		for (OutNewOrderDunBo o : list) {
   			calendar2.setTime(o.getCreateTime());
-  			if (o!=null&&o.getApproval()!=null&&o.getApproval()==2) {
-  	  	  		calendar2.add(Calendar.DATE, o.getWaitDay());
-  	  	  		if (calendar.getTimeInMillis() > calendar2.getTimeInMillis()) {//当前时间大于计算后时间则触发
-  	  	  			updateOrderDun(o);
-  	  	  			Thread.sleep(2000);
-  				}
+  			if (o!=null&&o.getApproval()!=null&&o.getApproval()!=0&&o.getDunType()==1&&o.getWaitDay()!=null) {
+  					calendar2.add(Calendar.DATE, o.getWaitDay());
+  					if (calendar.getTimeInMillis() > calendar2.getTimeInMillis()) {//当前时间大于计算后时间则触发
+  						updateOrderDun(o);
+  						Thread.sleep(2000);
+  					}
 			}
   			if(o.getProjectType()==OrderDunProjectType.HY.getCode()&&o.getDunType()==2) {
   				calendar2.add(Calendar.DATE, o.getEffectiveCount()*180);
   				CalendarTimeCleared(calendar2);
+  				System.out.println(DateUtils.formatDate(calendar2.getTime(), AFTConstants.YYYYMMDDHHMMSS));
   				if (calendar.getTimeInMillis() > calendar2.getTimeInMillis()) {//当前时间大于计算后时间则触发
   	  	  			updateOrderDun(o);
   	  	  			Thread.sleep(2000);
@@ -83,9 +86,6 @@ public class OrderDunTask {
   		        if(month>9)year=year+2;
   		        calendar2.set(year, 5, 1);
   		        CalendarTimeCleared(calendar2);
-  		        System.out.println(calendar.getTime());
-  		      System.out.println(calendar2.getTime());
-  		      System.out.println(calendar.getTimeInMillis() > calendar2.getTimeInMillis()?1:0);
   				if (calendar.getTimeInMillis() > calendar2.getTimeInMillis()) {//当前时间大于计算后时间则触发
   	  	  			updateOrderDun(o);
   	  	  			Thread.sleep(2000);
@@ -118,7 +118,7 @@ public class OrderDunTask {
 		o.setStartTime(new Date());
 		newOrderDunService.updateDun(o);
 		TOrderNew t2=tOrderNewMapper.selectByPrimaryKey(t.getOrderNo());
-		orderNewService.addNewDunNoticAndSendEmail(t2, t);;
+		orderNewService.addTimingTaskNewDunNoticAndSendEmail(t2, t);;
 	}
 	
 	/**

+ 18 - 0
src/main/java/com/goafanti/order/service/OrderNewService.java

@@ -157,22 +157,40 @@ public interface OrderNewService {
 	 */
 	Pagination<TOrderRefundBo> orderRefundList(String name, String orderNo, String starTime, String endTime, Integer specially,
 			Integer pageNo, Integer pageSize);
+	
 	boolean checkOrderMain(TOrderTask t);
+	
 	boolean chekeOrderStatus(String orderNo);
+	
 	boolean chekeApprovalOrderStatus(String orderNo);
+	
 	int deleteOrderNew(String orderNo);
+	
 	boolean checkOderSettlementAmount(String orderNo);
+	
 	boolean checkORderTask(String orderNo);
+	
 	void exportOrderDunData(String name,String orderNo,String starTime,String endTime,Integer specially,String adminName,
 			String depId,Integer newStatus,Integer pageNo,Integer pageSize,HttpServletResponse response) throws IOException ;
+	
 	int updateOrderOver(String orderNo);
+	
 	OrderRefundDetailBo orderRefundDetail(String id);
+	
 	int updateOrderRefund(TOrderRefundWithBLOBs t);
+	
 	int updatetechnicianBackOrder(String orderNo, String reason);
+	
 	List<OrderDunTaskBo> selectAllOrderDun();
+	
 	void updateOrderDun(TOrderDun tDun);
+	
 	void addNoticAndSendEmail(String orderNo, OrderDunTaskBo t, Integer code)throws UnsupportedEncodingException, MessagingException;
+	
 	void addNewDunNoticAndSendEmail(TOrderNew t2, OutNewOrderDunBo o);
+	
+	void addTimingTaskNewDunNoticAndSendEmail(TOrderNew t2, OutNewOrderDunBo o);
+	
 	boolean checkORderDun(String orderNo);
 	
 	int updateFinance(String orderNo, String newFinance);

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

@@ -272,6 +272,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 			tl.setProcess(OrderLogProcess.TJ.getCode());
 			tl.setAid(TokenManager.getAdminId());
 			addOrderLog(tl);
+			System.out.println(""+t2.getContractNo());
 			if (StringUtils.isBlank(t2.getContractNo())) {
 				//没有合同编号则生成
 				createContractNo(t);
@@ -388,8 +389,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		if (tOrderNewMapper.checkContractNo(sno)>0) {
 			int i=Integer.parseInt(sno.substring(sno.indexOf("-")+5, sno.length()));
 			sno=countNo(mp, sno, ty, i);
-			iterationNo(sno,mp,ty,i);
-			
+			sno=iterationNo(sno,mp,ty,i);
 		}
 		return sno;
 	}
@@ -592,6 +592,16 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 			throw new BusinessException(new Error("邮件发送错误。"));
 		}
 	}
+	public void addTimingTaskNewDunNoticAndSendEmail(TOrderNew t2, OutNewOrderDunBo o) {
+		AdminListBo a = adminMapper.getDeptNameByAid("1");
+		TOrderNewBo b  = tOrderNewMapper.getSaleIdByOno(t2.getOrderNo());
+		addNotic(t2.getOrderNo(),NoticeStatus.ORDER_DUN.getCode(),a, b);
+		try {
+			NewDunsendEmail(t2.getOrderNo(),o.getId(), a, b);
+		} catch (UnsupportedEncodingException | MessagingException e) {
+			throw new BusinessException(new Error("邮件发送错误。"));
+		}
+	}
 	
 	
 	public void  NewDunsendEmail(String orderNo,Integer dunId,AdminListBo a,TOrderNewBo b) throws UnsupportedEncodingException, MessagingException{
@@ -642,7 +652,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		Map<String, Object> params = new HashMap<String, Object>();
 		if(pageSize==null||pageSize<0)pageSize=10;
 		if(pageNo==null||pageNo<0)pageNo=1;
-		params.put("newStatus", newStatus==null?0:1);
+		params.put("newStatus", newStatus!=null?newStatus:0);
 		if (StringUtils.isNotBlank(name)) params.put("name", name);
 		if (StringUtils.isNotBlank(depId)) params.put("depId", depId);
 		if(specially!=null&&specially==1) params.put("aid", TokenManager.getAdminId());