完成提成界面
This commit is contained in:
		| @@ -16,6 +16,16 @@ public class CusUserPost implements Serializable { | ||||
|  | ||||
|     private String postId; | ||||
|  | ||||
|     private String postName; | ||||
|  | ||||
|     public void setPostName(String postName) { | ||||
|         this.postName = postName; | ||||
|     } | ||||
|  | ||||
|     public String getPostName() { | ||||
|         return postName; | ||||
|     } | ||||
|  | ||||
|     public String getPostCode() { | ||||
|         return postCode; | ||||
|     } | ||||
| @@ -55,6 +65,7 @@ public class CusUserPost implements Serializable { | ||||
|                 ", userName='" + userName + '\'' + | ||||
|                 ", postCode='" + postCode + '\'' + | ||||
|                 ", postid='" + postId + '\'' + | ||||
|                 ", postName='" + postName + '\'' + | ||||
|                 '}'; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -9,88 +9,135 @@ import java.math.BigDecimal; | ||||
|  | ||||
| /** | ||||
|  * 业务提成比例对象 sys_commision | ||||
|  *  | ||||
|  * | ||||
|  * @author wonder | ||||
|  * @date 2020-09-24 | ||||
|  */ | ||||
| public class SysCommision extends BaseEntity | ||||
| { | ||||
| public class SysCommision extends BaseEntity { | ||||
|     private static final long serialVersionUID = 1L; | ||||
|  | ||||
|     /** 编号 */ | ||||
|     /** | ||||
|      * 编号 | ||||
|      */ | ||||
|     private Long ruleId; | ||||
|  | ||||
|     /** 业务员 */ | ||||
|     /** | ||||
|      * 业务员 | ||||
|      */ | ||||
|     private Long userId; | ||||
|  | ||||
|     /** 业务员 */ | ||||
|     @Excel(name = "业务员") | ||||
|     private String nickName; | ||||
|     /** | ||||
|      * 职位id | ||||
|      */ | ||||
|     private Long postId; | ||||
|  | ||||
|     /** 金额 */ | ||||
|     /** | ||||
|      * 业务员 | ||||
|      */ | ||||
|     @Excel(name = "业务员") | ||||
|     private String userName; | ||||
|  | ||||
|     @Excel(name = "职位") | ||||
|     private String postName; | ||||
|  | ||||
|     /** | ||||
|      * 金额 | ||||
|      */ | ||||
|     @Excel(name = "金额") | ||||
|     private BigDecimal amount; | ||||
|  | ||||
|     /** 分成比例 */ | ||||
|     @Excel(name = "分成比例") | ||||
|     /** | ||||
|      * 分成比例 | ||||
|      */ | ||||
|     @Excel(name = "比例", suffix = "%") | ||||
|     private Long rate; | ||||
|  | ||||
|     public void setRuleId(Long ruleId)  | ||||
|     { | ||||
|     /** | ||||
|      * 提成 | ||||
|      */ | ||||
|     @Excel(name = "提成") | ||||
|     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()  | ||||
|     { | ||||
|     public Long getRuleId() { | ||||
|         return ruleId; | ||||
|     } | ||||
|     public void setUserId(Long userId)  | ||||
|     { | ||||
|  | ||||
|     public void setUserId(Long userId) { | ||||
|         this.userId = userId; | ||||
|     } | ||||
|  | ||||
|     public Long getUserId()  | ||||
|     { | ||||
|     public Long getUserId() { | ||||
|         return userId; | ||||
|     } | ||||
|     public void setNickName(String nickName)  | ||||
|     { | ||||
|         this.nickName = nickName; | ||||
|  | ||||
|     public void setUserName(String userName) { | ||||
|         this.userName = userName; | ||||
|     } | ||||
|  | ||||
|     public String getNickName()  | ||||
|     { | ||||
|         return nickName; | ||||
|     public String getUserName() { | ||||
|         return userName; | ||||
|     } | ||||
|     public void setAmount(BigDecimal amount) { this.amount = amount; } | ||||
|  | ||||
|     public BigDecimal getAmount() | ||||
|     { | ||||
|     public void setAmount(BigDecimal amount) { | ||||
|         this.amount = amount; | ||||
|     } | ||||
|  | ||||
|     public BigDecimal getAmount() { | ||||
|         return amount; | ||||
|     } | ||||
|     public void setRate(Long rate)  | ||||
|     { | ||||
|  | ||||
|     public void setRate(Long rate) { | ||||
|         this.rate = rate; | ||||
|     } | ||||
|  | ||||
|     public Long getRate()  | ||||
|     { | ||||
|     public Long getRate() { | ||||
|         return rate; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public String toString() { | ||||
|         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | ||||
|             .append("ruleId", getRuleId()) | ||||
|             .append("userId", getUserId()) | ||||
|             .append("nickName", getNickName()) | ||||
|             .append("amount", getAmount()) | ||||
|             .append("rate", getRate()) | ||||
|             .append("createBy", getCreateBy()) | ||||
|             .append("createTime", getCreateTime()) | ||||
|             .append("updateBy", getUpdateBy()) | ||||
|             .append("updateTime", getUpdateTime()) | ||||
|             .append("remark", getRemark()) | ||||
|             .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(); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -58,4 +58,6 @@ public interface SysCommisionMapper | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     public int deleteSysCommisionByIds(Long[] ruleIds); | ||||
|  | ||||
|     public List<SysCommision> selectSysCommisionDetail(SysCommision sysCommision); | ||||
| } | ||||
|   | ||||
| @@ -58,4 +58,6 @@ public interface ISysCommisionService | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     public int deleteSysCommisionById(Long ruleId); | ||||
|  | ||||
|     public List<SysCommision> selectSysCommisionDetail(SysCommision sysCommision); | ||||
| } | ||||
|   | ||||
| @@ -93,4 +93,9 @@ public class SysCommisionServiceImpl implements ISysCommisionService | ||||
|     { | ||||
|         return sysCommisionMapper.deleteSysCommisionById(ruleId); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<SysCommision> selectSysCommisionDetail(SysCommision sysCommision) { | ||||
|         return sysCommisionMapper.selectSysCommisionDetail(sysCommision); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -9,12 +9,13 @@ | ||||
|         <result property="userName" column="nick_name"/> | ||||
|         <result property="postId" column="post_id"/> | ||||
|         <result property="postCode" column="post_code"/> | ||||
|         <result property="postName" column="post_name"/> | ||||
|     </resultMap> | ||||
|  | ||||
|     <sql id="selectCusUserPostVo"> | ||||
|         SELECT u.user_id, u.nick_name, p.post_id, p.post_code | ||||
|         SELECT u.user_id, u.nick_name, p.post_id, p.post_code, p.post_name | ||||
|         FROM sys_user u, sys_post p, sys_user_post up | ||||
|         WHERE up.user_id = u.user_id AND p.post_id = up.post_id | ||||
|         WHERE up.user_id = u.user_id AND p.post_id = up.post_id AND p.post_id > 4 | ||||
|     </sql> | ||||
|  | ||||
|     <select id="selectAllCusUserPost" parameterType="CusUserPost" resultMap="CusUserPostResult"> | ||||
|   | ||||
| @@ -1,45 +1,108 @@ | ||||
| <?xml version="1.0" encoding="UTF-8" ?> | ||||
| <!DOCTYPE mapper | ||||
| PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
| "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||
|         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|         "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||
| <mapper namespace="com.ruoyi.custom.mapper.SysCommisionMapper"> | ||||
|      | ||||
|  | ||||
|     <resultMap type="SysCommision" id="SysCommisionResult"> | ||||
|         <result property="ruleId"    column="rule_id"    /> | ||||
|         <result property="userId"    column="user_id"    /> | ||||
|         <result property="nickName"    column="nick_name"    /> | ||||
|         <result property="amount"    column="amount"    /> | ||||
|         <result property="rate"    column="rate"    /> | ||||
|         <result property="createBy"    column="create_by"    /> | ||||
|         <result property="createTime"    column="create_time"    /> | ||||
|         <result property="updateBy"    column="update_by"    /> | ||||
|         <result property="updateTime"    column="update_time"    /> | ||||
|         <result property="remark"    column="remark"    /> | ||||
|         <result property="ruleId" column="rule_id"/> | ||||
|         <result property="userId" column="user_id"/> | ||||
|         <result property="postId" column="post_id"/> | ||||
|         <result property="userName" column="user_name"/> | ||||
|         <result property="postName" column="post_name"/> | ||||
|         <result property="amount" column="amount"/> | ||||
|         <result property="rate" column="rate"/> | ||||
|         <result property="createBy" column="create_by"/> | ||||
|         <result property="createTime" column="create_time"/> | ||||
|         <result property="updateBy" column="update_by"/> | ||||
|         <result property="updateTime" column="update_time"/> | ||||
|         <result property="remark" column="remark"/> | ||||
|         <result property="commision" column="commision"/> | ||||
|     </resultMap> | ||||
|  | ||||
|     <sql id="selectSysCommisionVo"> | ||||
|         select rule_id, user_id, nick_name, amount, rate, create_by, create_time, update_by, update_time, remark from sys_commision | ||||
|     <resultMap id="SysCommisionDetailResult" type="SysCommision"> | ||||
|         <result property="userId" column="user_id"/> | ||||
|         <result property="userName" column="user_name"/> | ||||
|         <result property="postId" column="post_id"/> | ||||
|         <result property="postName" column="post_name"/> | ||||
|         <result property="amount" column="amount"/> | ||||
|     </resultMap> | ||||
|  | ||||
|     <sql id="groupAmountVo"> | ||||
|         SELECT ${column} AS user_id, SUM(amount) AS amount | ||||
|         FROM sys_order | ||||
|         WHERE ${column} IS NOT NULL | ||||
|         <if test="beginTime != null and beginTime != ''"> AND date_format(order_time,'%y%m%d') >= date_format(${beginTime},'%y%m%d')</if> | ||||
|         <if test="endTime != null and endTime != ''">AND date_format(order_time,'%y%m%d') <= date_format(${endTime},'%y%m%d')</if> | ||||
|         GROUP BY ${column} | ||||
|     </sql> | ||||
|  | ||||
|     <select id="selectSysCommisionDetail" parameterType="SysCommision" resultMap="SysCommisionResult"> | ||||
|         SELECT * FROM view_user_post pa | ||||
|         JOIN ( | ||||
|             <include refid="groupAmountVo"> | ||||
|                 <property name="column" value="pre_sale_id"/> | ||||
|                 <property name="beginTime" value="#{beginTime}"/> | ||||
|                 <property name="endTime" value="#{endTime}"/> | ||||
|             </include> | ||||
|             UNION | ||||
|             <include refid="groupAmountVo"> | ||||
|                 <property name="column" value="after_sale_id"/> | ||||
|                 <property name="beginTime" value="#{beginTime}"/> | ||||
|                 <property name="endTime" value="#{endTime}"/> | ||||
|             </include> | ||||
|             UNION | ||||
|             <include refid="groupAmountVo"> | ||||
|                 <property name="column" value="nutritionist_id"/> | ||||
|                 <property name="beginTime" value="#{beginTime}"/> | ||||
|                 <property name="endTime" value="#{endTime}"/> | ||||
|             </include> | ||||
|             UNION | ||||
|             <include refid="groupAmountVo"> | ||||
|                 <property name="column" value="nutri_assis_id"/> | ||||
|                 <property name="beginTime" value="#{beginTime}"/> | ||||
|                 <property name="endTime" value="#{endTime}"/> | ||||
|             </include> | ||||
|             UNION | ||||
|             <include refid="groupAmountVo"> | ||||
|                 <property name="column" value="operator_id"/> | ||||
|                 <property name="beginTime" value="#{beginTime}"/> | ||||
|                 <property name="endTime" value="#{endTime}"/> | ||||
|             </include> | ||||
|         ) AS a USING(user_id) | ||||
|         <where> | ||||
|             <if test="postId != null and postId != ''">and post_id = #{postId}</if> | ||||
|             <if test="userId != null and userId != ''">and user_id = #{userId}</if> | ||||
|         </where> | ||||
|     </select> | ||||
|  | ||||
|     <sql id="selectSysCommisionVo"> | ||||
|         SELECT * FROM ( | ||||
|             SELECT * FROM view_user_post AS pa | ||||
|             JOIN (SELECT * FROM sys_commision WHERE rate > 0) AS c USING(user_id) | ||||
|             ORDER BY user_id, amount | ||||
|         ) as t | ||||
|     </sql> | ||||
|  | ||||
|  | ||||
|  | ||||
|     <select id="selectSysCommisionList" parameterType="SysCommision" resultMap="SysCommisionResult"> | ||||
|         <include refid="selectSysCommisionVo"/> | ||||
|         <where>   | ||||
|             <if test="userId != null "> and user_id = #{userId}</if> | ||||
|             <if test="amount != null "> and amount = #{amount}</if> | ||||
|             <if test="rate != null "> and rate = #{rate}</if> | ||||
|         <where> | ||||
|             <if test="userId != null ">and user_id = #{userId}</if> | ||||
|             <if test="postId != null ">and post_id = #{postId}</if> | ||||
|         </where> | ||||
|     </select> | ||||
|      | ||||
|  | ||||
|     <select id="selectSysCommisionById" parameterType="Long" resultMap="SysCommisionResult"> | ||||
|         <include refid="selectSysCommisionVo"/> | ||||
|         where rule_id = #{ruleId} | ||||
|     </select> | ||||
|          | ||||
|  | ||||
|     <insert id="insertSysCommision" parameterType="SysCommision" useGeneratedKeys="true" keyProperty="ruleId"> | ||||
|         insert into sys_commision | ||||
|         <trim prefix="(" suffix=")" suffixOverrides=","> | ||||
|             <if test="userId != null">user_id,</if> | ||||
|             <if test="nickName != null">nick_name,</if> | ||||
|             <if test="amount != null">amount,</if> | ||||
|             <if test="rate != null">rate,</if> | ||||
|             <if test="createBy != null">create_by,</if> | ||||
| @@ -47,10 +110,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|             <if test="updateBy != null">update_by,</if> | ||||
|             <if test="updateTime != null">update_time,</if> | ||||
|             <if test="remark != null">remark,</if> | ||||
|          </trim> | ||||
|         </trim> | ||||
|         <trim prefix="values (" suffix=")" suffixOverrides=","> | ||||
|             <if test="userId != null">#{userId},</if> | ||||
|             <if test="nickName != null">#{nickName},</if> | ||||
|             <if test="amount != null">#{amount},</if> | ||||
|             <if test="rate != null">#{rate},</if> | ||||
|             <if test="createBy != null">#{createBy},</if> | ||||
| @@ -58,14 +120,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|             <if test="updateBy != null">#{updateBy},</if> | ||||
|             <if test="updateTime != null">#{updateTime},</if> | ||||
|             <if test="remark != null">#{remark},</if> | ||||
|          </trim> | ||||
|         </trim> | ||||
|     </insert> | ||||
|  | ||||
|     <update id="updateSysCommision" parameterType="SysCommision"> | ||||
|         update sys_commision | ||||
|         <trim prefix="SET" suffixOverrides=","> | ||||
|             <if test="userId != null">user_id = #{userId},</if> | ||||
|             <if test="nickName != null">nick_name = #{nickName},</if> | ||||
|             <if test="amount != null">amount = #{amount},</if> | ||||
|             <if test="rate != null">rate = #{rate},</if> | ||||
|             <if test="createBy != null">create_by = #{createBy},</if> | ||||
| @@ -82,10 +143,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|     </delete> | ||||
|  | ||||
|     <delete id="deleteSysCommisionByIds" parameterType="String"> | ||||
|         delete from sys_commision where rule_id in  | ||||
|         delete from sys_commision where rule_id in | ||||
|         <foreach item="ruleId" collection="array" open="(" separator="," close=")"> | ||||
|             #{ruleId} | ||||
|         </foreach> | ||||
|     </delete> | ||||
|      | ||||
|  | ||||
| </mapper> | ||||
| @@ -52,8 +52,8 @@ | ||||
|             <if test="plannerAssisId != null ">and planner_assis_id = #{plannerAssisId}</if> | ||||
|             <if test="operatorId != null ">and operator_id = #{operatorId}</if> | ||||
|             <if test="recommender != null  and recommender != ''">and recommender = #{recommender}</if> | ||||
|             <if test="beginTime != null ">and order_time >= #{beginTime}</if> | ||||
|             <if test="endTime != null ">and order_time <= #{endTime}</if> | ||||
|             <if test="beginTime != null and beginTime != ''">and date_format(order_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')</if> | ||||
|             <if test="endTime != null and endTime != ''">and date_format(order_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')</if> | ||||
|             <if test="serveMonth != null ">and serve_month = #{serveMonth}</if> | ||||
|             <if test="reviewStatus != null ">and review_status = #{reviewStatus}</if> | ||||
|         </where> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user