From 00efd2e4db8157ece4116c956c314803ed073042 Mon Sep 17 00:00:00 2001
From: 935090232@qq.com <ak473600000>
Date: Sat, 03 Apr 2021 16:39:15 +0800
Subject: [PATCH] 会员中心手工调整积分
---
zq-erp/src/main/java/com/matrix/system/shopXcx/api/dto/ScoreFlowDto.java | 21 +
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java | 152 ++++++++++
zq-erp/src/main/resources/mybatis/mapper/hive/SysBeauticianStateDao.xml | 5
zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html | 188 +++++++++++++
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java | 2
zq-erp/src/main/java/com/matrix/system/hive/action/VipInfoController.java | 41 --
zq-erp/src/main/java/com/matrix/system/hive/dto/ScoreChangeDto.java | 26 +
zq-erp/src/main/java/com/matrix/system/score/entity/ScoreVipDetail.java | 4
zq-erp/src/main/resources/mybatis/mapper/score/ScoreUseRecordDao.xml | 62 +++-
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java | 150 ++++++++++
zq-erp/src/main/java/com/matrix/system/score/service/ScoreVipDetailService.java | 20 +
zq-erp/src/main/java/com/matrix/core/pojo/BasePageQueryDto.java | 4
zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/ScoreOrderTask.java | 2
zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/SalesOrderRefundTask.java | 2
zq-erp/src/main/java/com/matrix/system/hive/action/ErpShopScoreAction.java | 101 +++++++
zq-erp/src/main/resources/mybatis/mapper/score/ScoreVipDetailDao.xml | 3
zq-erp/src/main/java/com/matrix/config/SwaggerConfig.java | 26 +
17 files changed, 732 insertions(+), 77 deletions(-)
diff --git a/zq-erp/src/main/java/com/matrix/config/SwaggerConfig.java b/zq-erp/src/main/java/com/matrix/config/SwaggerConfig.java
index 035cf82..6b71b6a 100644
--- a/zq-erp/src/main/java/com/matrix/config/SwaggerConfig.java
+++ b/zq-erp/src/main/java/com/matrix/config/SwaggerConfig.java
@@ -79,4 +79,30 @@
.version("1.0")
.build();
}
+
+
+ @Bean
+ public Docket ERPApi(){
+ // 添加请求参数,我们这里把token作为请求头部参数传入后端
+ ParameterBuilder parameterBuilder = new ParameterBuilder();
+ List<Parameter> parameters = new ArrayList<Parameter>();
+ parameterBuilder.name("token").description("令牌").modelRef(new ModelRef("string")).parameterType("header")
+ .required(true).build();
+ parameters.add(parameterBuilder.build());
+
+
+ return new Docket(DocumentationType.SWAGGER_2).apiInfo(ERPApiInfo()).enable(swaggerEnable).select().apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
+ .paths(PathSelectors.ant("/admin/**")).build().globalOperationParameters(parameters).groupName("ERP接口");
+ }
+
+ private ApiInfo ERPApiInfo(){
+ return new ApiInfoBuilder()
+ .title("Hive ERP")
+ .description("This is a restful api document of Hive ERP.")
+ .version("1.0")
+ .build();
+ }
+
+
+
}
diff --git a/zq-erp/src/main/java/com/matrix/core/pojo/BasePageQueryDto.java b/zq-erp/src/main/java/com/matrix/core/pojo/BasePageQueryDto.java
index 630052f..a47fd5b 100644
--- a/zq-erp/src/main/java/com/matrix/core/pojo/BasePageQueryDto.java
+++ b/zq-erp/src/main/java/com/matrix/core/pojo/BasePageQueryDto.java
@@ -14,11 +14,11 @@
public class BasePageQueryDto {
- @NotNull(message = "参数不能为空")
+ @NotNull(message = "pageNum参数不能为空")
@ApiModelProperty(value = "第几页", example = "1")
private Integer pageNum;
- @NotNull(message = "参数不能为空")
+ @NotNull(message = "pageSize参数不能为空")
@ApiModelProperty(value ="数量", example = "10")
private Integer pageSize;
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/action/ErpShopScoreAction.java b/zq-erp/src/main/java/com/matrix/system/hive/action/ErpShopScoreAction.java
new file mode 100644
index 0000000..d5729d1
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/hive/action/ErpShopScoreAction.java
@@ -0,0 +1,101 @@
+package com.matrix.system.hive.action;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.matrix.core.constance.MatrixConstance;
+import com.matrix.core.pojo.AjaxResult;
+import com.matrix.core.tools.WebUtil;
+import com.matrix.system.common.bean.SysUsers;
+import com.matrix.system.hive.bean.SysVipInfo;
+import com.matrix.system.hive.dao.SysVipInfoDao;
+import com.matrix.system.hive.dto.ScoreChangeDto;
+import com.matrix.system.score.dao.ScoreUseRecordDao;
+import com.matrix.system.score.dao.ScoreVipDetailDao;
+import com.matrix.system.score.entity.ScoreVipDetail;
+import com.matrix.system.score.service.ScoreVipDetailService;
+import com.matrix.system.shopXcx.api.dto.ScoreFlowDto;
+import com.matrix.system.shopXcx.api.vo.ScoreUseRecordVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * @author jyy
+ * @date 2021-03-22 15:10
+ */
+@Api(tags = "用户积分接口类")
+@RestController
+@RequestMapping(value = "/admin/score")
+public class ErpShopScoreAction {
+
+
+
+ @Autowired
+ ScoreUseRecordDao scoreUseRecordDao;
+
+ @Autowired
+ ScoreVipDetailDao scoreVipDetailDao;
+
+ @Autowired
+ ScoreVipDetailService scoreVipDetailService;
+
+ @Autowired
+ SysVipInfoDao sysVipInfoDao;
+
+ @ApiOperation(value = "获取积分流水", notes = "")
+ @PostMapping(value = "/getFlowList")
+ @ApiResponses({
+ @ApiResponse(code = 200, message = "ok", response = ScoreUseRecordVo.class)
+ })
+ AjaxResult getFlowList(@RequestBody ScoreFlowDto scoreFlowDto) {
+ SysVipInfo vipInfo = sysVipInfoDao.selectById(scoreFlowDto.getVipId());
+ scoreFlowDto.setUserId(vipInfo.getOpenId());
+ Page<ScoreUseRecordVo> page=new Page<>(scoreFlowDto.getPageNum(),scoreFlowDto.getPageSize());
+ IPage<ScoreUseRecordVo> shopScoreRecord = scoreUseRecordDao.selectFlowList(page,scoreFlowDto);
+ AjaxResult result=AjaxResult.buildSuccessInstance(shopScoreRecord.getRecords(),shopScoreRecord.getTotal());
+ return result;
+ }
+
+
+
+
+
+ @ApiOperation(value = "调整用户积分", notes = "")
+ @PostMapping(value = "/changeUserScore")
+ @ApiResponses({
+ @ApiResponse(code = 200, message = "ok", response = AjaxResult.class)
+ })
+ AjaxResult changeUserScore(@RequestBody @Validated ScoreChangeDto scoreChangeDto) {
+ SysVipInfo vipInfo = sysVipInfoDao.selectById(scoreChangeDto.getVipId());
+ SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
+
+ if(scoreChangeDto.getAmount()>0){
+ scoreVipDetailService.addScore(null,vipInfo.getId(),sysUsers.getSuId(),sysUsers.getShopId(),scoreChangeDto.getAmount(),0L, ScoreVipDetail.SCORE_VIP_TYPE_USERCHANGE,scoreChangeDto.getRemarks());
+ }else if (scoreChangeDto.getAmount()<0){
+ scoreVipDetailService.deductionScore(null,vipInfo.getId(),sysUsers.getSuId(),sysUsers.getShopId(),Math.abs(scoreChangeDto.getAmount()),0L,ScoreVipDetail.SCORE_VIP_TYPE_USERCHANGE,scoreChangeDto.getRemarks());
+ }
+ AjaxResult result=AjaxResult.buildSuccessInstance("调整成功");
+ return result;
+ }
+
+
+
+
+
+
+ @ApiOperation(value = "获取用户积分", notes = "")
+ @PostMapping(value = "/getUserScore/{vipId}")
+ @ApiResponses({
+ @ApiResponse(code = 200, message = "ok", response = AjaxResult.class)
+ })
+ AjaxResult getUserScore(@PathVariable Long vipId) {
+ AjaxResult result=AjaxResult.buildSuccessInstance(scoreVipDetailDao.selectUserTotalScore(null,vipId));
+ return result;
+ }
+
+
+}
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/action/VipInfoController.java b/zq-erp/src/main/java/com/matrix/system/hive/action/VipInfoController.java
index 69717d5..350d982 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/action/VipInfoController.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/action/VipInfoController.java
@@ -9,24 +9,26 @@
import com.matrix.core.tools.excl.ExcelSheetPO;
import com.matrix.core.tools.excl.ExcelUtil;
import com.matrix.core.tools.excl.ExcelVersion;
-import com.matrix.system.common.bean.CustomerDataDictionary;
-import com.matrix.system.common.bean.SystemDictionary;
import com.matrix.system.common.bean.SysUsers;
+import com.matrix.system.common.bean.SystemDictionary;
import com.matrix.system.common.constance.AppConstance;
import com.matrix.system.common.dao.CustomerDataDictionaryDao;
-import com.matrix.system.common.service.SystemDictionaryService;
import com.matrix.system.common.service.SysUsersService;
+import com.matrix.system.common.service.SystemDictionaryService;
import com.matrix.system.common.tools.ResponseHeadUtil;
import com.matrix.system.constance.Dictionary;
import com.matrix.system.constance.SystemConstance;
import com.matrix.system.hive.action.util.QueryUtil;
-import com.matrix.system.hive.bean.*;
+import com.matrix.system.hive.bean.Question;
+import com.matrix.system.hive.bean.SysVipInfo;
+import com.matrix.system.hive.bean.SysVipLevel;
+import com.matrix.system.hive.bean.VipAnswer;
import com.matrix.system.hive.dao.MoneyCardUseDao;
import com.matrix.system.hive.dao.SysVipLabelDao;
import com.matrix.system.hive.dao.VipAnswerDao;
-import com.matrix.core.tools.DateUtil;
import com.matrix.system.hive.pojo.RegisterInfo;
import com.matrix.system.hive.service.*;
+import com.matrix.system.score.dao.ScoreVipDetailDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
@@ -87,6 +89,9 @@
@Resource
private SysOrderService sysOrderService;
+ @Autowired
+ private ScoreVipDetailDao scoreVipDetailDao;
+
@RequestMapping(value = "/showVipLevel")
public @ResponseBody
@@ -119,34 +124,12 @@
@RequestMapping(value = "/showVipInfo")
public @ResponseBody
AjaxResult findByModel(String keyWord) {
- LinkedList<SysVipInfo> userList = null;
- // 获取最近查询客户
- if (WebUtil.getSession().getAttribute(SystemConstance.HISTORY_CUSTOMER) == null) {
- userList = new LinkedList<SysVipInfo>();
- WebUtil.getSession().setAttribute(SystemConstance.HISTORY_CUSTOMER, userList);
- } else {
- userList = (LinkedList<SysVipInfo>) WebUtil.getSession().getAttribute(SystemConstance.HISTORY_CUSTOMER);
- }
+
List<SysVipInfo> vips = vipInfoService.findByVipNoOrTel(keyWord);
if (vips.size() > 0) {
- // 在session存放当前查询的客户
+ vips.get(0).setPointAll(scoreVipDetailDao.selectUserTotalScore(null,vips.get(0).getId()));
vips.get(0).setSysOrder(sysOrderService.findSysOrderTjByVipId(vips.get(0).getId()));
vips.get(0).setLevelCard(cardUseService.findByVipId(vips.get(0).getId()));
- WebUtil.getSession().setAttribute(SystemConstance.CURRENT_CUSTOMER, vips.get(0));
- // 满20后删除一个
- if (userList.size() == 20) {
- userList.poll();
- }
- // 去重标志
- boolean isNoRepeat = true;
- for (SysVipInfo sysVipInfo : userList) {
- if (vips.get(0).getPhone().equals(sysVipInfo.getPhone())) {
- isNoRepeat = false;
- }
- }
- if (isNoRepeat) {
- userList.add(vips.get(0));
- }
vips.get(0).setLabels(sysVipLabelDao.selectByVipId(vips.get(0).getId()));
vips.get(0).setAge(DateUtil.getAgeForBirthDay(vips.get(0).getBirthday1()));
vips.get(0).setBalance(moneyCardUseDao.selectVipCardTotalMoney(vips.get(0).getId()));
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/dto/ScoreChangeDto.java b/zq-erp/src/main/java/com/matrix/system/hive/dto/ScoreChangeDto.java
new file mode 100644
index 0000000..5307e08
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/hive/dto/ScoreChangeDto.java
@@ -0,0 +1,26 @@
+package com.matrix.system.hive.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+
+@Data
+@ApiModel(value = "ScoreChangeDto", description = "积分修改参数接收类")
+public class ScoreChangeDto {
+
+ @NotNull
+ @ApiModelProperty(value = "会员id", example = "1")
+ private Long vipId;
+
+ @NotNull(message = "调整数量不能为空")
+ @ApiModelProperty(value = "调整数量", example = "1")
+ private Integer amount;
+
+ @NotEmpty(message = "调整说明不能为空")
+ @ApiModelProperty(value = "调整说明", example = "线下兑换")
+ private String remarks;
+
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java
index 9417d73..c0feb9d 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java
@@ -13,6 +13,7 @@
import com.matrix.system.app.vo.OrderDetailItemVo;
import com.matrix.system.app.vo.OrderDetailVo;
import com.matrix.system.app.vo.RankingVo;
+import com.matrix.system.common.bean.BusParameterSettings;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.common.dao.BusParameterSettingsDao;
import com.matrix.system.common.dao.SysUsersDao;
@@ -25,6 +26,9 @@
import com.matrix.system.hive.pojo.ShoppingCarItem;
import com.matrix.system.hive.pojo.ShoppingCarItemsVo;
import com.matrix.system.hive.service.*;
+import com.matrix.system.score.constant.ScoreSettingConstant;
+import com.matrix.system.score.entity.ScoreVipDetail;
+import com.matrix.system.score.service.ScoreVipDetailService;
import com.matrix.system.shopXcx.mqTask.MQTaskRouting;
import com.matrix.system.wechart.templateMsg.UniformMsgParam;
import org.springframework.beans.BeanUtils;
@@ -35,6 +39,7 @@
import javax.servlet.http.HttpSession;
import javax.validation.constraints.NotEmpty;
+import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -63,7 +68,11 @@
@Autowired
MoneyCardUseFlowDao moneyCardUseFlowDao;
+ @Autowired
+ ScoreVipDetailService scoreVipDetailService;
+ @Autowired
+ BusParameterSettingsDao busParameterSettingsDao;
@Autowired
SysVipLevelDao sysVipLevelDao;
@@ -362,6 +371,9 @@
// 删除收款记录
sysOrderFlowDao.deleteByOrderId(id);
+ //删除积分
+ scoreVipDetailService.removeByBusinessId(null,order.getVipId(), order.getId());
+
// 取消订单
order.setStatu(Dictionary.ORDER_STATU_YQX);
return sysOrderDao.update(order);
@@ -511,6 +523,141 @@
setShopSelCount(pageOrder);
+ //设置会员积分
+ addVipScore(pageOrder);
+
+ }
+
+ /**
+ * 设置会员消费积分
+ * @param pageOrder
+ */
+ private void addVipScore(SysOrder pageOrder) {
+
+ SysVipInfo vipInfo=sysVipInfoDao.selectById(pageOrder.getVipId());
+
+ List<SysOrderFlow> flows = pageOrder.getFlows();
+ int [] cashScore={0,0,0};
+ //现金支付金额
+ BigDecimal cashPayAmount=flows.stream()
+ .filter(item->(!item.getPayMethod().equals("储值卡"))&&(!item.getPayMethod().equals("欠款")))
+ .map(SysOrderFlow::getAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
+ BusParameterSettings cashConsumption = busParameterSettingsDao.selectCompanyParamByCode(ScoreSettingConstant.CASH_CONSUMPTION, vipInfo.getCompanyId());
+ if(cashPayAmount!=null
+ &&cashPayAmount.compareTo(BigDecimal.ZERO)>0
+ &&StringUtils.isNotBlank(cashConsumption.getParamValue())){
+
+ BigDecimal scoreSetting0 = new BigDecimal(cashConsumption.getParamValue());
+ cashScore[0]= cashPayAmount.divide(scoreSetting0).intValue();
+
+ if(StringUtils.isNotBlank(cashConsumption.getParamValue1())){
+ BigDecimal scoreSetting1 = new BigDecimal(cashConsumption.getParamValue1());
+ cashScore[1]= cashPayAmount.divide(scoreSetting1).intValue();
+ }
+
+ if(StringUtils.isNotBlank(cashConsumption.getParamValue2())){
+ BigDecimal scoreSetting2 = new BigDecimal(cashConsumption.getParamValue2());
+ cashScore[2]= cashPayAmount.divide(scoreSetting2).intValue();
+ }
+ }
+
+ int [] cardScore={0,0,0};
+ //储值卡本金支付金额
+ BigDecimal cardPayAmount=flows.stream()
+ .filter(item->item.getPayMethod().equals("储值卡")&&item.getIsGift().equals("N"))
+ .map(SysOrderFlow::getAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
+
+ BusParameterSettings principalBalanceConsumption = busParameterSettingsDao.selectCompanyParamByCode(ScoreSettingConstant.PRINCIPAL_BALANCE_CONSUMPTION, vipInfo.getCompanyId());
+ if(cardPayAmount!=null
+ &&cardPayAmount.compareTo(BigDecimal.ZERO)>0
+ &&StringUtils.isNotBlank(principalBalanceConsumption.getParamValue())){
+
+ BigDecimal scoreSetting0 = new BigDecimal(principalBalanceConsumption.getParamValue());
+ cardScore[0]= cardPayAmount.divide(scoreSetting0).intValue();
+
+ if(StringUtils.isNotBlank(principalBalanceConsumption.getParamValue1())){
+ BigDecimal scoreSetting1 = new BigDecimal(principalBalanceConsumption.getParamValue1());
+ cardScore[1]= cardPayAmount.divide(scoreSetting1).intValue();
+ }
+
+ if(StringUtils.isNotBlank(principalBalanceConsumption.getParamValue2())){
+ BigDecimal scoreSetting2 = new BigDecimal(principalBalanceConsumption.getParamValue2());
+ cardScore[2]= cardPayAmount.divide(scoreSetting2).intValue();
+ }
+ }
+
+ int [] giftScore={0,0,0};
+ //储值卡本赠送付金额
+ BigDecimal giftPayAmount=flows.stream()
+ .filter(item->item.getPayMethod().equals("储值卡")&&item.getIsGift().equals("Y"))
+ .map(SysOrderFlow::getAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
+ BusParameterSettings bonusBalanceConsumption = busParameterSettingsDao.selectCompanyParamByCode(ScoreSettingConstant.BONUS_BALANCE_CONSUMPTION, vipInfo.getCompanyId());
+ if(giftPayAmount!=null
+ &&giftPayAmount.compareTo(BigDecimal.ZERO)>0
+ &&StringUtils.isNotBlank(bonusBalanceConsumption.getParamValue())){
+
+ BigDecimal scoreSetting0 = new BigDecimal(bonusBalanceConsumption.getParamValue());
+ giftScore[0]= giftPayAmount.divide(scoreSetting0).intValue();
+
+ if(StringUtils.isNotBlank(bonusBalanceConsumption.getParamValue1())){
+ BigDecimal scoreSetting1 = new BigDecimal(bonusBalanceConsumption.getParamValue1());
+ giftScore[1]= giftPayAmount.divide(scoreSetting1).intValue();
+ }
+
+ if(StringUtils.isNotBlank(bonusBalanceConsumption.getParamValue2())){
+ BigDecimal scoreSetting2 = new BigDecimal(bonusBalanceConsumption.getParamValue2());
+ giftScore[2]= giftPayAmount.divide(scoreSetting2).intValue();
+ }
+ }
+
+ int selfScore=cashScore[0]+cardScore[0]+giftScore[0];
+ int parentScore=cashScore[1]+cardScore[1]+giftScore[1];
+ int topParentScore=cashScore[2]+cardScore[2]+giftScore[2];
+
+
+ //添加自己的积分
+ if(selfScore>0){
+ scoreVipDetailService.addScore(null,
+ vipInfo.getId(),
+ pageOrder.getStaffId(),
+ pageOrder.getShopId(),
+ selfScore,
+ pageOrder.getId(),
+ ScoreVipDetail.SCORE_VIP_TYPE_CASH,
+ "消费奖励"
+ );
+ }
+
+ if(vipInfo.getRecommendId()!=null){
+ //推荐注册老带新积分奖励
+ SysVipInfo referrerVip = sysVipInfoDao.selectById(vipInfo.getRecommendId());
+ if(parentScore>0){
+ scoreVipDetailService.addScore(null,
+ referrerVip.getId(),
+ pageOrder.getStaffId(),
+ pageOrder.getShopId(),
+ parentScore,
+ pageOrder.getId(),
+ ScoreVipDetail.SCORE_VIP_TYPE_CASH,
+ "推荐消费奖励"
+ );
+ }
+ //推荐注册二级带新积分奖励
+ if(referrerVip.getRecommendId()!=null){
+ SysVipInfo topVipInfo = sysVipInfoDao.selectById(referrerVip.getRecommendId());
+ if(topParentScore>0){
+ scoreVipDetailService.addScore(null,
+ topVipInfo.getId(),
+ pageOrder.getStaffId(),
+ pageOrder.getShopId(),
+ topParentScore,
+ pageOrder.getId(),
+ ScoreVipDetail.SCORE_VIP_TYPE_CASH,
+ "推荐消费奖励"
+ );
+ }
+ }
+ }
}
/**
@@ -1274,6 +1421,7 @@
sourceOrder.setIsHasRefund(SysOrder.IS_HAS_REFUND_Y);
// sourceOrder.setStatu(Dictionary.ORDER_STATU_TK);
sysOrderDao.update(sourceOrder);
+ SysOrder oldOrder=sysOrderDao.selectById( sysOrder.getOldOrderId());
sysOrder.setId(null);
sysOrder.setStaffId(user.getSuId());
@@ -1310,6 +1458,8 @@
addOrderFlow(sysOrder);
//退款退套餐退项目
refundProjUse(sysOrder);
+ //删除积分
+ scoreVipDetailService.removeByBusinessId(null,oldOrder.getVipId(), oldOrder.getId());
// 设置业绩
achieveNewService.addAchaeveByOrder(sysOrder);
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java
index 9a8f42b..a1f0b08 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java
@@ -12,13 +12,18 @@
import com.matrix.core.tools.WebUtil;
import com.matrix.system.app.dto.ServiceOrderListDto;
import com.matrix.system.app.vo.ServiceOrderListVo;
+import com.matrix.system.common.bean.BusParameterSettings;
import com.matrix.system.common.bean.SysUsers;
+import com.matrix.system.common.dao.BusParameterSettingsDao;
import com.matrix.system.common.dao.SysUsersDao;
import com.matrix.system.constance.Dictionary;
import com.matrix.system.hive.bean.*;
import com.matrix.system.hive.dao.*;
import com.matrix.system.hive.plugin.util.MoneyUtil;
import com.matrix.system.hive.service.*;
+import com.matrix.system.score.constant.ScoreSettingConstant;
+import com.matrix.system.score.entity.ScoreVipDetail;
+import com.matrix.system.score.service.ScoreVipDetailService;
import com.matrix.system.shopXcx.mqTask.MQTaskRouting;
import com.matrix.system.wechart.templateMsg.UniformMsgParam;
import org.apache.commons.collections.CollectionUtils;
@@ -107,6 +112,16 @@
@Autowired
private RabiitMqTemplate rabiitMqTemplate;
+
+ @Autowired
+ BusParameterSettingsDao busParameterSettingsDao;
+
+ @Autowired
+ ScoreVipDetailService scoreVipDetailService;
+
+ @Autowired
+ SysVipInfoDao sysVipInfoDao;
+
@Value("${evn}")
private String evn;
@@ -121,7 +136,7 @@
public SysProjServices addSysProjServices(SysProjServices sysProjServices) throws GlobleException {
//创建服务单
- if(WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY)!=null){
+ if (WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY) != null) {
SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY);
sysProjServices.setCreateStaffId(user.getSuId());
sysProjServices.setShopId(user.getShopId());
@@ -482,6 +497,9 @@
sysOutStoreDao.deleteById(sysOutStore.getId());
sysOutStoreItemDao.deleteByOrderId(sysOutStore.getId());
}
+ //删除积分
+ scoreVipDetailService.removeByBusinessId(null,checkProjServices.getVipId(), checkProjServices.getId());
+
//更新服务单状态
return sysProjServicesDao.update(checkProjServices);
}
@@ -494,7 +512,7 @@
private void backProjCount(SysProjServices projServices) {
List<SysBeauticianState> beauticianStateList = beauticianStateDao.selectBySerIds(projServices.getId());
- Map<Long ,List<SysProjUse>> taocanMap = new HashMap<>();
+ Map<Long, List<SysProjUse>> taocanMap = new HashMap<>();
// 回退项目余额
for (SysBeauticianState beauticianState : beauticianStateList) {
// 该修改为 有效日期判断更新所有
@@ -599,18 +617,129 @@
projServices.setState(Dictionary.SERVICE_STATU_FFJS);
projServices.setConsumeTime(new Date());
- int result=sysProjServicesDao.update(projServices);
+ int result = sysProjServicesDao.update(projServices);
achieveNewService.addAchieveByServiceOrder(projServices);
+ //设置会员积分
+ addVipScore(projServices);
+
//发送微信公众号提醒
- UniformMsgParam uniformMsgParam=new UniformMsgParam(projServices.getCompanyId(),UniformMsgParam.GZH_FWWC);
- uniformMsgParam.put("serviceId",projServices.getId());
- rabiitMqTemplate.sendMsg(MQTaskRouting.SEND_UNIFORM_TEMPLATE_MSG+evn,uniformMsgParam.toJSONString());
+ UniformMsgParam uniformMsgParam = new UniformMsgParam(projServices.getCompanyId(), UniformMsgParam.GZH_FWWC);
+ uniformMsgParam.put("serviceId", projServices.getId());
+ rabiitMqTemplate.sendMsg(MQTaskRouting.SEND_UNIFORM_TEMPLATE_MSG + evn, uniformMsgParam.toJSONString());
+
+
+
return result;
}
+
+
}
+ /**
+ * 设置会员消费积分
+ */
+ private void addVipScore(SysProjServices projServices) {
+
+ SysVipInfo vipInfo =sysVipInfoDao.selectById(projServices.getVipId());
+
+ List<SysBeauticianState> sysBeauticianStates = beauticianStateDao.selectBySerIds(projServices.getId());
+
+
+ double principalPrice = 0D;
+ double giftPrice = 0D;
+ for (SysBeauticianState sysBeauticianState : sysBeauticianStates) {
+ SysProjUse projUse = sysBeauticianState.getProjUse();
+ if (projUse.getSource().equals(Dictionary.TAOCAN_SOURCE_ZS)) {
+ giftPrice += projUse.getPrice();
+ } else {
+ principalPrice += projUse.getPrice();
+ }
+ }
+
+ int[] principalConsumScore = {0, 0, 0};
+ BusParameterSettings principalConsumption = busParameterSettingsDao.selectCompanyParamByCode(ScoreSettingConstant.PRINCIPAL_CONSUMPTION, vipInfo.getCompanyId());
+ //本金消耗
+ if (principalPrice > 0
+ && StringUtils.isNotBlank(principalConsumption.getParamValue())) {
+
+ principalConsumScore[0] = (int) (principalPrice / Double.parseDouble(principalConsumption.getParamValue()));
+
+ if (StringUtils.isNotBlank(principalConsumption.getParamValue1())) {
+ principalConsumScore[1] = (int) (principalPrice / Double.parseDouble(principalConsumption.getParamValue1()));
+ }
+
+ if (StringUtils.isNotBlank(principalConsumption.getParamValue2())) {
+ principalConsumScore[2] = (int) (principalPrice / Double.parseDouble(principalConsumption.getParamValue2()));
+ }
+ }
+
+ int[] giveConsumScore = {0, 0, 0};
+ BusParameterSettings giveConsumption = busParameterSettingsDao.selectCompanyParamByCode(ScoreSettingConstant.GIVE_CONSUMPTION, vipInfo.getCompanyId());
+ //本金消耗
+ if (giftPrice > 0
+ && StringUtils.isNotBlank(giveConsumption.getParamValue())) {
+
+ giveConsumScore[0] = (int) (giftPrice / Double.parseDouble(giveConsumption.getParamValue()));
+
+ if (StringUtils.isNotBlank(giveConsumption.getParamValue1())) {
+ giveConsumScore[1] = (int) (giftPrice / Double.parseDouble(giveConsumption.getParamValue1()));
+ }
+
+ if (StringUtils.isNotBlank(giveConsumption.getParamValue2())) {
+ giveConsumScore[2] = (int) (giftPrice / Double.parseDouble(giveConsumption.getParamValue2()));
+ }
+ }
+
+ int selfScore =principalConsumScore[0]+giveConsumScore[0];
+ int parentScore =principalConsumScore[1]+giveConsumScore[1];
+ int topParentScore =principalConsumScore[2]+giveConsumScore[2];
+
+ //添加自己的积分
+ if (selfScore > 0) {
+ scoreVipDetailService.addScore(null,
+ vipInfo.getId(),
+ projServices.getCreateStaffId(),
+ projServices.getShopId(),
+ selfScore,
+ projServices.getId(),
+ ScoreVipDetail.SCORE_VIP_TYPE_CASH,
+ "消耗奖励"
+ );
+ }
+
+ if (vipInfo.getRecommendId() != null) {
+ //推荐注册老带新积分奖励
+ SysVipInfo referrerVip = sysVipInfoDao.selectById(vipInfo.getRecommendId());
+ if (parentScore > 0) {
+ scoreVipDetailService.addScore(null,
+ referrerVip.getId(),
+ projServices.getCreateStaffId(),
+ projServices.getShopId(),
+ parentScore,
+ projServices.getId(),
+ ScoreVipDetail.SCORE_VIP_TYPE_CASH,
+ "推荐消耗奖励"
+ );
+ }
+ //推荐注册二级带新积分奖励
+ if (referrerVip.getRecommendId() != null) {
+ SysVipInfo topVipInfo = sysVipInfoDao.selectById(referrerVip.getRecommendId());
+ if (topParentScore > 0) {
+ scoreVipDetailService.addScore(null,
+ topVipInfo.getId(),
+ projServices.getCreateStaffId(),
+ projServices.getShopId(),
+ topParentScore,
+ projServices.getId(),
+ ScoreVipDetail.SCORE_VIP_TYPE_CASH,
+ "推荐消耗奖励"
+ );
+ }
+ }
+ }
+ }
// 派单 jyy
@@ -655,9 +784,9 @@
outStore.setOutStoreNo(codeService.getOutStoreCode());
outStore.setShopId(projServices.getShopId());
- if(projServices.getDevisionId()!=null){
+ if (projServices.getDevisionId() != null) {
outStore.setStaffId(projServices.getDevisionId());
- }else{
+ } else {
outStore.setStaffId(sysUsers.getSuId());
}
@@ -682,7 +811,7 @@
double sum = stores.stream().mapToDouble(item2 -> item2.getStoreTotal()).sum();
Double needAmount = MoneyUtil.div(item.getAmount(), Double.valueOf(shoppingGoods.getVolume()));
if (sum < needAmount) {
- throw new GlobleException("出库失败:【" + shoppingGoods.getName()+"-"+shoppingGoods.getCode()+ "库存不足】");
+ throw new GlobleException("出库失败:【" + shoppingGoods.getName() + "-" + shoppingGoods.getCode() + "库存不足】");
}
//循环获取所有批次产品,并扣减库存
for (SysStoreInfo storeInfo : stores) {
@@ -716,7 +845,7 @@
// 设置服务单状态
// projServices.setState(Dictionary.SERVICE_STATU_PLWC);
- if(projServices.getDevisionId()==null){
+ if (projServices.getDevisionId() == null) {
//如果没有设置配料师则默认为操作配料的人为配料师
projServices.setDevisionId(sysUsers.getSuId());
}
@@ -745,11 +874,12 @@
/**
* 服务单收费需要生成出库记录
+ *
* @param projServicesVo
* @return
*/
private boolean isNeedOutStore(SysProjServices projServicesVo) {
- if(CollectionUtils.isNotEmpty(projServicesVo.getOutStoreItem())){
+ if (CollectionUtils.isNotEmpty(projServicesVo.getOutStoreItem())) {
for (SysOutStoreItem item : projServicesVo.getOutStoreItem()) {
if (item.getAmount() != null && item.getAmount() > 0) {
return true;
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java
index bd847d1..5a0def9 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java
@@ -572,7 +572,7 @@
Integer.parseInt(referrerScoreSetting.getParamValue1()),
vipInfo.getId(),
ScoreVipDetail.SCORE_VIP_TYPE_REFERRER,
- "推荐人"+topVipInfo.getVipName()+"推荐会员"
+ "间接推荐会员"
);
}
}
diff --git a/zq-erp/src/main/java/com/matrix/system/score/entity/ScoreVipDetail.java b/zq-erp/src/main/java/com/matrix/system/score/entity/ScoreVipDetail.java
index 4ef9e66..25123d2 100644
--- a/zq-erp/src/main/java/com/matrix/system/score/entity/ScoreVipDetail.java
+++ b/zq-erp/src/main/java/com/matrix/system/score/entity/ScoreVipDetail.java
@@ -32,6 +32,10 @@
* 获取类型(3推荐客户)
*/
public static final int SCORE_VIP_TYPE_REFERRER=3;
+ /**
+ * 获取类型(4人工调整)
+ */
+ public static final int SCORE_VIP_TYPE_USERCHANGE=4;
/** 有效*/
public static final int SCORE_STATUS_YX=1;
diff --git a/zq-erp/src/main/java/com/matrix/system/score/service/ScoreVipDetailService.java b/zq-erp/src/main/java/com/matrix/system/score/service/ScoreVipDetailService.java
index 037fbd0..569cd35 100644
--- a/zq-erp/src/main/java/com/matrix/system/score/service/ScoreVipDetailService.java
+++ b/zq-erp/src/main/java/com/matrix/system/score/service/ScoreVipDetailService.java
@@ -54,7 +54,7 @@
* 扣除用户积分
*/
@Transactional(rollbackFor = Exception.class)
- public void deductionScore(String openId, Long vipId,Long shopId, Integer score, Long businessId, int type,String remark) {
+ public void deductionScore(String openId, Long vipId,Long oprationUserId,Long shopId, Integer score, Long businessId, int type,String remark) {
Long companyId=null;
if(openId!=null){
companyId= bizUserDao.findByOpenId(openId).getCompanyId();
@@ -63,8 +63,12 @@
}else{
throw new IllegalArgumentException("vipId,openId必须有一个");
}
+ String createBy=MatrixConstance.SYSTEM_USER;
+ if(oprationUserId!=null){
+ createBy=sysUsersDao.selectById(oprationUserId).getSuName();
+ }
- List<ScoreVipDetail> effectiveScoreList = scoreVipDetailDao.selectEffectiveScore(openId,null);
+ List<ScoreVipDetail> effectiveScoreList = scoreVipDetailDao.selectEffectiveScore(openId,vipId);
for (ScoreVipDetail scoreVipDetail : effectiveScoreList) {
@@ -89,9 +93,13 @@
scoreVipDetailDao.updateById(scoreVipDetail);
score=Math.abs(surplus);
}
+
+
+
+
//新增扣除记录
- scoreUseRecord.setCreateBy(MatrixConstance.SYSTEM_USER);
- scoreUseRecord.setUpdateBy(MatrixConstance.SYSTEM_USER);
+ scoreUseRecord.setCreateBy(createBy);
+ scoreUseRecord.setUpdateBy(createBy);
scoreUseRecord.setCreateTime(DateTime.now());
scoreUseRecord.setUpdateTime(DateTime.now());
scoreUseRecord.setNowScore(scoreVipDetail.getRemainScore());
@@ -104,6 +112,7 @@
scoreUseRecord.setOpenId(openId);
scoreUseRecord.setVipId(vipId);
scoreUseRecord.setRemarks(remark);
+ scoreUseRecord.setOprationUserId(oprationUserId);
scoreUseRecordDao.insert(scoreUseRecord);
if(surplus > 0 || surplus == 0){
@@ -224,7 +233,7 @@
});
}
- public void removeByBusinessId(String openId, Long vipId, Long oldBusinessId, int type){
+ public void removeByBusinessId(String openId, Long vipId, Long oldBusinessId){
Long companyId=null;
if(openId!=null){
companyId= bizUserDao.findByOpenId(openId).getCompanyId();
@@ -239,7 +248,6 @@
QueryWrapper queryWrapper=new QueryWrapper();
queryWrapper.eq("business_id",oldBusinessId);
queryWrapper.eq("company_id",companyId);
- queryWrapper.eq("type",type);
scoreVipDetailDao.delete(queryWrapper);
scoreUseRecordDao.delete(queryWrapper);
}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/dto/ScoreFlowDto.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/dto/ScoreFlowDto.java
index b1a94b3..b6c8eb1 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/dto/ScoreFlowDto.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/dto/ScoreFlowDto.java
@@ -1,19 +1,30 @@
package com.matrix.system.shopXcx.api.dto;
+import com.fasterxml.jackson.annotation.JsonFormat;
import com.matrix.core.pojo.BasePageQueryDto;
+import com.matrix.core.tools.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
-import javax.validation.constraints.NotNull;
+import java.util.Date;
@Data
@ApiModel(value = "ScoreFlowDto", description = "积分流水查询参数接收类")
public class ScoreFlowDto extends BasePageQueryDto {
- @NotNull(message = "查询月份不能为空")
+
@ApiModelProperty(value = "查询月份",example = "2021-03")
private String queryTime;
+
+ @DateTimeFormat(pattern = DateUtil.DATE_FORMAT_DD)
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone="GMT+8")
+ private Date beginTime;
+
+ @DateTimeFormat(pattern = DateUtil.DATE_FORMAT_DD)
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone="GMT+8")
+ private Date endTime;
@ApiModelProperty(value = "收支类型 不传全部,1,收入,2支出", example = "1")
@@ -22,5 +33,11 @@
@ApiModelProperty(hidden = true)
private String userId;
+ @ApiModelProperty(value = "会员id", example = "1")
+ private Long vipId;
+
+ @ApiModelProperty(value = "备注", example = "1")
+ private String remarks;
+
}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/SalesOrderRefundTask.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/SalesOrderRefundTask.java
index b345782..4a51238 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/SalesOrderRefundTask.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/SalesOrderRefundTask.java
@@ -60,7 +60,7 @@
}
//消费获得积分返还,如果本订单获得了积分则要扣除获得积分
- scoreVipDetailService.removeByBusinessId(order.getUserId(),null,Long.parseLong(order.getId()+""), ScoreVipDetail.SCORE_VIP_TYPE_CASH);
+ scoreVipDetailService.removeByBusinessId(order.getUserId(),null,Long.parseLong(order.getId()+""));
}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/ScoreOrderTask.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/ScoreOrderTask.java
index f099fdc..f83901f 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/ScoreOrderTask.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/ScoreOrderTask.java
@@ -49,7 +49,7 @@
order.setDetails(orderDetails);
//扣除积分
if(order.getScorePay()!=null&&order.getScorePay()>0){
- scoreVipDetailService.deductionScore(order.getUserId(),null,Long.parseLong(order.getStoreId()+""),order.getScorePay(),Long.parseLong(order.getId()+""), ScoreVipDetail.SCORE_VIP_TYPE_CASH,"商城积分抵扣");
+ scoreVipDetailService.deductionScore(order.getUserId(),null,null,Long.parseLong(order.getStoreId()+""),order.getScorePay(),Long.parseLong(order.getId()+""), ScoreVipDetail.SCORE_VIP_TYPE_CASH,"商城积分抵扣");
}else{
//消费获得积分
int addScore=0;
diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysBeauticianStateDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysBeauticianStateDao.xml
index 41b07c4..144ab7e 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysBeauticianStateDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysBeauticianStateDao.xml
@@ -138,9 +138,8 @@
d.SURPLUS_COUNT as pu_SURPLUS_COUNT,
d.ASSEMBLE_ID as pu_ASSEMBLE_ID,
d.price as pu_price,
- d.taocan_id as pu_taocan_id
-
-
+ d.taocan_id as pu_taocan_id,
+ d.source as pu_source
from sys_beautician_state a
left join sys_users b on a.staff_id= b.su_id
left join shopping_goods c on a.proj_id=c.id
diff --git a/zq-erp/src/main/resources/mybatis/mapper/score/ScoreUseRecordDao.xml b/zq-erp/src/main/resources/mybatis/mapper/score/ScoreUseRecordDao.xml
index cb50621..876d0a9 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/score/ScoreUseRecordDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/score/ScoreUseRecordDao.xml
@@ -1,30 +1,54 @@
<?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">
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.matrix.system.score.dao.ScoreUseRecordDao">
- <select id="selectFlowList" resultType="com.matrix.system.shopXcx.api.vo.ScoreUseRecordVo">
+ <select id="selectFlowList" resultType="com.matrix.system.shopXcx.api.vo.ScoreUseRecordVo">
- select a.*,
- b.SHOP_NAME,
- c.su_name as optionName
- from score_use_record a
- left join sys_shop_info b on a.shop_id=b.id
- left join sys_users c on a.opration_user_id=c.su_id
- where a.open_id=#{record.userId}
- and DATE_FORMAT(a.create_time,'%Y-%m')=#{record.queryTime}
- <if test="record.revenueType==1">
- and a.rec_num>0
- </if>
- <if test="record.revenueType==2">
- <![CDATA[ and a.rec_num<0 ]]>
- </if>
- order by a.create_time desc
+ select a.*,
+ b.SHOP_NAME,
+ c.su_name as optionName
+ from score_use_record a
+ left join sys_shop_info b on a.shop_id=b.id
+ left join sys_users c on a.opration_user_id=c.su_id
+ <where>
- </select>
+ <if test="(record.userId!=null and record.userId!='') and (record.vipId!=null and record.vipId!='')">
+ and (a.open_id=#{record.userId} or a.vip_id=#{record.vipId})
+ </if>
+ <if test="(record.userId!=null and record.userId!='') and record.vipId==null">
+ and a.open_id=#{record.userId}
+ </if>
+
+ <if test="(record.vipId!=null and record.vipId!='') and record.userId==null">
+ and a.vip_id=#{record.vipId}
+ </if>
+
+ <if test="record.remarks!=null and record.remarks!=''">
+ and a.remarks like concat('%',#{record.remarks},'%')
+ </if>
+
+ <if test="record.queryTime!=null and record.queryTime!=''">
+ and DATE_FORMAT(a.create_time,'%Y-%m')=#{record.queryTime}
+ </if>
+
+ <if test="record.beginTime != null and record.endTime!=null">
+ and (date(a.create_time) between #{record.beginTime} and #{record.endTime})
+ </if>
+
+ <if test="record.revenueType==1">
+ and a.rec_num>0
+ </if>
+ <if test="record.revenueType==2">
+ <![CDATA[ and a.rec_num<0 ]]>
+ </if>
+ </where>
+ order by a.create_time desc
+
+ </select>
</mapper>
\ No newline at end of file
diff --git a/zq-erp/src/main/resources/mybatis/mapper/score/ScoreVipDetailDao.xml b/zq-erp/src/main/resources/mybatis/mapper/score/ScoreVipDetailDao.xml
index 3f9fa59..7c7cfea 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/score/ScoreVipDetailDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/score/ScoreVipDetailDao.xml
@@ -24,7 +24,8 @@
</if>
<if test="vipId !=null">
and vip_id=#{vipId}
- </if> order by create_time
+ </if>
+ order by create_time
</select>
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html
index 60178c4..15d5daa 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html
@@ -568,6 +568,69 @@
</el-pagination>
</el-row>
</el-tab-pane>
+ <el-tab-pane label="积分记录" name="scoreTab">
+ <el-row style="line-height: 40px;">
+ <el-col :span="8">
+ <el-date-picker v-model="scoreTab.selectTime"
+ type="daterange"
+ range-separator="至"
+ format="yyyy-MM-dd"
+ start-placeholder="开始日期"
+ end-placeholder="结束日期">
+ </el-date-picker>
+ </el-col>
+ <el-col :span="8"> <el-input v-model="scoreTab.remarks" placeholder="请输入备注查询" ></el-input></el-col>
+ <el-col :span="6" style="margin-left: 5px;">
+ <el-button type="primary" @click="scoreCheckQuery">查询</el-button>
+ <el-button type="primary" @click="changeScore">调整</el-button>
+ </el-col>
+ </el-row>
+ <el-row class="table-style">
+ <el-table :data="scoreTab.scoreTableDate"
+ style="width: 100%;">
+ <el-table-column
+ type="index"
+ width="50">
+ </el-table-column>
+ <el-table-column
+ prop="createTime"
+ label="时间">
+ </el-table-column>
+ <el-table-column
+ prop="optionName"
+ label="操作人员">
+ </el-table-column>
+ <el-table-column
+ prop="shopName"
+ label="门店">
+ </el-table-column>
+ <el-table-column
+ prop="recNum"
+ label="修改数量">
+ </el-table-column>
+ <el-table-column
+ prop="nowScore"
+ label="余额">
+ </el-table-column>
+ <el-table-column
+ prop="remarks"
+ label="备注">
+ </el-table-column>
+ </el-table>
+ </el-row>
+ <el-row>
+ <el-pagination
+ background
+ @size-change="scoreCheckSizeChange"
+ @current-change="scoreCheckCurrentChange"
+ :current-page="scoreTab.page.currentPage"
+ :page-sizes="[10, 20, 30, 50]"
+ :page-size="scoreTab.page.pageSize"
+ layout="total, sizes, prev, pager, next, jumper"
+ :total="scoreTab.page.total">
+ </el-pagination>
+ </el-row>
+ </el-tab-pane>
<el-tab-pane label="皮肤检测" name="skinCheck">
<el-row style="line-height: 40px;">
<el-col :span="11">
@@ -624,10 +687,31 @@
</el-pagination>
</el-row>
</el-tab-pane>
+
+
</el-tabs>
</el-main>
</el-container>
</el-container>
+
+ <el-dialog title="积分调整" :visible.sync="scoreTab.showChangePaln">
+ <el-form :model="scoreTab.form">
+ <h3>可用积分:{{vipInfo.pointAll}}</h3>
+ <el-form-item label="调整数量" >
+ <el-input v-model="scoreTab.form.amount" autocomplete="off"></el-input>
+ </el-form-item>
+ <el-form-item label="调整备注" >
+ <el-input v-model="scoreTab.form.remarks" autocomplete="off"></el-input>
+ </el-form-item>
+ </el-form>
+ <div slot="footer" class="dialog-footer">
+ <el-button @click="scoreTab.showChangePaln = false">取 消</el-button>
+ <el-button type="primary" @click="submitChangeScore" >确 定</el-button>
+ </div>
+ </el-dialog>
+
+
+
</div>
</body>
<script type="text/javascript" th:src="@{/js/systools/AjaxProxyVue.js}"></script>
@@ -692,6 +776,23 @@
total : 0
}
},
+ //用户积分tab
+ scoreTab : {
+ scoreTableDate : [],
+ selectTime : '',
+ remarks:'',
+ showChangePaln:false,
+ page : {
+ currentPage : 1,
+ pageSize : 10,
+ total : 0
+ },
+ form:{
+ amount:'',
+ remarks:'',
+ }
+
+ },
// 皮肤检测tab
skinTab : {
skinTableDate : [],
@@ -740,6 +841,7 @@
},
handleSelect(row) {
this.vipInfoFn(row.key);
+ this.searchValue=row.key;
},
// 请求会员信息
vipInfoFn(key) {
@@ -1125,7 +1227,7 @@
},
// 取消
cancelServiceOrder(index, row) {
- MTools.handleItem(basePath + "/admin/projService/cancelOrder?id=" + row.row, "确定取消订单吗?", this.serviceOrderQuery);
+ MTools.handleItem(basePath + "/admin/projService/cancelOrder?id=" + row.id, "确定取消订单吗?", this.serviceOrderQuery);
},
// 修改时间
modifyTime(index, row) {
@@ -1215,6 +1317,85 @@
},
/********* 订单Tab end ***********/
+ /************** 积分tab start **************/
+ submitChangeScore(){
+ let _this=this;
+
+ var params={
+ amount:this.scoreTab.form.amount,
+ remarks:this.scoreTab.form.remarks,
+ vipId:this.vipInfo.id
+ };
+
+
+
+ $.AjaxProxy({
+ p:params,
+ json:"json"
+ }).invoke(basePath + "/admin/score/changeUserScore", function (loj) {
+ _this.$message.success('调整成功');
+ _this.scoreTab.showChangePaln=false;
+ _this.scoreTab.form={
+ amount:'',
+ remarks:''
+ }
+ _this.vipInfoFn(_this.searchValue);
+ _this.scoreCheckQuery();
+
+ });
+
+ },
+ changeScore(){
+ if (!this.vipInfo.id) {
+ this.$message.error('请选择用户');
+ return;
+ }else {
+ this.scoreTab.showChangePaln=true;
+ }
+
+ },
+
+ scoreCheckQuery() {
+ this.scoreCheckTableDataQueryFn();
+ },
+ scoreCheckTableDataQueryFn() {
+ let _this = this;
+ let scoreTab = _this.scoreTab;
+ let page = scoreTab.page;
+ var params = {};
+
+ if (!_this.vipInfo.id) {
+ return;
+ }
+
+ params.pageSize = page.pageSize;
+ params.pageNum =page.currentPage ;
+ params.vipId = _this.vipInfo.id;
+ params.remarks = scoreTab.remarks;
+ if (scoreTab.selectTime) {
+ params.beginTime = scoreTab.selectTime?moment(scoreTab.selectTime[0]).format("YYYY-MM-DD"):'';
+ params.endTime = scoreTab.selectTime?moment(scoreTab.selectTime[1]).format("YYYY-MM-DD"):'';
+ }
+ $.AjaxProxy({
+ p:params,
+ json:"json"
+ }).invoke(basePath + "/admin/score/getFlowList", function (loj) {
+ scoreTab.page.total = loj.getResult().total;
+ scoreTab.scoreTableDate = loj.getValue("rows");
+ });
+ },
+ scoreCheckSizeChange(val) {
+ this.scoreTab.page.pageSize = val;
+ this.scoreCheckTableDataQueryFn()
+ },
+ scoreCheckCurrentChange(val) {
+ this.scoreTab.page.currentPage = val;
+ this.scoreCheckTableDataQueryFn()
+ },
+ /************** 积分tab end **************/
+
+
+
/************** 皮肤检测tab start **************/
skinCheckQuery() {
this.skinCheckTableDataQueryFn();
@@ -1304,6 +1485,11 @@
this.skinCheckTableDataQueryFn();
}
}
+ if (tab.name === "scoreTab") {
+ if (_this.scoreTab.scoreTableDate.length <= 0) {
+ this.scoreCheckTableDataQueryFn();
+ }
+ }
},
/********** 标签代码 start ************/
--
Gitblit v1.9.1