Browse Source

Merge branch 'test' of http://git.jishutao.com/jishutao/kede-server.git into test

limin 7 years ago
parent
commit
decf2d73ac

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

@@ -1060,6 +1060,7 @@
   	where a.delete_sign = 0 
   	<if test="specially == 0">
   	and a.order_status not in(3,5,6) and a.approval !=3
+  	and a.salesman_id = #{aid,jdbcType=VARCHAR}
   	</if>
   	<if test="specially == 1">
   	and a.process_status =1  and a.order_status=1
@@ -1073,16 +1074,15 @@
   	<if test="specially == 4">
   	and a.process_status in (4,5,6)
   	</if>
+  	<if test="specially == 4">
+  	and c.department_id=(select department_id from admin where  id= #{aid,jdbcType=VARCHAR})
+  	</if>
   	<if test="distribution == 1">
   	and a.process_status = 5
   	</if>
   	<if test="distribution == 2">
   	and a.process_status = 6
   	</if>
-  	
-  	<if test="aid != null">
-  	and a.salesman_id = #{aid,jdbcType=VARCHAR}
-  	</if>
   	<if test="name != null">
   	and b.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
   	</if>
@@ -1102,7 +1102,6 @@
   	select 
   		count(*)
   	from t_order_new a  left join `user` b on a.buyer_id=b.id
-  	from t_order_new a  left join `user` b on a.buyer_id=b.id 
   	left join admin c on a.salesman_id=c.id
   	left join admin d on a.finance_id=d.id
   	<if test="specially == 2">
@@ -1116,6 +1115,7 @@
   	where a.delete_sign = 0 
   	<if test="specially == 0">
   	and a.order_status not in(3,5,6) and a.approval !=3
+  	and a.salesman_id = #{aid,jdbcType=VARCHAR}
   	</if>
   	<if test="specially == 1">
   	and a.process_status =1  and a.order_status=1
@@ -1129,16 +1129,15 @@
   	<if test="specially == 4">
   	and a.process_status in (4,5,6)
   	</if>
+  	<if test="specially == 4">
+  	and c.department_id=(select department_id from admin where  id= #{aid,jdbcType=VARCHAR})
+  	</if>
   	<if test="distribution == 1">
   	and a.process_status = 5
   	</if>
   	<if test="distribution == 2">
   	and a.process_status = 6
   	</if>
-  	
-  	<if test="aid != null">
-  	and a.salesman_id = #{aid,jdbcType=VARCHAR}
-  	</if>
   	<if test="name != null">
   	and b.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
   	</if>
@@ -1268,4 +1267,4 @@
      left join t_order_new b  on a.order_no=b.order_no
      where a.id= #{id,jdbcType=INTEGER}
   </select>
-</mapper>
+</mapper>

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

@@ -1,21 +1,19 @@
 package com.goafanti.common.task;
 
 
-import java.io.UnsupportedEncodingException;
 import java.util.Date;
 import java.util.List;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Controller;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 
 import com.goafanti.common.model.TOrderDun;
-
+import com.goafanti.common.utils.LoggerUtils;
 import com.goafanti.order.bo.OrderDunTaskBo;
 import com.goafanti.order.service.OrderNewService;
 //@Component
@@ -32,19 +30,28 @@ public class OrderDunTask {
 	
 //	@Scheduled(cron = "0 0 2  * * ?") 
   	@RequestMapping(value = "/open/updateorderDun", method = RequestMethod.GET)
+  	@Transactional
 	public void updateorderDun(){
+  		try {
   		List<OrderDunTaskBo> list=orderNewService.selectAllOrderDun();
   		for (OrderDunTaskBo t : list) {
 			if (t.getDunSubject()/10==1) {
 				if (t.getDunSubject()%10==t.getOrderStatus()&&t.getSettlementAmount().compareTo(t.getMoney()) == -1) {
 					 updateOrderDun(t);
+						Thread.sleep(2000);
 				}
 			}else {
 				if (t.getDunSubject()%10==t.getProjectStatus()&&t.getSettlementAmount().compareTo(t.getMoney()) == -1) {
 					 updateOrderDun(t);
+					 Thread.sleep(2000);
 				}
 			}
 		}
+  		} catch (InterruptedException e) {
+  			LoggerUtils.error(getClass(), "=============================================");
+			LoggerUtils.error(getClass(), "催款的信息处理失败", e);
+			LoggerUtils.error(getClass(), "=============================================");
+		}
   		
   	}
 
@@ -52,6 +59,7 @@ public class OrderDunTask {
 	private void updateOrderDun(OrderDunTaskBo t) {
 		TOrderDun tDun=new TOrderDun();
 		 tDun.setId(t.getId());
+		 tDun.setDunStatus(1);
 		 tDun.setStartTime(new Date());
 		 orderNewService.updateOrderDun(tDun);
 		 orderNewService.SendEmail(t.getOrderNo(),t.getId());

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

@@ -252,7 +252,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;
-		if (specially!=null&&specially==0) {
+		if (specially!=null&&(specially==0||specially==5)) {
 			params.put("aid", TokenManager.getAdminId()==null?"1":TokenManager.getAdminId());
 		}else if(specially!=null&&specially==4){
 			params.put("distribution",distribution);
@@ -576,6 +576,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 			}
 			//发送驳回邮件
 			EmailBo bo = new EmailBo(tite, b.getEmail(), b.getSalesmanName(), a.getDepartmentName(), a.getName(), content);
+			LoggerUtils.debug(logger, "tite:"+tite+"  Email:"+ b.getEmail()+"  收件人姓名:"+ b.getSalesmanName()+ "    部门:"+a.getDepartmentName()+ "  发件人姓名:"+a.getName()+"   内容:"+ content);
 			SendEmailUtil.send(bo);
 			LoggerUtils.debug(logger, "=========================================发送邮件成功");
 		} catch (UnsupportedEncodingException e) {