huwhois 3 years ago
parent
commit
4f06def097

+ 0 - 13
src/main/java/io/renren/modules/sales/controller/SaleOrderItemController.java

@ -45,19 +45,6 @@ public class SaleOrderItemController extends AbstractController {
45 45
        return R.ok().put("page", page);
46 46
    }
47 47
48
    /**
49
     * 列表
50
     * @param orderId
51
     * @return
52
     */
53
    @GetMapping("/list/{orderId}")
54
    @RequiresPermissions("sales:saleorderitem:list")
55
    public R list(@PathVariable("orderId") Long orderId){
56
        List<SaleOrderItemEntity> list = saleOrderItemService.listByOrderId(orderId);
57
        PageUtils page = new PageUtils(list, 1, 10, 1);
58
        return R.ok().put("page", page);
59
    }
60
61 48
    /**
62 49
     * 信息
63 50
     */

+ 0 - 8
src/main/java/io/renren/modules/sales/controller/SaleOrderPaymentController.java

@ -1,10 +1,6 @@
1 1
package io.renren.modules.sales.controller;
2 2
3
import java.math.BigDecimal;
4
import java.util.Arrays;
5
import java.util.Date;
6 3
import java.util.List;
7
import java.util.Map;
8 4
9 5
import org.apache.shiro.authz.annotation.RequiresPermissions;
10 6
import org.springframework.beans.factory.annotation.Autowired;
@ -13,14 +9,10 @@ import org.springframework.web.bind.annotation.PathVariable;
13 9
import org.springframework.web.bind.annotation.PostMapping;
14 10
import org.springframework.web.bind.annotation.RequestBody;
15 11
import org.springframework.web.bind.annotation.RequestMapping;
16
import org.springframework.web.bind.annotation.RequestParam;
17 12
import org.springframework.web.bind.annotation.RestController;
18 13
19
import io.renren.common.utils.PageUtils;
20 14
import io.renren.common.utils.R;
21
import io.renren.modules.sales.entity.SaleOrderItemEntity;
22 15
import io.renren.modules.sales.entity.SaleOrderPaymentEntity;
23
import io.renren.modules.sales.service.SaleOrderItemService;
24 16
import io.renren.modules.sales.service.SaleOrderPaymentService;
25 17
import io.renren.modules.sys.controller.AbstractController;
26 18

+ 11 - 20
src/main/java/io/renren/modules/sales/controller/SaleSellerFeeController.java

@ -3,6 +3,7 @@ package io.renren.modules.sales.controller;
3 3
import java.util.Arrays;
4 4
import java.util.Map;
5 5
6
import org.apache.commons.lang.StringUtils;
6 7
import org.apache.shiro.authz.annotation.RequiresPermissions;
7 8
import org.springframework.beans.factory.annotation.Autowired;
8 9
import org.springframework.web.bind.annotation.PathVariable;
@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
13 14
14 15
import io.renren.modules.sales.entity.SaleSellerFeeEntity;
15 16
import io.renren.modules.sales.service.SaleSellerFeeService;
17
import io.renren.modules.sys.controller.AbstractController;
16 18
import io.renren.common.utils.PageUtils;
17 19
import io.renren.common.utils.R;
18 20
@ -27,7 +29,7 @@ import io.renren.common.utils.R;
27 29
 */
28 30
@RestController
29 31
@RequestMapping("sales/salesellerfee")
30
public class SaleSellerFeeController {
32
public class SaleSellerFeeController  extends AbstractController {
31 33
    @Autowired
32 34
    private SaleSellerFeeService saleSellerFeeService;
33 35
@ -42,36 +44,25 @@ public class SaleSellerFeeController {
42 44
        return R.ok().put("page", page);
43 45
    }
44 46
45
46 47
    /**
47 48
     * 信息
48 49
     */
49
    @RequestMapping("/info/{sellerId}")
50
    @RequestMapping("/info/{id}")
50 51
    @RequiresPermissions("sales:salesellerfee:info")
51
    public R info(@PathVariable("sellerId") Long sellerId){
52
		SaleSellerFeeEntity saleSellerFee = saleSellerFeeService.getById(sellerId);
52
    public R info(@PathVariable("id") Long id){
53
		SaleSellerFeeEntity saleSellerFee = saleSellerFeeService.getById(id);
53 54
54 55
        return R.ok().put("saleSellerFee", saleSellerFee);
55 56
    }
56 57
57 58
    /**
58
     * 保存
59
     * 保存或修改
59 60
     */
60
    @RequestMapping("/save")
61
    @RequestMapping("/savefee")
61 62
    @RequiresPermissions("sales:salesellerfee:save")
62
    public R save(@RequestBody SaleSellerFeeEntity saleSellerFee){
63
		saleSellerFeeService.save(saleSellerFee);
64
65
        return R.ok();
66
    }
67
68
    /**
69
     * 修改
70
     */
71
    @RequestMapping("/update")
72
    @RequiresPermissions("sales:salesellerfee:update")
73
    public R update(@RequestBody SaleSellerFeeEntity saleSellerFee){
74
		saleSellerFeeService.updateById(saleSellerFee);
63
    public R saveSellerFee(@RequestBody SaleSellerFeeEntity saleSellerFee){
64
        saleSellerFee.setCreateUserId(getUserId());
65
        saleSellerFeeService.saveSellerFee(saleSellerFee);
75 66
76 67
        return R.ok();
77 68
    }

+ 13 - 15
src/main/java/io/renren/modules/sales/dao/SaleOrderItemDao.java

@ -1,10 +1,8 @@
1 1
package io.renren.modules.sales.dao;
2 2
3
import io.renren.modules.sales.entity.SaleOrderItemCommissionEntity;
3
import io.renren.modules.sales.entity.SaleOrderUnionItemEntity;
4 4
import io.renren.modules.sales.entity.SaleOrderItemEntity;
5 5
6
import java.util.List;
7
8 6
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
9 7
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
10 8
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -39,18 +37,18 @@ public interface SaleOrderItemDao extends BaseMapper<SaleOrderItemEntity> {
39 37
	+ " truncate(ifnull(((select sum(`sop`.`pay_money`) from `sy_sale_order_payment` `sop` where(`soi`.`id` = `sop`.`order_item_id`)) / 100),0),2)"
40 38
	+ " AS `pay_money`,truncate(ifnull(((select sum(`sot`.`fare`) from `sy_sale_order_transport` as `sot` where (`soi`.`id` = `sot`.`order_item_id`)) / 100),0),2)"
41 39
	+ " AS `fare` from (`sy_sale_order_item` `soi` join `sy_sale_order` `so` on((`soi`.`order_id` = `so`.`id`))) ${ew.customSqlSegment}")
42
	IPage<SaleOrderItemEntity> queryMorePage(IPage<SaleOrderItemEntity> page, @Param(Constants.WRAPPER) QueryWrapper<SaleOrderItemEntity> ew);
40
	IPage<SaleOrderUnionItemEntity> queryMorePage(IPage<SaleOrderUnionItemEntity> page, @Param(Constants.WRAPPER) QueryWrapper<SaleOrderUnionItemEntity> ew);
43 41
44
	@Select("select `soi`.`id` AS `id`,`soi`.`order_id` AS `order_id`,`so`.`contract_no` AS `contract_no`,`so`.`contract_time` AS `contract_time`,"
45
	+ "`soi`.`products_category_name` AS `products_category_name`,`soi`.`products_id` AS `products_id`,`soi`.`products_name` AS `products_name`,"
46
	+ "`soi`.`products_price` AS `products_price`,`soi`.`products_identifier` AS `products_identifier`,`soi`.`sales_amount` AS `sales_amount`,"
47
	+ "`soi`.`sales_price` AS `sales_price`,`soi`.`sales_money` AS `sales_money`,`soi`.`agency` AS `agency`,`soi`.`other_fee` AS `other_fee`,"
48
	+ "`soi`.`commission_type` AS `commission_type`,`soi`.`commission_rate` AS `commission_rate`,`so`.`client_name` AS `client_name`,"
49
	+ "`so`.`seller_name` AS `seller_name`,`so`.`is_review` AS `is_review`,month(`so`.`contract_time`) AS `month`,year(`so`.`contract_time`) AS `year`,"
50
	+ "ifnull(`sy_sale_commission`.`id`,0) AS `is_commission`,truncate(ifnull(((select sum(`sop`.`pay_money`) from `sy_sale_order_payment` `sop`"
51
	+ " where (`soi`.`id` = `sop`.`order_item_id`)) / 100),0),2) AS `pay_money`,truncate(ifnull(((select sum(`sot`.`fare`) from `sy_sale_order_transport`"
52
	+ " `sot` where (`soi`.`id` = `sot`.`order_item_id`)) / 100),0),2) AS `fare` from ((`sy_sale_order_item` `soi` join `sy_sale_order` `so`"
53
	+ " on((`soi`.`order_id` = `so`.`id`))) left join `sy_sale_commission` on((`soi`.`order_id` = `sy_sale_commission`.`order_id`)))  ${ew.customSqlSegment}")
54
	IPage<SaleOrderItemCommissionEntity> queryCommissionItemPage(IPage<SaleOrderItemCommissionEntity> page, @Param(Constants.WRAPPER) QueryWrapper<SaleOrderItemCommissionEntity> ew);
42
	// @Select("select `soi`.`id` AS `id`,`soi`.`order_id` AS `order_id`,`so`.`contract_no` AS `contract_no`,`so`.`contract_time` AS `contract_time`,"
43
	// + "`soi`.`products_category_name` AS `products_category_name`,`soi`.`products_id` AS `products_id`,`soi`.`products_name` AS `products_name`,"
44
	// + "`soi`.`products_price` AS `products_price`,`soi`.`products_identifier` AS `products_identifier`,`soi`.`sales_amount` AS `sales_amount`,"
45
	// + "`soi`.`sales_price` AS `sales_price`,`soi`.`sales_money` AS `sales_money`,`soi`.`agency` AS `agency`,`soi`.`other_fee` AS `other_fee`,"
46
	// + "`soi`.`commission_type` AS `commission_type`,`soi`.`commission_rate` AS `commission_rate`,`so`.`client_name` AS `client_name`,"
47
	// + "`so`.`seller_name` AS `seller_name`,`so`.`is_review` AS `is_review`,month(`so`.`contract_time`) AS `month`,year(`so`.`contract_time`) AS `year`,"
48
	// + "ifnull(`sy_sale_commission`.`id`,0) AS `is_commission`,truncate(ifnull(((select sum(`sop`.`pay_money`) from `sy_sale_order_payment` `sop`"
49
	// + " where (`soi`.`id` = `sop`.`order_item_id`)) / 100),0),2) AS `pay_money`,truncate(ifnull(((select sum(`sot`.`fare`) from `sy_sale_order_transport`"
50
	// + " `sot` where (`soi`.`id` = `sot`.`order_item_id`)) / 100),0),2) AS `fare` from ((`sy_sale_order_item` `soi` join `sy_sale_order` `so`"
51
	// + " on((`soi`.`order_id` = `so`.`id`))) left join `sy_sale_commission` on((`soi`.`order_id` = `sy_sale_commission`.`order_id`)))  ${ew.customSqlSegment}")
52
	// IPage<SaleOrderItemCommissionEntity> queryCommissionItemPage(IPage<SaleOrderItemCommissionEntity> page, @Param(Constants.WRAPPER) QueryWrapper<SaleOrderItemCommissionEntity> ew);
55 53
		
56 54
}

+ 0 - 20
src/main/java/io/renren/modules/sales/dao/SaleOrderSummaryDao.java

@ -1,20 +0,0 @@
1
package io.renren.modules.sales.dao;
2
3
4
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
6
import org.apache.ibatis.annotations.Mapper;
7
8
import io.renren.modules.sales.entity.SaleOrderSummaryEntity;
9
10
/**
11
 * 销售订单汇总信息
12
 * 
13
 * @author huwhois
14
 * @email huwhois@163.com
15
 * @date 2021-04-14 11:03:56
16
 */
17
@Mapper
18
public interface SaleOrderSummaryDao extends BaseMapper<SaleOrderSummaryEntity> {
19
20
}

+ 13 - 4
src/main/java/io/renren/modules/sales/dao/SaleSellerFeeDao.java

@ -1,13 +1,16 @@
1 1
package io.renren.modules.sales.dao;
2 2
3
import io.renren.modules.sales.entity.SaleSellerFeeEntity;
4
5
import java.util.List;
6
3
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
7 4
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
import com.baomidou.mybatisplus.core.metadata.IPage;
6
import com.baomidou.mybatisplus.core.toolkit.Constants;
7
8
import org.apache.ibatis.annotations.Param;
8 9
import org.apache.ibatis.annotations.Mapper;
9 10
import org.apache.ibatis.annotations.Select;
10 11
12
import io.renren.modules.sales.entity.SaleSellerFeeEntity;
13
11 14
/**
12 15
 * 销售员
13 16
 * 
@ -17,5 +20,11 @@ import org.apache.ibatis.annotations.Select;
17 20
 */
18 21
@Mapper
19 22
public interface SaleSellerFeeDao extends BaseMapper<SaleSellerFeeEntity> {
23
24
    @Select("select `sf`.`id` AS `id`,`sf`.`seller_id` AS `seller_id`,`sf`.`other_fee` AS `other_fee`,`sf`.`month` AS `month`,"
25
    + "`sf`.`year` AS `year`,`sf`.`create_user_id` AS `create_user_id`,`sf`.`create_time` AS `create_time`,`sf`.`overdraft` AS"
26
    + " `overdraft`,`su`.`username` AS `seller_name`,concat_ws('-',`sf`.`year`,`sf`.`month`) AS `year_month`,`sf`.`remark` "
27
    + " from (`sy_sale_seller_fee` `sf` join `sy_sys_user` `su` on((`sf`.`seller_id` = `su`.`user_id`))) ${ew.customSqlSegment}")
28
	IPage<SaleSellerFeeEntity> queryPage(IPage<SaleSellerFeeEntity> page, @Param(Constants.WRAPPER)  QueryWrapper<SaleSellerFeeEntity> ew);
20 29
	
21 30
}

+ 4 - 4
src/main/java/io/renren/modules/sales/entity/SaleOrderItemEntity.java

@ -135,6 +135,10 @@ public class SaleOrderItemEntity implements Serializable {
135 135
     * 录入时间
136 136
     */
137 137
    private Date createTime;
138
    /**
139
     * ud orderItem 编号
140
     */
141
    private String u8itemid;
138 142
    /**
139 143
     * 付款详情
140 144
     */
@ -196,8 +200,4 @@ public class SaleOrderItemEntity implements Serializable {
196 200
     */
197 201
    @TableField(exist = false)
198 202
    private String u8id;
199
     /**
200
     * ud orderItem 编号
201
     */
202
    private String u8itemid;
203 203
}

+ 0 - 162
src/main/java/io/renren/modules/sales/entity/SaleOrderSummaryEntity.java

@ -1,162 +0,0 @@
1
package io.renren.modules.sales.entity;
2
3
import com.baomidou.mybatisplus.annotation.TableField;
4
import com.baomidou.mybatisplus.annotation.TableId;
5
import com.baomidou.mybatisplus.annotation.TableName;
6
import com.fasterxml.jackson.annotation.JsonFormat;
7
8
import org.springframework.format.annotation.DateTimeFormat;
9
10
import java.math.BigDecimal;
11
import java.io.Serializable;
12
import io.renren.convert.YuanToFenTypeHandler;
13
import java.util.Date;
14
15
import lombok.Data;
16
17
/**
18
 * View
19
 * @author huwhois
20
 * @email huwhois@163.com
21
 * @date 2021-04-16 15:36:23
22
 */
23
@Data
24
@TableName(value = "sy_sale_order_summary",autoResultMap = true)
25
public class SaleOrderSummaryEntity implements Serializable {
26
	private static final long serialVersionUID = 1L;
27
28
	/**
29
	 * id
30
	 */
31
	@TableId
32
	private Long id;
33
	/**
34
	 * 序号, 格式 MHTNO
35
	 */
36
	private String no;
37
	/**
38
	 * 合同号
39
	 */
40
	private String contractNo;
41
	/**
42
	 * 销售时间
43
	 */
44
	@JsonFormat(pattern = "yyyy-MM-dd")
45
	@DateTimeFormat(pattern="yyyy-MM-dd")
46
	private Date contractTime;
47
	/**
48
	 * 合同类型
49
	 */
50
	private Integer contractType;
51
	/**
52
	 * 合同金额(单位元)
53
	 */
54
	@TableField(typeHandler = YuanToFenTypeHandler.class)
55
	private BigDecimal contractMoney;
56
	/**
57
	 * 实际金额(单位元)
58
	 */
59
	@TableField(typeHandler = YuanToFenTypeHandler.class)
60
	private BigDecimal actualMoney;
61
	/**
62
	 * 客户id
63
	 */
64
	private Long clientId;
65
	/**
66
	 * 客户名称
67
	 */
68
	private String clientName;
69
	/**
70
	 * 销售员id
71
	 */
72
	private Long sellerId;
73
	/**
74
	 * 销售员名称
75
	 */
76
	private String sellerName;
77
	/**
78
	 * 销售员部门
79
	 */
80
	private Long sellerDepartmentId;
81
	/**
82
	 * 销售员部门
83
	 */
84
	private String sellerDepartmentName;
85
	/**
86
     * 销售供应商id
87
     */
88
    private Long supplyId;
89
    /**
90
     * 销售供应商名称
91
     */
92
    private String supplyName;
93
	/**
94
	 * 付款方式
95
	 */
96
	private String payType;
97
	/**
98
	 * 状态, 0 正常(正在进行), -1 作废(取消)
99
	 */
100
	private Integer status;
101
	/**
102
	 * 备注
103
	 */
104
	private String remark;
105
	/**
106
	 * 数据录入时间
107
	 */
108
	private Date createTime;
109
	/**
110
	 * 创建者ID
111
	 */
112
	private Long createUserId;
113
	/**
114
	 * 审核状态, 0 未审核, 1 已审核
115
	 */
116
	private Integer isReview;
117
	/**
118
	 * 审核时间
119
	 */
120
	private Date reviewTime;
121
	/**
122
	 * 审核者ID
123
	 */
124
	private Long reviewUserId;
125
	/**
126
	 * 审核者
127
	 */
128
	private String reviewUsername;
129
	/**
130
	 * 年
131
	 */
132
	private Integer month;
133
	/**
134
	 * 月
135
	 */
136
	private Integer year;
137
	/**
138
	 * 是否提成
139
	 */
140
	private Long isCommission;
141
	/**
142
	 * 代理费
143
	 */
144
	@TableField(typeHandler = YuanToFenTypeHandler.class)
145
	private BigDecimal agency;
146
	/**
147
	 * 运费
148
	 */
149
	@TableField(typeHandler = YuanToFenTypeHandler.class)
150
	private BigDecimal fare;
151
	/**
152
	 * 到款
153
	 */
154
	@TableField(typeHandler = YuanToFenTypeHandler.class)
155
	private BigDecimal payment;
156
	/**
157
	 * 开票金额
158
	 */
159
	@TableField(typeHandler = YuanToFenTypeHandler.class)
160
	private BigDecimal taxMoney;
161
162
}

+ 221 - 0
src/main/java/io/renren/modules/sales/entity/SaleOrderUnionItemEntity.java

@ -0,0 +1,221 @@
1
package io.renren.modules.sales.entity;
2
3
import com.baomidou.mybatisplus.annotation.TableField;
4
import com.baomidou.mybatisplus.annotation.TableId;
5
import com.baomidou.mybatisplus.annotation.TableName;
6
import com.fasterxml.jackson.annotation.JsonFormat;
7
8
import org.springframework.format.annotation.DateTimeFormat;
9
10
import java.math.BigDecimal;
11
import java.io.Serializable;
12
import java.util.Date;
13
14
import io.renren.convert.YuanToFenTypeHandler;
15
16
import lombok.Data;
17
18
/**
19
 * 销售订单产品明细
20
 * 
21
 * @author huwhois
22
 * @email huwhois@163.com
23
 * @date 2021-04-14 11:03:56
24
 */
25
@Data
26
@TableName(value = "sy_sale_order_item", autoResultMap = true)
27
public class SaleOrderUnionItemEntity implements Serializable {
28
    private static final long serialVersionUID = 1L;
29
30
    /**
31
     * id
32
     */
33
    @TableId
34
    private Long id;
35
    /**
36
     * 订单id
37
     */
38
    private Long orderId;
39
    /**
40
     * 种类id
41
     */
42
    private Long productsCategoryId;
43
    /**
44
     * 种类名称
45
     */
46
    private String productsCategoryName;
47
    /**
48
     * 产品id
49
     */
50
    private Long productsId;
51
    /**
52
     * 产品名称
53
     */
54
    private String productsName;
55
    /**
56
     * 型号规格
57
     */
58
    private String specification;
59
    /**
60
     * 产品价格 单位元(数据库存整数分, 下同)
61
     */
62
    @TableField(typeHandler = YuanToFenTypeHandler.class)
63
    private BigDecimal productsPrice;
64
    /**
65
     * 销售数量(单位KG/台)
66
     */
67
    private BigDecimal salesAmount;
68
    /**
69
     * 销售价格 单位元
70
     */
71
    @TableField(typeHandler = YuanToFenTypeHandler.class)
72
    private BigDecimal salesPrice;
73
    /**
74
     * 销售金额
75
     */
76
    @TableField(typeHandler = YuanToFenTypeHandler.class)
77
    private BigDecimal salesMoney;
78
    /**
79
     * 实际合同价格(去代理费)单位元
80
     */
81
    @TableField(typeHandler = YuanToFenTypeHandler.class)
82
    private BigDecimal realPrice;
83
    /**
84
     * 实际合同金额(去代理费)
85
     */
86
    @TableField(typeHandler = YuanToFenTypeHandler.class)
87
    private BigDecimal realMoney;
88
    /**
89
     * 实际发货量(单位KG/台)
90
     */
91
    private BigDecimal actualAmount;
92
    /**
93
     * 实际成交价格, 单位元
94
     */
95
    @TableField(typeHandler = YuanToFenTypeHandler.class)
96
    private BigDecimal actualPrice;
97
    /**
98
     * 实际金额, 单位元
99
     */
100
    @TableField(typeHandler = YuanToFenTypeHandler.class)
101
    private BigDecimal actualMoney;
102
    /**
103
     * 代理费分摊
104
     */
105
    @TableField(typeHandler = YuanToFenTypeHandler.class)
106
    private BigDecimal agency;
107
    /**
108
     * 其他费用
109
     */
110
    @TableField(typeHandler = YuanToFenTypeHandler.class)
111
    private BigDecimal otherFee;
112
    /**
113
     * 提成类别: 1,一般, 2, 特批1, 3, 特批2
114
     */
115
    private Integer commissionType;
116
    /**
117
     * 0,正常; -1, 取消
118
     */
119
    private Integer status;
120
    /**
121
     * 备注
122
     */
123
    private String remark;
124
    /**
125
     * 创建者ID
126
     */
127
    private Long createUserId;
128
    /**
129
     * 创建者
130
     */
131
    @TableField(exist=false)
132
    private String createUsername;
133
    /**
134
     * 录入时间
135
     */
136
    private Date createTime;
137
    /**
138
     * ud orderItem 编号
139
     */
140
    private String u8itemid;
141
    /**
142
     * 总收款
143
     */
144
    @TableField(exist = false)
145
    private BigDecimal PayMoney;
146
    /**
147
     * 运费
148
     */
149
    @TableField(exist=false)
150
    private BigDecimal fare;
151
    // order 属性
152
    /**
153
     * 合同号
154
     */
155
    @TableField(exist = false)
156
    private String contractNo;
157
    /**
158
     * 销售时间
159
     */
160
    @TableField(exist = false)
161
    @JsonFormat(pattern = "yyyy-MM-dd")
162
    @DateTimeFormat(pattern = "yyyy-MM-dd")
163
    private Date contractTime;
164
    /**
165
     * 客户id
166
     */
167
    @TableField(exist = false) 
168
    private Long clientId;
169
    /**
170
     * 客户名称
171
     */
172
    @TableField(exist = false) 
173
    private String clientName;
174
    /**
175
     * 销售员
176
     */
177
    @TableField(exist = false)
178
    private String sellerName;
179
    /**
180
     * 销售部门
181
     */
182
    @TableField(exist = false)
183
    private String sellerDepartmentName;
184
    /**
185
     * u8 订单编号
186
     */
187
    @TableField(exist = false)
188
    private String u8id;
189
    // commission 属性
190
    /**
191
     * 是否完成提成
192
     */
193
    @TableField(exist = false)
194
    private Long isCommission;
195
    /**
196
     * 合同基准额
197
     */
198
    @TableField(exist=false)
199
    private BigDecimal baseMoney;
200
    /**
201
     * 总利润
202
     */
203
    @TableField(exist=false)
204
    private BigDecimal profit;
205
    /**
206
     * 价格比例
207
     */
208
    @TableField(exist=false)
209
    private BigDecimal priceRate;
210
    /**
211
     * 提成比例(百分比)
212
     */
213
    @TableField(exist=false)
214
    private BigDecimal commissionRate;
215
    /**
216
     * 提成金额
217
     */
218
    @TableField(exist=false)
219
    private BigDecimal money;
220
221
}

+ 14 - 0
src/main/java/io/renren/modules/sales/entity/SaleSellerFeeEntity.java

@ -53,10 +53,24 @@ public class SaleSellerFeeEntity implements Serializable {
53 53
	 * 创建时间
54 54
	 */
55 55
	private Date createTime;
56
	/**
57
	 * 备注
58
	 */
59
	private String remark;
56 60
	/**
57 61
	 * 历史欠款
58 62
	 */
59 63
	@TableField(typeHandler = YuanToFenTypeHandler.class)
60 64
	private BigDecimal overdraft;
65
	/**
66
	 * 销售员姓名
67
	 */
68
	@TableField(exist = false)
69
	private String sellerName;
70
	/**
71
	 * 年月
72
	 */
73
	@TableField(exist = false)
74
	private String yearMonth;
61 75
62 76
}

+ 0 - 2
src/main/java/io/renren/modules/sales/service/SaleOrderItemService.java

@ -33,7 +33,5 @@ public interface SaleOrderItemService extends IService<SaleOrderItemEntity> {
33 33
	void saveItem(SaleOrderItemEntity saleOrderItem);
34 34
35 35
	void updateItem(SaleOrderItemEntity saleOrderItem);
36
37
	PageUtils queryCommissionPage(Map<String, Object> params);
38 36
}
39 37

+ 0 - 21
src/main/java/io/renren/modules/sales/service/SaleOrderSummaryService.java

@ -1,21 +0,0 @@
1
package io.renren.modules.sales.service;
2
3
import com.baomidou.mybatisplus.extension.service.IService;
4
import io.renren.common.utils.PageUtils;
5
import io.renren.modules.sales.entity.SaleOrderSummaryEntity;
6
7
import java.util.List;
8
import java.util.Map;
9
10
/**
11
 * 销售订单
12
 *
13
 * @author huwhois
14
 * @email huwhois@163.com
15
 * @date 2021-04-14 11:03:56
16
 */
17
public interface SaleOrderSummaryService extends IService<SaleOrderSummaryEntity> {
18
19
    PageUtils queryPage(Map<String, Object> params);
20
}
21

+ 1 - 1
src/main/java/io/renren/modules/sales/service/SaleSellerFeeService.java

@ -21,7 +21,7 @@ public interface SaleSellerFeeService extends IService<SaleSellerFeeEntity> {
21 21
    /**
22 22
     * 保存(更新)销售业务员月度其他业务费用
23 23
     */
24
    void saveSellerFee(SaleSellerFeeEntity sellerFee);
24
    void saveSellerFee(SaleSellerFeeEntity saleSellerFee);
25 25
26 26
    /**
27 27
     * 查询月度销售费用

+ 6 - 26
src/main/java/io/renren/modules/sales/service/impl/SaleOrderItemServiceImpl.java

@ -12,7 +12,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
12 12
import org.apache.commons.lang.StringUtils;
13 13
import org.springframework.beans.factory.annotation.Autowired;
14 14
import org.springframework.beans.factory.annotation.Value;
15
import org.springframework.scheduling.annotation.Async;
16 15
import org.springframework.stereotype.Service;
17 16
18 17
import io.renren.common.utils.PageUtils;
@ -20,7 +19,7 @@ import io.renren.common.utils.Query;
20 19
import io.renren.modules.common.entity.ProductsEntity;
21 20
import io.renren.modules.common.service.ProductsService;
22 21
import io.renren.modules.sales.dao.SaleOrderItemDao;
23
import io.renren.modules.sales.entity.SaleOrderItemCommissionEntity;
22
import io.renren.modules.sales.entity.SaleOrderUnionItemEntity;
24 23
import io.renren.modules.sales.entity.SaleOrderItemEntity;
25 24
import io.renren.modules.sales.service.SaleOrderItemService;
26 25
@ -38,12 +37,12 @@ public class SaleOrderItemServiceImpl extends ServiceImpl<SaleOrderItemDao, Sale
38 37
        String key = (String) params.get("key");
39 38
        Integer year = params.containsKey("year") ? Integer.parseInt((String) params.get("year")) : 0;
40 39
        Integer month = params.containsKey("month") ? Integer.parseInt((String) params.get("month")) : 0;
41
        Long sellerId = params.containsKey("sellerId") ? Long.valueOf((String) params.get("sellerId")) : 0L;
42
        Long orderId = params.containsKey("orderId") ? Long.valueOf((String) params.get("orderId")) : 0L;
40
        Long sellerId = params.containsKey("sellerId") && StringUtils.isNotBlank((String) params.get("sellerId")) ? Long.valueOf((String) params.get("sellerId")) : 0L;
41
        Long orderId = params.containsKey("orderId") && StringUtils.isNotBlank((String) params.get("orderId"))  ? Long.valueOf((String) params.get("orderId")) : 0L;
43 42
44
        IPage<SaleOrderItemEntity> page = baseMapper.queryMorePage(new Query<SaleOrderItemEntity>().getPage(params),
45
                new QueryWrapper<SaleOrderItemEntity>().eq(year != 0, "year(`contract_time`)", year)
46
                        .eq(month != 0, "month(`contract_time`)", month).eq(sellerId != 0L, "seller_id", sellerId)
43
        IPage<SaleOrderUnionItemEntity> page = baseMapper.queryMorePage(new Query<SaleOrderUnionItemEntity>().getPage(params),
44
                new QueryWrapper<SaleOrderUnionItemEntity>().eq(year != 0, "year(`so`.`contract_time`)", year)
45
                        .eq(month != 0, "month(`so`.`contract_time`)", month).eq(sellerId != 0L, "seller_id", sellerId)
47 46
                        .eq(orderId != 0L, "order_id", orderId).and(StringUtils.isNotBlank(key), Wrapper -> Wrapper
48 47
                                .like("`so`.`client_name`", key).or().like("`so`.`contract_no`", key)));
49 48
@ -111,23 +110,4 @@ public class SaleOrderItemServiceImpl extends ServiceImpl<SaleOrderItemDao, Sale
111 110
        this.updateById(saleOrderItem);
112 111
113 112
    }
114
115
    @Override
116
    @Async
117
    public PageUtils queryCommissionPage(Map<String, Object> params) {
118
        String key = (String) params.get("key");
119
        Integer year = params.containsKey("year") ? Integer.parseInt((String) params.get("year")) : 0;
120
        Integer month = params.containsKey("month") ? Integer.parseInt((String) params.get("month")) : 0;
121
        Long sellerId = params.containsKey("sellerId") ? Long.valueOf((String) params.get("sellerId")) : 0L;
122
123
        IPage<SaleOrderItemCommissionEntity> page = baseMapper.queryCommissionItemPage(
124
                new Query<SaleOrderItemCommissionEntity>().getPage(params),
125
                new QueryWrapper<SaleOrderItemCommissionEntity>().eq(year != 0, "year(`so`.`contract_time`)", year)
126
                        .eq(month != 0, "month(`so`.`contract_time`)", month)
127
                        .eq(sellerId != 0L, "`so`.`seller_id`", sellerId)
128
                        .and(StringUtils.isNotBlank(key), Wrapper -> Wrapper.like("`so`.`client_name`", key).or()
129
                                .like("`so`.`contract_no`", key)));
130
131
        return new PageUtils(page);
132
    }
133 113
}

+ 0 - 41
src/main/java/io/renren/modules/sales/service/impl/SaleOrderSummaryServiceImpl.java

@ -1,41 +0,0 @@
1
package io.renren.modules.sales.service.impl;
2
3
import java.util.List;
4
import java.util.Map;
5
6
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
7
import com.baomidou.mybatisplus.core.metadata.IPage;
8
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
9
10
import org.apache.commons.lang.StringUtils;
11
import org.springframework.stereotype.Service;
12
13
import io.renren.common.utils.PageUtils;
14
import io.renren.common.utils.Query;
15
import io.renren.modules.sales.dao.SaleOrderSummaryDao;
16
import io.renren.modules.sales.entity.SaleOrderSummaryEntity;
17
import io.renren.modules.sales.service.SaleOrderSummaryService;
18
19
@Service("SaleOrderSummaryService")
20
public class SaleOrderSummaryServiceImpl extends ServiceImpl<SaleOrderSummaryDao, SaleOrderSummaryEntity>
21
        implements SaleOrderSummaryService {
22
23
    @Override
24
    public PageUtils queryPage(Map<String, Object> params) {
25
        String key = (String) params.get("key");
26
        String sellerName = (String) params.get("seller_namey");
27
        Integer year = params.containsKey("year") ? Integer.parseInt((String) params.get("year")) : 0;
28
        Integer month = params.containsKey("month") ? Integer.parseInt((String) params.get("month")) : 0;
29
        Long createUserId = (Long) params.get("createUserId");
30
31
        IPage<SaleOrderSummaryEntity> page = this.page(new Query<SaleOrderSummaryEntity>().getPage(params),
32
                new QueryWrapper<SaleOrderSummaryEntity>().eq(year != 0, "year", year).eq(month != 0, "month", month)
33
                        .like(StringUtils.isNotBlank(key), "client_name", key).or()
34
                        .like(StringUtils.isNotBlank(key), "contract_no", key)
35
                        .eq(StringUtils.isNotBlank(sellerName), "seller_name", sellerName)
36
                        .eq("is_review", 1)
37
                        .eq(createUserId != null, "create_user_id", createUserId));
38
39
        return new PageUtils(page);
40
    }
41
}

+ 36 - 15
src/main/java/io/renren/modules/sales/service/impl/SaleSellerFeeServiceImpl.java

@ -3,6 +3,7 @@ package io.renren.modules.sales.service.impl;
3 3
import org.apache.commons.lang.StringUtils;
4 4
import org.springframework.stereotype.Service;
5 5
6
import java.util.Date;
6 7
import java.util.List;
7 8
import java.util.Map;
8 9
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -23,35 +24,55 @@ public class SaleSellerFeeServiceImpl extends ServiceImpl<SaleSellerFeeDao, Sale
23 24
24 25
    @Override
25 26
    public PageUtils queryPage(Map<String, Object> params) {
26
        IPage<SaleSellerFeeEntity> page = this.page(new Query<SaleSellerFeeEntity>().getPage(params),
27
                new QueryWrapper<SaleSellerFeeEntity>());
27
        Integer year = 0;
28
        Integer month = 0;
29
        String yearMonth = params.containsKey("yearMonth") ? (String) params.get("yearMonth") : null;
30
        if (StringUtils.isNotBlank(yearMonth)) {
31
            String[] year_month = yearMonth.split("-");
32
            year = Integer.parseInt(year_month[0]);
33
            month = Integer.parseInt(year_month[1]);
34
        }
35
36
        IPage<SaleSellerFeeEntity> page = baseMapper.queryPage(new Query<SaleSellerFeeEntity>().getPage(params),
37
                new QueryWrapper<SaleSellerFeeEntity>().eq(year != 0, "year", year).eq(month != 0, "month", month));
28 38
29 39
        return new PageUtils(page);
30 40
    }
31 41
32 42
    @Override
33
    public void saveSellerFee(SaleSellerFeeEntity sellerFee) {
34
        if (sellerFee.getYear() == null || sellerFee.getYear() == 0 || sellerFee.getMonth() == null
35
                || sellerFee.getMonth() == 0) {
43
    public void saveSellerFee(SaleSellerFeeEntity saleSellerFee) {
44
        if (StringUtils.isBlank(saleSellerFee.getYearMonth())) {
36 45
            throw new RRException("年月不可为空");
37 46
        }
38 47
39
        SaleSellerFeeEntity otherFee = this.getOne(new QueryWrapper<SaleSellerFeeEntity>().eq("seller_id",
40
                sellerFee.getSellerId()).eq("year", sellerFee.getYear()).eq("month", sellerFee.getMonth()));
48
        String[] year_month = saleSellerFee.getYearMonth().split("-");
49
        Integer year = Integer.parseInt(year_month[0]);
50
        Integer month = Integer.parseInt(year_month[1]);
51
52
        saleSellerFee.setYear(year);
53
        saleSellerFee.setMonth(month);
41 54
42
        if (otherFee == null) {
43
            this.save(sellerFee);
55
        if (saleSellerFee.getId() != 0L) {
56
            this.updateById(saleSellerFee);
44 57
        } else {
45
            otherFee.setOtherFee(sellerFee.getOtherFee());
46
            otherFee.setOverdraft(sellerFee.getOverdraft());
47
            this.updateById(otherFee);
48
        }
58
            SaleSellerFeeEntity oldFee = this.getOne(new QueryWrapper<SaleSellerFeeEntity>().eq(year != 0, "year", year)
59
                    .eq(month != 0, "month", month).eq("seller_id", saleSellerFee.getSellerId()));
49 60
61
            if (oldFee == null) {
62
                saleSellerFee.setCreateTime(new Date());
63
                this.save(saleSellerFee);
64
            } else {
65
                oldFee.setOtherFee(saleSellerFee.getOtherFee());
66
                oldFee.setOverdraft(saleSellerFee.getOverdraft());
67
                
68
                this.updateById(oldFee);
69
            }
70
        }
50 71
    }
51 72
52 73
    @Override
53 74
    public List<SaleSellerFeeEntity> queryMonthList(Map<String, Object> params) {
54
        
75
55 76
        Integer year = 0;
56 77
        Integer month = 0;
57 78
        String yearMonth = (String) params.get("yearMonth");
@ -60,7 +81,7 @@ public class SaleSellerFeeServiceImpl extends ServiceImpl<SaleSellerFeeDao, Sale
60 81
            year = Integer.parseInt(year_month[0]);
61 82
            month = Integer.parseInt(year_month[1]);
62 83
        }
63
        
84
64 85
        return this.list(new QueryWrapper<SaleSellerFeeEntity>().eq("year", year).eq("month", month));
65 86
    }
66 87