Browse Source

Merge branch 'test' of jishutao/kede-server into prod

gitadmin 6 years ago
parent
commit
13fedde7b9

+ 14 - 8
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -1054,17 +1054,19 @@
    <select id="selectAdminCustomerList" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminCustomerBo">
   	select a.id as aid,a.name as aName,d.name as depName,ifnull(b.userCount,0) as userCount,ifnull(c.timeCount,0) as timeCount from admin a 
 	left join (select aid,count(aid) as userCount from user where aid is not null  
-	and  share_type=0 and source !=0
+	and  share_type=0 and source !=0 and type=1
 	group by aid) b on a.id=b.aid
 	left join (select aid,count(aid) as timeCount from user where aid is not null  
-	and  share_type=0 and source !=0
+	and  share_type=0 and source !=0 and type=1
 	 <if test="startTime != null and endTime != null"> 
     and  create_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
     </if>
 	group by aid) c on a.id=c.aid
 	left join department d on a.department_id=d.id
-	where a.status='正常'
-	and b.userCount !=0
+	left join user_role e on a.id=e.uid
+	left join `role` f on e.rid=f.id
+	where f.role_name in ('营销员','营销经理')	
+	and	 a.status='正常'
 	<if test="depId != null"> 
     and a.department_id =  #{depId,jdbcType=VARCHAR}
     </if>
@@ -1076,16 +1078,18 @@
   <select id="selectAdminCustomerCount" parameterType="java.lang.String" resultType="java.lang.Integer">
   select count(*) from admin a 
 	left join (select aid,count(aid) as userCount from user where aid is not null  
-	and  share_type=0 and source !=0
+	and  share_type=0 and source !=0 and type=1
 	group by aid) b on a.id=b.aid
 	left join (select aid,count(aid) as timeCount from user where aid is not null  
-	and  share_type=0 and source !=0
+	and  share_type=0 and source !=0 and type=1
 	 <if test="startTime != null and endTime != null"> 
     and  create_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
     </if>
 	group by aid) c on a.id=c.aid
-	where a.status='正常'
-	and b.userCount !=0
+	left join user_role e on a.id=e.uid
+	left join `role` f on e.rid=f.id
+	where f.role_name in ('营销员','营销经理')	
+	and  a.status='正常'
 	<if test="depId != null"> 
     and a.department_id =  #{depId,jdbcType=VARCHAR}
     </if>
@@ -1102,6 +1106,7 @@
 	and a.aid=  #{aid,jdbcType=VARCHAR}
     </if>
 	and  a.share_type=0 
+	and a.type=1
 	<if test="startTime != null and endTime != null">
 	 and  a.create_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR} 
     </if>
@@ -1119,6 +1124,7 @@
 	and a.aid=  #{aid,jdbcType=VARCHAR}
     </if>
 	and  a.share_type=0 
+	and a.type=1
 	<if test="startTime != null and endTime != null">
 	 and  a.create_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR} 
     </if>

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

@@ -879,12 +879,7 @@
   	and o.create_time between #{a,jdbcType=VARCHAR} and #{b,jdbcType=VARCHAR}
   	</if>
 )oo
-  	<if test="ob == 1">
-  	order by oo.createTime desc
-  	</if>
-  	<if test="ob == 2">
-  	order by oo.liquidation_status,oo.createTime desc
-  	</if>
+  	order by oo.processStatus,oo.createTime desc
 	<if test="page_sql != null">
 		${page_sql}
 	</if>
@@ -1050,9 +1045,7 @@
   		<if test='o.liquidationStatus != null and o.liquidationStatus != ""'>
 	  	and o.liquidation_status = #{o.liquidationStatus,jdbcType=INTEGER}
 	  	</if>
-  		<if test='o.liquidationStatus == null or o.liquidationStatus == ""'>
-	  	and o.liquidation_status &lt; 2
-	  	</if>
+  		
   		<if test='o.orderNo != null and o.orderNo != ""'>
 	  	and o.order_no = #{o.orderNo,jdbcType=VARCHAR}
 	  	</if>
@@ -1095,9 +1088,6 @@
 	  	<if test='o.liquidationStatus != null and o.liquidationStatus != ""'>
 	  	and o.liquidation_status = #{o.liquidationStatus,jdbcType=VARCHAR}
 	  	</if>
-  		<if test='o.liquidationStatus == null or o.liquidationStatus == ""'>
-	  	and o.liquidation_status &lt; 2
-	  	</if>
   		<if test='o.orderNo != null and o.orderNo != ""'>
 	  	and o.order_no = #{o.orderNo,jdbcType=VARCHAR}
 	  	</if>

+ 1 - 1
src/main/java/com/goafanti/order/controller/FundManagerOrderApiController.java

@@ -54,7 +54,7 @@ public class FundManagerOrderApiController extends CertifyApiController {
 		//判断当前登录的角色是不是财务管理员
 		
 		//order.setProcessStatus(2);//订单状态为2   改为前端传
-		res.setData(fundManageOrderServiceImpl.allUnassignedOrder(order, pageNo, pageSize,1));
+		res.setData(fundManageOrderServiceImpl.allUnassignedOrder(order, pageNo, pageSize));
 		return res;
 	}
 	

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

@@ -18,7 +18,7 @@ public interface FundManageOrderService {
 	 * @param PageSize
 	 * @return
 	 */
-	Pagination<OrderListBo> allUnassignedOrder(OrderListBo order,Integer pageNo,Integer pageSize,Integer ob);
+	Pagination<OrderListBo> allUnassignedOrder(OrderListBo order,Integer pageNo,Integer pageSize);
 	/**
 	 * 财务专员查看分配给自己的订单
 	 * @param order

+ 17 - 18
src/main/java/com/goafanti/order/service/impl/FundManagerOrderServiceImpl.java

@@ -80,11 +80,11 @@ public class FundManagerOrderServiceImpl extends BaseMybatisDao<TOrderNewMapper>
 	@SuppressWarnings("unchecked")
 	@Override
 	public Pagination<OrderListBo> allUnassignedOrder(OrderListBo order, Integer pageNo,
-			Integer pageSize,Integer ob) {
+			Integer pageSize) {
 		
 		Map<String, Object> params = new HashMap<String, Object>();
 		params.put("o", order);
-		params.put("ob", ob);
+		
 		Pagination<OrderListBo> data = (Pagination<OrderListBo>)findPage("getAllUnassignedListOrder", "getAllUnassignedCountOrder", params, pageNo, pageSize);
 		return data;
 	}
@@ -209,21 +209,22 @@ public class FundManagerOrderServiceImpl extends BaseMybatisDao<TOrderNewMapper>
 			//发放给技术员如果付完款所有参与这个项目任务的人都会有结算奖
 			//获得所有的任务负责人
 			List<TOrderTask> l = taskMapper.getReceiverByOid(billNew.getOrderNo());
-			if(null == l || l.size() == 0){
-				return -3;//没有给将任务分给咨询师(技术员)
-			}
+//			取消没有技术员不能支付全款
+//			if(null == l || l.size() == 0){
+//				return -3;//没有给将任务分给咨询师(技术员)
+//			}
 			for (TOrderTask tOrderTask : l) {
-				if(null == tOrderTask ||null == tOrderTask.getTaskReceiver()){
-					return -3;
-				}
-				bonus.setTaskId(tOrderTask.getId());//任务id
-				bonus.setGrantTarget(tOrderTask.getTaskReceiver());
-				bonus.setGrantType(1);
-				int c = bonusMapper.checkByOnoAndSub(bonus);
-				//不存在就设置
-				if(c==0){
-					bonus.setId(UUID.randomUUID().toString());
-					bonusMapper.insertSelective(bonus);
+				if(null != tOrderTask &&null != tOrderTask.getTaskReceiver()){
+					bonus.setTaskId(tOrderTask.getId());//任务id
+					bonus.setGrantTarget(tOrderTask.getTaskReceiver());
+					bonus.setGrantType(1);
+					int c = bonusMapper.checkByOnoAndSub(bonus);
+					//不存在就设置
+					if(c==0){
+						bonus.setId(UUID.randomUUID().toString());
+						bonusMapper.insertSelective(bonus);
+					}
+					
 				}
 				
 			}
@@ -246,10 +247,8 @@ public class FundManagerOrderServiceImpl extends BaseMybatisDao<TOrderNewMapper>
 		}
 		//否则新增流水信息
 		billNew.setBillNo(UUID.randomUUID().toString().replaceAll("-", ""));
-		//System.out.println("*****************"+billNew.getBillNo());
 		billNew.setCreater(TokenManager.getAdminId());
 		int result = billNewMapper.insertSelective(billNew);
-		
 		//修改订单结算金额和结算状态
 		//如果已经首付并且流程状态是没有派给咨询师的修改流程状态为4
 		TOrderNew orderNew = new TOrderNew();

+ 38 - 4
src/main/java/com/goafanti/order/service/impl/OrderProjectServiceImpl.java

@@ -1,6 +1,7 @@
 package com.goafanti.order.service.impl;
 
 import java.lang.reflect.InvocationTargetException;
+import java.math.BigDecimal;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
@@ -39,6 +40,7 @@ import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.order.bo.TOrderTaskBo;
 import com.goafanti.order.bo.TOrderTaskDetailBo;
 import com.goafanti.order.bo.TOrderTaskListBo;
+import com.goafanti.order.enums.BonusSubject;
 import com.goafanti.order.enums.ProcessStatus;
 import com.goafanti.order.enums.ProjectNewStage;
 import com.goafanti.order.service.OrderProjectService;
@@ -167,6 +169,8 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 			contactBook.setMobile(t.getContactMobile());
 			organizationContactBookMapper.insertSelective(contactBook);
 		}
+		//新增结算奖金信息
+		checkSettlementAward(tn,task);
 		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
 		try {
 			if(StringUtils.isNotBlank(t.getStartDate()))task.setTaskStartTime(sdf.parse(t.getStartDate()));
@@ -193,15 +197,45 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 		return 1;
 	}
 
+	private void checkSettlementAward(TOrderNew tn,TOrderTask task) {
+		if(task.getTaskStatus()==TaskState.COMPLETE.getCode()&&tn.getTotalAmount().compareTo(tn.getSettlementAmount())==0) {
+			List<TOrderTask> l = tOrderTaskMapper.getReceiverByOid(tn.getOrderNo());
+//					取消没有技术员不能支付全款
+//					if(null == l || l.size() == 0){
+//						return -3;//没有给将任务分给咨询师(技术员)
+//					}
+			for (TOrderTask tOrderTask : l) {
+				if(null != tOrderTask &&null != tOrderTask.getTaskReceiver()){
+					TOrderBonus bonus = new TOrderBonus();
+					bonus.setId(UUID.randomUUID().toString());
+					bonus.setOrderNo(tn.getOrderNo());
+					bonus.setGrantBy(tn.getFinanceId());
+					bonus.setBonusSubject(BonusSubject.WK.getCode());//12
+					bonus.setTaskId(tOrderTask.getId());//任务id
+					bonus.setGrantTarget(tOrderTask.getTaskReceiver());
+					bonus.setGrantType(1);
+					int c = tOrderBonusMapper.checkByOnoAndSub(bonus);
+					//不存在就设置
+					if(c==0){
+						bonus.setId(UUID.randomUUID().toString());
+						tOrderBonusMapper.insertSelective(bonus);
+					}
+					
+				}
+				
+			}
+		}
+	}
+
 	private void meanwhileUpdateOrder(TOrderTask task) {
-		if (task.getMain()==1) {//是否是主要项目
+//		if (task.getMain()==1) {//是否是主要项目 更改为不管是不是主项目都会有奖金信息
 			//更改订单项目状态
 			TOrderNew tNew=new TOrderNew();
 			tNew.setProjectStatus(task.getProjectStatus());
 			tNew.setOrderNo(task.getOrderNo());
 			tOrderNewMapper.updateByPrimaryKeySelective(tNew);
-			//新增奖金信息
-			System.out.println(task.getProjectStatus());
+			
+			
 			if (task.getProjectStatus()==ProjectNewStage.YTJ.getCode()||task.getProjectStatus()==ProjectNewStage.LS.getCode()||
 					task.getProjectStatus()==ProjectNewStage.GS.getCode()) {
 				TOrderBonus tb=new TOrderBonus();
@@ -222,7 +256,7 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 				}
 				
 			}
-		}
+		
 	}
 
 	@Override

+ 1 - 1
src/main/resources/props/config_local.properties

@@ -60,7 +60,7 @@ template.cacheable=false
 portal.host=//sf.jishutao.com/portal/2.0.6
 avatar.upload.host=//sb.jishutao.com/upload
 #连接开发
-static.host=//sb.jishutao.com/1.0.50
+static.host=//sb.jishutao.com/1.0.95
 avatar.host=//sb.jishutao.com
 
 #连生产

+ 1 - 1
src/main/resources/props/config_test.properties

@@ -54,7 +54,7 @@ session.validate.timespan=18000000
 app.name=AFT
 template.cacheable=false
 
-static.host=//static.kedexinxi.com/1.0.51
+static.host=//static.kedexinxi.com/1.0.52
 portal.host=//static.kedexinxi.com/portal/2.0.6
 avatar.host=//static.kedexinxi.com
 avatar.upload.host=//static.kedexinxi.com/upload