提成改为保留三位小数四舍五入,订单页面修改,增加服务天数
This commit is contained in:
@ -4,6 +4,7 @@ import com.stdiet.common.annotation.Log;
|
||||
import com.stdiet.common.core.domain.AjaxResult;
|
||||
import com.stdiet.common.core.domain.entity.SysUser;
|
||||
import com.stdiet.common.enums.BusinessType;
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import com.stdiet.common.utils.StringUtils;
|
||||
import com.stdiet.common.utils.poi.ExcelUtil;
|
||||
import com.stdiet.custom.controller.OrderBaseController;
|
||||
@ -17,6 +18,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -81,6 +83,12 @@ public class SysOrderController extends OrderBaseController {
|
||||
if (StringUtils.isNotEmpty(order.getPhone())) {
|
||||
order.setPhone(StringUtils.hiddenPhoneNumber(order.getPhone()));
|
||||
}
|
||||
//根据服务时长、赠送天数计算服务天数
|
||||
int month = order.getServeTimeId() != null ? order.getServeTimeId().intValue()/30 : 0;
|
||||
if(order.getStartTime() != null && order.getServerEndTime() != null && order.getServeTimeId() != null && month > 0){
|
||||
long serverDay = ChronoUnit.DAYS.between(DateUtils.dateToLocalDate(order.getStartTime()), DateUtils.dateToLocalDate(order.getStartTime()).plusMonths(month).plusDays(order.getGiveServeDay() == null ? 0 : order.getGiveServeDay())) + 1;
|
||||
order.setServerDay(Integer.parseInt(serverDay + ""));
|
||||
}
|
||||
}
|
||||
return getOrderDataTable(list, totalAmount);
|
||||
}
|
||||
@ -123,6 +131,9 @@ public class SysOrderController extends OrderBaseController {
|
||||
order.setOperatorAssis(user.getNickName());
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotEmpty(order.getPhone())) {
|
||||
order.setPhone(StringUtils.hiddenPhoneNumber(order.getPhone()));
|
||||
}
|
||||
}
|
||||
ExcelUtil<SysOrder> util = new ExcelUtil<SysOrder>(SysOrder.class);
|
||||
return util.exportExcel(list, "order");
|
||||
|
@ -46,7 +46,7 @@ public class SysWxUserInfoController extends BaseController {
|
||||
|
||||
for (SysWxUserInfo userInfo : list) {
|
||||
if (StringUtils.isNotEmpty(userInfo.getPhone())) {
|
||||
userInfo.setPhone(userInfo.getPhone().replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"));
|
||||
userInfo.setPhone(StringUtils.hiddenPhoneNumber(userInfo.getPhone()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,6 +61,11 @@ public class SysWxUserInfoController extends BaseController {
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SysWxUserInfo sysWxUserInfo) {
|
||||
List<SysWxUserInfo> list = sysWxUserInfoService.selectSysWxUserInfoList(sysWxUserInfo);
|
||||
for (SysWxUserInfo userInfo : list) {
|
||||
if (StringUtils.isNotEmpty(userInfo.getPhone())) {
|
||||
userInfo.setPhone(StringUtils.hiddenPhoneNumber(userInfo.getPhone()));
|
||||
}
|
||||
}
|
||||
ExcelUtil<SysWxUserInfo> util = new ExcelUtil<SysWxUserInfo>(SysWxUserInfo.class);
|
||||
return util.exportExcel(list, "wxUserInfo");
|
||||
}
|
||||
|
@ -213,6 +213,12 @@ public class SysOrder extends BaseEntity {
|
||||
@Excel(name = "进粉时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date becomeFanTime;
|
||||
|
||||
/**
|
||||
* 服务天数
|
||||
*/
|
||||
@Excel(name = "服务结束时间", width = 30)
|
||||
private Integer serverDay;
|
||||
|
||||
/**
|
||||
* 订单暂停记录 非持久化字段
|
||||
* */
|
||||
@ -525,6 +531,14 @@ public class SysOrder extends BaseEntity {
|
||||
this.becomeFanTime = becomeFanTime;
|
||||
}
|
||||
|
||||
public Integer getServerDay() {
|
||||
return serverDay;
|
||||
}
|
||||
|
||||
public void setServerDay(Integer serverDay) {
|
||||
this.serverDay = serverDay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
@ -1,5 +1,6 @@
|
||||
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.mapper.SysCommisionMapper;
|
||||
@ -106,6 +107,14 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
|
||||
* 根据用户ID统计出该用户在该月所有订单的服务数量、服务总天数、服务订单总额、暂停总天数
|
||||
* **/
|
||||
public void dealServerOrderCommissionDetail(List<SysOrderCommisionDayDetail> orderDetailList, SysCommissionDayDetail sysCommissionDayDetail){
|
||||
/*System.out.println("------------------开始--------------");
|
||||
if(orderDetailList != null){
|
||||
for(SysOrderCommisionDayDetail sysOrderCommisionDayDetail : orderDetailList){
|
||||
System.out.println("姓名:"+sysOrderCommisionDayDetail.getName() + " 总天数:"+sysOrderCommisionDayDetail.getServerDay()
|
||||
+" 每天金额:"+sysOrderCommisionDayDetail.getDayMoney() + " 一月服务天数:"+sysOrderCommisionDayDetail.getEveryYearMonthServerDay().get("20211")
|
||||
+" 一月对应金额:"+ sysOrderCommisionDayDetail.getEveryYearMonthServerMoney().get("20211"));
|
||||
}
|
||||
}*/
|
||||
//总提成
|
||||
BigDecimal totalCommissionAmount = new BigDecimal(0);
|
||||
//已发放提成
|
||||
@ -440,7 +449,7 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
|
||||
* double转为BigDecimal,保留一位小数,向下舍去
|
||||
* */
|
||||
public BigDecimal getMoney(Double money, int n){
|
||||
return new BigDecimal(money.toString()).setScale(n, BigDecimal.ROUND_DOWN);
|
||||
return new BigDecimal(money.toString()).setScale(3, BigDecimal.ROUND_HALF_UP);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -475,10 +484,6 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
|
||||
|
||||
/*System.out.println(ts(109792.8 * 6 / 100D, 1));
|
||||
System.out.println(ts(6587.8,2).doubleValue());*/
|
||||
System.out.println(ts(1.919,1).doubleValue());
|
||||
}
|
||||
|
||||
public static BigDecimal ts(Double money, int n){
|
||||
return new BigDecimal(money.toString()).setScale(n, BigDecimal.ROUND_DOWN);
|
||||
}
|
||||
}
|
||||
|
@ -78,6 +78,7 @@
|
||||
<if test="endTime != null and endTime != ''">and date_format(order_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')</if>
|
||||
<if test="serveTimeId != null ">and serve_time_id = #{serveTimeId}</if>
|
||||
<if test="reviewStatus != null ">and review_status = #{reviewStatus}</if>
|
||||
<if test="serveTimeId != null ">and serve_time_id = #{serveTimeId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
@ -65,7 +65,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="提成" align="center" prop="commision">
|
||||
<template scope="scope">
|
||||
{{scope.row.commision.toFixed(2)}}
|
||||
{{scope.row.commision.toFixed(3)}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
@ -65,23 +65,23 @@
|
||||
<el-table-column label="岗位" align="center" prop="postName"/>
|
||||
<el-table-column label="总提成" align="center" prop="totalCommissionAmount">
|
||||
<template scope="scope">
|
||||
{{scope.row.totalCommissionAmount}}
|
||||
{{scope.row.totalCommissionAmount.toFixed(3)}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="已发放提成" align="center" prop="totalHasSentCommissionAmount">
|
||||
<template scope="scope">
|
||||
{{scope.row.totalHasSentCommissionAmount}}
|
||||
{{scope.row.totalHasSentCommissionAmount.toFixed(3)}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="未发放提成" align="center" prop="totalNotSentCommissionAmount">
|
||||
<template scope="scope">
|
||||
{{scope.row.totalNotSentCommissionAmount}}
|
||||
{{scope.row.totalNotSentCommissionAmount.toFixed(3)}}
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column label="下月应发提成" align="center" prop="nextMonthCommission">
|
||||
<template scope="scope">
|
||||
{{scope.row.nextMonthCommission}}
|
||||
{{scope.row.nextMonthCommission.toFixed(3)}}
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
@ -112,7 +112,11 @@
|
||||
{{scope.row.yearMonth.substring(0, 4)}}年{{scope.row.yearMonth.substring(4)}}月
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column property="yearMonthCommission" label="提成金额" width="100"></el-table-column>
|
||||
<el-table-column property="yearMonthCommission" label="提成金额" width="100">
|
||||
<template scope="scope">
|
||||
{{scope.row.yearMonthCommission.toFixed(3)}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
@ -143,6 +143,18 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="服务时长" prop="serveTimeId">
|
||||
<el-select v-model="queryParams.serveTimeId" placeholder="请选服务时长">
|
||||
<el-option
|
||||
v-for="dict in serveTimeIdOption"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="parseInt(dict.dictValue)"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="成交日期" prop="orderTime">
|
||||
<el-date-picker
|
||||
@ -159,6 +171,7 @@
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col>
|
||||
<el-form-item>
|
||||
<el-button type="cyan" icon="el-icon-search" size="mini"
|
||||
@ -265,6 +278,11 @@
|
||||
<span>{{ parseTime(scope.row.serverEndTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="服务天数" align="center" prop="serverDay" width="80">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.serverDay ? `${scope.row.serverDay}天` : '0天'}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" width="120"/>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="300" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
@ -582,6 +600,30 @@
|
||||
export default {
|
||||
name: "Order",
|
||||
data() {
|
||||
const checkStartTime = (rule, value, callback) => {
|
||||
if (!value) {
|
||||
return callback(new Error('开始时间不能为空'))
|
||||
}
|
||||
if (!this.form.orderTime) {
|
||||
return callback(new Error('请先选择成交时间'))
|
||||
}
|
||||
if(dayjs(this.form.startTime).diff(dayjs(this.form.orderTime),'day') < 0){
|
||||
return callback(new Error('开始时间不能小于成交时间'))
|
||||
}
|
||||
callback();
|
||||
};
|
||||
const checkOrderTime = (rule, value, callback) => {
|
||||
if (!value) {
|
||||
return callback(new Error('成交时间不能为空'))
|
||||
}
|
||||
if (!this.form.becomeFanTime) {
|
||||
return callback(new Error('请先填写进粉时间'))
|
||||
}
|
||||
if(dayjs(this.form.orderTime).diff(dayjs(this.form.becomeFanTime),'day') < 0){
|
||||
return callback(new Error('成交时间不能小于进粉时间'))
|
||||
}
|
||||
callback();
|
||||
}
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
@ -660,6 +702,7 @@
|
||||
operatorAssisId: null,
|
||||
recommender: null,
|
||||
reviewStatus: null,
|
||||
serveTimeId: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
@ -677,8 +720,13 @@
|
||||
phone: [
|
||||
{required: true, message: "手机号不能为空", trigger: "blur"}
|
||||
],
|
||||
orderTime: [
|
||||
{required: true, message: "成交时间不能为空", trigger: "blur"},
|
||||
{required: true, trigger: "blur", validator: checkOrderTime}
|
||||
],
|
||||
startTime: [
|
||||
{required: true, message: "开始时间不能为空", trigger: "blur"}
|
||||
{required: true, message: "开始时间不能为空", trigger: "blur"},
|
||||
{required: true, trigger: "blur", validator: checkStartTime}
|
||||
],
|
||||
becomeFanTime: [
|
||||
{required: true, message: "进粉时间不能为空", trigger: "blur"}
|
||||
@ -863,7 +911,7 @@
|
||||
phone: null,
|
||||
amount: null,
|
||||
weight: null,
|
||||
startTime: dayjs().format("YYYY-MM-DD"),
|
||||
startTime: dayjs().add(3, 'day').format("YYYY-MM-DD"),
|
||||
pauseTime: null,
|
||||
payTypeId: defaultPayType ? parseInt(defaultPayType.dictValue) : null,
|
||||
preSaleId: defaultPresale ? parseInt(defaultPresale.dictValue) : null,
|
||||
|
@ -166,7 +166,8 @@
|
||||
|
||||
const checkcusId = (rule, value, callback) => {
|
||||
if (!value) {
|
||||
return callback(new Error('证件号码不能为空'))
|
||||
callback();
|
||||
//return callback(new Error('证件号码不能为空'))
|
||||
}
|
||||
setTimeout(() => {
|
||||
const {code, msg} = validatorIDCard(value, this.idType);
|
||||
@ -214,7 +215,7 @@
|
||||
{required: true, trigger: "blur", validator: checkPhone}
|
||||
],
|
||||
cusId: [
|
||||
{required: true, trigger: "blur", validator: checkcusId}
|
||||
{required: false, trigger: "blur", validator: checkcusId}
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -243,8 +244,10 @@
|
||||
})
|
||||
},
|
||||
submitForm() {
|
||||
console.log("chdkscjksdc1");
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
console.log("chdkscjksdc2");
|
||||
signContract(this.form).then(result => {
|
||||
if (result.code === 200) {
|
||||
window.location.href = window.location.origin + result.url;
|
||||
|
Reference in New Issue
Block a user