From 355dff1ede1c22437537ae17bdf06062f25192fb Mon Sep 17 00:00:00 2001 From: xiezhijun <15270898033@163.com> Date: Tue, 12 Jan 2021 18:35:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E6=88=90=E4=BC=98=E5=8C=96=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E3=80=81=E8=AE=A2=E5=8D=95=E5=88=97=E8=A1=A8=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=BF=9B=E7=B2=89=E5=AD=97=E6=AE=B5=E3=80=81=E8=B0=83?= =?UTF-8?q?=E7=90=86=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/stdiet/custom/domain/SysCustomer.java | 11 + .../domain/SysCustomerPhysicalSigns.java | 28 ++- .../com/stdiet/custom/domain/SysOrder.java | 57 +++++ .../service/ISysCommissionDayService.java | 2 + .../impl/SysCommissionDayServiceImpl.java | 206 ++++++------------ .../mapper/custom/SysCustomerMapper.xml | 35 ++- .../custom/SysCustomerPhysicalSignsMapper.xml | 91 ++++---- .../mapper/custom/SysOrderMapper.xml | 22 +- .../custom/commision/detail_day/index.vue | 49 ++++- stdiet-ui/src/views/custom/order/index.vue | 56 ++++- 10 files changed, 333 insertions(+), 224 deletions(-) diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomer.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomer.java index ce8e083d1..aacaaa1cc 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomer.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomer.java @@ -79,6 +79,9 @@ public class SysCustomer extends BaseEntity @Excel(name = "跟进状态") private Long followStatus; + /** 删除标识(0 未删除 1已删除) */ + private Integer delFlag; + /** 体征数据,非持久化字段 */ private SysCustomerPhysicalSigns sign; @@ -226,6 +229,14 @@ public class SysCustomer extends BaseEntity this.sign = sign; } + public Integer getDelFlag() { + return delFlag; + } + + public void setDelFlag(Integer delFlag) { + this.delFlag = delFlag; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerPhysicalSigns.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerPhysicalSigns.java index 302e6874a..007388233 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerPhysicalSigns.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerPhysicalSigns.java @@ -108,8 +108,8 @@ public class SysCustomerPhysicalSigns extends BaseEntity @Excel(name = "联系沟通时间", readConverterExp = "2=4小时制") private Integer connectTime; - /** 备注 */ - @Excel(name = "备注") + /** 饮食备注 */ + @Excel(name = "饮食备注") private String remarks; /** 湿气数据 */ @@ -132,6 +132,13 @@ public class SysCustomerPhysicalSigns extends BaseEntity @Excel(name = "减脂经历") private String experience; + /** 备注 */ + @Excel(name = "备注") + private String comments; + + /** 删除标识(0 未删除 1已删除) */ + private Integer delFlag; + /** 体征对象集合 **/ private List signList; @@ -402,6 +409,22 @@ public class SysCustomerPhysicalSigns extends BaseEntity this.signList = signList; } + public String getComments() { + return comments; + } + + public void setComments(String comments) { + this.comments = comments; + } + + public Integer getDelFlag() { + return delFlag; + } + + public void setDelFlag(Integer delFlag) { + this.delFlag = delFlag; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -440,5 +463,4 @@ public class SysCustomerPhysicalSigns extends BaseEntity .append("updateBy", getUpdateBy()) .toString(); } - } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysOrder.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysOrder.java index eee9e056e..e1b488561 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysOrder.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysOrder.java @@ -188,6 +188,31 @@ public class SysOrder extends BaseEntity { @Excel(name = "成交时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date orderTime; + /** + * 调理项目id + */ + private Integer conditioningProjectId; + + /** + * 调理项目 + */ + @Excel(name = "调理项目", width = 30) + private String conditioningProject; + + /** + * 服务结束时间(根据开始日期、服务月份、暂停记录计算而来) + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "服务结束时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date serverEndTime; + + /** + * 进粉时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "进粉时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date becomeFanTime; + /** * 订单暂停记录 非持久化字段 * */ @@ -476,6 +501,30 @@ public class SysOrder extends BaseEntity { this.orderPauseList = orderPauseList; } + public Integer getConditioningProjectId() { + return conditioningProjectId; + } + + public void setConditioningProjectId(Integer conditioningProjectId) { + this.conditioningProjectId = conditioningProjectId; + } + + public Date getServerEndTime() { + return serverEndTime; + } + + public void setServerEndTime(Date serverEndTime) { + this.serverEndTime = serverEndTime; + } + + public Date getBecomeFanTime() { + return becomeFanTime; + } + + public void setBecomeFanTime(Date becomeFanTime) { + this.becomeFanTime = becomeFanTime; + } + @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) @@ -519,4 +568,12 @@ public class SysOrder extends BaseEntity { .append("weight", getWeight()) .toString(); } + + public String getConditioningProject() { + return conditioningProject; + } + + public void setConditioningProject(String conditioningProject) { + this.conditioningProject = conditioningProject; + } } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCommissionDayService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCommissionDayService.java index c5693fea1..0e2d54440 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCommissionDayService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCommissionDayService.java @@ -2,8 +2,10 @@ package com.stdiet.custom.service; 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 java.util.Date; import java.util.List; import java.util.Map; diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCommissionDayServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCommissionDayServiceImpl.java index 452c16517..438833960 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCommissionDayServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCommissionDayServiceImpl.java @@ -1,21 +1,16 @@ package com.stdiet.custom.service.impl; import com.stdiet.common.utils.DateUtils; -import com.stdiet.common.utils.StringUtils; import com.stdiet.custom.domain.*; import com.stdiet.custom.mapper.SysCommisionMapper; import com.stdiet.custom.mapper.SysOrderMapper; import com.stdiet.custom.mapper.SysOrderPauseMapper; -import com.stdiet.custom.service.ISysCommisionService; import com.stdiet.custom.service.ISysCommissionDayService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.math.BigDecimal; -import java.math.RoundingMode; -import java.text.DecimalFormat; import java.time.*; -import java.time.format.DateTimeFormatter; import java.time.temporal.ChronoUnit; import java.time.temporal.TemporalAdjusters; import java.util.*; @@ -38,7 +33,7 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService { //查询用户 List list = sysCommisionMapper.selectSysCommisionDayDetail(sysCommision); if(list != null && list.size() > 0){ - Map> orderDetailMap = getOrderByList(null); + Map> orderDetailMap = getOrderByList(sysCommision.getUserId()); SysCommissionDayDetail sysCommissionDayDetail = null; for(SysCommision commision : list){ sysCommissionDayDetail = new SysCommissionDayDetail(); @@ -48,9 +43,8 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService { sysCommissionDayDetail.setPostName(commision.getPostName()); sysCommissionDayDetail.setOrderTotalAmount(commision.getAmount()); //获取查询时间 - LocalDate localDate = StringUtils.isEmpty(sysCommision.getBeginTime()) ? LocalDate.now() : LocalDate.parse(sysCommision.getBeginTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd")); - //dealServerOrderCommissionDetail2(orderDetailMap.get(sysCommissionDayDetail.getUserId()), sysCommissionDayDetail, localDate.getYear()+""+localDate.getMonth().getValue()); - dealServerOrderCommissionDetail2(orderDetailMap.get(sysCommissionDayDetail.getUserId()), sysCommissionDayDetail); + //LocalDate localDate = StringUtils.isEmpty(sysCommision.getBeginTime()) ? LocalDate.now() : LocalDate.parse(sysCommision.getBeginTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd")); + dealServerOrderCommissionDetail(orderDetailMap.get(sysCommissionDayDetail.getUserId()), sysCommissionDayDetail); result.add(sysCommissionDayDetail); } } @@ -61,103 +55,110 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService { /** * 根据用户ID统计出该用户在该月所有订单的服务数量、服务总天数、服务订单总额、暂停总天数 * **/ - public void dealServerOrderCommissionDetail2(List orderDetailList, SysCommissionDayDetail sysCommissionDayDetail){ + public void dealServerOrderCommissionDetail(List orderDetailList, SysCommissionDayDetail sysCommissionDayDetail){ //总提成 - double totalCommissionAmount = 0.0; + BigDecimal totalCommissionAmount = new BigDecimal(0); //已发放提成 - double totalHasSentCommissionAmount = 0.0; + BigDecimal totalHasSentCommissionAmount = new BigDecimal(0); //未发放提成 - double totalNotSentCommissionAmount = 0.0; + BigDecimal totalNotSentCommissionAmount = new BigDecimal(0); //未发放提成记录 List> sendDetailList = new ArrayList<>(); if(orderDetailList != null){ //获取每个月的成交总额度 - Map orderAmount = new TreeMap<>(new MyComparator()); + Map orderAmount = new TreeMap<>(new MyComparator()); Set commissionMonthSet = new TreeSet<>(new MyComparator()); for (SysOrderCommisionDayDetail sysOrderCommisionDayDetail : orderDetailList) { String yearMonth = sysOrderCommisionDayDetail.getOrderTime().getYear()+""+sysOrderCommisionDayDetail.getOrderTime().getMonth().getValue(); if(orderAmount.containsKey(yearMonth)){ - orderAmount.put(yearMonth, orderAmount.get(yearMonth) + sysOrderCommisionDayDetail.getOrderAmount().doubleValue()); + orderAmount.put(yearMonth, orderAmount.get(yearMonth).add(sysOrderCommisionDayDetail.getOrderAmount())); }else{ - orderAmount.put(yearMonth, sysOrderCommisionDayDetail.getOrderAmount().doubleValue()); + orderAmount.put(yearMonth, sysOrderCommisionDayDetail.getOrderAmount()); } commissionMonthSet.addAll(sysOrderCommisionDayDetail.getEveryYearMonthServerMoney().keySet()); } //获取提成比例以及计算提成 - Map rateMap = getRateByAmount2(sysCommissionDayDetail.getUserId(), sysCommissionDayDetail.getPostId(), orderAmount); + Map rateMap = getRateByAmount(sysCommissionDayDetail.getUserId(), sysCommissionDayDetail.getPostId(), orderAmount); int i = 1; - double commissionA = 0D; + BigDecimal commissionA = new BigDecimal(0); for (String ym : commissionMonthSet) { - double ym_mession = 0; + BigDecimal ym_mession = new BigDecimal(0); if(orderAmount.containsKey(ym)){ - totalCommissionAmount += orderAmount.get(ym) * rateMap.get(ym) / 100D; + totalCommissionAmount = totalCommissionAmount.add(getMoney(orderAmount.get(ym).doubleValue() * rateMap.get(ym) / 100D, 1)); } for (SysOrderCommisionDayDetail sysOrderCommisionDayDetail : orderDetailList) { Map everyYearMonthServerMoney = sysOrderCommisionDayDetail.getEveryYearMonthServerMoney(); if(everyYearMonthServerMoney.containsKey(ym)){ String orderYearMonth = sysOrderCommisionDayDetail.getOrderTime().getYear()+""+sysOrderCommisionDayDetail.getOrderTime().getMonth().getValue(); - double m = (everyYearMonthServerMoney.get(ym) == null) ? 0 : everyYearMonthServerMoney.get(ym).doubleValue(); - ym_mession += m * rateMap.get(orderYearMonth) / 100D; + BigDecimal m = (everyYearMonthServerMoney.get(ym) == null) ? new BigDecimal(0) : everyYearMonthServerMoney.get(ym); + ym_mession = ym_mession.add(getMoney(m.doubleValue() * rateMap.get(orderYearMonth) / 100D, 1)); } } if(isSendCommissionByYearMonth(ym)){ - totalHasSentCommissionAmount += ym_mession; + totalHasSentCommissionAmount = totalHasSentCommissionAmount.add(ym_mession); }else{ Map map = new HashMap<>(); map.put("yearMonth", ym); - if(i++ != commissionMonthSet.size()){ - map.put("yearMonthCommission", getMoney(ym_mession, 1)); + if(i != commissionMonthSet.size()){ + //计算未发放的提成(除最后一个月) + commissionA = commissionA.add(ym_mession); + map.put("yearMonthCommission", ym_mession); }else{ - System.out.println("最后:"+commissionA); - map.put("yearMonthCommission", getMoney(totalCommissionAmount - commissionA, 1)); + //最后一个月除去已发放的月份的提成,再减去前面未发放提成,防止出现误差 + map.put("yearMonthCommission", totalCommissionAmount.subtract(totalHasSentCommissionAmount).subtract(commissionA)); } sendDetailList.add(map); } - commissionA += getMoney(ym_mession, 1).doubleValue(); + i++; } } - sysCommissionDayDetail.setTotalCommissionAmount(getMoney(totalCommissionAmount,1)); - sysCommissionDayDetail.setTotalHasSentCommissionAmount(getMoney(totalHasSentCommissionAmount,1)); - sysCommissionDayDetail.setTotalNotSentCommissionAmount(getMoney(totalCommissionAmount - totalHasSentCommissionAmount,1)); + sysCommissionDayDetail.setTotalCommissionAmount(totalCommissionAmount); + sysCommissionDayDetail.setTotalHasSentCommissionAmount(totalHasSentCommissionAmount); + sysCommissionDayDetail.setTotalNotSentCommissionAmount(totalCommissionAmount.subtract(totalHasSentCommissionAmount)); sysCommissionDayDetail.setSendDetailList(sendDetailList); } + /**判断该月提成是否已发放*/ public boolean isSendCommissionByYearMonth(String yearMonth){ LocalDate localDate = LocalDate.of(Integer.parseInt(yearMonth.substring(0,4)), Integer.parseInt(yearMonth.substring(4)), 1); LocalDate nowDate = LocalDate.now(); - if(localDate.getMonth().getValue() >= 0){ - return false; + long betweenMonth = ChronoUnit.MONTHS.between(localDate, nowDate); + if(betweenMonth > 1){ + return true; + }else if(betweenMonth == 1){ + //判断目前是否大于15号 + return nowDate.getDayOfMonth() > 15 ? true : false; } - return true; + return false; } /** * 根据用户成交总额获取对应比例,再计算提成 * */ - public Map getRateByAmount2(Long userId, Long postId, Map amountMap){ + public Map getRateByAmount(Long userId, Long postId, Map amountMap){ SysCommision tmpQueryCom = new SysCommision(); tmpQueryCom.setUserId(userId); tmpQueryCom.setPostId(postId); List tmpComList = sysCommisionMapper.selectSysCommisionList(tmpQueryCom); Map rateMap = new TreeMap<>(new MyComparator()); for(String yearMonth : amountMap.keySet()){ - double orderAmount = amountMap.get(yearMonth); + BigDecimal orderAmount = amountMap.get(yearMonth); rateMap.put(yearMonth, 0F); if(tmpComList != null && tmpComList.size() > 0){ for (int i = 0; i < tmpComList.size(); i++) { SysCommision com = tmpComList.get(i); double cAmount = com.getAmount().floatValue(); - if (orderAmount <= cAmount && i == 0) { + if (orderAmount.floatValue() <= cAmount && i == 0) { // 第一条规则 rateMap.put(yearMonth,com.getRate()); break; - } else if (i == tmpComList.size() - 1 && orderAmount > cAmount) { + } else if (i == tmpComList.size() - 1 && orderAmount.floatValue() > cAmount) { // 最后一条规则 rateMap.put(yearMonth,com.getRate()); break; - } else if (cAmount < orderAmount && orderAmount <= tmpComList.get(i + 1).getAmount().floatValue()) { + } else if (cAmount < orderAmount.floatValue() && orderAmount.floatValue() <= tmpComList.get(i + 1).getAmount().floatValue()) { // 中间规则 rateMap.put(yearMonth,tmpComList.get(i + 1).getRate()); break; @@ -168,79 +169,6 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService { return rateMap; } - /** - * 根据用户ID统计出该用户在该月所有订单的服务数量、服务总天数、服务订单总额、暂停总天数 - * **/ - public void dealServerOrderCommissionDetail(List orderDetailList, SysCommissionDayDetail sysCommissionDayDetail, String yearMonth){ - //服务订单数量 - int serverOrderCount = 0; - //服务总天数 - int serverTotalDay = 0; - //服务订单总金额 - double serverTotalAmount = 0.0; - //暂停总天数 - int pauseTotalDay = 0; - if(orderDetailList != null){ - for (SysOrderCommisionDayDetail sysOrderCommisionDayDetail : orderDetailList) { - //Map dayMap = ((Map)orderMap.get("everyYearMonthServerDay")); - if(sysOrderCommisionDayDetail.getEveryYearMonthServerDay() != null && sysOrderCommisionDayDetail.getEveryYearMonthServerDay().containsKey(yearMonth)){ - int day = sysOrderCommisionDayDetail.getEveryYearMonthServerDay().get(yearMonth).intValue(); - serverTotalDay += day; - serverOrderCount += day > 0 ? 1 : 0; - } - if(sysOrderCommisionDayDetail.getEveryYearMonthServerMoney() != null && sysOrderCommisionDayDetail.getEveryYearMonthServerMoney().containsKey(yearMonth)){ - serverTotalAmount += sysOrderCommisionDayDetail.getEveryYearMonthServerMoney().get(yearMonth).doubleValue(); - } - //dayMap = ((Map)orderMap.get("everyYearMonthPauseDay")); - if(sysOrderCommisionDayDetail.getEveryYearMonthPauseDay() != null && sysOrderCommisionDayDetail.getEveryYearMonthPauseDay().containsKey(yearMonth)){ - pauseTotalDay += sysOrderCommisionDayDetail.getEveryYearMonthPauseDay().get(yearMonth).intValue(); - } - } - } - sysCommissionDayDetail.setServerOrderTotalCount(serverOrderCount); - sysCommissionDayDetail.setServerTotalDay(serverTotalDay); - sysCommissionDayDetail.setServerTotalAmount(getMoney(serverTotalAmount, 1)); - sysCommissionDayDetail.setServerOrderPauseTotalDay(pauseTotalDay); - //获取提成比例以及计算提成 - getRateByAmount(sysCommissionDayDetail); - - } - - /** - * 根据用户成交总额获取对应比例,再计算提成 - * */ - public void getRateByAmount(SysCommissionDayDetail sysCommissionDayDetail){ - SysCommision tmpQueryCom = new SysCommision(); - tmpQueryCom.setUserId(sysCommissionDayDetail.getUserId()); - tmpQueryCom.setPostId(sysCommissionDayDetail.getPostId()); - List tmpComList = sysCommisionMapper.selectSysCommisionList(tmpQueryCom); - double orderAmount = sysCommissionDayDetail.getOrderTotalAmount().doubleValue(); - sysCommissionDayDetail.setRate(0F); - sysCommissionDayDetail.setCommissionTotalAmount(getMoney(0.0D, 1)); - if(tmpComList != null && tmpComList.size() > 0){ - for (int i = 0; i < tmpComList.size(); i++) { - SysCommision com = tmpComList.get(i); - double cAmount = com.getAmount().floatValue(); - if (orderAmount <= cAmount && i == 0) { - // 第一条规则 - sysCommissionDayDetail.setRate(com.getRate()); - break; - } else if (i == tmpComList.size() - 1 && orderAmount > cAmount) { - // 最后一条规则 - sysCommissionDayDetail.setRate(com.getRate()); - break; - } else if (cAmount < orderAmount && orderAmount <= tmpComList.get(i + 1).getAmount().floatValue()) { - // 中间规则 - sysCommissionDayDetail.setRate(tmpComList.get(i + 1).getRate()); - break; - } - } - } - double serverAmount = sysCommissionDayDetail.getServerTotalAmount().doubleValue(); - serverAmount = serverAmount * sysCommissionDayDetail.getRate() / 100D; - sysCommissionDayDetail.setCommissionTotalAmount(getMoney(serverAmount, 1)); - } - /** * 查询2021年1月份之后所有订单,对订单进行处理,得出每笔订单的相关信息 * */ @@ -251,15 +179,20 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService { Map> userOrderResultMap = new HashMap<>(); for (SysOrder sysOrder : orderList) { //建档时间为空、售后人员ID为空、营养师ID为空、订单金额为空或小于0,都视为异常订单 - if(sysOrder.getStartTime() == null || sysOrder.getAfterSaleId() == null || sysOrder.getNutritionistId() == null + if(sysOrder.getOrderTime() == null || sysOrder.getStartTime() == null || sysOrder.getServeTimeId() == null + || (sysOrder.getAfterSaleId() == null && sysOrder.getNutritionistId() == null) || sysOrder.getAmount() == null || sysOrder.getAmount().doubleValue() < 0){ - System.out.println("客户:"+ sysOrder.getCustomer() +",营养师:"+sysOrder.getNutritionist() + ",售后" + sysOrder.getAfterSale()); + //System.out.println("客户:"+ sysOrder.getCustomer() +",营养师:"+sysOrder.getNutritionist() + ",售后" + sysOrder.getAfterSale()); continue; } //对每笔订单进行处理,统计出该比订单在每年每月对应的服务天数、金额、暂停天数等 SysOrderCommisionDayDetail sysOrderCommisionDayDetail = statisticsOrderMessage(sysOrder); - addUserOrderResultMap(sysOrder.getAfterSaleId(), sysOrderCommisionDayDetail, userOrderResultMap); - addUserOrderResultMap(sysOrder.getNutritionistId(), sysOrderCommisionDayDetail, userOrderResultMap); + if(sysOrder.getAfterSaleId() != null && sysOrder.getAfterSaleId() > 0L){ + addUserOrderResultMap(sysOrder.getAfterSaleId(), sysOrderCommisionDayDetail, userOrderResultMap); + } + if(sysOrder.getNutritionistId() != null && sysOrder.getNutritionistId() > 0L){ + addUserOrderResultMap(sysOrder.getNutritionistId(), sysOrderCommisionDayDetail, userOrderResultMap); + } } return userOrderResultMap; } @@ -433,8 +366,8 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService { /** * double转为BigDecimal,保留一位小数,向下舍去 * */ - public BigDecimal getMoney(double money, int n){ - return new BigDecimal(money).setScale(n, RoundingMode.DOWN); + public BigDecimal getMoney(Double money, int n){ + return new BigDecimal(money).setScale(n, BigDecimal.ROUND_HALF_UP); } /** @@ -449,29 +382,20 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService { } public static void main(String[] args){ - DecimalFormat df = new DecimalFormat("#.#"); - BigDecimal money = new BigDecimal(3300.00/91); - System.out.println(Period.between(LocalDate.of(2020,2, 28), LocalDate.of(2020,1, 27)).getDays()); - System.out.println(ChronoUnit.DAYS.between(LocalDate.of(2021,2, 28), LocalDate.of(2021,3, 1))); - System.out.println(LocalDate.of(2020,1, 20).getYear()); - System.out.println(LocalDate.of(2021,1, 30).plusMonths(1)); + Double s = 31190.1; + /* NumberFormat nf = NumberFormat.getNumberInstance(); + // 保留小数位数 + nf.setMaximumFractionDigits(1); + // 如果不需要四舍五入,可以使用 + nf.setRoundingMode(RoundingMode.DOWN); + System.out.println(Double.parseDouble(nf.format(s))); + System.out.println( new BigDecimal(nf.format(s)).doubleValue());*/ + System.out.println(new BigDecimal(s).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue()); - System.out.println("s" + LocalDate.of(2021,1, 30).getMonth().getValue()); - - System.out.println("----------------------------"); - LocalDate server_end_date = LocalDate.now().plusMonths(3); - server_end_date = server_end_date.plusDays(7); - server_end_date = server_end_date.minusDays(7); - System.out.println(server_end_date); - - System.out.println(LocalDate.now().getMonth().getValue()); - - Float f = 520.4F; - System.out.println(f * 1 / 100F); - - System.out.println(new BigDecimal(f * 1 / 100F).setScale(1, RoundingMode.DOWN)); + LocalDate localDate = LocalDate.of(2020, 1, 15); + System.out.println(ChronoUnit.MONTHS.between(localDate, LocalDate.now())); + System.out.println(localDate.getDayOfMonth()); + System.out.println(localDate.getDayOfWeek()); + System.out.println(localDate.getDayOfYear()); } - - - } diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml index c82853ec3..089e13cd7 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml @@ -87,15 +87,14 @@ @@ -167,21 +166,21 @@ where id = #{id} - - delete from sys_customer where id = #{id} - + + update sys_customer set del_flag = 1 where id = #{id} + - - delete from sys_customer where id in + + update sys_customer set del_flag = 1 where id in #{id} - + @@ -190,7 +189,7 @@ select sc.id, sc.name, sc.phone, sc.create_time, sc.create_by, sc.update_time, sc.update_by, from sys_customer sc - left join sys_customer_physical_signs scps on scps.customer_id = sc.id + left join sys_customer_physical_signs scps on scps.customer_id = sc.id and scps.del_flag = 0 @@ -201,12 +200,10 @@ diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerPhysicalSignsMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerPhysicalSignsMapper.xml index b92be9a45..601d5bc3d 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerPhysicalSignsMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerPhysicalSignsMapper.xml @@ -38,50 +38,49 @@ + select id, customer_id, sex, age, tall, weight, physical_signs_id, dishes_ingredient_id, photo, constipation, stayLate, motion, make_food_type, make_food_taste, walk, difficulty, weakness, rebound, crux, position, sleep_time, getup_time, connect_time, remarks, blood_data, moisture_date, vocation, - night, experience, create_time, create_by, update_time, update_by from sys_customer_physical_signs + night, experience, comments, create_time, create_by, update_time, update_by from sys_customer_physical_signs @@ -113,10 +112,9 @@ blood_data, moisture_date, vocation, - - night, + night, experience, + comments, create_time, create_by, update_time, @@ -151,6 +149,7 @@ night != null"> #{vocation}, #{night}, #{experience}, + #{comments}, #{createTime}, #{createBy}, #{updateTime}, @@ -189,6 +188,7 @@ night != null"> vocation = #{vocation}, night = #{night}, experience = #{experience}, + comments = #{comments}, create_time = #{createTime}, create_by = #{createBy}, update_time = #{updateTime}, @@ -197,16 +197,16 @@ night != null"> where id = #{id} - - delete from sys_customer_physical_signs where id = #{id} - + + update sys_customer_physical_signs set del_flag = 0 where id = #{id} + - - delete from sys_customer_physical_signs where id in + + update sys_customer_physical_signs set del_flag = 0 where id in #{id} - + @@ -239,6 +239,7 @@ night != null"> vocation = #{vocation}, night = #{night}, experience = #{experience}, + comments = #{comments}, create_time = #{createTime}, create_by = #{createBy}, update_time = #{updateTime}, @@ -247,11 +248,11 @@ night != null"> where customer_id = #{customerId} - - delete from sys_customer_physical_signs where customer_id in + + update sys_customer_physical_signs set del_flag = 0 where customer_id in #{id} - + \ No newline at end of file diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml index 9a18ec711..44854bfc9 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml @@ -36,19 +36,24 @@ + + + + select o.order_id, o.review_status, o.customer, o.phone, o.amount, o.start_time, o.pause_time, o.status, o.weight, ser.dict_label as serve_time, o.serve_time_id, o.pay_type_id, pay.dict_label as pay_type, o.pre_sale_id, o.create_by, o.create_time, o.after_sale_id, o.update_by, o.update_time, o.nutritionist_id, o.remark, o.nutri_assis_id, o.account_id, acc.dict_label as account, o.planner_id, o.planner_assis_id, o.operator_id, o.operator_assis_id, - o.recommender, o.order_time,o.give_serve_day from sys_order o + o.recommender, o.order_time,o.give_serve_day,o.conditioning_project_id,cp.dict_label as conditioning_project,o.server_end_time,o.become_fan_time from sys_order o LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'cus_pay_type') AS pay ON pay.dict_value = o.pay_type_id LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'cus_account') AS acc ON acc.dict_value = o.account_id LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'cus_serve_time') AS ser ON ser.dict_value = o.serve_time_id + LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'conditioning_project') AS cp ON cp.dict_value = o.conditioning_project_id - select o.order_id,o.order_time,o.customer,o.review_status,o.amount,o.serve_time_id,o.give_serve_day,o.after_sale_id,su_sale.nick_name as afterSale_name,o.nutritionist_id,su_nutritionist.nick_name as nutritionist_name,sc.create_time as start_time + select o.order_id,o.order_time,o.start_time,o.customer,o.review_status,o.amount,o.serve_time_id,o.give_serve_day,o.after_sale_id,su_sale.nick_name as afterSale_name,o.nutritionist_id,su_nutritionist.nick_name as nutritionist_name 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 - left join sys_customer sc on sc.phone = o.phone and sc.del_flag = 0 where o.order_time >= '2021-01-01' and (su_sale.user_id = #{userId} or su_nutritionist.user_id = #{userId}) diff --git a/stdiet-ui/src/views/custom/commision/detail_day/index.vue b/stdiet-ui/src/views/custom/commision/detail_day/index.vue index 1ce53c99a..e97c3ebf7 100644 --- a/stdiet-ui/src/views/custom/commision/detail_day/index.vue +++ b/stdiet-ui/src/views/custom/commision/detail_day/index.vue @@ -76,7 +76,7 @@ - + @@ -249,6 +250,11 @@ + + +