jyy
2021-06-19 e522e4d40451b4e46ec79b3d8a3891899196f14f
Merge branch 'score_shop' into api_score_meger
12 files modified
185 ■■■■ changed files
zq-erp/src/main/java/com/matrix/system/hive/action/OrderController.java 2 ●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveNew.java 17 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/plugin/util/MoneyUtil.java 4 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java 11 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java 22 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/statistics/AchieveAction.java 65 ●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml 5 ●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/templates/views/admin/hive-erp/order/orderXq-form.html 2 ●●● patch | view | raw | blame | history
zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/daily-list-new.html 11 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html 34 ●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html 2 ●●● patch | view | raw | blame | history
zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-list-new.html 10 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/action/OrderController.java
@@ -115,7 +115,7 @@
            total = total.add(new BigDecimal(item.getPrice() * item.getCount()));
        }
        SysOrder sysOrderResult = new SysOrder();
        sysOrderResult.setZkTotal(zkTotal.doubleValue());
        sysOrderResult.setZkTotal(zkTotal.setScale(2,BigDecimal.ROUND_DOWN).doubleValue());
        sysOrderResult.setTotal(total.doubleValue());
        return AjaxResult.buildSuccessInstance(Arrays.asList(sysOrderResult));
zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveNew.java
@@ -3,11 +3,9 @@
import com.fasterxml.jackson.annotation.JsonFormat;
import com.matrix.core.anotations.Extend;
import com.matrix.core.tools.DateUtil;
import com.matrix.system.app.dto.BasePageDto;
import com.matrix.system.common.bean.EntityDTOExt;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
 *
@@ -230,6 +228,7 @@
     * 开始时间
     */
    @DateTimeFormat(pattern = DateUtil.DATE_FORMAT_MM)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date  beginTime;
            
    
@@ -237,6 +236,7 @@
     * 结束时间
     */
    @DateTimeFormat(pattern = DateUtil.DATE_FORMAT_MM)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date  endTime;
@@ -251,6 +251,19 @@
    private String cateName;
    /**
     * 业绩规则名称
     */
    private String achieveRuleName;
    public String getAchieveRuleName() {
        return achieveRuleName;
    }
    public void setAchieveRuleName(String achieveRuleName) {
        this.achieveRuleName = achieveRuleName;
    }
    public Double getCardCash() {
        return cardCash;
    }
zq-erp/src/main/java/com/matrix/system/hive/plugin/util/MoneyUtil.java
@@ -62,7 +62,7 @@
        v2=v2==null ? 0:v2;
        BigDecimal b1 = new BigDecimal(Double.toString(v1));
        BigDecimal b2 = new BigDecimal(Double.toString(v2));
        return b1.multiply(b2).doubleValue();
        return b1.multiply(b2).setScale(2,BigDecimal.ROUND_DOWN).doubleValue();
    }
@@ -104,7 +104,7 @@
    
        BigDecimal b1 = new BigDecimal(Double.toString(v1));
        BigDecimal b2 = new BigDecimal(Double.toString(v2));
        return b1.divide(b2, scale, BigDecimal.ROUND_HALF_DOWN).doubleValue();
        return b1.divide(b2, scale, BigDecimal.ROUND_DOWN).doubleValue();
    }
    /**
zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java
@@ -172,8 +172,7 @@
        // 下单人是否计算消耗业绩
        boolean flag = projServicesService.skipServiceOrderStep(Dictionary.SALE_MAN_IS_CONSUME_ACHIEVE);
        //赠送项目是否计算消耗业绩
        boolean zsConsumeAchieve = projServicesService.skipServiceOrderStep(Dictionary.ZS_CONSUME_ACHIEVE);
        for (SysBeauticianState beauticianState : beauticianStateList) {
@@ -188,18 +187,10 @@
            // 是否为赠送业绩
            if (Dictionary.TAOCAN_SOURCE_ZS.equals(projUse.getSource())) {
                if(zsConsumeAchieve){
                    achieveNew.setFreeConsume(projUse.getPrice()*beauticianState.getCount());
                    //计算提成
                    achieveNew.setProjPercentage(
                            calculationProjPercentage(AchieveRuleItem.ACHIEVE_TYPE_ZS,achieveNew.getFreeConsume(),beauticianState.getProjId()));
                }else{
                    continue;
                }
            } else {
                achieveNew.setHisConsume(projUse.getPrice()*beauticianState.getCount());
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java
@@ -1238,13 +1238,21 @@
        if (sysOrderItem.getIsFree().equals(Dictionary.FLAG_NO) && sysOrderItem.getZkPrice() > 0) {
            puse.setSource(Dictionary.TAOCAN_SOURCE_GM);
        } else {
            //赠送产品按原价计算消耗
            puse.setSource(Dictionary.TAOCAN_SOURCE_ZS);
            //赠送项目是否计算消耗业绩否则 赠送产品按原价计算消耗
            boolean zsConsumeAchieve = projServicesService.skipServiceOrderStep(Dictionary.ZS_CONSUME_ACHIEVE);
            if(zsConsumeAchieve){
            if (taocanId == null) {
                puse.setPrice(goodsAssemble.getShoppingGoods().getPrice() );
            } else {
                puse.setPrice(goodsAssemble.getPrice());
            }
            }else{
                puse.setPrice(0D);
            }
        }
        puse.setBalance(MoneyUtil.mul(puse.getPrice(), Double.valueOf(puse.getSurplusCount())));
        puse.setFailTime(failTime);
@@ -1311,6 +1319,9 @@
        sysProjUseDao.update(taocanProjUse);
    }
    @Autowired
    private SysProjServicesService projServicesService;
    /**
     * 根据订单创建用户项目使用情况
     *
@@ -1335,8 +1346,15 @@
            puse.setPrice(sysOrderItem.getZkPrice());
        } else {
            puse.setSource(Dictionary.TAOCAN_SOURCE_ZS);
            //赠送产品按原价计算消耗
            //赠送项目是否计算消耗业绩否则 赠送产品按原价计算消耗
            boolean zsConsumeAchieve = projServicesService.skipServiceOrderStep(Dictionary.ZS_CONSUME_ACHIEVE);
            if(zsConsumeAchieve){
            puse.setPrice(sysOrderItem.getShoppingGoods().getSealPice());
            }else{
                puse.setPrice(0D);
            }
        }
        // 设置失效时间
        Date invalidTime = shoppingGoodsService.calInvalidTime(sysOrderItem.getShoppingGoods(), 1, null);
zq-erp/src/main/java/com/matrix/system/hive/statistics/AchieveAction.java
@@ -9,8 +9,10 @@
import com.matrix.core.tools.WebUtil;
import com.matrix.core.tools.excl.ExcelSheetPO;
import com.matrix.core.tools.excl.ExcelVersion;
import com.matrix.system.common.bean.CustomerDataDictionary;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.common.constance.AppConstance;
import com.matrix.system.common.dao.CustomerDataDictionaryDao;
import com.matrix.system.common.tools.ResponseHeadUtil;
import com.matrix.system.hive.action.util.QueryUtil;
import com.matrix.system.hive.bean.AchieveNew;
@@ -18,8 +20,6 @@
import com.matrix.system.hive.dto.AchieveNewStatisticsDto;
import com.matrix.system.hive.plugin.util.CollectionUtils;
import com.matrix.system.hive.service.AchieveNewService;
import com.matrix.system.hive.service.SysOrderItemService;
import com.matrix.system.hive.service.SysOrderService;
import com.matrix.system.hive.vo.AchieveNewStatisticsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@@ -50,12 +50,6 @@
    private AchieveNewService achieveNewService;
    @Autowired
    private SysOrderService sysOrderService;
    @Autowired
    private SysOrderItemService sysOrderItemService;
    @Autowired
    private AchieveNewDao achieveNewDao;
@@ -82,7 +76,7 @@
     */
    @RequestMapping(value = "/findSumDailyInfoNew")
    public @ResponseBody
    AjaxResult findSumDailyInfoNew(AchieveNew achieveNew, PaginationVO pageVo) {
    AjaxResult findSumDailyInfoNew(@RequestBody  AchieveNew achieveNew) {
        SysUsers sysUsers = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY);
        if(!AppConstance.ZONGDIAN.equals(sysUsers.getShopName())){
            achieveNew.setShopId(sysUsers.getShopId());
@@ -164,17 +158,46 @@
        com.matrix.core.tools.excl.ExcelUtil.createWorkbookAtOutStream(ExcelVersion.V2007, res, os, true);
    }
    @Autowired
    CustomerDataDictionaryDao dataDictionaryDao;
    @RequestMapping(value = "/exportDailyInfoNew")
    public void exportDailyInfoNew(ModelMap model, HttpServletRequest request, HttpServletResponse response, AchieveNew achieveNew) throws IOException {
        //这里是从数据库里查数据并组装成我们想要的数据结构的过程
        SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
        List<CustomerDataDictionary> achieveTyps = dataDictionaryDao.selectByParentCode("YJLX", sysUsers.getCompanyId());
        List<ExcelSheetPO> res = new ArrayList<>();
        ExcelSheetPO orderSheet = new ExcelSheetPO();
        String title = "每日单据明细";
        String title = "员工业绩报表";
        orderSheet.setSheetName(title);
        orderSheet.setTitle(title);
        String[] header = {"年", "月", "日", "订单编号", "订单类型", "会员姓名", "项目名称", "订单金额", "订单业绩", "收款方式", "业绩类型", "员工", "本金消耗", "赠消", "提成", "人头", "项目个数", "项目时间", "顾问", "门店"};
        List<String> headerList =new ArrayList();
        headerList.add("订单时间");
        headerList.add("订单编号");
        headerList.add("订单类型");
        headerList.add("会员姓名");
        headerList.add("产品");
        headerList.add("业绩规则");
        headerList.add("产品分类");
        headerList.add("订单金额");
        headerList.add("现金");
        headerList.add("划扣");
        headerList.add("员工");
        achieveTyps.forEach(item->{headerList.add(item.getValue());});
        headerList.add("本金消耗");
        headerList.add("赠消");
        headerList.add("提成");
        headerList.add("人头");
        headerList.add("项目个数");
        headerList.add("项目时间");
        headerList.add("顾问");
        headerList.add("门店");
        String[] header =  headerList.toArray(new String[headerList.size()]);
        orderSheet.setHeaders(header);
        SysUsers sysUsers = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY);
        if(!AppConstance.ZONGDIAN.equals(sysUsers.getShopName())){
            achieveNew.setShopId(sysUsers.getShopId());
        }
@@ -185,17 +208,25 @@
        if (dataList.size() > 0) {
            for (AchieveNew item : dataList) {
                List<Object> temp = new ArrayList<>();
                temp.add(item.getYear());
                temp.add(item.getMonth());
                temp.add(item.getDay());
                temp.add(DateUtil.dateFormatStr(item.getDatatime(), DateUtil.DATE_FORMAT_MM));
                temp.add(item.getOrderNo());
                temp.add(item.getOrderType());
                temp.add(item.getVipName());
                temp.add(item.getProName());
                temp.add(item.getAchieveRuleName());
                temp.add(item.getCateName());
                temp.add(item.getZkTotal());
                temp.add(item.getGoodsCash());
                temp.add(item.getPayMethod());
                temp.add(item.getCardCash());
                temp.add(item.getMeiliao());
                //动态导出列----
                achieveTyps.forEach(item2->{
                    if(item2.getValue().equals(item.getAchieveType())){
                        temp.add(item.getGoodsCash());
                    }else{
                        temp.add("");
                    }
                 });
                temp.add(item.getHisConsume());
                temp.add(item.getFreeConsume());
                temp.add(item.getProjPercentage());
zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
@@ -52,6 +52,7 @@
        <result property="goodsName" column="goodsName" />
        <result property="cateName" column="cateName" />
        <result property="achieveRuleName" column="achieveRuleName" />
    </resultMap>
@@ -68,6 +69,7 @@
        e.name as pro_name,
        b.ZK_TOTAL as zk_total,
        a.his_consume,
        er.name as achieveRuleName,
        a.free_consume,
        f.su_name meiliao,
        g.su_name guwen,
@@ -88,6 +90,7 @@
        left join sys_vip_info c on a.vip_id=c.id
        left join sys_vip_level d on c.LEVEL_ID=d.id
        left join shopping_goods e on a.shopping_goods_id=e.id
        left join achieve_rule er on e.achieve_rule_id=er.id
        LEFT JOIN sys_users f on a.beault_id=f.su_id
        LEFT JOIN sys_users g on a.sale_id = g.su_id
        LEFT JOIN sys_shop_info h ON a.SHOP_ID = h.ID
@@ -1044,7 +1047,7 @@
            b.code goodsNo,
            b.name goodsName,
            c.su_name meiliao,
            d.count*d.zk_price zk_total
            TRUNCATE(d.count*d.zk_price,2) zk_total
        from achieve_new a
        left join shopping_goods b on a.shopping_goods_id=b.id
        left join sys_users c on a.beault_id=c.su_id
zq-erp/src/main/resources/templates/views/admin/hive-erp/order/orderXq-form.html
@@ -765,7 +765,7 @@
                _this.dialogSettleVisible = true;
            },
            calOrderTotalFormatter(row, column) {
                return row.count * row.zkPrice;
                return (row.count * row.zkPrice).toFixed(2);
            },
            getVipMoneyCards() {
                let _this = this;
zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/daily-list-new.html
@@ -111,6 +111,7 @@
            <el-table-column prop="orderType" label="订单类型"></el-table-column>
            <el-table-column prop="vipName" label="会员姓名"></el-table-column>
            <el-table-column prop="proName" label="产品" width="200"></el-table-column>
            <el-table-column prop="achieveRuleName" label="业绩规则" width="200"></el-table-column>
            <el-table-column prop="cateName" label="产品分类"></el-table-column>
            <el-table-column prop="zkTotal" label="订单金额"></el-table-column>
            <el-table-column prop="goodsCash" label="现金"></el-table-column>
@@ -187,7 +188,14 @@
                let _this = this;
                let form = _this.form;
                let page = _this.page;
                let params = _this.form;
                let params = {};
                params.year=form.year;
                params.month=form.month;
                params.year=form.year;
                params.day=form.day;
                params.vipQueryKey=form.vipQueryKey;
                params.beaultId=form.beaultId;
                params.shopId=form.shopId;
                params.limit = page.size;
                params.offset = (page.currentPage - 1) * page.size;
@@ -195,6 +203,7 @@
                    params.beginTime = form.timeRange?moment(form.timeRange[0]).format("YYYY-MM-DD HH:mm"):'';
                    params.endTime = form.timeRange?moment(form.timeRange[1]).format("YYYY-MM-DD HH:mm"):'';
                }
                AjaxProxy.requst({
                    app: _this,
                    data: params,
zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html
@@ -767,7 +767,7 @@
                                                    commission : 0,
                                                    achieveType : _this.achieveTypeList[0].value,
                                                    isShare: false,
                                                    payMethod:item.payMethod,
                                                    payMethod:"现金",
                                                });
                                            });
                                            _this.order.payMoney = orderPayMoney;
@@ -999,9 +999,14 @@
                if (this.checkSubmitOrder()) {
                    let _this = this;
                    //是否全部为储值卡支付
                    let isCardPay=true;
                    if(submitType == 1) {
                        //校验支付方式
                        if (_this.payMoneys.length > 0) {
                            let flows = []
                            var total = 0;
@@ -1019,6 +1024,8 @@
                                if (item.type == '储值卡'){
                                    flow.isGift = item.isGift;
                                    flow.cardId = item.id;
                                }else{
                                    isCardPay=false;
                                }
                                total += parseFloat(item.money);
                                flows.push(flow)
@@ -1028,27 +1035,38 @@
                                return false;
                            }
                            _this.order.flows = flows;
                        } else {
                            this.$message.warning("请选择支付方式");
                            return false;
                        }
                    }
                    console.log("isCardPay",isCardPay);
                    //匹配业绩
                    _this.order.items.forEach(item=>{
                        item.achieveList = [];
                    })
                    _this.achieveList.forEach(achieve => {
                        for (let i = 0; i < _this.order.items.length; i++) {
                            let item = _this.order.items[i];
                            if (!item.achieveList){
                                item.achieveList = [];
                            }
                            if (item.uuid == achieve.orderItem.uuid) {
                                let payMethod=achieve.payMethod;
                                    if(isCardPay){
                                    //如果是储值卡支付,则业绩自动切换到划扣金额
                                        payMethod="划扣";
                                    }
                                let achieveNew = {
                                    uuid:item.uuid,
                                    beaultId: achieve.saleId,
                                    projPercentage: achieve.commission,
                                    achieveType: achieve.achieveType,
                                    goodsCash: achieve.goodsCash,
                                    payMethod: achieve.payMethod,
                                    payMethod: payMethod,
                                };
                               item.achieveList.push(achieveNew);
                                break;
@@ -1154,9 +1172,9 @@
             */
            chouseGoods() {
                let _this = this;
                // this.multipleSelection.forEach(item => {
                //     _this.pushToSelectGoods(item, BUY_TYPE_NOT_FREE);
                // });
                _this.multipleSelection.forEach(item => {
                    _this.pushToSelectGoods(item, BUY_TYPE_NOT_FREE);
                });
                this.closeXm();
                this.calculationTotal();
            },
zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html
@@ -785,7 +785,7 @@
                _this.dialogSettleVisible = true;
            },
            calOrderTotalFormatter(row, column) {
                return row.count * row.zkPrice;
                return (row.count * row.zkPrice).toFixed(2);
            },
            getVipMoneyCards() {
                let _this = this;
zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-list-new.html
@@ -113,6 +113,7 @@
            <el-table-column prop="orderType" label="订单类型"></el-table-column>
            <el-table-column prop="vipName" label="会员姓名"></el-table-column>
            <el-table-column prop="proName" label="产品" width="200"></el-table-column>
            <el-table-column prop="achieveRuleName" label="业绩规则" width="200"></el-table-column>
            <el-table-column prop="cateName" label="产品分类"></el-table-column>
            <el-table-column prop="zkTotal" label="订单金额"></el-table-column>
            <el-table-column prop="goodsCash" label="现金"></el-table-column>
@@ -190,7 +191,14 @@
                let _this = this;
                let form = _this.form;
                let page = _this.page;
                let params = _this.form;
                let params = {};
                params.year=form.year;
                params.month=form.month;
                params.year=form.year;
                params.day=form.day;
                params.vipQueryKey=form.vipQueryKey;
                params.beaultId=form.beaultId;
                params.shopId=form.shopId;
                params.limit = page.size;
                params.offset = (page.currentPage - 1) * page.size;