Helius
2021-11-02 be9b2404f95523923ceaacdc3e127a07da7c96a2
Merge branch 'ty_fix' into alpha
27 files modified
3 files added
564 ■■■■ changed files
zq-erp/src/main/java/com/matrix/system/app/action/ApiCommonAction.java 7 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/action/ApiRankingAction.java 13 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/action/ApiSettingAction.java 15 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/dto/RankingDto.java 3 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/dto/SettingDto.java 13 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/vo/VipInfoVo.java 10 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/common/constance/AppConstance.java 5 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/common/service/BusParameterSettingService.java 40 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/action/VipInfoController.java 1 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveNew.java 6 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipInfo.java 4 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java 2 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/dao/SysOrderDao.java 3 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/dao/SysVipInfoDao.java 5 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/service/SysOrderService.java 3 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/service/SysVipInfoService.java 5 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/service/TaiYanAliyunSmsService.java 48 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java 50 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java 5 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java 77 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java 15 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/statistics/VipStatisticsAction.java 17 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/config/application.properties 10 ●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml 46 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderDao.xml 6 ●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml 60 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html 1 ●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/templates/views/admin/hive/statistics/vip-arrears-list.html 79 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/templates/views/admin/index.html 2 ●●● patch | view | raw | blame | history
zq-erp/src/test/java/com/matrix/ParameterSettingsTool.java 13 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/action/ApiCommonAction.java
@@ -68,12 +68,15 @@
    @Value("${static_resource_url}")
    private String nginxUrl;
    @Value("${login_public_key}")
    private String publicKey;
    @ApiOperation(value = "登陆接口", notes = "手机端登陆接口")
    @ApiResponses({
            @ApiResponse(code = 200, message = "OK",  response = UserInfoVo.class)
    })
    @PostMapping(value = "/login")
    public AjaxResult login(@RequestBody @Validated LoginDto loginDto) {
    public AjaxResult login(@RequestBody @Validated LoginDto loginDto) throws Exception {
        SysUsers user = new SysUsers();
        user.setSuAccount(loginDto.getUsername());
@@ -97,10 +100,12 @@
        userInfoVo.setRoleName(user.getRoleName());
        userInfoVo.setPhoto(user.getSuPhoto());
        String sb = token + "_1" + "_/api/vip/findVipInfoById/972";
        AjaxResult result = AjaxResult.buildSuccessInstance("登陆成功");
        authorityManager.initUserPower(result,user);
        result.putInMap("user", userInfoVo);
        result.putInMap("token", token);
        result.putInMap("rasToken", RSAUtils.encryptByPublicKey(sb, publicKey));
        return result;
    }
zq-erp/src/main/java/com/matrix/system/app/action/ApiRankingAction.java
@@ -86,4 +86,17 @@
        achieveNew.setT1(rankingDto.getType());
        return AjaxResult.buildSuccessInstance(achieveNewDao.selectBeauticianConsumeAchieveRanking(achieveNew));
    }
    @ApiOperation(value = "人头数排名", notes = "人头数排名")
    @ApiResponses({
            @ApiResponse(code = 200, message = "ok", response = RankingVo.class)
    })
    @PostMapping(value = "/findNumOfPeopleRanking")
    public AjaxResult findNumOfPeopleRanking(@RequestBody RankingDto rankingDto) {
        AchieveNew achieveNew = new AchieveNew();
        QueryUtil.setQueryLimitCom(achieveNew);
        achieveNew.setDatatime(new Date());
        achieveNew.setT1(rankingDto.getType());
        return AjaxResult.buildSuccessInstance(achieveNewDao.selectNumOfPeopleAchieveRanking(achieveNew));
    }
}
zq-erp/src/main/java/com/matrix/system/app/action/ApiSettingAction.java
@@ -3,6 +3,7 @@
import com.matrix.core.constance.MatrixConstance;
import com.matrix.core.pojo.AjaxResult;
import com.matrix.core.tools.WebUtil;
import com.matrix.system.app.dto.SettingDto;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.common.constance.AppConstance;
import com.matrix.system.common.dao.BusParameterSettingsDao;
@@ -12,10 +13,7 @@
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
 * @author jyy
@@ -44,4 +42,13 @@
        return result;
    }
    @ApiOperation(value = "根据code获取配置", notes = "根据code获取配置")
    @PostMapping(value = "/findAppSettingsByCode")
    public AjaxResult findAppSettingsByCode(@RequestBody SettingDto settingDto) {
        SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
        AjaxResult result = AjaxResult.buildSuccessInstance("查询成功");
        result.putInMap(settingDto.getCode(), busParameterSettingsDao.selectCompanyParamByCode(settingDto.getCode(),user.getCompanyId()));
        return result;
    }
}
zq-erp/src/main/java/com/matrix/system/app/dto/RankingDto.java
@@ -18,11 +18,12 @@
    public static final String DAY = "1";
    public static final String MONTH = "2";
    public static final String YEAR = "3";
    public static final String WEEK = "4";
    @ApiModelProperty(value = "数据类型 1-销售 2-消耗", example = "1")
    private String dataType;
    @ApiModelProperty(value = "排行榜类型 1-日榜 2-月榜 3-年榜", example = "1")
    @ApiModelProperty(value = "排行榜类型 1-日榜 2-月榜 3-年榜 4-周榜", example = "1")
    private String type;
    public String getDataType() {
zq-erp/src/main/java/com/matrix/system/app/dto/SettingDto.java
New file
@@ -0,0 +1,13 @@
package com.matrix.system.app.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "SettingDto", description = "根据code获取配置参数接收类")
public class SettingDto {
    @ApiModelProperty(value = "code", example = "1")
    private String code;
}
zq-erp/src/main/java/com/matrix/system/app/vo/VipInfoVo.java
@@ -42,6 +42,16 @@
    @ApiModelProperty(value = "累计消费")
    private BigDecimal totalShopping;
    @ApiModelProperty(value = "欠款")
    private BigDecimal arrears;
    public BigDecimal getArrears() {
        return arrears;
    }
    public void setArrears(BigDecimal arrears) {
        this.arrears = arrears;
    }
    public String getPhoto() {
        return photo;
zq-erp/src/main/java/com/matrix/system/common/constance/AppConstance.java
@@ -592,6 +592,11 @@
    public static final String OPEN_SMS_NOTICE = "OPEN_SMS_NOTICE";
    /**
     * 服务单自动配料
     */
    public static final String OPEN_SERVICE_ORDER_AUTO_BATCHING = "OPEN_SERVICE_ORDER_AUTO_BATCHING";
    /**
     * 赠送金额购买产品算赠送购买
     */
    public static final String SHOP_MANAGE_GIFTISFREE = "shopManageGiftisfree";
zq-erp/src/main/java/com/matrix/system/common/service/BusParameterSettingService.java
New file
@@ -0,0 +1,40 @@
package com.matrix.system.common.service;
import com.matrix.core.tools.LogUtil;
import com.matrix.core.tools.StringUtils;
import com.matrix.system.common.bean.BusParameterSettings;
import com.matrix.system.common.bean.SysCompany;
import com.matrix.system.common.constance.AppConstance;
import com.matrix.system.common.dao.BusParameterSettingsDao;
import com.matrix.system.fenxiao.constant.FenxiaoSettingConstant;
import com.matrix.system.score.constant.ScoreSettingConstant;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@Service
@AllArgsConstructor
public class BusParameterSettingService {
    private BusParameterSettingsDao busParameterSettingsDao;
    /**
     * 判断某个设置是否是开启状态
     * 未配置,或者无效settingkey都返回false
     */
    public boolean isSettingOpen(String settingKey,Long companyId) {
        BusParameterSettings busParameterSettings = busParameterSettingsDao.selectCompanyParamByCode(settingKey, companyId);
        return (
                Objects.nonNull(busParameterSettings)
                && StringUtils.isNotBlank(busParameterSettings.getParamValue())
                && AppConstance.IS_Y.equals(busParameterSettings.getParamValue())
                );
    }
}
zq-erp/src/main/java/com/matrix/system/hive/action/VipInfoController.java
@@ -261,6 +261,7 @@
            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()));
            vips.get(0).setArrears(sysOrderService.findVipArrearsByVipId(vips.get(0).getId()));
            AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, vips, 0);
            return result;
        } else {
zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveNew.java
@@ -1,5 +1,7 @@
package com.matrix.system.hive.bean;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.matrix.core.anotations.Extend;
import com.matrix.core.tools.DateUtil;
@@ -13,9 +15,9 @@
 */
public class AchieveNew extends EntityDTOExt {
    @Extend
    private static final long serialVersionUID = 1L;
    private static final long serialVersionUID = 1L;
    @TableId(type = IdType.AUTO)
    private Long  id;
            
    
zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipInfo.java
@@ -9,6 +9,7 @@
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@@ -437,8 +438,7 @@
    private String name;
    private BigDecimal arrears;
}
zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java
@@ -91,4 +91,6 @@
    IPage<AchieveNewStatisticsVo> achieveNewStatistics(Page<AchieveNewStatisticsVo> page,  @Param("record")AchieveNewStatisticsDto queryDto);
     void setPayMethod(@Param("paymethod") String paymethod, @Param("list")  ArrayList<Long> ids);
     List<RankingVo> selectNumOfPeopleAchieveRanking(@Param("record") AchieveNew achieveNew);
}
zq-erp/src/main/java/com/matrix/system/hive/dao/SysOrderDao.java
@@ -9,6 +9,7 @@
import com.matrix.system.shopXcx.api.vo.ErpOrderDetailVo;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@@ -54,4 +55,6 @@
    List<ErpOrderDetailVo> selectErpOrderList(ErpOrderListDto erpOrderListDto);
    ErpOrderDetailVo findUserOrderById(Long orderId);
    BigDecimal selectArrearsByVipId(Long vipId);
}
zq-erp/src/main/java/com/matrix/system/hive/dao/SysVipInfoDao.java
@@ -8,6 +8,7 @@
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
@@ -214,4 +215,8 @@
    int unbundlingSaleMan(Long userId);
    int bindingRecommend(@Param("recommendId") Long recommendId,@Param("userId") Long userId);
    List<Map<String, Object>> selectVipArrearsStatistics(@Param("record") SysVipInfo sysVipInfo, @Param("pageVo") PaginationVO pageVo);
    Integer selectVipArrearsStatisticsTotal(@Param("record") SysVipInfo sysVipInfo);
}
zq-erp/src/main/java/com/matrix/system/hive/service/SysOrderService.java
@@ -12,6 +12,7 @@
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpSession;
import java.math.BigDecimal;
import java.util.List;
/**
@@ -142,4 +143,6 @@
    List<RankingVo> findApiShopAchieveRanking(SysOrder sysOrder);
    BigDecimal findVipArrearsByVipId(Long vipId);
}
zq-erp/src/main/java/com/matrix/system/hive/service/SysVipInfoService.java
@@ -14,6 +14,7 @@
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
 *
@@ -205,4 +206,8 @@
    public int setToBeAnSalesman(Long userId,Long invitationId,long gradeId);
    SysVipInfo findByOpenId(String openId);
    List<Map<String, Object>> findVipArrearsStatistics(SysVipInfo sysVipInfo, PaginationVO pageVo);
    Integer findVipArrearsStatisticsTotal(SysVipInfo sysVipInfo);
}
zq-erp/src/main/java/com/matrix/system/hive/service/TaiYanAliyunSmsService.java
@@ -15,6 +15,7 @@
import com.matrix.system.common.bean.BusParameterSettings;
import com.matrix.system.common.constance.AppConstance;
import com.matrix.system.common.dao.BusParameterSettingsDao;
import com.matrix.system.common.service.BusParameterSettingService;
import com.matrix.system.hive.bean.SysBeauticianState;
import com.matrix.system.hive.bean.SysProjServices;
import com.matrix.system.hive.bean.SysShopInfo;
@@ -48,8 +49,7 @@
    SysBeauticianStateService sysBeauticianStateService;
    BusParameterSettingsDao busParameterSettingsDao;
    BusParameterSettingService busParameterSettingService;
    /**
     * 预约成功短信提醒
     *
@@ -58,12 +58,8 @@
    @Async
    public void sendYycgNotice(SysProjServices services) {
        //短信接口为肽妍公司定制,暂时写死
        if (services.getCompanyId() != 17L) {
            return;
        }
        if (isCloseSmsNotice(services)){
            return;
        }
        if (chackSetting(services)) return;
        SysVipInfo sysVipInfo = vipInfoDao.selectById(services.getVipId());
        SysShopInfo shopInfo = shopInfoService.findById(services.getShopId());
        String date = DateUtil.dateFormatStr(new Date(), "yyyy年MM月dd日");
@@ -81,35 +77,14 @@
    /**
     * 判断是否开启了短信提醒
     * @param services
     * @return
     */
    private boolean isCloseSmsNotice(SysProjServices services) {
        BusParameterSettings openSmsNoticeSetting = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.OPEN_SMS_NOTICE, services.getCompanyId());
        if (StringUtils.isBlank(openSmsNoticeSetting.getParamValue())
                || AppConstance.IS_N.equals(openSmsNoticeSetting.getParamValue())) {
            LogUtil.debug("未开启短信提醒");
            return true;
        }
        return false;
    }
    /**
     * 项目划扣短信提醒
     *
     * @param services
     */
    @Async
    public void sendHkNotice(SysProjServices services) {
        //短信接口为肽妍公司定制,暂时写死
       if (services.getCompanyId() != 17L) {
            return;
        }
        if (isCloseSmsNotice(services)){
            return;
        }
        if (chackSetting(services)) return;
        SysVipInfo sysVipInfo = vipInfoDao.selectById(services.getVipId());
        SysShopInfo shopInfo = shopInfoService.findById(services.getShopId());
        String date = DateUtil.dateFormatStr(new Date(), "yyyy年MM月dd日");
@@ -136,5 +111,16 @@
    }
    private boolean chackSetting(SysProjServices services) {
        //短信接口为肽妍公司定制,暂时写死
        if (services.getCompanyId() != 17L) {
            return true;
        }
        if (!busParameterSettingService.isSettingOpen(AppConstance.OPEN_SMS_NOTICE, services.getCompanyId())) {
            return true;
        }
        return false;
    }
}
zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java
@@ -174,8 +174,7 @@
        boolean flag = projServicesService.skipServiceOrderStep(Dictionary.SALE_MAN_IS_CONSUME_ACHIEVE);
        Set<Long> beautyIds = new HashSet<>();
        for (SysBeauticianState beauticianState : beauticianStateList) {
            // 是否第一次计算改美疗师
            boolean isFirst = true;
@@ -222,13 +221,13 @@
//                }
            }
            List<AchieveNew> beautyList = achieveNewDao.selectBeautyManAchieveList(beauticianState.getStaffId(), projServices.getVipId(), new Date());
            if (CollUtil.isEmpty(beautyList)) {
                achieveNew.setNumberOfPeople(1D / size);
            } else {
                achieveNew.setNumberOfPeople(1D / (size + beautyList.size()));
                achieveNewDao.updateAchieveNumOfPeople(beautyList, achieveNew.getNumberOfPeople());
            }
//            List<AchieveNew> beautyList = achieveNewDao.selectBeautyManAchieveList(beauticianState.getStaffId(), projServices.getVipId(), new Date());
//            if (CollUtil.isEmpty(beautyList)) {
//                achieveNew.setNumberOfPeople(1D / size);
//            } else {
//                achieveNew.setNumberOfPeople(1D / (size + beautyList.size()));
//                achieveNewDao.updateAchieveNumOfPeople(beautyList, achieveNew.getNumberOfPeople());
//            }
            achieveNew.setProjNum(1);
            if (StringUtils.isNotBlank(beauticianState.getExtract())) {
@@ -244,11 +243,14 @@
                achieveNew.setProjTime(beauticianState.getExcTime());
                isFirst = false;
            }
            beautyIds.add(achieveNew.getBeaultId());
            achieveNewList.add(achieveNew);
        }
        if (CollectionUtils.isNotEmpty(achieveNewList)) {
            achieveNewDao.batchInsert(achieveNewList);
            achieveNumOfPeople(beautyIds, projServices.getVipId());
        }
    }
@@ -297,9 +299,31 @@
        }
    }
    /**
     *
     * 合并订单与服务单人头逻辑,即每一个客户对美疗师/顾问来说,每一天同一个客户只算一个人头。
     * 如若A给客户X下订单,并给客户X服务,对A来说只算一个人头
     */
    private void achieveNumOfPeople(Set<Long> beautyIds, Long vipId) {
        for (Long userId : beautyIds) {
            double num;
            List<AchieveNew> achieveNewList = achieveNewDao.selectBeautyManAchieveList(userId, vipId, new Date());
            if (CollUtil.isEmpty(achieveNewList)) {
                num = 1D;
            } else {
                num = 1D / achieveNewList.size();
            }
            achieveNewDao.updateAchieveNumOfPeople(achieveNewList, num);
        }
    }
    @Override
    public void addAchaeveByOrder(SysOrder pageOrder) {
        List<AchieveNew> achieveNewList = new ArrayList<>();
        Set<Long> beautyIds = new HashSet<>();
        if (CollectionUtils.isNotEmpty(pageOrder.getItems())) {
            for (SysOrderItem orderItem : pageOrder.getItems()) {
@@ -309,13 +333,19 @@
                        if (achieveNew !=null   && achieveNew.getGoodsCash()!=null) {
                            buildAchieve(pageOrder,  orderItem, achieveNew);
                            achieveNewList.add(achieveNew);
                            beautyIds.add(achieveNew.getBeaultId());
                        }
                    }
                }
            }
        }
        if (CollectionUtils.isNotEmpty(achieveNewList)) {
            achieveNewDao.batchInsert(achieveNewList);
            if (!beautyIds.isEmpty()) {
                achieveNumOfPeople(beautyIds, pageOrder.getVipId());
            }
        }
    }
@@ -354,7 +384,7 @@
        }
        // 设置顾问人头业绩
        saleAchieveNumOfPeople(achieveNew);
//        saleAchieveNumOfPeople(achieveNew);
        achieveNew.setOrderType(Dictionary.ORDER_TYPE_SEAL);
        achieveNew.setOrderId(pageOrder.getId());
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java
@@ -1853,4 +1853,9 @@
        sysInstoreInfoService.check(instoreInfo);
    }
    @Override
    public BigDecimal findVipArrearsByVipId(Long vipId) {
        return sysOrderDao.selectArrearsByVipId(vipId);
    }
}
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java
@@ -1,12 +1,16 @@
package com.matrix.system.hive.service.imp;
import cn.hutool.core.collection.CollUtil;
import com.google.common.collect.Lists;
import com.matrix.component.asyncmessage.AsyncMessageManager;
import com.matrix.core.constance.MatrixConstance;
import com.matrix.core.exception.GlobleException;
import com.matrix.core.pojo.PaginationVO;
import com.matrix.core.pojo.VerifyResult;
import com.matrix.core.tools.*;
import com.matrix.core.tools.DateUtil;
import com.matrix.core.tools.LogUtil;
import com.matrix.core.tools.StringUtils;
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;
@@ -14,6 +18,7 @@
import com.matrix.system.common.constance.AppConstance;
import com.matrix.system.common.dao.BusParameterSettingsDao;
import com.matrix.system.common.dao.SysUsersDao;
import com.matrix.system.common.service.BusParameterSettingService;
import com.matrix.system.constance.Dictionary;
import com.matrix.system.hive.bean.*;
import com.matrix.system.hive.dao.*;
@@ -116,12 +121,17 @@
    BusParameterSettingsDao busParameterSettingsDao;
    @Autowired
    BusParameterSettingService busParameterSettingService;
    @Autowired
    ScoreVipDetailService scoreVipDetailService;
    @Autowired
    SysVipInfoDao sysVipInfoDao;
    @Autowired
    ShoppingGoodsAssembleDao goodsAssembleDao;
    /**
     * 新增服务单 jyy
@@ -257,7 +267,7 @@
            SysProjUse sysProjUse = projUseService.findById(sysBeauticianState.getPuseId());
            //检查是否已经处于无效状态
            if(Dictionary.TAOCAN_STATUS_WX.equals(sysProjUse.getStatus())){
            if (Dictionary.TAOCAN_STATUS_WX.equals(sysProjUse.getStatus())) {
                return new VerifyResult(true, sysProjUse.getProjName() + "项目已经失效");
            }
@@ -447,7 +457,54 @@
            lastList.add(lastWork);
        }
        LastestWorkBeatuistaffDao.batchInsert(lastList);
        return sysProjServicesDao.update(projServices);
        int i = sysProjServicesDao.update(projServices);
        //根据配置是否完成自动配料
        if (busParameterSettingService.isSettingOpen(AppConstance.OPEN_SERVICE_ORDER_AUTO_BATCHING, checkProjServices.getCompanyId())){
            autoBatching(projServices);
        }
        return i;
    }
    /**
     * 根据配置是否完成自动配料
     *
     * @param projServices
     */
    private void autoBatching(SysProjServices projServices) {
        //获取最新的服务单信息
        projServices=findById(projServices.getId());
        List<SysBeauticianState> beauticianStateList = beauticianStateDao.selectBySerIds(projServices.getId());
        List<SysOutStoreItem> outStoreItemList = Lists.newLinkedList();
        beauticianStateList.stream().forEach(item -> {
            List<ShoppingGoodsAssemble> shoppingGoodsAssembles = goodsAssembleDao.selectGoodsByShoppingGoodsIdAndType(item.getProjId(), ShoppingGoods.SHOPPING_GOODS_TYPE_JJCP);
            if (CollUtil.isNotEmpty(shoppingGoodsAssembles)) {
                outStoreItemList.addAll(shoppingGoodsAssembles.stream().map(assemble -> {
                    SysOutStoreItem outStoreItem = new SysOutStoreItem();
                    outStoreItem.setSkuId(assemble.getAssembleGoodId());
                    outStoreItem.setAmount(Double.parseDouble(assemble.getTotal()+""));
                    outStoreItem.setRemark("自动配料");
                    return outStoreItem;
                }).collect(Collectors.toList()));
            }
        });
        //组合配料参数
        projServices.setOutStoreItem(outStoreItemList);
        //调用配料出库方法
        try {
            modifyPLProjServices(projServices);
        }catch (GlobleException e){
            LogUtil.debug("配料失败:{}",e.getMessage());
        }
    }
@@ -660,7 +717,7 @@
            //发送微信公众号提醒
            UniformMsgParam uniformMsgParam = new UniformMsgParam(projServices.getCompanyId(), UniformMsgParam.GZH_FWWC);
            uniformMsgParam.put("serviceId", projServices.getId());
            asyncMessageManager.sendMsg(AsyncMessageRouting.SEND_UNIFORM_TEMPLATE_MSG ,uniformMsgParam);
            asyncMessageManager.sendMsg(AsyncMessageRouting.SEND_UNIFORM_TEMPLATE_MSG, uniformMsgParam);
            //发送划扣短信提醒
            taiYanAliyunSmsService.sendHkNotice(projServices);
@@ -1062,10 +1119,10 @@
        int i = modify(services);
        if (i > 0) {
            //发送微信公众号提醒
            services=findById(services.getId());
            UniformMsgParam uniformMsgParam=new UniformMsgParam(services.getCompanyId(),UniformMsgParam.GZH_YYCG);
            uniformMsgParam.put("serviceId",services.getId());
            asyncMessageManager.sendMsg(AsyncMessageRouting.SEND_UNIFORM_TEMPLATE_MSG ,uniformMsgParam);
            services = findById(services.getId());
            UniformMsgParam uniformMsgParam = new UniformMsgParam(services.getCompanyId(), UniformMsgParam.GZH_YYCG);
            uniformMsgParam.put("serviceId", services.getId());
            asyncMessageManager.sendMsg(AsyncMessageRouting.SEND_UNIFORM_TEMPLATE_MSG, uniformMsgParam);
            taiYanAliyunSmsService.sendYycgNotice(services);
@@ -1073,10 +1130,6 @@
        }
        return i;
    }
}
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java
@@ -79,6 +79,9 @@
    @Autowired
    ScoreVipDetailService scoreVipDetailService;
    @Autowired
    private SysOrderDao sysOrderDao;
    /**
     * 新增会员储值卡
@@ -440,7 +443,9 @@
    @Override
    public com.matrix.system.app.vo.VipInfoVo findApiVipInfoById(Long id) {
        return sysVipInfoDao.selectVipInfoById(id);
        com.matrix.system.app.vo.VipInfoVo result = sysVipInfoDao.selectVipInfoById(id);
        result.setArrears(sysOrderDao.selectArrearsByVipId(id));
        return result;
    }
    @Override
@@ -669,5 +674,13 @@
    }
    @Override
    public List<Map<String, Object>> findVipArrearsStatistics(SysVipInfo sysVipInfo, PaginationVO pageVo) {
        return sysVipInfoDao.selectVipArrearsStatistics(sysVipInfo, pageVo);
    }
    @Override
    public Integer findVipArrearsStatisticsTotal(SysVipInfo sysVipInfo) {
        return sysVipInfoDao.selectVipArrearsStatisticsTotal(sysVipInfo);
    }
}
zq-erp/src/main/java/com/matrix/system/hive/statistics/VipStatisticsAction.java
@@ -7,7 +7,9 @@
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.common.tools.DataAuthUtil;
import com.matrix.system.hive.bean.AchieveNew;
import com.matrix.system.hive.bean.SysVipInfo;
import com.matrix.system.hive.service.AchieveNewService;
import com.matrix.system.hive.service.SysVipInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -29,6 +31,9 @@
    @Autowired
    private AchieveNewService achieveNewService;
    @Autowired
    private SysVipInfoService sysVipInfoService;
    @RequestMapping(value = "/vipConsumeStatistics")
    @ResponseBody
    public AjaxResult vipConsumeStatistics(AchieveNew achieveNew, PaginationVO pageVo) {
@@ -40,4 +45,16 @@
        int total = achieveNewService.findVipConsumeStatisticsTotal(achieveNew);
        return AjaxResult.buildSuccessInstance(list, total);
    }
    @RequestMapping(value = "/vipArrearsStatistics")
    @ResponseBody
    public AjaxResult vipArrearsStatistics(SysVipInfo sysVipInfo, PaginationVO pageVo) {
        SysUsers sysUsers = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY);
        if (!DataAuthUtil.hasAllShopAuth()) {
            sysVipInfo.setShopId(sysUsers.getShopId());
        }
        int total = sysVipInfoService.findVipArrearsStatisticsTotal(sysVipInfo);
        return AjaxResult.buildSuccessInstance(sysVipInfoService.findVipArrearsStatistics(sysVipInfo, pageVo), total);
    }
}
zq-erp/src/main/resources/config/application.properties
@@ -8,6 +8,10 @@
#spring.datasource.password=123456
#spring.datasource.url=jdbc:mysql://120.27.238.55:3306/hive_test_meidu?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8
spring.datasource.username=ct_test
spring.datasource.password=123456
spring.datasource.url=jdbc:mysql://120.27.238.55:3306/hive_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8
#spring.datasource.username=xc_shop
#spring.datasource.password=xc_shop123!@#
#spring.datasource.url=jdbc:mysql://124.70.222.34/xc_shop?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8
@@ -22,9 +26,9 @@
#spring.datasource.url=jdbc:mysql://47.111.134.136/db_meidu_prd?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/md_test_local?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8
#spring.datasource.username=root
#spring.datasource.password=root
#spring.datasource.url=jdbc:mysql://127.0.0.1:3306/md_test_local?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
@@ -989,6 +989,9 @@
            <if test='record.t1 == "3" and record.datatime != null'>
                and date_format(datatime, '%Y') = date_format(#{record.datatime}, '%Y')
            </if>
            <if test='record.t1 == "4" and record.datatime != null'>
                and date_format(datatime, '%Y-%m-%d %u') = date_format(#{record.datatime}, '%Y-%m-%d %u')
            </if>
        </where>
        group by a.shop_id
        order by amount desc, a.shop_id
@@ -1020,6 +1023,9 @@
            </if>
            <if test='record.t1 == "3" and record.datatime != null'>
                and date_format(datatime, '%Y') = date_format(#{record.datatime}, '%Y')
            </if>
            <if test='record.t1 == "4" and record.datatime != null'>
                and date_format(datatime, '%Y-%m-%d %u') = date_format(#{record.datatime}, '%Y-%m-%d %u')
            </if>
        </where>
        group by a.beault_id
@@ -1066,6 +1072,9 @@
            <if test='record.type == "3" and record.datatime != null'>
                and date_format(datatime, '%Y') = date_format(#{record.datatime}, '%Y')
            </if>
            <if test='record.t1 == "4" and record.datatime != null'>
                and date_format(datatime, '%Y-%m-%d %u') = date_format(#{record.datatime}, '%Y-%m-%d %u')
            </if>
        </where>
        group by b.su_id
        order by amount desc, b.su_id
@@ -1092,6 +1101,9 @@
            </if>
            <if test='record.t1 == "3" and record.datatime != null'>
                and date_format(a.create_time, '%Y') = date_format(#{record.datatime}, '%Y')
            </if>
            <if test='record.t1 == "4" and record.datatime != null'>
                and date_format(a.create_time, '%Y-%m-%d %u') = date_format(#{record.datatime}, '%Y-%m-%d %u')
            </if>
        </where>
        group by a.shop_id
@@ -1193,4 +1205,38 @@
    </update>
    <select id="selectNumOfPeopleAchieveRanking" resultType="com.matrix.system.app.vo.RankingVo">
        select
        b.su_name name,
        b.su_id id,
        b.su_photo photo,
        sum(number_of_people) amount,
        c.shop_short_name shopName
        from achieve_new a
        inner join sys_users b on a.beault_id=b.su_id
        left join sys_shop_info c on a.shop_id=c.ID
        <where>
            <if test="record.companyId != null">
                and a.company_id=#{record.companyId}
            </if>
            <if test="record.shopId != null">
                and a.shop_id=#{record.shopId}
            </if>
            <if test='record.t1 == "1" and record.datatime != null'>
                and date_format(datatime, '%Y-%m-%d') = date_format(#{record.datatime}, '%Y-%m-%d')
            </if>
            <if test='record.t1 == "2" and record.datatime != null'>
                and date_format(datatime, '%Y-%m') = date_format(#{record.datatime}, '%Y-%m')
            </if>
            <if test='record.t1 == "3" and record.datatime != null'>
                and date_format(datatime, '%Y') = date_format(#{record.datatime}, '%Y')
            </if>
            <if test='record.t1 == "4" and record.datatime != null'>
                and date_format(datatime, '%Y-%m-%d %u') = date_format(#{record.datatime}, '%Y-%m-%d %u')
            </if>
        </where>
        group by a.beault_id
        order by amount desc
    </select>
</mapper>
zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderDao.xml
@@ -494,7 +494,7 @@
            MAX(pay_time) payTime,
            GROUP_CONCAT(DISTINCT t2.shop_short_name) shopName
        from sys_order t1
        left join sys_order_flow b on t1.id=b.ORDER_ID and pay_method!='储值卡'
        left join sys_order_flow b on t1.id=b.ORDER_ID and pay_method!='储值卡' and pay_method!='欠款'
        left join sys_shop_info t2 on t1.SHOP_ID=t2.ID
        where t1.VIP_ID=#{vipId} and STATU='已付款';
    </select>
@@ -690,4 +690,8 @@
    </select>
    <select id="selectArrearsByVipId" resultType="java.math.BigDecimal">
        select sum(arrears) from sys_order
        where vip_id=#{vipId} and statu='欠款'
    </select>
</mapper>
zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml
@@ -1473,8 +1473,68 @@
    <select id="selectVipArrearsStatistics" resultType="java.util.Map">
        select
            a.VIP_NAME vipName,
            a.PHONE phone,
            c.shop_short_name shopName,
            sum(b.arrears) arrears,
            count(1) cnt,
            d.su_name staffName
        from sys_vip_info a
         inner join sys_order b on a.ID=b.VIP_ID
         inner join sys_shop_info c on a.SHOP_ID=c.ID
         left join sys_users d on a.STAFF_ID=d.su_id
        where b.STATU='欠款' and b.arrears!=0
            <if test="record.companyId!=null">
                and a.company_id=#{record.companyId}
            </if>
            <if test="record.shopId!=null">
                and a.shop_id=#{record.shopId}
            </if>
            <if test='record.vipName!=null and record.vipName!="" '>
                and (a.vip_name like concat('%', #{record.vipName}, '%') or a.vip_no like concat('%', #{record.vipName}, '%') or a.phone like concat('%', #{record.vipName}, '%'))
            </if>
        group by a.id
        <if test="pageVo !=null"><!-- 判断pageVo对象是否为空 -->
            <if test="pageVo.sort !=null  and pageVo.order !=null">
                order by
                ${pageVo.sort} ${pageVo.order}
            </if>
            <if test="pageVo.offset >=0  and pageVo.limit >0">
                limit
                #{pageVo.offset},#{pageVo.limit}
            </if>
        </if>
    </select>
    <select id="selectVipArrearsStatisticsTotal" resultType="java.lang.Integer">
        select count(1) from (
            select
                a.VIP_NAME vipName,
                a.PHONE phone,
                c.shop_short_name shopName,
                sum(b.arrears) arrears,
                count(1) cnt,
                d.su_name staffName
            from sys_vip_info a
                inner join sys_order b on a.ID=b.VIP_ID
                inner join sys_shop_info c on a.SHOP_ID=c.ID
                left join sys_users d on a.STAFF_ID=d.su_id
            where b.STATU='欠款' and b.arrears!=0
                <if test="record.companyId!=null">
                    and a.company_id=#{record.companyId}
                </if>
                <if test="record.shopId!=null">
                    and a.shop_id=#{record.shopId}
                </if>
                <if test='record.vipName!=null and record.vipName!="" '>
                    and (a.vip_name like concat('%', #{record.vipName}, '%') or a.vip_no like concat('%', #{record.vipName}, '%') or a.phone like concat('%', #{record.vipName}, '%'))
                </if>
            group by a.id
        ) a
    </select>
</mapper>
    
zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html
@@ -150,6 +150,7 @@
                    <el-row style="padding: 10px 20px;">
                        <p>余额:<span v-if="vipInfo.balance != null">{{vipInfo.balance}}元</span></p>
                        <p>积分:<span v-if="vipInfo.pointAll != null">{{vipInfo.pointAll}}</span></p>
                        <p>欠款金额:<span v-if="vipInfo.arrears != null">{{vipInfo.arrears}} 元</span></p>
                        <p>累计消费金额:<span v-if="vipInfo.totalMoney != null">{{vipInfo.totalMoney.toFixed(2)}} 元</span></p>
                        <p>累计消费次数:<span v-if="vipInfo.totalTimes != null">{{vipInfo.totalTimes}} 次</span></p>
                        <p>上次消费时间:<span v-if="vipInfo.payTime">{{vipInfo.payTime}}</span></p>
zq-erp/src/main/resources/templates/views/admin/hive/statistics/vip-arrears-list.html
New file
@@ -0,0 +1,79 @@
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org" xmlns:matrix="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
    content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="../images/favicon.ico">
<!-- 本框架基本脚本和样式 -->
<script type="text/javascript"
        th:src="@{/js/plugin/jquery-2.1.4.min.js}"></script>
<script type="text/javascript" th:src="@{/js/systools/MBase.js}"></script>
</head>
<body class="gray-bg">
    <div class="ibox-content">
    <!-- 搜索框部分start -->
        <form class="form-inline" id="serchform">
        <div class="row mb-10">
                <div class="col-sm-8">
                    <button  onclick="myGrid.serchData()" type="button" class="btn btn-info btn-sm"><i class="fa fa-search" ></i> 搜索</button>
                    <button  onclick="myGrid.resetForm()" type="button"   class="btn btn-default btn-sm"><i class="fa fa-refresh " ></i> 重置</button>
                </div>
            </div>
            <div class="form-group mr-20">
                <input autocomplete="off" placeholder="会员姓名/手机/编号"   name="vipName" type="text" class="form-control" />
            </div>
            <div class="form-group mr-20">
                <label for="staffId">健康顾问</label>
                <select class="form-control autoFull select2"
                        th:data-url="@{/admin/shopAll}"
                        data-value="suId"
                        id="staffId"
                        data-filed="suName"
                        name="staffId">
                    <option value="">--请选择顾问--</option>
                </select>
            </div>
        </form>
        <div id="option-bar" >
            <button matrix:btn="bedList-exportExcel" onclick="exportExcel()" type="button" class="btn btn-default btn-sm"><i class="fa fa-download" ></i> 导出</button>
        </div>
        <table id="mgrid" data-url="" >
            <thead>
                <tr>
                    <th data-formatter="MGrid.indexfn" data-align="center"  data-width="30px" >序号</th>
                    <th data-field="vipName">会员名称</th>
                    <th data-field="phone">手机号码</th>
                    <th data-field="shopName">所属门店</th>
                    <th data-field="arrears" data-sortable="true">欠款金额</th>
                    <th data-field="cnt" data-sortable="true">欠款订单</th>
                    <th data-field="staffName">所属顾问</th>
                </tr>
            </thead>
        </table>
    </div>
    <script type="text/javascript" th:src="@{/js/systools/MJsBase.js}"></script><script type="text/javascript">
        var myGrid;
        $(function(){
            //初始化项目属性搜索列表
            MTools.autoFullSelect();
            $(".select2").select2();
            myGrid=MGrid.initGrid({
                 url:basePath+"/admin/vipStatistics/vipArrearsStatistics"
             });
        });
        // function exportExcel(){
        //     var param=MForm.toUrlParam("#serchform");
        //     window.location.href=basePath+"/admin/moneyCardUseStatistics/exportSummaryItemDetail?"+param;
        // }
    </script>
</body>
</html>
zq-erp/src/main/resources/templates/views/admin/index.html
@@ -89,7 +89,7 @@
                        <i class="fa fa-user" ></i>
                        <span style="line-height: 35px; color: #333; " th:utext="${session.userInfo.suName}+' | '">
                        </span>
                        <a style="line-height: 35px; color: #333; " target="_blank" href="https://www.yuque.com/books/share/70c39d28-6aac-4763-ae92-899ea5822a0d" >
                        <a style="line-height: 35px; color: #333; " target="_blank" href="https://www.yuque.com/books/share/7b10c3aa-f289-4f36-b402-5031fbd7f038" >
                            <i class="fa fa-book" aria-hidden="true"></i>
                            帮助手册</a>
                    </div>
zq-erp/src/test/java/com/matrix/ParameterSettingsTool.java
@@ -119,13 +119,20 @@
        newSetting10.setCategory("店务配置");
        newSettings.add(newSetting10);
        ParameterSettings newSetting11=new ParameterSettings();
        newSetting11.setCode(AppConstance.OPEN_SERVICE_ORDER_AUTO_BATCHING);
        newSetting11.setName("开启服务单自动配料");
        newSetting11.setType(1);
        newSetting11.setCategory("店务配置");
        newSettings.add(newSetting11);
        for (ParameterSettings newSetting : newSettings) {
            List<ParameterSettings> parameterSettings = parameterSettingsDao.selectByModel(newSetting);
            if(CollectionUtil.isEmpty(parameterSettings)){
                parameterSettingsDao.insert(newSetting);
                System.out.println("新增配置"+newSetting.getName());
            }else {
                System.out.println("配置"+newSetting.getName()+"已经存在");
            }
            addSettingsTOAllCompany(newSetting);
        }
@@ -144,8 +151,6 @@
                busParameterSettings.setParamValue("");
                busParameterSettingsDao.insert(busParameterSettings);
                System.out.println(sysCompany.getComName()+"新增成功");
            }else{
                System.out.println("公司"+sysCompany.getComName()+"已经存在配置"+newSetting.getName());
            }
        }