anderx лет назад: 3
Родитель
Сommit
33acf214d4

+ 32 - 26
src/main/java/com/goafanti/common/mapper/TOrderBonusMapper.xml

@@ -92,7 +92,7 @@
       This element is automatically generated by MyBatis Generator, do not modify.
       This element was generated on Tue Nov 27 11:15:28 CST 2018.
     -->
-    id, create_time, order_no, bonus_subject, grant_status, grant_target, grant_by, grant_time, 
+    id, create_time, order_no, bonus_subject, grant_status, grant_target, grant_by, grant_time,
     grant_type, task_id
   </sql>
   <select id="selectByExample" parameterType="com.goafanti.common.model.TOrderBonusExample" resultMap="BaseResultMap">
@@ -120,7 +120,7 @@
       This element is automatically generated by MyBatis Generator, do not modify.
       This element was generated on Tue Nov 27 11:15:28 CST 2018.
     -->
-    select 
+    select
     <include refid="Base_Column_List" />
     from t_order_bonus
     where id = #{id,jdbcType=VARCHAR}
@@ -151,12 +151,12 @@
       This element is automatically generated by MyBatis Generator, do not modify.
       This element was generated on Tue Nov 27 11:15:28 CST 2018.
     -->
-    insert into t_order_bonus (id, create_time, order_no, 
-      bonus_subject, grant_status, grant_target, 
+    insert into t_order_bonus (id, create_time, order_no,
+      bonus_subject, grant_status, grant_target,
       grant_by, grant_time, grant_type, task_id
       )
-    values (#{id,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{orderNo,jdbcType=VARCHAR}, 
-      #{bonusSubject,jdbcType=INTEGER}, #{grantStatus,jdbcType=INTEGER}, #{grantTarget,jdbcType=VARCHAR}, 
+    values (#{id,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{orderNo,jdbcType=VARCHAR},
+      #{bonusSubject,jdbcType=INTEGER}, #{grantStatus,jdbcType=INTEGER}, #{grantTarget,jdbcType=VARCHAR},
       #{grantBy,jdbcType=VARCHAR}, #{grantTime,jdbcType=DATE}, #{grantType,jdbcType=INTEGER}, #{taskId,jdbcType=INTEGER}
       )
   </insert>
@@ -365,7 +365,7 @@
   </update>
   <!-- 财务专员统计技术员的奖金 -->
   <select id="technicianBonusList" parameterType="Map" resultType="com.goafanti.order.bo.TOrderBonusBo">
-   select b.id, t.id as tid, b.order_no as orderNo, t.task_receiver as taskReceiver, t.task_status as taskStatus,  
+   select b.id, t.id as tid, b.order_no as orderNo, t.task_receiver as taskReceiver, t.task_status as taskStatus,
   		t.commodity_quantity as commodityQuantity, t.project_status as projectStatus, t.commodity_name as commodityName,
   		accept_time as acceptTime, review_time as reviewTime, licence_time as licenceTime,
   		o.liquidation_status as liquidationStatus, ga.name as byName,
@@ -374,9 +374,9 @@
   		from t_order_bonus b
   		left join t_order_task t on b.task_id = t.id
   		left join t_order_new o on o.order_no = t.order_no
-  		left join admin a on a.id = t.task_receiver 
+  		left join admin a on a.id = t.task_receiver
   		left join admin oa on oa.id = o.salesman_id
-  		left join admin ga on ga.id = b.grant_by 
+  		left join admin ga on ga.id = b.grant_by
   		where  b.grant_type = 1
   		<if test="fids != null and fids.size > 0">
   		and b.grant_by in
@@ -411,7 +411,7 @@
   		<bind name="e1" value="b.endTime1 +' 23:59:59'"/>
   		and b.create_time between #{a1,jdbcType=VARCHAR} and #{e1,jdbcType=VARCHAR}
   		</if>
-  		order by b.grant_status ,b.create_time 
+  		order by b.grant_status ,b.create_time
   		<if test="page_sql != null">
 			${page_sql}
 		</if>
@@ -421,7 +421,7 @@
   from t_order_bonus b
   		left join t_order_task t on b.task_id = t.id
   		left join t_order_new o on o.order_no = t.order_no
-  		left join admin a on a.id = t.task_receiver 
+  		left join admin a on a.id = t.task_receiver
   		left join admin oa on oa.id = o.salesman_id
   		where b.grant_type = 1
   		<if test="fids != null">
@@ -447,7 +447,7 @@
   		<if test='b.orderNo != null and b.orderNo !=""'>
 		and b.order_no = #{b.orderNo,jdbcType=VARCHAR}
 		</if>
-		
+
   		<if test='b.startTime != null and b.startTime != "" and b.endTime != null and b.endTime != ""'>
   		<bind name="a" value="b.startTime +'-01'"/>
   		<bind name="e" value="b.endTime +'-31'"/>
@@ -462,7 +462,7 @@
   <!-- 财务专员统计营销员奖金 -->
   <select id="saleBonusList" parameterType="Map" resultType="com.goafanti.order.bo.TOrderBonusBo">
   select b.id, o.order_no as orderNo, o.salesman_id as salesmanId, o.sign_time as signTime,
-	o.buyer_id as buyerId, u.nickname as buyName, o.total_amount as totalAmount, 
+	o.buyer_id as buyerId, u.nickname as buyName, o.total_amount as totalAmount,
 	o.first_amount as firstAmount, o.settlement_amount as settlementAmount, o.refund_amount as refundAmount,
 	o.order_status as orderStatus, o.project_status as projectStatus, b.bonus_subject as bonusSubject,
 	o.proof_count as proofCount, b.grant_status as grantStatus, a.name as salesName, o.proof_status as proofStatus,
@@ -486,8 +486,11 @@
 	<bind name="sn" value="'%' + b.salesName + '%'" />
 	and a.name like #{sn,jdbcType=VARCHAR}
 	</if>
-	<if test='b.departmentId != null and b.departmentId !=""'>
-	and a.department_id = #{b.departmentId,jdbcType=VARCHAR}
+	<if test='deps !=null'>
+	and a.department_id in
+        <foreach close=")" collection="deps" item="depId" open="(" separator=",">
+            #{depId}
+        </foreach>
 	</if>
 	<if test="b.grantStatus != null">
 	and b.grant_status = #{b.grantStatus,jdbcType=INTEGER}
@@ -512,7 +515,7 @@
   </select>
   <select id="saleBonusCount" parameterType="Map" resultType="java.lang.Integer">
   select count(*)
-	
+
 	from t_order_bonus b
 	left join t_order_new o on o.order_no = b.order_no
 	left join admin a on o.salesman_id = a.id
@@ -525,9 +528,12 @@
 	<bind name="sn" value="'%' + b.salesName + '%'" />
 	and a.name like #{sn,jdbcType=VARCHAR}
 	</if>
-	<if test='b.departmentId != null and b.departmentId !=""'>
-	and a.department_id = #{b.departmentId,jdbcType=VARCHAR}
-	</if>
+      <if test='deps !=null'>
+          and a.department_id in
+          <foreach close=")" collection="deps" item="depId" open="(" separator=",">
+              #{depId}
+          </foreach>
+      </if>
 	<if test="b.grantStatus != null">
 	and b.grant_status = #{b.grantStatus,jdbcType=INTEGER}
 	</if>
@@ -581,7 +587,7 @@
   </select>
   <!-- 获得及技术员奖金数据 -->
   <select id="getBonusData" parameterType="com.goafanti.order.bo.TOrderBonusBo" resultType="com.goafanti.order.bo.TOrderBonusBo">
-  select b.id, t.id as tid, b.order_no as orderNo, t.task_receiver as taskReceiver, t.task_status as taskStatus,  
+  select b.id, t.id as tid, b.order_no as orderNo, t.task_receiver as taskReceiver, t.task_status as taskStatus,
   		t.commodity_quantity as commodityQuantity, t.project_status as projectStatus, t.commodity_name as commodityName,
   		accept_time as acceptTime, review_time as reviewTime, licence_time as licenceTime,
   		o.liquidation_status as liquidationStatus, ga.name as byName,
@@ -590,9 +596,9 @@
   		from t_order_bonus b
   		left join t_order_task t on b.task_id = t.id
   		left join t_order_new o on o.order_no = t.order_no
-  		left join admin a on a.id = t.task_receiver 
+  		left join admin a on a.id = t.task_receiver
   		left join admin oa on oa.id = o.salesman_id
-  		left join admin ga on ga.id = b.grant_by 
+  		left join admin ga on ga.id = b.grant_by
   		where b.grant_type = 1
   		<if test="grantBy != null">
   		and b.grant_by = #{grantBy,jdbcType=VARCHAR}
@@ -626,7 +632,7 @@
   <!-- 查看营销员的奖金数据 -->
   <select id="getSaleBounsList" parameterType="com.goafanti.order.bo.TOrderBonusBo" resultType="com.goafanti.order.bo.TOrderBonusBo">
   select b.id, o.order_no as orderNo, o.salesman_id as salesmanId, o.sign_time as signTime,
-	o.buyer_id as buyerId, u.nickname as buyName, o.total_amount as totalAmount, 
+	o.buyer_id as buyerId, u.nickname as buyName, o.total_amount as totalAmount,
 	o.first_amount as firstAmount, o.settlement_amount as settlementAmount, o.refund_amount as refundAmount,
 	o.order_status as orderStatus, o.project_status as projectStatus, b.bonus_subject as bonusSubject,
 	o.proof_count as proofCount, b.grant_status as grantStatus, a.name as salesName
@@ -662,7 +668,7 @@
   </select>
   <!-- 根据订单编号和科目和奖金发放人检查这个奖金是否存在 -->
   <select id="checkByOnoAndSub" parameterType="com.goafanti.common.model.TOrderBonus" resultType="java.lang.Integer">
-  	select count(*) from t_order_bonus where order_no = #{orderNo,jdbcType=VARCHAR} and bonus_subject = #{bonusSubject,jdbcType=INTEGER} 
+  	select count(*) from t_order_bonus where order_no = #{orderNo,jdbcType=VARCHAR} and bonus_subject = #{bonusSubject,jdbcType=INTEGER}
   	and grant_target = #{grantTarget,jdbcType=VARCHAR} and grant_type = #{grantType,jdbcType=INTEGER}
   	<if test="taskId != null">
   	and task_id = #{taskId,jdbcType=INTEGER}
@@ -672,8 +678,8 @@
   <select id="checkNoPay" parameterType="com.goafanti.order.bo.TOrderBonusBo" resultType="java.lang.Integer">
   	select bonus_subject from t_order_bonus
 	where id = #{id,jdbcType=VARCHAR} and bonus_subject > (
-	select min(bonus_subject) from t_order_bonus 
+	select min(bonus_subject) from t_order_bonus
 	where order_no = #{orderNo,jdbcType=VARCHAR} and grant_status = 0 and grant_type = 0)
   </select>
-  
+
 </mapper>

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

@@ -1049,13 +1049,7 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
   	<if test="amountStatus == 4">
   	and a.total_amount  &gt; 40
   	</if>
-  	<if test="deps != null">
-      and a.order_dep in
-      <foreach close=")" collection="deps" item="deps" open="(" separator=",">
-        #{deps.id}
-      </foreach>
-  	</if>
-    <if test="starTime !=null and endTime !=null">
+  	<if test="starTime !=null and endTime !=null">
       and a.create_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
     </if>
     <if test="contractStart !=null and contractEnd !=null">
@@ -1201,12 +1195,6 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
   	<if test="amountStatus == 4">
   	and a.total_amount  &gt; 40
   	</if>
-  	<if test="deps != null">
-      and a.order_dep in
-      <foreach close=")" collection="deps" item="deps" open="(" separator=",">
-        #{deps.id}
-      </foreach>
-  	</if>
   	<if test="starTime !=null and endTime !=null">
   	and a.create_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
   	</if>

+ 29 - 29
src/main/java/com/goafanti/order/bo/TOrderBonusBo.java

@@ -5,48 +5,48 @@ import java.math.BigDecimal;
 import com.goafanti.common.model.TOrderBonus;
 
 public class TOrderBonusBo extends TOrderBonus{
-	
+
 	private String targetName; //发放目标(可以是技术员和营销员)
-	
+
 	private String byName; //发放人
-	
+
 	private String salesName;//订单负责人
-	
+
 	private String commodityName;
-	
+
 	private Integer tid; //任务数量
-	
+
 	private Integer commodityQuantity; //任务数量
-	
+
 	private BigDecimal commodityPrice; //价格
-	
+
 	private Integer taskStatus; //任务状态
-	
+
 	private Integer liquidationStatus; //订单结算状态
-	
+
 	private String taskAllocator; //任务分配人
-	
+
 	private String taskReceiver; //任务负责人
-	
+
 	private Integer projectStatus; //项目状态
-	
+
 	private String acceptTime; //受理时间
-	
+
 	private String reviewTime; //评审日期
-	
+
 	private String publicityTime; //公示日期
-	
+
 	private String licenceTime; // 发证日期
-	
+
 	private String signTime; // 签单日期
-	
-	private String departmentId; // 部门id
+
+	private String deps; // 部门id
 	private String departmentName; // 部门名称
 	private String startTime;
 	private String endTime;
 	private String startTime1;
 	private String endTime1;
-	
+
 	private String buyId;
 	private String saleId;
 	private String buyName;
@@ -54,17 +54,17 @@ public class TOrderBonusBo extends TOrderBonus{
 	private BigDecimal firstAmount; //首付
 	private BigDecimal settlementAmount; //已收
 	private BigDecimal refundAmount; //已付
-	
+
 	private Integer orderStatus; //订单状态
 	private Float proofCount; //校对量
 	private Integer proofStatus; //校对状态
-	
-	
+
+
 	private String kejim;
 	private String renzm;
 	private String kejiy;
 	private String renzy;
-	
+
 	private Integer main;
 
 	public String getTargetName() {
@@ -219,12 +219,12 @@ public class TOrderBonusBo extends TOrderBonus{
 		this.salesName = salesName;
 	}
 
-	public String getDepartmentId() {
-		return departmentId;
+	public String getDeps() {
+		return deps;
 	}
 
-	public void setDepartmentId(String departmentId) {
-		this.departmentId = departmentId;
+	public void setDeps(String deps) {
+		this.deps = deps;
 	}
 
 	public String getSignTime() {
@@ -370,5 +370,5 @@ public class TOrderBonusBo extends TOrderBonus{
 	public void setEndTime1(String endTime1) {
 		this.endTime1 = endTime1;
 	}
-	
+
 }

+ 19 - 13
src/main/java/com/goafanti/order/service/impl/OrderBonusServiceImpl.java

@@ -8,6 +8,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 
+import com.goafanti.admin.service.DepartmentService;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -31,7 +32,7 @@ import com.goafanti.order.service.OrderBonusService;
 
 @Service
 public class OrderBonusServiceImpl extends BaseMybatisDao<TOrderBonusMapper> implements OrderBonusService {
-	
+
 	@Autowired
 	private TOrderBonusMapper bonusMapper;
 	@Autowired
@@ -40,7 +41,9 @@ public class OrderBonusServiceImpl extends BaseMybatisDao<TOrderBonusMapper> imp
 	private AdminMapper	adminMapper;
 	@Autowired
 	private TOrderMonthReportMapper orderMonthReportMapper;
-	
+	@Autowired
+	private DepartmentService departmentService;
+
 	@Override
 	public Integer addOrderBouns(TOrderBonus bonus) {
 		// 生成id
@@ -78,27 +81,30 @@ public class OrderBonusServiceImpl extends BaseMybatisDao<TOrderBonusMapper> imp
 		return data;
 	}
 
-	
-	
+
+
 	@SuppressWarnings("unchecked")
 	@Override
 	public Pagination<TOrderBonusBo> saleBonusStatistics(TOrderBonusBo newBo, Integer pageNo, Integer pageSize) {
 		Map<String, Object> params = new HashMap<String, Object>();
-		
+
 		List<String> fids=new ArrayList<>();
 		if (TokenManager.hasRole(AFTConstants.FINANCE)) {
 			newBo.setGrantBy(TokenManager.getAdminId());
 		}else if (TokenManager.hasRole(AFTConstants.FINANCE_MANAGER)) {
 			fids=adminMapper.selectBySuperId(TokenManager.getAdminId());
 		}
+		if (newBo.getDeps()!=null){
+			params.put("deps", departmentService.parseArray(newBo.getDeps()));
+		}
 		params.put("fids", fids);
 		params.put("b", newBo);
 		Pagination<TOrderBonusBo> data = (Pagination<TOrderBonusBo>)findPage("saleBonusList", "saleBonusCount", params, pageNo, pageSize);
-		
+
 		innerData((List<TOrderBonusBo>) data.getList(), newBo);
 		return data;
 	}
-	
+
 	private void innerData(List<TOrderBonusBo> list, TOrderBonusBo newBo){
 		Integer m = null;
 		Integer m1 = null;
@@ -131,7 +137,7 @@ public class OrderBonusServiceImpl extends BaseMybatisDao<TOrderBonusMapper> imp
 					orderListBo.setRenzm(o.getRenzm());
 				}
 			}
-			
+
 			r.setMonth(y);
 			r.setMonth1(y1);
 			//处理年度数据
@@ -157,7 +163,7 @@ public class OrderBonusServiceImpl extends BaseMybatisDao<TOrderBonusMapper> imp
 	@Override
 	public XSSFWorkbook exportTechnicianBonusData(TOrderBonusBo bonusBo) {
 		// 判断导出是否有部门
-		String deptid = bonusBo.getDepartmentId();
+		String deptid = bonusBo.getDeps();
 		Map<String, List<TOrderBonusBo>> map = new HashMap<String, List<TOrderBonusBo>>();
 		if(StringUtils.isBlank(deptid)){
 			//获得所有有数据的部门
@@ -168,8 +174,8 @@ public class OrderBonusServiceImpl extends BaseMybatisDao<TOrderBonusMapper> imp
 			}
 			for (int i = 0; i < dlist.size(); i++) {
 				TOrderBonusBo ob = dlist.get(i);
-				if(null != ob && null!= ob.getDepartmentId()){
-					bonusBo.setDepartmentId(ob.getDepartmentId());
+				if(null != ob && null!= ob.getDeps()){
+//					bonusBo.setDepartmentId(ob.getDepartmentId());
 					map.put(ob.getDepartmentName(), bonusMapper.getBonusData(bonusBo));
 				}
 			}
@@ -183,7 +189,7 @@ public class OrderBonusServiceImpl extends BaseMybatisDao<TOrderBonusMapper> imp
 
 	@Override
 	public XSSFWorkbook exportSaleBonusData(TOrderBonusBo bonusBo) {
-		String deptid = bonusBo.getDepartmentId();
+		String deptid = bonusBo.getDeps();
 		Map<String, List<TOrderBonusBo>> map = new HashMap<String, List<TOrderBonusBo>>();
 		if(StringUtils.isBlank(deptid)){
 			//获得所有有数据的部门
@@ -194,7 +200,7 @@ public class OrderBonusServiceImpl extends BaseMybatisDao<TOrderBonusMapper> imp
 			}
 			for (int i = 0; i < dlist.size(); i++) {
 				TOrderBonusBo ob = dlist.get(i);
-				bonusBo.setDepartmentId(ob.getDepartmentId());
+//				bonusBo.setDepartmentId(ob.getDepartmentId());
 				List<TOrderBonusBo> l =  bonusMapper.getSaleBounsList(bonusBo);
 				innerData(l, bonusBo);
 				map.put(ob.getDepartmentName(), l);