Merge branch 'xzj' of gitee.com:darlk/ShengTangManage into develop
This commit is contained in:
		| @@ -1,5 +1,6 @@ | ||||
| package com.stdiet.custom.domain; | ||||
|  | ||||
| import lombok.Data; | ||||
| import org.apache.commons.lang3.builder.ToStringBuilder; | ||||
| import org.apache.commons.lang3.builder.ToStringStyle; | ||||
| import com.stdiet.common.annotation.Excel; | ||||
| @@ -13,6 +14,7 @@ import java.math.BigDecimal; | ||||
|  * @author wonder | ||||
|  * @date 2020-09-24 | ||||
|  */ | ||||
| @Data | ||||
| public class SysCommision extends BaseEntity { | ||||
|     private static final long serialVersionUID = 1L; | ||||
|  | ||||
| @@ -58,86 +60,6 @@ public class SysCommision extends BaseEntity { | ||||
|     @Excel(name = "提成", scale = 2) | ||||
|     private BigDecimal commision; | ||||
|  | ||||
|     public BigDecimal getCommision() { | ||||
|         return commision; | ||||
|     } | ||||
|  | ||||
|     public void setCommision(BigDecimal commision) { | ||||
|         this.commision = commision; | ||||
|     } | ||||
|  | ||||
|     public Long getPostId() { | ||||
|         return postId; | ||||
|     } | ||||
|  | ||||
|     public void setPostId(Long postId) { | ||||
|         this.postId = postId; | ||||
|     } | ||||
|  | ||||
|     public void setPostName(String postName) { | ||||
|         this.postName = postName; | ||||
|     } | ||||
|  | ||||
|     public String getPostName() { | ||||
|         return postName; | ||||
|     } | ||||
|  | ||||
|     public void setRuleId(Long ruleId) { | ||||
|         this.ruleId = ruleId; | ||||
|     } | ||||
|  | ||||
|     public Long getRuleId() { | ||||
|         return ruleId; | ||||
|     } | ||||
|  | ||||
|     public void setUserId(Long userId) { | ||||
|         this.userId = userId; | ||||
|     } | ||||
|  | ||||
|     public Long getUserId() { | ||||
|         return userId; | ||||
|     } | ||||
|  | ||||
|     public void setUserName(String userName) { | ||||
|         this.userName = userName; | ||||
|     } | ||||
|  | ||||
|     public String getUserName() { | ||||
|         return userName; | ||||
|     } | ||||
|  | ||||
|     public void setAmount(BigDecimal amount) { | ||||
|         this.amount = amount; | ||||
|     } | ||||
|  | ||||
|     public BigDecimal getAmount() { | ||||
|         return amount; | ||||
|     } | ||||
|  | ||||
|     public void setRate(Float rate) { | ||||
|         this.rate = rate; | ||||
|     } | ||||
|  | ||||
|     public Float getRate() { | ||||
|         return rate; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public String toString() { | ||||
|         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) | ||||
|                 .append("ruleId", getRuleId()) | ||||
|                 .append("userId", getUserId()) | ||||
|                 .append("userName", getUserName()) | ||||
|                 .append("postId", getPostId()) | ||||
|                 .append("postName", getPostName()) | ||||
|                 .append("amount", getAmount()) | ||||
|                 .append("commision", getCommision()) | ||||
|                 .append("rate", getRate()) | ||||
|                 .append("createBy", getCreateBy()) | ||||
|                 .append("createTime", getCreateTime()) | ||||
|                 .append("updateBy", getUpdateBy()) | ||||
|                 .append("updateTime", getUpdateTime()) | ||||
|                 .append("remark", getRemark()) | ||||
|                 .toString(); | ||||
|     } | ||||
|     //订单审核状态 | ||||
|     private String reviewStatus; | ||||
| } | ||||
|   | ||||
| @@ -4,6 +4,7 @@ import java.math.BigDecimal; | ||||
| import java.util.Date; | ||||
| import java.util.List; | ||||
|  | ||||
| import com.alibaba.fastjson.JSONArray; | ||||
| import com.fasterxml.jackson.annotation.JsonFormat; | ||||
| import lombok.Data; | ||||
| import com.stdiet.common.annotation.Excel; | ||||
| @@ -269,6 +270,9 @@ public class SysOrder extends BaseEntity { | ||||
|     //拆分比例,如:1,9就是按照比例10%、90%拆分,非持久化字段 | ||||
|     private String nutritionistRate; | ||||
|  | ||||
|     //订单查询时的订单类型二维数组 | ||||
|     private JSONArray searchOrderTypeArray; | ||||
|  | ||||
|  | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,25 @@ | ||||
| package com.stdiet.custom.dto.request; | ||||
|  | ||||
| import lombok.Data; | ||||
|  | ||||
| import java.io.Serializable; | ||||
| import java.util.Date; | ||||
|  | ||||
| @Data | ||||
| public class SysOrderCommision implements Serializable { | ||||
|  | ||||
|     private static final long serialVersionUID = 1L; | ||||
|  | ||||
|     //后台用户ID | ||||
|     private Long userId; | ||||
|  | ||||
|     //岗位ID | ||||
|     private Long postId; | ||||
|  | ||||
|     //订单审核状态 | ||||
|     private String reviewStatus; | ||||
|  | ||||
|     //订单截止结束时间 | ||||
|     private String endTime; | ||||
|  | ||||
| } | ||||
| @@ -2,6 +2,7 @@ package com.stdiet.custom.mapper; | ||||
|  | ||||
| import java.util.List; | ||||
| import com.stdiet.custom.domain.SysCommision; | ||||
| import com.stdiet.custom.dto.request.SysOrderCommision; | ||||
|  | ||||
| /** | ||||
|  * 业务提成比例Mapper接口 | ||||
| @@ -61,5 +62,10 @@ public interface SysCommisionMapper | ||||
|  | ||||
|     public List<SysCommision> selectSysCommisionDetail(SysCommision sysCommision); | ||||
|  | ||||
|     List<SysCommision> selectSysCommisionDayDetail(SysCommision sysCommision); | ||||
|     /** | ||||
|      * 查询售后、营养师用户信息 | ||||
|      * @param sysCommision | ||||
|      * @return | ||||
|      */ | ||||
|     List<SysCommision> getAfterSaleAndNutri(SysCommision sysCommision); | ||||
| } | ||||
|   | ||||
| @@ -6,6 +6,7 @@ import java.util.List; | ||||
| import com.stdiet.custom.domain.SysCommision; | ||||
| import com.stdiet.custom.domain.SysCommissionDayDetail; | ||||
| import com.stdiet.custom.domain.SysOrder; | ||||
| import com.stdiet.custom.dto.request.SysOrderCommision; | ||||
| import org.apache.ibatis.annotations.Param; | ||||
|  | ||||
| /** | ||||
| @@ -72,7 +73,7 @@ public interface SysOrderMapper | ||||
|     public BigDecimal selectAllOrderAmount(SysOrder sysOrder); | ||||
|  | ||||
|     /** | ||||
|      * 获取订单信息 | ||||
|      * 获取订单信息(按天提成计算) | ||||
|      * @return | ||||
|      */ | ||||
|     List<SysOrder> selectSimpleOrderMessage(SysCommision sysCommision); | ||||
|   | ||||
| @@ -62,6 +62,4 @@ public interface ISysCommisionService | ||||
|     public int deleteSysCommisionById(Long ruleId); | ||||
|  | ||||
|     public List<SysCommision> selectSysCommisionDetail(SysCommision sysCommision); | ||||
|  | ||||
|     List<SysCommision> selectSysCommisionDayDetail(SysCommision sysCommision); | ||||
| } | ||||
|   | ||||
| @@ -4,6 +4,7 @@ import com.stdiet.custom.domain.SysCommision; | ||||
| import com.stdiet.custom.domain.SysCommissionDayDetail; | ||||
| import com.stdiet.custom.domain.SysOrder; | ||||
| import com.stdiet.custom.domain.SysOrderCommisionDayDetail; | ||||
| import com.stdiet.custom.dto.request.SysOrderCommision; | ||||
|  | ||||
| import java.time.LocalDate; | ||||
| import java.util.Date; | ||||
|   | ||||
| @@ -98,9 +98,4 @@ public class SysCommisionServiceImpl implements ISysCommisionService | ||||
|     public List<SysCommision> selectSysCommisionDetail(SysCommision sysCommision) { | ||||
|         return sysCommisionMapper.selectSysCommisionDetail(sysCommision); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<SysCommision> selectSysCommisionDayDetail(SysCommision sysCommision){ | ||||
|         return sysCommisionMapper.selectSysCommisionDayDetail(sysCommision); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -3,6 +3,7 @@ package com.stdiet.custom.service.impl; | ||||
| import com.alibaba.fastjson.JSONArray; | ||||
| import com.stdiet.common.utils.DateUtils; | ||||
| import com.stdiet.custom.domain.*; | ||||
| import com.stdiet.custom.dto.request.SysOrderCommision; | ||||
| import com.stdiet.custom.mapper.SysCommisionMapper; | ||||
| import com.stdiet.custom.mapper.SysOrderMapper; | ||||
| import com.stdiet.custom.mapper.SysOrderPauseMapper; | ||||
| @@ -32,7 +33,7 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService { | ||||
|     public List<SysCommissionDayDetail> calculateCommissionByDay(SysCommision sysCommision){ | ||||
|         List<SysCommissionDayDetail> result = new ArrayList<>(); | ||||
|         //查询用户 | ||||
|         List<SysCommision> list = sysCommisionMapper.selectSysCommisionDayDetail(sysCommision); | ||||
|         List<SysCommision> list = sysCommisionMapper.getAfterSaleAndNutri(sysCommision); | ||||
|         //合计 | ||||
|         SysCommissionDayDetail total = new SysCommissionDayDetail(); | ||||
|         total.setTotalCommissionAmount(new BigDecimal(0)); | ||||
|   | ||||
| @@ -10,6 +10,8 @@ public class OrderUtils { | ||||
|  | ||||
|     private static final String[] orderMoneyTypeArray = {"全款单","定金单","尾款单"}; | ||||
|  | ||||
|     private static final String[] orderMainTypeArray = {"主单","副单"}; | ||||
|  | ||||
|     /** | ||||
|      * 根据订单对象获取订单类型名称 | ||||
|      * @param sysOrder | ||||
| @@ -18,8 +20,16 @@ public class OrderUtils { | ||||
|     public static final String getOrderTypeName(SysOrder sysOrder){ | ||||
|         String orderTypeName = ""; | ||||
|         orderTypeName += orderTypeArray[Integer.parseInt(sysOrder.getOrderType())]; | ||||
|         //比例拆分单需要确认出主单副单 | ||||
|         /*if("1".equals(sysOrder.getOrderType())){ | ||||
|             orderTypeName += "("+(sysOrder.getMainOrderId().intValue() == 0 ? orderMainTypeArray[0] : orderMainTypeArray[1])+")"; | ||||
|         }*/ | ||||
|         orderTypeName += "/"+orderCountTypeArray[Integer.parseInt(sysOrder.getOrderCountType())]; | ||||
|         orderTypeName += "/"+orderMoneyTypeArray[Integer.parseInt(sysOrder.getOrderMoneyType())]; | ||||
|         //判断是不是二开提成单 | ||||
|         if("1".equals(sysOrder.getOrderCountType()) && sysOrder.getAfterSaleCommissOrder().intValue() == 1){ | ||||
|             orderTypeName += "/提成单"; | ||||
|         } | ||||
|         return orderTypeName; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -32,7 +32,9 @@ | ||||
|         SELECT ${column} AS user_id, ${postId} AS post_id, SUM(amount) AS amount | ||||
|         FROM sys_order | ||||
|         WHERE ${column} IS NOT NULL AND ${column} <> 0 AND del_flag = 0 | ||||
|         AND review_status = 'yes' | ||||
|         <if test="reviewStatus != null and reviewStatus != ''"> | ||||
|             AND review_status = #{reviewStatus} | ||||
|         </if> | ||||
|         <if test="beginTime != null and beginTime != ''">AND date_format(order_time,'%y%m%d') >= | ||||
|             date_format(${beginTime},'%y%m%d') | ||||
|         </if> | ||||
| @@ -47,6 +49,7 @@ | ||||
|         JOIN ( | ||||
|         <include refid="groupAmountVo"> | ||||
|             <property name="column" value="pre_sale_id"/> | ||||
|             <property name="reviewStatus" value="#{reviewStatus}"/> | ||||
|             <property name="beginTime" value="#{beginTime}"/> | ||||
|             <property name="endTime" value="#{endTime}"/> | ||||
|             <property name="postId" value="5"/> | ||||
| @@ -54,6 +57,7 @@ | ||||
|         UNION | ||||
|         <include refid="groupAmountVo"> | ||||
|             <property name="column" value="after_sale_id"/> | ||||
|             <property name="reviewStatus" value="#{reviewStatus}"/> | ||||
|             <property name="beginTime" value="#{beginTime}"/> | ||||
|             <property name="endTime" value="#{endTime}"/> | ||||
|             <property name="postId" value="6"/> | ||||
| @@ -61,6 +65,7 @@ | ||||
|         UNION | ||||
|         <include refid="groupAmountVo"> | ||||
|             <property name="column" value="nutritionist_id"/> | ||||
|             <property name="reviewStatus" value="#{reviewStatus}"/> | ||||
|             <property name="beginTime" value="#{beginTime}"/> | ||||
|             <property name="endTime" value="#{endTime}"/> | ||||
|             <property name="postId" value="9"/> | ||||
| @@ -68,6 +73,7 @@ | ||||
|         UNION | ||||
|         <include refid="groupAmountVo"> | ||||
|             <property name="column" value="nutri_assis_id"/> | ||||
|             <property name="reviewStatus" value="#{reviewStatus}"/> | ||||
|             <property name="beginTime" value="#{beginTime}"/> | ||||
|             <property name="endTime" value="#{endTime}"/> | ||||
|             <property name="postId" value="10"/> | ||||
| @@ -75,6 +81,7 @@ | ||||
|         UNION | ||||
|         <include refid="groupAmountVo"> | ||||
|             <property name="column" value="operator_id"/> | ||||
|             <property name="reviewStatus" value="#{reviewStatus}"/> | ||||
|             <property name="beginTime" value="#{beginTime}"/> | ||||
|             <property name="endTime" value="#{endTime}"/> | ||||
|             <property name="postId" value="11"/> | ||||
| @@ -82,6 +89,7 @@ | ||||
|         UNION | ||||
|         <include refid="groupAmountVo"> | ||||
|             <property name="column" value="operator_assis_id"/> | ||||
|             <property name="reviewStatus" value="#{reviewStatus}"/> | ||||
|             <property name="beginTime" value="#{beginTime}"/> | ||||
|             <property name="endTime" value="#{endTime}"/> | ||||
|             <property name="postId" value="13"/> | ||||
| @@ -89,6 +97,7 @@ | ||||
|         UNION | ||||
|         <include refid="groupAmountVo"> | ||||
|             <property name="column" value="planner_id"/> | ||||
|             <property name="reviewStatus" value="#{reviewStatus}"/> | ||||
|             <property name="beginTime" value="#{beginTime}"/> | ||||
|             <property name="endTime" value="#{endTime}"/> | ||||
|             <property name="postId" value="7"/> | ||||
| @@ -96,6 +105,7 @@ | ||||
|         UNION | ||||
|         <include refid="groupAmountVo"> | ||||
|             <property name="column" value="planner_assis_id"/> | ||||
|             <property name="reviewStatus" value="#{reviewStatus}"/> | ||||
|             <property name="beginTime" value="#{beginTime}"/> | ||||
|             <property name="endTime" value="#{endTime}"/> | ||||
|             <property name="postId" value="8"/> | ||||
| @@ -188,7 +198,8 @@ | ||||
|         </foreach> | ||||
|     </delete> | ||||
|  | ||||
|     <select id="selectSysCommisionDayDetail" parameterType="SysCommision" resultMap="SysCommisionResult"> | ||||
|     <!-- 查询售后和营养师 --> | ||||
|     <select id="getAfterSaleAndNutri" parameterType="SysCommision" resultMap="SysCommisionResult"> | ||||
|         SELECT su.user_id,su.nick_name as user_name,sp.post_id, sp.post_code,sp.post_name FROM sys_user su | ||||
|         LEFT JOIN sys_user_post sup ON sup.user_id = su.user_id | ||||
|         LEFT JOIN sys_post sp ON sp.post_id = sup.post_id | ||||
|   | ||||
| @@ -103,6 +103,8 @@ | ||||
|                 </if> | ||||
|             </if> | ||||
|             <if test="true">and del_flag = 0</if> | ||||
|             <!-- 计算总额时需要除去二开售后提成单 --> | ||||
|             AND after_sale_commiss_order = 0 | ||||
|         </where> | ||||
|     </select> | ||||
|  | ||||
| @@ -139,6 +141,26 @@ | ||||
|                     and 0 > amount | ||||
|                 </if> | ||||
|             </if> | ||||
|             <if test="searchOrderTypeArray != null"> | ||||
|                 <trim prefix="AND (" suffix=")" suffixOverrides="or"> | ||||
|                 <foreach collection="searchOrderTypeArray"  separator="or" item="typeArray" index="i"> | ||||
|                     ( | ||||
|                     <foreach collection="typeArray" separator="and" item="type" index="j"> | ||||
|                         <if test="j == 0"> | ||||
|                             order_type = #{type} | ||||
|                         </if> | ||||
|                         <if test="j == 1"> | ||||
|                             order_count_type = #{type} | ||||
|                         </if> | ||||
|                         <if test="j == 2"> | ||||
|                             order_money_type = #{type} | ||||
|                         </if> | ||||
|                     </foreach> | ||||
|                     ) | ||||
|                     <!--(order_type = #{typeArray[0]} and order_count_type = #{typeArray[1]} and order_money_type =#{typeArray[2]})--> | ||||
|                 </foreach> | ||||
|                 </trim> | ||||
|             </if> | ||||
|             <if test="true">and o.del_flag = 0</if> | ||||
|         </where> | ||||
|         order by order_time desc | ||||
| @@ -365,7 +387,10 @@ | ||||
|       from sys_order o | ||||
|       left join sys_user su_sale on su_sale.user_id = o.after_sale_id and su_sale.del_flag = 0 | ||||
|       left join sys_user su_nutritionist on su_nutritionist.user_id = o.nutritionist_id and su_nutritionist.del_flag = 0 | ||||
|       where review_status = 'yes' and o.order_time >= '2021-01-01' and o.del_flag = 0 | ||||
|       where o.order_time >= '2021-01-01' and o.del_flag = 0 | ||||
|         <if test="reviewStatus != null and reviewStatus != ''"> | ||||
|             and review_status = #{reviewStatus} | ||||
|         </if> | ||||
|       <if test="userId != null"> | ||||
|           and (su_sale.user_id = #{userId} or su_nutritionist.user_id = #{userId}) | ||||
|       </if> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user