jyy
2021-03-12 baa79615425b71521e67ec8a9344b88ce53fc5de
Merge remote-tracking branch 'origin/score_shop' into score_shop

# Conflicts:
# zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/OrderTask.java
4 files added
43 files modified
1821 ■■■■■ changed files
zq-erp/pom.xml 1 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/TestClass.java 4 ●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/constance/Dictionary.java 5 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/fenxiao/action/FenXiaoUserAction.java 50 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/fenxiao/dao/ShopSalesmanApplyDao.java 3 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/fenxiao/dao/ShopSalesmanGradeDao.java 6 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/fenxiao/dto/AddSaleManApplyDto.java 17 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/fenxiao/dto/ShopSalesmanAppliingDto.java 2 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/fenxiao/entity/ShopSalesmanApply.java 3 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/fenxiao/service/ShopSalesmanApplyService.java 51 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/fenxiao/vo/ShopSalesmanGradeVo.java 17 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/action/OrderController.java 54 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/action/ProjServiceController.java 19 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveNew.java 106 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrder.java 80 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrderItem.java 32 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java 10 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/dao/SysProjServicesDao.java 2 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java 22 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java 193 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java 35 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/statistics/AchieveAction.java 51 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesmanAction.java 3 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/OrderTask.java 4 ●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/config/db/increment/美度业绩升级.sql 13 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/fenxiao/ShopSalesmanApplyDao.xml 22 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/fenxiao/ShopSalesmanGradeDao.xml 11 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml 133 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/hive/SysBeauticianStateDao.xml 3 ●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/hive/SysBusinessDataDao.xml 18 ●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderDao.xml 25 ●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderItemDao.xml 10 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/hive/SysProjServicesDao.xml 6 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/hive/TjVipSumDao.xml 52 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/readme-jyy 11 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/static/templates/vipInfoImport.xls patch | view | raw | blame | history
zq-erp/src/main/resources/static/templates/vipProjUse.xls patch | view | raw | blame | history
zq-erp/src/main/resources/templates/views/admin/fenxiao/fenxiao-apply.html 59 ●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/templates/views/admin/hive-erp/order/orderXq-form.html 158 ●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/daily-list-new.html 101 ●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html 199 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html 150 ●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/pbxq-form.html 6 ●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/underlineOrder.html 24 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html 12 ●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-list-new.html 36 ●●●● patch | view | raw | blame | history
zq-erp/src/test/java/com/matrix/SourceFlowTests.java 2 ●●● patch | view | raw | blame | history
zq-erp/pom.xml
@@ -401,7 +401,6 @@
                    <exclude>**/*.woff</exclude>
                    <exclude>**/*.woff2</exclude>
                    <exclude>**/*.ttf</exclude>
zq-erp/src/main/java/com/matrix/TestClass.java
@@ -1,9 +1,7 @@
package com.matrix;
import java.io.FileWriter;
import java.io.IOException;
import java.math.BigDecimal;
public class TestClass {
    public static void main(String[] args) throws IOException {
@@ -19,7 +17,7 @@
//            printer.printRecord(cells);
//        }
//        printer.flush();
//        printer.close();
//        printer.close();
        long t2 = System.currentTimeMillis();
        System.out.println("CSV: " + (t2 - t1));
    }
zq-erp/src/main/java/com/matrix/system/constance/Dictionary.java
@@ -55,10 +55,7 @@
     * 支付方式-现金支付
     */
    String PAY_TYPE_MOENY = "现金";
    /**
     * 支付方式-现金支付
     */
    String PAY_TYPE_MOENY_CARD = "会员卡";
    /**
     * 支付方式-卡支付
     */
zq-erp/src/main/java/com/matrix/system/fenxiao/action/FenXiaoUserAction.java
@@ -2,19 +2,26 @@
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.StringUtils;
import com.matrix.core.tools.WebUtil;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.fenxiao.dto.AddSaleManApplyDto;
import com.matrix.system.fenxiao.dto.ShopSalesmanAppliingDto;
import com.matrix.system.fenxiao.dto.ShopSalesmanApplyDto;
import com.matrix.system.fenxiao.service.ShopSalesmanApplyService;
import com.matrix.system.fenxiao.vo.ShopSalesmanAppliingVo;
import com.matrix.system.fenxiao.vo.ShopSalesmanApplyVo;
import com.matrix.system.fenxiao.vo.ShopSalesmanGradeVo;
import com.matrix.system.hive.action.util.QueryUtil;
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.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping(value = "/fenXiao/fenXiaoUser")
@@ -41,23 +48,12 @@
            shopSalesmanApplyDto.setOrder("desc");
        }
        
        Page<ShopSalesmanApplyVo> page = new Page(shopSalesmanApplyDto.getPageNum(), shopSalesmanApplyDto.getPageSize());
        IPage<ShopSalesmanApplyVo> rows = shopSalesmanApplyService.findShopSalesmanApplyList(page,shopSalesmanApplyDto);
        AjaxResult result = AjaxResult.buildSuccessInstance(rows.getRecords(),rows.getTotal());
        return result;
    }
    /**
     * 跳转 分销员待审核记录页面
     *
    @RequestMapping(value = "/shopSalesmanAppliing")
    public String shopSalesmanAppliing() {
        return "admin/fenxiao/fenxiao-apply";
    }
     */
    
    /**
     *获取分销员待审核记录
@@ -71,8 +67,6 @@
    AjaxResult findShopSalesmanAppliingList(@RequestBody ShopSalesmanAppliingDto shopSalesmanAppliingDto) {
        //设置用户公司ID
        QueryUtil.setQueryLimitCom(shopSalesmanAppliingDto);
        //查询条件待审核状态
        shopSalesmanAppliingDto.setApplyStatus(1);
        //排序
        if(StringUtils.isBlank(shopSalesmanAppliingDto.getSort())){
            shopSalesmanAppliingDto.setSort("create_time");
@@ -80,9 +74,37 @@
        }
        Page<ShopSalesmanAppliingVo> page = new Page(shopSalesmanAppliingDto.getPageNum(), shopSalesmanAppliingDto.getPageSize());
        IPage<ShopSalesmanAppliingVo> rows = shopSalesmanApplyService.findShopSalesmanAppliingList(page,shopSalesmanAppliingDto);
        IPage<ShopSalesmanAppliingVo> rows = shopSalesmanApplyService.selectBizUserApplyList(page,shopSalesmanAppliingDto);
        //IPage<ShopSalesmanAppliingVo> rows = shopSalesmanApplyService.findShopSalesmanAppliingList(page,shopSalesmanAppliingDto);
        AjaxResult result = AjaxResult.buildSuccessInstance(rows.getRecords(),rows.getTotal());
        return result;
    }
    /**
     *获取对应的分销员等级
     */
    @RequestMapping(value = "/getShopSalesmanGrade")
    private @ResponseBody AjaxResult getShopSalesmanGradeVo(){
        AjaxResult result= AjaxResult.buildSuccessInstance("查询成功");
        SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
        List<ShopSalesmanGradeVo> dataList = shopSalesmanApplyService.getShopSalesmanGradeVo(user.getCompanyId());
        result.putInMap("salesGrade", dataList);
        return result;
    }
    /**
     *新增分销员
     */
    @ApiOperation(value = "新增分销员")
    @PostMapping(value = "/addSaleManApply")
    public @ResponseBody
    AjaxResult findShopSalesmanAppliingList(@RequestBody AddSaleManApplyDto addSaleManApplyDto) {
        AjaxResult result= AjaxResult.buildSuccessInstance("设置成功");
        SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
        shopSalesmanApplyService.addSaleManApply(addSaleManApplyDto.getUserId(),addSaleManApplyDto.getGradeId());
        return result;
    }
}
zq-erp/src/main/java/com/matrix/system/fenxiao/dao/ShopSalesmanApplyDao.java
@@ -28,4 +28,7 @@
    IPage<ShopSalesmanAppliingVo> findShopSalesmanAppliingList(Page<ShopSalesmanAppliingVo> page,
            @Param("record")ShopSalesmanAppliingDto shopSalesmanAppliingDto);
    IPage<ShopSalesmanAppliingVo> selectBizUserApplyList(Page<ShopSalesmanAppliingVo> page,
            @Param("record")ShopSalesmanAppliingDto shopSalesmanAppliingDto);
}
zq-erp/src/main/java/com/matrix/system/fenxiao/dao/ShopSalesmanGradeDao.java
@@ -2,6 +2,10 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.matrix.system.fenxiao.entity.ShopSalesmanGrade;
import com.matrix.system.fenxiao.vo.ShopSalesmanGradeVo;
import io.lettuce.core.dynamic.annotation.Param;
import java.util.List;
/**
 * @description 推广员等级
@@ -10,4 +14,6 @@
 */
public interface ShopSalesmanGradeDao extends BaseMapper<ShopSalesmanGrade> {
    List<ShopSalesmanGradeVo> getShopSalesmanGradeVo(@Param("companyId")Long companyId);
}
zq-erp/src/main/java/com/matrix/system/fenxiao/dto/AddSaleManApplyDto.java
New file
@@ -0,0 +1,17 @@
package com.matrix.system.fenxiao.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "AddSaleManApplyDto", description = "查询参数")
public class AddSaleManApplyDto {
    @ApiModelProperty(value ="会员ID")
    private String userId;
    @ApiModelProperty(value ="等级ID")
    private String gradeId;
}
zq-erp/src/main/java/com/matrix/system/fenxiao/dto/ShopSalesmanAppliingDto.java
@@ -15,8 +15,6 @@
    
    @ApiModelProperty(hidden = true)
    private Long companyId;
    @ApiModelProperty(hidden = true)
    private Integer applyStatus;
    
}
zq-erp/src/main/java/com/matrix/system/fenxiao/entity/ShopSalesmanApply.java
@@ -63,6 +63,9 @@
    @ApiModelProperty(value = "备注")
    private String  remark;
    
    @ApiModelProperty(value = "等级ID")
    private long  gradeId;
    /**
     * 公司ID
     */
zq-erp/src/main/java/com/matrix/system/fenxiao/service/ShopSalesmanApplyService.java
@@ -1,5 +1,7 @@
package com.matrix.system.fenxiao.service;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -14,15 +16,19 @@
import com.matrix.system.common.interceptor.HostInterceptor;
import com.matrix.system.fenxiao.constant.FenxiaoSettingConstant;
import com.matrix.system.fenxiao.dao.ShopSalesmanApplyDao;
import com.matrix.system.fenxiao.dao.ShopSalesmanGradeDao;
import com.matrix.system.fenxiao.dto.ShopSalesmanAppliingDto;
import com.matrix.system.fenxiao.dto.ShopSalesmanApplyDto;
import com.matrix.system.fenxiao.entity.ShopSalesmanApply;
import com.matrix.system.fenxiao.entity.ShopSalesmanGrade;
import com.matrix.system.fenxiao.vo.ShopSalesmanAppliingVo;
import com.matrix.system.fenxiao.vo.ShopSalesmanApplyVo;
import com.matrix.system.fenxiao.vo.ShopSalesmanGradeVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
 * @description 推广员申请记录
@@ -38,6 +44,9 @@
    @Autowired
    ShopSalesmanApplyDao salesmanApplyDao;
    @Autowired
    ShopSalesmanGradeDao shopSalesmanGradeDao;
    @Autowired
    private BizUserDao bizUserDao;
@@ -51,7 +60,7 @@
     * @param invitationId
     * @return
     */
    public ShopSalesmanApply applyToBeAnSalesman(String openId, String invitationId) {
    public ShopSalesmanApply applyToBeAnSalesman(String openId,String gradeId,String invitationId) {
        BizUser loginUser=bizUserDao.findByOpenId(openId);
        //校验审核状态,和是否重复发起
@@ -63,6 +72,7 @@
            ShopSalesmanApply shopSalesmanApply=new ShopSalesmanApply();
            shopSalesmanApply.setUserId(openId);
            shopSalesmanApply.setCreateBy(loginUser.getNickName());
            shopSalesmanApply.setApplyWay(ShopSalesmanApply.APPLY_WAY_SELF);
@@ -77,6 +87,16 @@
            }else if(StringUtils.isNotBlank(loginUser.getParentOpenId())){
                //如果曾经是被邀请进来的则自动绑定为之前邀请人的下级
                shopSalesmanApply.setParentUserId(loginUser.getParentOpenId());
            }
            if(StringUtils.isNotBlank(gradeId)){
                shopSalesmanApply.setGradeId(Long.parseLong(gradeId));
            }else{
                //获取初始等级ID(公司id,是否为初始等级)
                Wrapper<ShopSalesmanGrade> queryWrapperOrepool = new QueryWrapper<>();
                ((QueryWrapper<ShopSalesmanGrade>) queryWrapperOrepool).eq("company_id", loginUser.getCompanyId());
                ((QueryWrapper<ShopSalesmanGrade>) queryWrapperOrepool).eq("is_default", 1);
                ShopSalesmanGrade shopSalesmanGrade = shopSalesmanGradeDao.selectOne(queryWrapperOrepool);
                shopSalesmanApply.setGradeId(shopSalesmanGrade.getId());
            }
            BusParameterSettings busParameterSettings = busParameterSettingsDao.selectCompanyParamByCode(FenxiaoSettingConstant.FX_AUDIT_METHOD, HostInterceptor.getCompanyId());
@@ -106,4 +126,33 @@
        return salesmanApplyDao.findShopSalesmanAppliingList(page,shopSalesmanAppliingDto);
    }
    public IPage<ShopSalesmanAppliingVo> selectBizUserApplyList(Page<ShopSalesmanAppliingVo> page, ShopSalesmanAppliingDto shopSalesmanAppliingDto) {
        return salesmanApplyDao.selectBizUserApplyList(page,shopSalesmanAppliingDto);
    }
    public List<ShopSalesmanGradeVo> getShopSalesmanGradeVo(Long companyId) {
        return shopSalesmanGradeDao.getShopSalesmanGradeVo(companyId);
    }
    public void addSaleManApply(String userId,String gradeId) {
        BizUser user = bizUserDao.selectById(userId);
        applyToBeAnSalesman(user.getOpenId(),gradeId, "");
    }
}
zq-erp/src/main/java/com/matrix/system/fenxiao/vo/ShopSalesmanGradeVo.java
New file
@@ -0,0 +1,17 @@
package com.matrix.system.fenxiao.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "ShopSalesmanGradeVo", description = "返参")
public class ShopSalesmanGradeVo {
    @ApiModelProperty(value = "id")
    private Long id;
    @ApiModelProperty(value = "等级名称")
    private String  name;
}
zq-erp/src/main/java/com/matrix/system/hive/action/OrderController.java
@@ -1,5 +1,6 @@
package com.matrix.system.hive.action;
import cn.hutool.core.collection.CollUtil;
import com.matrix.component.rabbitmq.RabiitMqTemplate;
import com.matrix.core.constance.MatrixConstance;
import com.matrix.core.exception.GlobleException;
@@ -21,6 +22,8 @@
import com.matrix.system.hive.pojo.ShoppingCarItem;
import com.matrix.system.hive.pojo.ShoppingCarItemsVo;
import com.matrix.system.hive.service.*;
import com.matrix.system.shopXcx.mqTask.MQTaskRouting;
import com.matrix.system.wechart.templateMsg.UniformMsgParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
@@ -40,7 +43,6 @@
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
@@ -54,6 +56,11 @@
public class OrderController extends BaseController {
    @Resource
    private SysOrderService orderService;
    @Autowired
    ShoppingGoodsDao shoppingGoodsDao;
    @Autowired
    private CodeService codeService;
    @Autowired
    private SysOrderItemDao orderItemDao;
@@ -87,6 +94,10 @@
    @Autowired
    RabiitMqTemplate rabiitMqTemplate;
    @Autowired
    private SysProjServicesDao sysProjServicesDao;
    @Value("${evn}")
    private String evn;
@@ -123,14 +134,16 @@
    AjaxResult payOrder(@RequestBody SysOrder sysOrder) {
        SysUsers user = getMe();
        sysOrder.setShopId(user.getShopId());
        sysOrder.setOrderType(SysOrder.ORDER_TYPE_SEAL);
        sysOrder.setIsHasRefund(SysOrder.IS_HAS_REFUND_N);
        //校验订单是否满足结算调价,新订单则保存订单,已有订单则删除后更新
        sysOrder = orderService.checkAndSaveOrder(sysOrder);
        orderService.updateReceiptMoney(sysOrder);
        //发送微信公众号提醒
//        UniformMsgParam uniformMsgParam=new UniformMsgParam(user.getCompanyId(),UniformMsgParam.GZH_GMCG);
//        uniformMsgParam.put("orderId",sysOrder.getId());
//        rabiitMqTemplate.sendMsg(MQTaskRouting.SEND_UNIFORM_TEMPLATE_MSG+evn,uniformMsgParam.toJSONString());
        UniformMsgParam uniformMsgParam=new UniformMsgParam(user.getCompanyId(),UniformMsgParam.GZH_GMCG);
        uniformMsgParam.put("orderId",sysOrder.getId());
        rabiitMqTemplate.sendMsg(MQTaskRouting.SEND_UNIFORM_TEMPLATE_MSG+evn,uniformMsgParam.toJSONString());
        //处理用户购买的产品
@@ -146,7 +159,6 @@
     */
    @RequestMapping(value = "/refundOrder")
    @ResponseBody
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult refundOrder(@RequestBody SysOrder sysOrder) {
        //储值卡订单不能通过退款渠道退款
        if(CollectionUtils.isNotEmpty(sysOrder.getItems())){
@@ -157,17 +169,6 @@
                }
            }
        }
        SysUsers user = getMe();
        sysOrder.setShopId(user.getShopId());
        sysOrder.setStatu(Dictionary.ORDER_STATU_TK);
        sysOrder.setOrderTime(new Date());
        //校验订单是否满足结算调价,新订单则保存订单,已有订单则删除后更新
        sysOrder = orderService.checkAndSaveOrder(sysOrder);
        orderService.refundOrderMoney(sysOrder);
        //处理用户购买的产品
        return AjaxResult.buildSuccessInstance(Arrays.asList(sysOrder), "订单退款成功");
@@ -476,13 +477,22 @@
        if (order == null) {
            return new AjaxResult(AjaxResult.STATUS_FAIL, "订单不存在!");
        }
        orderService.cancelOrder(id);
        if (del > 0) {
            orderService.removeById(id);
            result.setInfo("删除成功!");
        } else {
            result.setInfo("取消成功!");
        List<SysOrderItem> items = orderItemDao.selectByOrderId(id);
        for (SysOrderItem item : items) {
            List<SysProjServices> sysProjServices = sysProjServicesDao.selectProjServicesByOrderItemId(item.getId());
            if (CollUtil.isNotEmpty(sysProjServices)) {
                return new AjaxResult(AjaxResult.STATUS_FAIL, "订单存在进行中的服务单无法取消/删除");
            }
        }
        orderService.cancelOrder(id);
//        if (del > 0) {
//            orderService.removeById(id);
//            result.setInfo("删除成功!");
//        } else {
            result.setInfo("取消成功!");
//        }
        result.setStatus(AjaxResult.STATUS_SUCCESS);
        return result;
zq-erp/src/main/java/com/matrix/system/hive/action/ProjServiceController.java
@@ -1,5 +1,6 @@
package com.matrix.system.hive.action;
import cn.hutool.core.collection.CollUtil;
import com.matrix.core.anotations.RemoveRequestToken;
import com.matrix.core.constance.MatrixConstance;
import com.matrix.core.exception.GlobleException;
@@ -108,6 +109,14 @@
        }
        //补充服务单扩展信息===============
        List<SysBeauticianState> beauticianStateList = beauticianStateDao.selectBySerIds(id);
        if (CollUtil.isNotEmpty(beauticianStateList)) {
            for (SysBeauticianState sysBeauticianState : beauticianStateList) {
                if (sysBeauticianState.getProjUse().getTaocanId() != null) {
                    SysProjUse sysProjUse = projUseService.findById(sysBeauticianState.getProjUse().getTaocanId());
                    sysBeauticianState.getProjInfo().setName(sysProjUse.getProjName()+"--"+sysBeauticianState.getProjInfo().getName());
                }
            }
        }
        projServices.setServiceItems(beauticianStateList);
        SysBedState sysBedState = sysBedStateDao.selectBySerIdAndBedId(projServices.getId(), projServices.getBedId());
        projServices.setBedState(sysBedState);
@@ -303,6 +312,14 @@
        //补充服务单扩展信息===============
        List<SysBeauticianState> beauticianStateList = beauticianStateDao.selectBySerIds(projServices.getId());
        if (CollUtil.isNotEmpty(beauticianStateList)) {
            for (SysBeauticianState sysBeauticianState : beauticianStateList) {
                if (sysBeauticianState.getProjUse().getTaocanId() != null) {
                    SysProjUse sysProjUse = projUseService.findById(sysBeauticianState.getProjUse().getTaocanId());
                    sysBeauticianState.getProjInfo().setName(sysProjUse.getProjName()+"--"+sysBeauticianState.getProjInfo().getName());
                }
            }
        }
        projServices.setServiceItems(beauticianStateList);
        SysBedState sysBedState = sysBedStateDao.selectBySerIdAndBedId(projServices.getId(), projServices.getBedId());
@@ -492,7 +509,7 @@
        if (balanceverifyResult.isError()) {
            return new AjaxResult(AjaxResult.STATUS_FAIL, balanceverifyResult.getMsg());
        }
        sysProjServices.setState(Dictionary.SERVICE_STATU_YYCG);
        sysProjServices.setState(Dictionary.SERVICE_STATU_DYY);
        SysProjServices newSysProjServices = sysProjServicesService.addSysProjServices(sysProjServices);
        if (newSysProjServices != null) {
            return AjaxResult.buildSuccessInstance(Arrays.asList(newSysProjServices));
zq-erp/src/main/java/com/matrix/system/hive/bean/AchieveNew.java
@@ -72,7 +72,13 @@
     * 客户id
     */
    private Long  vipId;
    /**
     * 购买业绩
     */
    private Double  goodsCash;
    
    /**
     * 赠送消耗
@@ -85,29 +91,7 @@
     */
    private Double  hisConsume;
            
    /**
     * 划扣金额 从卡中划扣钱买东西
     */
    private Double  consume;
    /**
     * 卡项,套餐,充值,开会籍卡
     */
    private Double  cardCash;
    /**
     * 现金单次,购买项目的业绩
     */
    private Double  projCash;
    /**
     * 现金产品,购买家居产品的钱
     */
    private Double  goodsCash;
            
    
    /**
@@ -155,11 +139,12 @@
     * 总金额
     */
    private Double  zkTotal;
    /**
     * 公司id
     */
    private Long companyId;
    private String  t1;
            
    
@@ -167,11 +152,11 @@
    /**
     * 业绩种类 1-现金业绩 2-划扣业绩
     * 业绩类型
     */
    private String  t3;
    private String  achieveType;
    private String  t4;
            
    
@@ -251,17 +236,32 @@
    private Date  endTime;
    /**
     * 分配的业绩金额
     */
    @Extend
    private Double achieveMoney;
    private String goodsNo;
    private String goodsName;
    private String type;
    private String payMethod;
    private String cateName;
    public String getCateName() {
        return cateName;
    }
    public void setCateName(String cateName) {
        this.cateName = cateName;
    }
    public String getPayMethod() {
        return payMethod;
    }
    public void setPayMethod(String payMethod) {
        this.payMethod = payMethod;
    }
    public String getType() {
        return type;
@@ -311,13 +311,6 @@
        this.companyId = companyId;
    }
    public Double getAchieveMoney() {
        return achieveMoney;
    }
    public void setAchieveMoney(Double achieveMoney) {
        this.achieveMoney = achieveMoney;
    }
    public Date getBeginTime() {
        return beginTime;
@@ -403,24 +396,8 @@
    public void setHisConsume(Double hisConsume) {
        this.hisConsume = hisConsume;
    }
    public Double getConsume() {
        return consume;
    }
    public void setConsume(Double consume) {
        this.consume = consume;
    }
    public Double getCardCash() {
        return cardCash;
    }
    public void setCardCash(Double cardCash) {
        this.cardCash = cardCash;
    }
    public Double getProjCash() {
        return projCash;
    }
    public void setProjCash(Double projCash) {
        this.projCash = projCash;
    }
    public Double getGoodsCash() {
        return goodsCash;
    }
@@ -481,12 +458,15 @@
    public void setT2(String t2) {
        this.t2 = t2;
    }
    public String getT3() {
        return t3;
    public String getAchieveType() {
        return achieveType;
    }
    public void setT3(String t3) {
        this.t3 = t3;
    public void setAchieveType(String achieveType) {
        this.achieveType = achieveType;
    }
    public String getT4() {
        return t4;
    }
zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrder.java
@@ -1,6 +1,5 @@
package com.matrix.system.hive.bean;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.matrix.core.tools.DateUtil;
import org.springframework.format.annotation.DateTimeFormat;
@@ -16,7 +15,15 @@
 */
public class SysOrder implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 订单类型-销售订单
     */
    public static final int ORDER_TYPE_SEAL= 1;
    /**
     * 订单类型-退款订单
     */
    public static final int ORDER_TYPE_REFUND= 2;
    /**
     * 序号
@@ -78,24 +85,24 @@
    /**
     * 订单总价
     */
    private double total;
    private Double total;
    /**
     * 折后价
     */
    private double zkTotal;
    private Double zkTotal;
    /**
     * 现金支付金额
     */
    private double cashPay;
    private Double cashPay;
    /**
     * 现金支付金额
     */
    private double cardPay;
    private Double cardPay;
    /**
     * 欠款金额
     */
    private double arrears;
    private Double arrears;
    /**
     * 店铺id
@@ -126,7 +133,12 @@
     * 会员姓名
     */
    private String vipNo;
    /**
     * 订单类型1,销售订单,2退款订单
     */
    private Integer orderType;
    /* 会员手机号
     */
    private String vipPhone;
@@ -165,12 +177,36 @@
     */
    private Integer times;
    private String type;
    /**
     * 原有订单ID 退款时使用
     */
    private Long oldOrderId;
    /**
     * 该订单有退款
     */
    public static final Integer IS_HAS_REFUND_Y = 1;
    /**
     * 该订单无退款
     */
    public static final Integer IS_HAS_REFUND_N = 2;
    /**
     * 是否发生退款 1-是 2-否
     */
    private Integer isHasRefund;
    public Integer getIsHasRefund() {
        return isHasRefund;
    }
    public void setIsHasRefund(Integer isHasRefund) {
        this.isHasRefund = isHasRefund;
    }
    public Long getOldOrderId() {
        return oldOrderId;
@@ -194,6 +230,14 @@
    public void setShopShortName(String shopShortName) {
        this.shopShortName = shopShortName;
    }
    public Integer getOrderType() {
        return orderType;
    }
    public void setOrderType(Integer orderType) {
        this.orderType = orderType;
    }
    public String getType() {
@@ -244,19 +288,19 @@
        this.searchShop = searchShop;
    }
    public double getArrears() {
    public Double getArrears() {
        return arrears;
    }
    public void setArrears(double arrears) {
    public void setArrears(Double arrears) {
        this.arrears = arrears;
    }
    public double getCardPay() {
    public Double getCardPay() {
        return cardPay;
    }
    public void setCardPay(double cardPay) {
    public void setCardPay(Double cardPay) {
        this.cardPay = cardPay;
    }
@@ -283,11 +327,11 @@
    public void setEndTimeVo(Date endTimeVo) {
        this.endTimeVo = endTimeVo;
    }
    public double getCashPay() {
    public Double getCashPay() {
        return cashPay;
    }
    public void setCashPay(double cashPay) {
    public void setCashPay(Double cashPay) {
        this.cashPay = cashPay;
    }
    
@@ -393,11 +437,11 @@
        this.activity = activity;
    }
    public double getTotal() {
    public Double getTotal() {
        return total;
    }
    public void setTotal(double total) {
    public void setTotal(Double total) {
        this.total = total;
    }
@@ -422,11 +466,11 @@
        this.changeId = changeId;
    }
    public double getZkTotal() {
    public Double getZkTotal() {
        return zkTotal;
    }
    public void setZkTotal(double zkTotal) {
    public void setZkTotal(Double zkTotal) {
        this.zkTotal = zkTotal;
    }
zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrderItem.java
@@ -33,6 +33,11 @@
    private Integer count;
    /**
     * 退款数量
     */
    private Integer refundCount;
    /**
     * 是否为赠送和 是否
@@ -87,11 +92,8 @@
     * 欠款金额
     */
    private Double arrears;
    //页面参数使用
    /**
     * 付款方式
     */
@@ -108,8 +110,7 @@
     */
    private Long cardId;
    
    /**
     * 是否为综合卡创建的订单明细
     * 1是
@@ -159,6 +160,14 @@
        return preCount;
    }
    public Integer getRefundCount() {
        return refundCount;
    }
    public void setRefundCount(Integer refundCount) {
        this.refundCount = refundCount;
    }
    public void setPreCount(int preCount) {
        this.preCount = preCount;
    }
@@ -182,14 +191,15 @@
    /**
     * 业绩计算
     */
    private List<AchieveNew> achaeveList;
    private List<AchieveNew> achieveList;
    public List<AchieveNew> getAchaeveList() {
        return achaeveList;
    public List<AchieveNew> getAchieveList() {
        return achieveList;
    }
    public void setAchaeveList(List<AchieveNew> achaeveList) {
        this.achaeveList = achaeveList;
    public void setAchieveList(List<AchieveNew> achieveList) {
        this.achieveList = achieveList;
    }
    public String getPayMethodDetail() {
zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java
@@ -1,15 +1,15 @@
package com.matrix.system.hive.dao;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.matrix.core.pojo.PaginationVO;
import com.matrix.system.app.vo.OrderDetailAchieveItemVo;
import com.matrix.system.app.vo.RankingVo;
import com.matrix.system.app.vo.UserAchieveVo;
import com.matrix.system.hive.bean.AchieveNew;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
@@ -73,4 +73,6 @@
    List<AchieveNew> selectOrderItemAchieveByOrderId(Long orderId);
    List<RankingVo> selectStaffSaleAchieveRanking(@Param("record") AchieveNew achieveNew);
    int deleteByOrderId(@Param("orderId") Long orderId);
}
zq-erp/src/main/java/com/matrix/system/hive/dao/SysProjServicesDao.java
@@ -68,4 +68,6 @@
     * @return
     */
    int updateNoticeTimes(@Param("list")List<Long> noticedIds);
    List<SysProjServices> selectProjServicesByOrderItemId(@Param("itemId") Long itemId);
}
zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java
@@ -213,10 +213,10 @@
        if (CollectionUtils.isNotEmpty(pageOrder.getItems())) {
            for (SysOrderItem orderItem : pageOrder.getItems()) {
                if (orderItem != null && CollectionUtils.isNotEmpty(orderItem.getAchaeveList())) {
                if (orderItem != null && CollectionUtils.isNotEmpty(orderItem.getAchieveList())) {
                    for (AchieveNew achieveNew : orderItem.getAchaeveList()) {
                        if (achieveNew !=null   && achieveNew.getT1()!=null) {
                    for (AchieveNew achieveNew : orderItem.getAchieveList()) {
                        if (achieveNew !=null   && achieveNew.getGoodsCash()!=null) {
                            buildAchieve(pageOrder,  orderItem, achieveNew);
                            // 新增美疗师业绩
                            achieveNewList.add(achieveNew);
@@ -237,7 +237,7 @@
        if (Dictionary.ORDER_STATU_TK.equals(pageOrder.getStatu())) {
            achieveNew.setId(null);
            achieveNew.setProjPercentage(0 - achieveNew.getProjPercentage());
            achieveNew.setT1((0 - Double.parseDouble(achieveNew.getT1())) + "");
            achieveNew.setGoodsCash(0 - achieveNew.getGoodsCash());
        }
        achieveNew.setVipId(pageOrder.getVipId());
@@ -256,14 +256,6 @@
        achieveNew.setShoppingGoodsId(orderItem.getGoodsId());
        // 是否赠送
        achieveNew.setT2(orderItem.getIsFree());
        // 根据商品类型设置业绩类型
        if (Dictionary.ACHIEVE_TYPE_CASH.equals(achieveNew.getT3())){
            achieveNew.setCardCash(Double.parseDouble(achieveNew.getT1()));
        } else {
            // 设置划扣金额
            achieveNew.setConsume(Double.parseDouble(achieveNew.getT1()));
        }
    }
    @Override
@@ -309,17 +301,17 @@
            // 本日
            case 1 :
                break;
                // 昨日
            // 昨日
            case 2:
                startTime = DateUtil.previousNDate(startTime, 1);
                endTime = startTime;
                break;
                // 本月
            // 本月
            case 3:
                calendar.set(Calendar.DAY_OF_MONTH, 1);
                startTime = calendar.getTime();
                break;
                // 上月
            // 上月
            case 4:
                calendar.add(Calendar.MONTH, -1);
                calendar.set(Calendar.DAY_OF_MONTH, 1);
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java
@@ -176,11 +176,6 @@
    @Override
    public SysOrder checkAndSaveOrder(SysOrder sysOrder) {
        // 收款改变订单状态
        SysOrder source = null;
        if (sysOrder.getId() != null) {
            source = sysOrderDao.selectById(sysOrder.getId());
        }
        // 计算订单折扣金额,收款情况下 计算订单总额
        double zkTotal = 0.0;
@@ -217,6 +212,10 @@
        SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY);
        sysOrder.setZkTotal(zkTotal);
        sysOrder.setStatu(orderStatus);
        SysOrder source = null;
        if (sysOrder.getId() != null) {
            source = sysOrderDao.selectById(sysOrder.getId());
        }
        sysOrder.setStaffId(source != null ? source.getStaffId() : user.getSuId());
        sysOrder.setCompanyId(source != null ? source.getCompanyId() : user.getCompanyId());
@@ -252,8 +251,6 @@
    /**
     * 取消订单
     * 本方法无法退回多次不同卡项收款的订单
     *
     * @param id
     * @return
     */
@@ -281,23 +278,22 @@
                throw new GlobleException("订单已取消");
            }
            List<SysOrderItem> sysOrderItems = orderItemDao.selectByOrderId(id);
            List<SysOrderFlow> flows = sysOrderFlowDao.selectByOrderId(id);
            // 非现金收款退回扣卡余额
            for (SysOrderFlow flow : flows) {
                if (SysOrderFlow.PAY_METHOD_CARD.equals(flow.getPayMethod())) {
            for (SysOrderItem orderItem : sysOrderItems) {
                //非现金收款退回扣卡余额
                if (StringUtils.isNotBlank(orderItem.getPayMethodDetail())) {
                    MoneyCardUse moneyCardUse = moneyCardUseDao.selectById(Long.parseLong(orderItem.getPayMethodDetail()));
                    MoneyCardUse moneyCardUse = moneyCardUseDao.selectById(flow.getCardId());
                    MoneyCardUseFlow moneyCardUseFlow = new MoneyCardUseFlow();
                    if (moneyCardUse != null) {
                        // 根据订单明细判断是赠送金额购买还是本金购买
                        moneyCardUseFlow.setTotal(orderItem.getCardPay());
                        moneyCardUse.setRealMoney(MoneyUtil.add(moneyCardUse.getRealMoney(), orderItem.getCardPay()));
                        //TODO 目前无法退回到具体的赠送金额还是本金
                        moneyCardUseFlow.setTotal(flow.getAmount().doubleValue());
                        if (SysOrderFlow.IS_GIFT_Y.equals(flow.getIsGift())) {
                            moneyCardUse.setGiftMoney(MoneyUtil.add(moneyCardUse.getGiftMoney(), flow.getAmount().doubleValue()));
                        } else {
                            moneyCardUse.setRealMoney(MoneyUtil.add(moneyCardUse.getRealMoney(), flow.getAmount().doubleValue()));
                        }
                        if (!moneyCardUse.getIsVipCar().equals(Dictionary.FLAG_YES_Y)) {
                            if (moneyCardUse.getLastCount() != null) {
@@ -319,29 +315,26 @@
                        moneyCardUseFlowDao.insert(moneyCardUseFlow);
                    }
                }
            }
            List<SysOrderItem> sysOrderItems = orderItemDao.selectByOrderId(id);
            for (SysOrderItem orderItem : sysOrderItems) {
                // 充值卡类型退款
                if (Dictionary.SHOPPING_GOODS_TYPE_CZK.equals(orderItem.getType())) {
                    ShoppingGoods shoppingGoods = shoppingGoodsDao.selectById(orderItem.getGoodsId());
                    //删除购买的充值卡
                    moneyCardUseDao.deleteByOrderItemId(orderItem.getId());
                } else if (Dictionary.SHOPPING_GOODS_TYPE_XM.equals(orderItem.getType())
                        || Dictionary.SHOPPING_GOODS_TYPE_TC.equals(orderItem.getType())) {
                    // 项目套餐退款
                    // 删除套餐项目使用情况
                    sysProjUseDao.deleteByOrderItemId(orderItem.getId());
                } else if (Dictionary.SHOPPING_GOODS_TYPE_ZHK.equals(orderItem.getType())) {
                    // 综合卡
                    // 删除套餐项目使用情况
                    sysProjUseDao.deleteByOrderItemId(orderItem.getId());
                    // 删除充值卡
                    moneyCardUseDao.deleteByOrderItemId(orderItem.getId());
                }
            }
@@ -371,8 +364,6 @@
            // 取消订单
            order.setStatu(Dictionary.ORDER_STATU_YQX);
            return sysOrderDao.update(order);
        }
@@ -490,6 +481,10 @@
        if (!Dictionary.ORDER_STATU_DFK.equals(pageOrder.getStatu())) {
            throw new GlobleException("该订单已经收过款,请刷新页面再试!");
        }
        // 更新收款时间
        pageOrder.setPayTime(new Date());
        pageOrder.setStatu(Dictionary.ORDER_STATU_YFK);
        sysOrderDao.update(pageOrder);
        // 获取用户信息
        SysVipInfo vipInfo = sysVipInfoDao.selectById(pageOrder.getVipId());
@@ -499,8 +494,8 @@
            sysVipInfoDao.update(vipInfo);
        }
        //设置订单的成交状态
        changeOrderStatu(pageOrder);
        //添加支付流水
        addOrderFlow(pageOrder);
        // 设置会员充值卡使用情况
        addMoneyCardUse(pageOrder);
@@ -519,78 +514,57 @@
    }
    /**
     * 收款改变订单状态,划扣金额
     * 创建支付流水
     *
     * @author:姜友瑶
     */
    private void changeOrderStatu(SysOrder sourceOrder) {
    private void addOrderFlow(SysOrder sourceOrder) {
        String orderStatus = Dictionary.ORDER_STATU_YFK;
        String flowType = SysOrderFlow.FLOW_TYPE_BUY;
        double cashPayTotal = 0D;
        double cardPayTotal = 0D;
        //处理支付流水
        int flowCount = 1;
        for (SysOrderFlow flow : sourceOrder.getFlows()) {
            //支付内容摘要设置
            Long goodsId = sourceOrder.getItems().get(0).getGoodsId();
            ShoppingGoods goods = shoppingGoodsDao.selectById(goodsId);
            flow.setFlowContent(goods.getName() + "等" + sourceOrder.getItems().size() + "件产品");
            // 若是退款,则取负数
            if (Dictionary.ORDER_STATU_TK.equals(sourceOrder.getStatu())) {
                flowType = SysOrderFlow.FLOW_TYPE_REFUND;
            if (SysOrder.ORDER_TYPE_REFUND==sourceOrder.getOrderType()) {
                flow.setFlowType(SysOrderFlow.FLOW_TYPE_REFUND);
                flow.setAmount(flow.getAmount().negate());
                flow.setOrderId(sourceOrder.getOldOrderId());
            } else {
                flow.setFlowType(SysOrderFlow.FLOW_TYPE_BUY);
                flow.setOrderId(sourceOrder.getId());
            }
            //欠款处理
            if (SysOrderFlow.PAY_METHOD_ARREARS.equals(flow.getPayMethod())) {
                orderStatus = Dictionary.ORDER_STATU_QK;
                sourceOrder.setStatu(Dictionary.ORDER_STATU_QK);
                sourceOrder.setArrears(flow.getAmount().doubleValue());
                sysOrderDao.update(sourceOrder);
            }
            //统计储值卡支付
            if (SysOrderFlow.PAY_METHOD_CARD.equals(flow.getPayMethod())) {
                if (flow.getCardId() != null) {
                    MoneyCardUse moneyCardUse = moneyCardUseDao.selectById(flow.getCardId());
                    cardPayTotal += flow.getAmount().doubleValue();
                    //修改储值卡余额
                    cardPaySk(moneyCardUse, sourceOrder, flow);
                }else{
                    throw new GlobleException("无效的储值卡支付方式");
                }
            }
            //统计现金支付
            if (!SysOrderFlow.PAY_METHOD_ARREARS.equals(flow.getPayMethod())
                    && !SysOrderFlow.PAY_METHOD_CARD.equals(flow.getPayMethod())) {
                cashPayTotal += flow.getAmount().doubleValue();
            }
            flow.setFlowNo(codeService.getFlowCode() + "-" + flowCount);
            flow.setVipId(sourceOrder.getVipId());
            flow.setFlowType(flowType);
            flow.setShopId(sourceOrder.getShopId());
            flow.setCompanyId(sourceOrder.getCompanyId());
            sysOrderFlowDao.insert(flow);
            flowCount++;
        }
        //修改订单信息
        if (Dictionary.ORDER_STATU_TK.equals(sourceOrder.getStatu())) {
            orderStatus = Dictionary.ORDER_STATU_TK;
        }
        // 更新收款状态
        sourceOrder.setPayTime(new Date());
        sourceOrder.setStatu(orderStatus);
        sourceOrder.setCardPay(cardPayTotal);
        sourceOrder.setCashPay(cashPayTotal);
        sysOrderDao.update(sourceOrder);
    }
@@ -701,6 +675,14 @@
            return true;
        } else {
            // 不是一卡通,
            // 判断卡是否可应用于所有产品
            ShoppingGoods cardGoods = shoppingGoodsDao.selectById(moneyCardUse.getGoodsId());
            if (cardGoods != null) {
                if (Dictionary.FLAG_YES.equals(cardGoods.getCarIsAll())) {
                    return true;
                }
            }
            // 比较分类
            MoneyCardAssemble moneyCardAssemble = new MoneyCardAssemble();
            moneyCardAssemble.setCardId(moneyCardUse.getGoodsId());
@@ -1212,7 +1194,7 @@
        orderItem.setIsFree(Dictionary.FLAG_NO);
        orderItem.setPrice(czVo.getBjmoney());
        orderItem.setStatus(Dictionary.ORDER_STATU_YFK);
        orderItem.setAchaeveList(czVo.getAchaeveList());
        orderItem.setAchieveList(czVo.getAchaeveList());
        orderItemDao.insert(orderItem);
        List<SysOrderItem> items = new ArrayList<>();
        items.add(orderItem);
@@ -1233,7 +1215,7 @@
        moneyCardUseFlowDao.insert(moneyCardUseFlow);
        order.setFlows(czVo.getFlows());
        changeOrderStatu(order);
        addOrderFlow(order);
        // 添加员工业绩
        achieveNewService.addAchaeveByOrder(order);
        return order;
@@ -1283,37 +1265,90 @@
    @Transactional(rollbackFor = Exception.class)
    @Override
    public void refundOrderMoney(SysOrder pageOrder) {
    public void refundOrderMoney(SysOrder sysOrder) {
        SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
        // 修改订单状态
        changeOrderStatu(pageOrder);
        //原订单设置为退款状态
        SysOrder sourceOrder=new SysOrder();
        sourceOrder.setId(sysOrder.getOldOrderId());
        sourceOrder.setIsHasRefund(SysOrder.IS_HAS_REFUND_Y);
//        sourceOrder.setStatu(Dictionary.ORDER_STATU_TK);
        sysOrderDao.update(sourceOrder);
        List<SysOrderItem> returnItems = new ArrayList<>();
        for (SysOrderItem item : pageOrder.getItems()) {
        sysOrder.setId(null);
        sysOrder.setStaffId(user.getSuId());
        sysOrder.setCompanyId(user.getCompanyId());
        sysOrder.setShopId(user.getShopId());
        sysOrder.setOrderType(SysOrder.ORDER_TYPE_REFUND);
        sysOrder.setStatu(Dictionary.ORDER_STATU_YFK);
        Date now = new Date();
        sysOrder.setOrderTime(now);
        sysOrder.setPayTime(now);
        sysOrder.setOrderNo(codeService.getRefundOrderNo());
        sysOrder.setZkTotal(-sysOrder.getZkTotal());
        sysOrder.setOrderType(SysOrder.ORDER_TYPE_REFUND);
        //新增订单
        sysOrderDao.insert(sysOrder);
        //插入明细
        for (SysOrderItem item : sysOrder.getItems()) {
            //更新原订单明细的可退数量
            SysOrderItem oldItem=new SysOrderItem();
            oldItem.setId(item.getId());
            oldItem.setRefundCount(item.getCount());
            orderItemDao.update(oldItem);
            //插入新的订单明细
            item.setId(null);
            item.setCount(-item.getCount());
            item.setOrderId(sysOrder.getId());
            orderItemDao.insert(item);
        }
        // 添加订单收款流水
        addOrderFlow(sysOrder);
        //退款退套餐退项目
        refundProjUse(sysOrder);
        // 设置业绩
        achieveNewService.addAchaeveByOrder(sysOrder);
    }
    /**
     * 退款退项目,套餐,卡项
     * @param sysOrder
     */
    private void refundProjUse(SysOrder sysOrder) {
        SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
        //记录需要退库存的产品
        List<SysOrderItem> returnGoodsList = new ArrayList<>();
        for (SysOrderItem item : sysOrder.getItems()) {
            SysProjUse queryProjUse = new SysProjUse();
            queryProjUse.setIsOver(Dictionary.FLAG_NO_N);
            queryProjUse.setStatus(Dictionary.TAOCAN_STATUS_YX);
            queryProjUse.setOrderItemId(item.getOldItemId());
            // 修改项目信息
            if (Dictionary.SHOPPING_GOODS_TYPE_XM.equals(item.getType()) || Dictionary.SHOPPING_GOODS_TYPE_JJCP.equals(item.getType())) {
                if (Dictionary.SHOPPING_GOODS_TYPE_JJCP.equals(item.getType())) {
                    if (Dictionary.FLAG_YES_Y.equals(item.getIsReturnStore())) {
                        returnItems.add(item);
                        returnGoodsList.add(item);
                    }
                } else {
                    SysProjUse sysProjUse = sysProjUseDao.selectByModel(queryProjUse).get(0);
                    int sub = sysProjUse.getSurplusCount() - item.getCount();
                    sysProjUse.setSurplusCount(sub);
                    if (sub <= 0) {
                    if (sub < 0) {
                      throw new GlobleException("项目余次不足");
                    }else if(sub==0){
                        sysProjUse.setIsOver(Dictionary.FLAG_YES_Y);
                        sysProjUse.setStatus(Dictionary.TAOCAN_STATUS_WX);
                    }
                    sysProjUse.setSurplusCount(sub);
                    sysProjUseDao.update(sysProjUse);
                    SysProjUseFlow sysProjUseFlow = SysProjUseMapper.INSTANCE.projUseToFlow(sysProjUse);
                    sysProjUseFlow.setOptionType("退款修改");
                    sysProjUseFlow.setId(null);
@@ -1326,15 +1361,13 @@
            if (Dictionary.SHOPPING_GOODS_TYPE_TC.equals(item.getType())) {
                queryProjUse.setTaocanId(-1L);
                List<SysProjUse> sysProjUses = sysProjUseDao.selectByModel(queryProjUse);
                if (item.getCount() > sysProjUses.size()) {
                    throw new GlobleException("数据异常");
                }
                for (int i = 0; i < item.getCount(); i++) {
                    SysProjUse sysProjUse = sysProjUses.get(i);
                    sysProjUse.setIsOver(Dictionary.FLAG_YES_Y);
                    sysProjUse.setStatus(Dictionary.TAOCAN_STATUS_WX);
                    sysProjUseDao.update(sysProjUse);
                    SysProjUseFlow sysProjUseFlow = SysProjUseMapper.INSTANCE.projUseToFlow(sysProjUse);
                    sysProjUseFlow.setOptionType("退款修改");
@@ -1372,13 +1405,9 @@
        }
        // 家居产品退库存
        if (CollectionUtils.isNotEmpty(returnItems)) {
            refundInstore(returnItems);
        if (CollectionUtils.isNotEmpty(returnGoodsList)) {
            refundInstore(returnGoodsList);
        }
        // 设置业绩
        achieveNewService.addAchaeveByOrder(pageOrder);
    }
    /**
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java
@@ -299,15 +299,13 @@
     */
    @Override
    public VerifyResult checkArrears(SysProjServices sysProjServices) {
        //检测欠款
       /* for (SysBeauticianState sysBeauticianState : sysProjServices.getServiceItems()) {
        // 检测欠款
       for (SysBeauticianState sysBeauticianState : sysProjServices.getServiceItems()) {
            SysProjUse sysProjUse = projUseService.findById(sysBeauticianState.getPuseId());
            ShoppingGoods shoppingGoods = shoppingGoodsDao.selectById(sysProjUse.getProjId());
            SysOrderItem orderItem = sysOrderItemService.findById(sysProjUse.getOrderItemId());
           SysOrderItem item = sysOrderItemService.findById(sysProjUse.getOrderItemId());
           SysOrder orderItem = sysOrderService.findById(item.getOrderId());
            if ("购买".equals(sysProjUse.getSource())) {
                // 如果用户有欠款,服务单总价不能超过已付金额
                if (orderItem!=null && orderItem.getArrears() > 0) {
@@ -323,17 +321,17 @@
                    double money = MoneyUtil.sub((bj - orderItem.getArrears()), (yxfje + bcxfje));
                    // 如果 已付金额  - (已消费金额+本次消费金额)<0 则不能再消费
                   if (money < 0) {
                        return new VerifyResult(true, shoppingGoods.getName() + "存在欠款" + orderItem.getArrears() + "元 , 订单编号[ " + sysOrderService.findById(orderItem.getOrderId()).getOrderNo() + " ] ");
                        return new VerifyResult(true, shoppingGoods.getName() + "存在欠款" + orderItem.getArrears() + "元 , 订单编号[ " + orderItem.getOrderNo() + " ] ");
                    }
                }
            } else if ("赠送".equals(sysProjUse.getSource())) {
                if (orderItem!=null &&orderItem.getArrears() > 0) {
                    return new VerifyResult(true, shoppingGoods.getName() + "存在欠款" + orderItem.getArrears() + "元 , 不能消费赠送项目,订单编号[ " + sysOrderService.findById(orderItem.getOrderId()).getOrderNo() + " ] ");
                    return new VerifyResult(true, shoppingGoods.getName() + "存在欠款" + orderItem.getArrears() + "元 , 不能消费赠送项目,订单编号[ " + orderItem.getOrderNo() + " ] ");
                }
            }
        }*/
        }
        return new VerifyResult(false);
    }
@@ -692,12 +690,29 @@
            sysOutStoreItemDao.batchInsert(realOutStoreItemList);
        }
        // 设置服务单状态
        projServices.setState(Dictionary.SERVICE_STATU_PLWC);
//        projServices.setState(Dictionary.SERVICE_STATU_PLWC);
        projServices.setState(Dictionary.SERVICE_STATU_FWWC);
        if(projServices.getDevisionId()==null){
            //如果没有设置配料师则默认为操作配料的人为配料师
            projServices.setDevisionId(sysUsers.getSuId());
        }
        // 释放床位资源
        SysBedState checkBedState = sysBedStateDao.selectBySerIdAndBedId(projServices.getBedId(), projServices.getId());
        if (checkBedState != null) {
            checkBedState.setBedState(Dictionary.BED_STATE_SYJS);
            bedStateDao.update(checkBedState);
        }
        projServices.setStartTime(new Date());
        projServices.setEndTime(new Date());
        // 计算时差
        long minspace = DateUtil.getDifTimeMin(projServices.getStartTime(), projServices.getEndTime())
                - projServices.getTotalTime();
        // 判断是服务超时还是服务提前结束,如果minspace大于0则是超时服务,小于0则是提前结束服务
        projServices.setIsOverTime(minspace + "");
        projServices.setState(Dictionary.SERVICE_STATU_FWWC);
        return sysProjServicesDao.update(projServices);
    }
zq-erp/src/main/java/com/matrix/system/hive/statistics/AchieveAction.java
@@ -12,13 +12,14 @@
import com.matrix.system.common.tools.ResponseHeadUtil;
import com.matrix.system.hive.action.util.QueryUtil;
import com.matrix.system.hive.bean.AchieveNew;
import com.matrix.system.hive.bean.SysOrder;
import com.matrix.system.hive.bean.SysOrderItem;
import com.matrix.system.hive.dao.AchieveNewDao;
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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -48,6 +49,9 @@
    @Autowired
    private SysOrderItemService sysOrderItemService;
    @Autowired
    private AchieveNewDao achieveNewDao;
    /**
     * 门店每日单据明细表
@@ -90,7 +94,7 @@
        String title = "每日单据明细";
        orderSheet.setSheetName(title);
        orderSheet.setTitle(title);
        String[] header = {"年", "月", "日",   "订单类型", "订单编号", "会员级别", "姓名", "项目名称", "总金额", "卡项", "现金单次", "现金产品", "划扣", "本金消耗", "赠消", "提成", "顾问", "美疗师", "人头", "项目个数", "项目时间", "门店"};
        String[] header = {"年", "月", "日", "订单编号", "订单类型", "会员姓名", "项目名称", "订单金额", "订单业绩", "收款方式", "业绩类型", "顾问", "美疗师", "本金消耗", "赠消", "提成", "人头", "项目个数", "项目时间", "门店"};
        orderSheet.setHeaders(header);
        SysUsers sysUsers = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY);
        if(!AppConstance.ZONGDIAN.equals(sysUsers.getShopName())){
@@ -106,21 +110,18 @@
                temp.add(item.getYear());
                temp.add(item.getMonth());
                temp.add(item.getDay());
                temp.add(item.getOrderType());
                temp.add(item.getOrderNo());
                temp.add(item.getLevelName());
                temp.add(item.getOrderType());
                temp.add(item.getVipName());
                temp.add(item.getProName());
                temp.add(item.getZkTotal());
                temp.add(item.getCardCash());
                temp.add(item.getProjCash());
                temp.add(item.getGoodsCash());
                temp.add(item.getConsume());
                temp.add(item.getPayMethod());
                temp.add(item.getGuwen());
                temp.add(item.getMeiliao());
                temp.add(item.getHisConsume());
                temp.add(item.getFreeConsume());
                temp.add(item.getProjPercentage());
                temp.add(item.getGuwen());
                temp.add(item.getMeiliao());
                temp.add(item.getNumberOfPeople());
                temp.add(item.getProjNum());
                temp.add(item.getProjTime());
@@ -149,27 +150,17 @@
    @RequestMapping(value = "/add")
    @ResponseBody
    @Transactional
    public AjaxResult add(@RequestBody List<AchieveNew> list) {
        SysOrder order = sysOrderService.findById(list.get(0).getOrderId());
        List<SysOrderItem> orderItems = sysOrderItemService.findByOrderId(order.getId());
        orderItems.forEach(item -> {
            List<AchieveNew> achieveNewList = new ArrayList<>();
            for(AchieveNew achieveNew : list) {
                achieveNewService.removeById(achieveNew.getId());
                achieveNew.setId(null);
                achieveNew.setConsume(null);
                achieveNew.setCardCash(null);
                if (achieveNew.getOrderItemId().equals(item.getId())) {
                    achieveNewList.add(achieveNew);
                }
            }
            item.setAchaeveList(achieveNewList);
        });
        order.setItems(orderItems);
        achieveNewService.addAchaeveByOrder(order);
        return AjaxResult.buildSuccessInstance("保存成功");
        if (CollectionUtils.isNotEmpty(list)) {
            //删除原业绩
            achieveNewDao.deleteByOrderId(list.get(0).getOrderId());
            //插入新业绩
            achieveNewDao.batchInsert(list);
            return AjaxResult.buildSuccessInstance("保存成功");
        } else {
            return AjaxResult.buildFailInstance("未找到业绩数据");
        }
    }
}
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesmanAction.java
@@ -54,6 +54,7 @@
    @Autowired
    ShopSalesmanApplyDao salesmanApplyDao;
    @Autowired
    ShopSalesmanApplyService shopSalesmanApplyService;
@@ -84,7 +85,7 @@
    public AjaxResult applyToBeAnSalesman(@RequestBody Map<String,String> param) {
        BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class);
        String invitationId = param.get("invitationId");
        ShopSalesmanApply shopSalesmanApply= shopSalesmanApplyService.applyToBeAnSalesman(loginUser.getOpenId(),invitationId);
        ShopSalesmanApply shopSalesmanApply= shopSalesmanApplyService.applyToBeAnSalesman(loginUser.getOpenId(),"",invitationId);
        loginUser=bizUserDao.selectById(loginUser.getUserId());
        redisUserLoginUtils.updateUserInfo(loginUser);
        return AjaxResult.buildSuccessInstance(shopSalesmanApply);
zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/OrderTask.java
@@ -89,7 +89,7 @@
    private ShopSalesmanGradeDao shopSalesmanGradeDao;
    @Transactional(rollbackFor = Exception.class)
    public void synchronizationOrderToErp(ShopOrder orderDto) {
    public void createOrder(ShopOrder orderDto) {
        //判断是否存在需要同步的产品,只有绑定了erp中产品的才同步
        boolean needTb=false;
@@ -127,7 +127,7 @@
            order.setTotal(orderDto.getOrderMoney().doubleValue());
            order.setZkTotal(orderDto.getOrderMoney().doubleValue());
            order.setPayTime(new Date());
            order.setArrears(0);
            order.setArrears(0D);
            int i = sysOrderDao.insert(order);
            // 创建订单明细,并计算总价与折扣总价
            int count = 0;
zq-erp/src/main/resources/config/db/increment/美度业绩升级.sql
New file
@@ -0,0 +1,13 @@
ALTER TABLE `achieve_new`
    ADD COLUMN `achieveMoney` double(10, 0) NULL AFTER `company_id`;
ALTER TABLE `sys_order`
    ADD COLUMN `orderType` int(2) NULL COMMENT '订单类型1,销售订单,2退款订单' AFTER `company_id`;
ALTER TABLE `achieve_new`
    CHANGE COLUMN `t3` `achieveType` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL AFTER `t2`;
ALTER TABLE `sys_order_item`
    ADD COLUMN `refundCount` int(11) NULL COMMENT '退款数量' AFTER `pay_method_detail`;
zq-erp/src/main/resources/mybatis/mapper/fenxiao/ShopSalesmanApplyDao.xml
@@ -64,7 +64,7 @@
        LEFT JOIN biz_user b ON a.user_id = b.user_id
        LEFT JOIN shop_salesman_grade g ON b.salesman_grade = g.id
        <where>
            and a.company_id=#{record.companyId}
             a.company_id=#{record.companyId}
            <if test="record.shenheState != null and record.shenheState != ''">
                and a.apply_status=#{record.shenheState}
            </if>
@@ -82,7 +82,7 @@
        shop_salesman_apply a
        LEFT JOIN biz_user b ON a.user_id = b.user_id
        <where>
            and a.company_id = #{record.companyId}
            a.company_id = #{record.companyId}
            and a.apply_status = #{record.applyStatus}
            <if test="record.nickName != null and record.nickName != ''">
                and b.nick_name like concat('%',#{record.nickName},'%')
@@ -93,5 +93,23 @@
            a.${record.sort} ${record.order}
        </if>
    </select>
    <select id="selectBizUserApplyList" resultType="com.matrix.system.fenxiao.vo.ShopSalesmanAppliingVo">
        SELECT
        a.user_id userId,
        a.nick_name nickName
        FROM
        biz_user a
        <where>
            a.company_id = #{record.companyId}
            and a.is_sales != 1
            <if test="record.nickName != null and record.nickName != ''">
                and a.nick_name like concat('%',#{record.nickName},'%')
            </if>
        </where>
        <if test="record.sort !=null">
            order by
            a.${record.sort} ${record.order}
        </if>
    </select>
</mapper>
zq-erp/src/main/resources/mybatis/mapper/fenxiao/ShopSalesmanGradeDao.xml
@@ -34,4 +34,15 @@
            <result property="companyId" column="company_id" />
    </resultMap>
    <select id="getShopSalesmanGradeVo" resultType="com.matrix.system.fenxiao.vo.ShopSalesmanGradeVo">
        SELECT
        a.id,
        a.name
        FROM
        shop_salesman_grade a
        where
        a.company_id = #{companyId}
    </select>
</mapper>
zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
@@ -17,9 +17,6 @@
        <result property="vipId" column="vip_id" />
        <result property="freeConsume" column="free_consume" />
        <result property="hisConsume" column="his_consume" />
        <result property="consume" column="consume" />
        <result property="cardCash" column="card_cash" />
        <result property="projCash" column="proj_cash" />
        <result property="goodsCash" column="goods_cash" />
        <result property="projNum" column="proj_num" />
        <result property="numberOfPeople" column="number_of_people" />
@@ -30,7 +27,7 @@
        <result property="projPercentage" column="proj_percentage" />
        <result property="t1" column="t1" />
        <result property="t2" column="t2" />
        <result property="t3" column="t3" />
        <result property="achieveType" column="achieveType" />
        <result property="t4" column="t4" />
        <result property="t5" column="t5" />
        <result property="t6" column="t6" />
@@ -52,7 +49,8 @@
        <result property="goodsNo" column="goodsNo" />
        <result property="goodsName" column="goodsName" />
        <result property="zkPrice" column="zkPrice" />
        <result property="payMethod" column="pay_method" />
        <result property="cateName" column="cateName" />
    </resultMap>
@@ -67,13 +65,8 @@
        d.level_name,
        c.vip_name,
        e.name as pro_name,
        a.card_cash,
        (IFNULL(a.card_cash,0) +IFNULL(a.proj_cash,0) + IFNULL(a.goods_cash,0)
        ) as zk_total,
        a.proj_cash,
        b.ZK_TOTAL as zk_total,
        a.goods_cash,
        a.card_cash,
        a.consume,
        a.his_consume,
        a.free_consume,
        f.su_name meiliao,
@@ -82,9 +75,11 @@
        a.number_of_people,
        a.proj_num,
        a.proj_time,
        i.name as module_subName,
        h.SHOP_NAME shop_name,
        a.order_type
        i.name as cateName,
        h.shop_short_name shop_name,
        a.order_type,
        a.achieveType,
        j.pay_method
        from
        achieve_new a
        left join sys_order b on a.order_id=b.id
@@ -96,6 +91,7 @@
        LEFT JOIN sys_shop_info h ON a.SHOP_ID = h.ID
        LEFT JOIN shopping_goods_category i ON e.cate_id = i.id
        left join sys_proj_services l on a.service_order_id=l.id
        left join sys_order_item j on a.order_item_id=j.ID
        <where>
            <if test="record!=null">
                <if
@@ -206,12 +202,8 @@
        YEAR (a.datatime) year,
        MONTH (a.datatime) month,
        DAY(a.datatime) day,
        SUM(a.card_cash) as card_cash ,
        SUM((IFNULL(a.card_cash,0) +IFNULL(a.proj_cash,0) + IFNULL(a.goods_cash,0) ) )as zk_total,
        SUM(a.proj_cash) as proj_cash,
        SUM( IFNULL(a.goods_cash,0)  )as zk_total,
        SUM(a.goods_cash) as goods_cash,
        SUM(a.card_cash) as card_cash,
        SUM(a.consume) as consume,
        SUM(a.his_consume) as his_consume,
        SUM(a.free_consume) as free_consume,
        SUM(a.proj_percentage) as proj_percentage,
@@ -287,9 +279,6 @@
        <result property="vipId" column="vip_id" />
        <result property="freeConsume" column="free_consume" />
        <result property="hisConsume" column="his_consume" />
        <result property="consume" column="consume" />
        <result property="cardCash" column="card_cash" />
        <result property="projCash" column="proj_cash" />
        <result property="goodsCash" column="goods_cash" />
        <result property="projNum" column="proj_num" />
        <result property="numberOfPeople" column="number_of_people" />
@@ -298,9 +287,10 @@
        <result property="remark" column="remark" />
        <result property="orderType" column="order_type" />
        <result property="projPercentage" column="proj_percentage" />
        <result property="t1" column="t1" />
        <result property="t2" column="t2" />
        <result property="t3" column="t3" />
        <result property="achieveType" column="achieveType" />
        <result property="t4" column="t4" />
        <result property="t5" column="t5" />
        <result property="t6" column="t6" />
@@ -323,9 +313,6 @@
        vip_id,
        free_consume,
        his_consume,
        consume,
        card_cash,
        proj_cash,
        goods_cash,
        proj_num,
        number_of_people,
@@ -334,9 +321,10 @@
        remark,
        order_type,
        proj_percentage,
        t1,
        t2,
        t3,
        achieveType,
        t4,
        t5,
        t6,
@@ -359,9 +347,6 @@
        #{item.vipId},
        #{item.freeConsume},
        #{item.hisConsume},
        #{item.consume},
        #{item.cardCash},
        #{item.projCash},
        #{item.goodsCash},
        #{item.projNum},
        #{item.numberOfPeople},
@@ -370,9 +355,10 @@
        #{item.remark},
        #{item.orderType},
        #{item.projPercentage},
        #{item.t1},
        #{item.t2},
        #{item.t3},
        #{item.achieveType},
        #{item.t4},
        #{item.t5},
        #{item.t6},
@@ -436,18 +422,8 @@
                test="(record.hisConsume!=null and record.hisConsume!='') or  (record.hisConsume!='' and record.hisConsume==0)  ">
                and his_consume = #{record.hisConsume}
            </if>
            <if
                test="(record.consume!=null and record.consume!='') or  (record.consume!='' and record.consume==0)  ">
                and consume = #{record.consume}
            </if>
            <if
                test="(record.cardCash!=null and record.cardCash!='') or  (record.cardCash!='' and record.cardCash==0)  ">
                and card_cash = #{record.cardCash}
            </if>
            <if
                test="(record.projCash!=null and record.projCash!='') or  (record.projCash!='' and record.projCash==0)  ">
                and proj_cash = #{record.projCash}
            </if>
            <if
                test="(record.goodsCash!=null and record.goodsCash!='') or  (record.goodsCash!='' and record.goodsCash==0)  ">
                and goods_cash = #{record.goodsCash}
@@ -489,8 +465,8 @@
                and t2 = #{record.t2}
            </if>
            <if
                test="(record.t3!=null and record.t3!='') or  (record.t3!='' and record.t3==0)  ">
                and t3 = #{record.t3}
                test="(record.achieveType!=null and record.achieveType!='') or  (record.achieveType!='' and record.achieveType==0)  ">
                and achieveType = #{record.achieveType}
            </if>
            <if
                test="(record.t4!=null and record.t4!='') or  (record.t4!='' and record.t4==0)  ">
@@ -584,15 +560,9 @@
            <if test="_parameter.containsKey('hisConsume')">
                his_consume = #{hisConsume},
            </if>
            <if test="_parameter.containsKey('consume')">
                consume = #{consume},
            </if>
            <if test="_parameter.containsKey('cardCash')">
                card_cash = #{cardCash},
            </if>
            <if test="_parameter.containsKey('projCash')">
                proj_cash = #{projCash},
            </if>
            <if test="_parameter.containsKey('goodsCash')">
                goods_cash = #{goodsCash},
            </if>
@@ -617,14 +587,15 @@
            <if test="_parameter.containsKey('projPercentage')">
                proj_percentage = #{projPercentage},
            </if>
            <if test="_parameter.containsKey('t1')">
                t1 = #{t1},
            </if>
            <if test="_parameter.containsKey('t2')">
                t2 = #{t2},
            </if>
            <if test="_parameter.containsKey('t3')">
                t3 = #{t3},
            <if test="_parameter.containsKey('achieveType')">
                achieveType = #{achieveType},
            </if>
            <if test="_parameter.containsKey('t4')">
                t4 = #{t4},
@@ -703,15 +674,8 @@
            <if test="record.hisConsume != null ">
                his_consume = #{record.hisConsume},
            </if>
            <if test="record.consume != null ">
                consume = #{record.consume},
            </if>
            <if test="record.cardCash != null ">
                card_cash = #{record.cardCash},
            </if>
            <if test="record.projCash != null ">
                proj_cash = #{record.projCash},
            </if>
            <if test="record.goodsCash != null ">
                goods_cash = #{record.goodsCash},
            </if>
@@ -736,14 +700,15 @@
            <if test="record.projPercentage != null ">
                proj_percentage = #{record.projPercentage},
            </if>
            <if test="record.t1 != null and record.t1 != '' ">
                t1 = #{record.t1},
            </if>
            <if test="record.t2 != null and record.t2 != '' ">
                t2 = #{record.t2},
            </if>
            <if test="record.t3 != null and record.t3 != '' ">
                t3 = #{record.t3},
            <if test="record.achieveType != null and record.achieveType != '' ">
                achieveType = #{record.achieveType},
            </if>
            <if test="record.t4 != null and record.t4 != '' ">
                t4 = #{record.t4},
@@ -784,6 +749,11 @@
        DELETE FROM achieve_new
        where 1=1
        <include refid="where_sql"></include>
    </delete>
    <delete id="deleteByOrderId">
        DELETE FROM achieve_new where order_id=#{orderId}
    </delete>
@@ -857,7 +827,7 @@
            sum(b.hisConsume) his_consume
        from sys_vip_info a
        inner join (
            select vip_id,datatime, sum(a.free_consume) freeConsume, sum(a.his_consume) hisConsume, sum(IFNULL(goods_cash, 0) + IFNULL(card_cash, 0)) buyConsume from achieve_new a group by vip_id
            select vip_id,datatime, sum(a.free_consume) freeConsume, sum(a.his_consume) hisConsume, sum(IFNULL(goods_cash, 0) )) buyConsume from achieve_new a group by vip_id
        ) b on a.ID = b.vip_id
        inner join (
            select vip_id, count(1) cnt from (
@@ -904,7 +874,7 @@
        select count(1)
        from sys_vip_info a
        inner join (
        select vip_id,datatime, sum(a.free_consume) freeConsume, sum(a.his_consume) hisConsume, sum(IFNULL(goods_cash, 0) + IFNULL(card_cash, 0)) buyConsume from achieve_new a group by vip_id
        select vip_id,datatime, sum(a.free_consume) freeConsume, sum(a.his_consume) hisConsume, sum(IFNULL(goods_cash, 0)  ) buyConsume from achieve_new a group by vip_id
        ) b on a.ID = b.vip_id
        inner join (
        select vip_id, count(1) cnt from (
@@ -940,8 +910,18 @@
    <select id="selectUserAchieveByTime" resultType="com.matrix.system.app.vo.UserAchieveVo">
        select
            sale_id id,
            sum(case t3 when '现金业绩' then card_cash else 0 end) orderCash,
            sum(case t3 when '划扣业绩' then consume else 0 end) cash,
            (select ifnull(sum(case b.pay_method when '现金' then goods_cash else 0 end),0)
                from achieve_new a
                inner join sys_order_item b on a.order_item_id=b.ID
            where a.beault_id=#{userId}
            and (date_format(datatime, '%Y-%m-%d') >= date_format(#{startTime}, '%Y-%m-%d') and date_format(#{endTime}, '%Y-%m-%d') >= date_format(datatime, '%Y-%m-%d'))
            ) orderCash,
            (select ifnull(sum(case b.pay_method when '划扣' then goods_cash else 0 end),0)
                from achieve_new a
                inner join sys_order_item b on a.order_item_id=b.ID
            where  a.beault_id=#{userId}
            and (date_format(datatime, '%Y-%m-%d') >= date_format(#{startTime}, '%Y-%m-%d') and date_format(#{endTime}, '%Y-%m-%d') >= date_format(datatime, '%Y-%m-%d'))
            ) cash,
            sum(case order_type when '订单' then proj_percentage else 0 end) cardUse,
            sum(IFNULL(his_consume, 0)) hisConsume,
            sum(IFNULL(free_consume, 0)) freeConsume,
@@ -954,7 +934,7 @@
    <select id="selectApiOrderItemAchieve" resultType="com.matrix.system.app.vo.OrderDetailAchieveItemVo">
        select
            b.su_name name,
            IFNULL(a.card_cash, 0) + IFNULL(a.proj_cash, 0) + IFNULL(a.goods_cash, 0) achieve
            IFNULL(a.goods_cash, 0) achieve
        from achieve_new a
        inner join sys_users b on (a.beault_id=b.su_id or a.sale_id = b.su_id)
        where a.order_item_id=#{itemId} and order_type = '订单'
@@ -989,7 +969,7 @@
        select
            b.su_name name,
            b.su_id id,
            sum(IFNULL(a.free_consume,0) + IFNULL(a.his_consume, 0) + IFNULL(a.consume, 0)) amount,
            sum(IFNULL(a.free_consume,0) + IFNULL(a.his_consume, 0) ) amount,
            c.shop_short_name shopName
        from achieve_new a
        inner join sys_users b on a.beault_id=b.su_id
@@ -1022,7 +1002,8 @@
            b.code goodsNo,
            b.name goodsName,
            c.su_name meiliao,
            d.count*d.zk_price zk_total
            d.count*d.zk_price zk_total,
            d.pay_method
        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
@@ -1035,7 +1016,7 @@
        b.su_name name,
        b.su_id id,
        b.su_photo photo,
        sum(ifnull(card_cash,0)) amount,
        sum(ifnull(goods_cash,0)) amount,
        c.shop_short_name shopName
        from achieve_new a
        inner join sys_users b on a.beault_id=b.su_id
@@ -1065,7 +1046,7 @@
        select
            b.shop_short_name name,
            b.SHOP_IMAG photo,
            sum(IFNULL(a.consume,0) + IFNULL(a.card_cash,0)) amount
            sum(IFNULL(a.goods_cash,0)) amount
        from achieve_new a
        left join sys_shop_info b on a.shop_id=b.ID and shop_type!=1
        <where>
zq-erp/src/main/resources/mybatis/mapper/hive/SysBeauticianStateDao.xml
@@ -137,7 +137,8 @@
            d.id as pu_id,
            d.SURPLUS_COUNT as pu_SURPLUS_COUNT,
            d.ASSEMBLE_ID as pu_ASSEMBLE_ID,
            d.price as pu_price
            d.price as pu_price,
            d.taocan_id as pu_taocan_id
        from sys_beautician_state a
zq-erp/src/main/resources/mybatis/mapper/hive/SysBusinessDataDao.xml
@@ -709,7 +709,7 @@
                    </if>
                ) refund,
                (select IFNULL(count(1),0) from sys_order
                    where STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                    where STATU in ('已付款', '欠款') and orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                    <if test="shopId != null">
                        and shop_id=#{shopId}
                    </if>
@@ -718,7 +718,7 @@
                    </if>
                    ) perCustomCnt,
                (select IFNULL(sum(b.COUNT),0) from sys_order a inner join sys_order_item b on a.ID=b.ORDER_ID
                    where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                    where a.STATU in ('已付款', '欠款') and a.orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                    <if test="shopId != null">
                        and shop_id=#{shopId}
                    </if>
@@ -732,7 +732,7 @@
                    inner join sys_store_info d on c.store_id = d.ID
                    inner join sys_order_item e on a.ID=e.ORDER_ID
                    inner join shopping_goods f on e.goods_id=f.id and f.good_type='家居产品'
                    where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                    where a.STATU in ('已付款', '欠款') and a.orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                    <if test="shopId != null">
                        and a.shop_id=#{shopId}
                    </if>
@@ -743,7 +743,7 @@
                (select IFNULL(sum(b.COUNT * IFNULL(c.price, 0)),0) from sys_order a
                    inner join sys_order_item b on a.ID=b.ORDER_ID
                    inner join shopping_goods c on c.good_type != '家居产品' and b.goods_id=c.id
                    where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                    where a.STATU in ('已付款', '欠款') and a.orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                    <if test="shopId != null">
                        and a.shop_id=#{shopId}
                    </if>
@@ -806,7 +806,7 @@
            #{item.beginTime} dataTime,
            (select shop_short_name from sys_shop_info where id=#{shopId}) shopName,
            (select sum(total) shouldPay from sys_order
                where STATU in ('已付款', '欠款') and <![CDATA[ create_time > #{item.beginTime} and create_time < #{item.endTime}]]>
                where STATU in ('已付款', '欠款') and orderType=1 and <![CDATA[ create_time > #{item.beginTime} and create_time < #{item.endTime}]]>
                <if test="shopId != null">
                    and shop_id=#{shopId}
                </if>
@@ -869,13 +869,13 @@
            </if>
            ) refund,
            (select IFNULL(count(1),0) from sys_order
            where STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
            where STATU in ('已付款', '欠款') and orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
            <if test="shopId != null">
                and shop_id=#{shopId}
            </if>
            ) perCustomCnt,
            (select IFNULL(sum(b.COUNT),0) from sys_order a inner join sys_order_item b on a.ID=b.ORDER_ID
            where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
            where a.STATU in ('已付款', '欠款') and a.orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
            <if test="shopId != null">
                and shop_id=#{shopId}
            </if>
@@ -886,7 +886,7 @@
            inner join sys_store_info d on c.store_id = d.ID
            inner join sys_order_item e on a.ID=e.ORDER_ID
            inner join shopping_goods f on e.goods_id=f.id and f.good_type='家居产品'
            where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
            where a.STATU in ('已付款', '欠款') and a.orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
            <if test="shopId != null">
                and a.shop_id=#{shopId}
            </if>
@@ -894,7 +894,7 @@
            (select IFNULL(sum(b.COUNT * IFNULL(c.price, 0)),0) from sys_order a
            inner join sys_order_item b on a.ID=b.ORDER_ID
            inner join shopping_goods c on c.good_type != '家居产品' and b.goods_id=c.id
            where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
            where a.STATU in ('已付款', '欠款') and a.orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
            <if test="shopId != null">
                and a.shop_id=#{shopId}
            </if>
zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderDao.xml
@@ -23,6 +23,7 @@
        <result property="vipNo" column="VIP_NO"/>
        <result property="staffName" column="STAFF_NAME"/>
        <result property="changeId" column="CHANGE_ID"/>
        <result property="orderType" column="orderType"/>
        <result property="cashPay" column="cash_Pay"/>
        <result property="cardPay" column="card_Pay"/>
@@ -61,7 +62,9 @@
        beatuyId,
        beatuyName,
        pay_time,
        company_id
        company_id,
        orderType,
        is_has_refund
        )
        VALUES (
        #{id},
@@ -83,7 +86,9 @@
        #{beatuyId},
        #{beatuyName},
        #{payTime},
        #{companyId}
        #{companyId},
        #{orderType},
        #{isHasRefund}
        )
    </insert>
@@ -140,9 +145,11 @@
            <if test="cashPay != null and cashPay  !='' ">
                cash_Pay = #{cashPay},
            </if>
            <if test="payTime != null  ">
                pay_time = #{payTime},
            </if>
            <if test="isHasRefund != null  ">
                is_has_refund = #{isHasRefund},
            </if>
        </set>
@@ -229,6 +236,9 @@
            <if test="(record.companyId!=null and record.companyId!='') ">
                and a.company_id = #{record.companyId}
            </if>
            <if test="(record.orderType!=null and record.orderType!='') ">
                and a.orderType = #{record.orderType}
            </if>
            <if test="record.beginTimeVo != null  ">
                and a.ORDER_TIME >= #{record.beginTimeVo}
            </if>
@@ -282,6 +292,9 @@
            </if>
            <if test="(record.companyId!=null and record.companyId!='') ">
                and a.company_id = #{record.companyId}
            </if>
            <if test="(record.orderType!=null and record.orderType!='') ">
                and a.orderType = #{record.orderType}
            </if>
            <if test="record.isCross != null and record.isCross !='' ">
                and a.IS_CROSS = #{record.isCross}
@@ -405,6 +418,9 @@
            <if test="(record.companyId!=null and record.companyId!='') ">
                and a.company_id = #{record.companyId}
            </if>
            <if test="(record.orderType!=null and record.orderType!='') ">
                and a.orderType = #{record.orderType}
            </if>
        </if>
    </sql>
@@ -434,6 +450,9 @@
            <if test="(record.companyId!=null and record.companyId!='') ">
                and a.company_id = #{record.companyId}
            </if>
            <if test="(record.orderType!=null and record.orderType!='') ">
                and a.orderType = #{record.orderType}
            </if>
            <if test="record.activity != null and record.activity !='' ">
                and a.ACTIVITY = #{record.activity}
            </if>
zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderItemDao.xml
@@ -10,6 +10,7 @@
        <!-- <result property="projId" column="PROJ_ID" />
        <result property="skuId" column="SKU_ID" /> -->
        <result property="count" column="COUNT"/>
        <result property="refundCount" column="refundCount"/>
        <!-- <result property="taocanId" column="TAOCAN_ID" /> -->
        <result property="isFree" column="IS_FREE"/>
        <result property="type" column="TYPE"/>
@@ -49,6 +50,7 @@
        a.TOTAL,
        a.SKU_ID,
        b.COUNT,
        b.refundCount,
        b.ID,
        b.IS_FREE,
        b.ORDER_ID,
@@ -89,6 +91,7 @@
        ID,
        ORDER_ID,
        COUNT,
        refundCount,
        TYPE,
        IS_FREE,
        PRICE,
@@ -106,6 +109,7 @@
        #{id},
        #{orderId},
        #{count},
        #{refundCount},
        #{type},
        #{isFree},
        #{price},
@@ -131,6 +135,9 @@
            </if>
            <if test="count != null and count !='' or count == 0 ">
                COUNT = #{count},
            </if>
            <if test="refundCount != null and refundCount !='' or refundCount == 0 ">
                refundCount = #{refundCount},
            </if>
            <if test="isFree != null and isFree !='' ">
                IS_FREE = #{isFree},
@@ -232,6 +239,7 @@
        i.ID,
        i.ORDER_ID,
        i.COUNT,
        i.refundCount,
        i.TYPE,
        i.IS_FREE,
        i.PRICE,
@@ -289,6 +297,7 @@
        ID,
        ORDER_ID,
        COUNT,
        refundCount,
        TYPE,
        IS_FREE,
        PRICE,
@@ -341,6 +350,7 @@
        c.name as goodsName,
        g.name as cateName,
        a.COUNT,
        a.refundCount,
        a.ZK_PRICE,
        a.IS_FREE,
        a.pay_method,
zq-erp/src/main/resources/mybatis/mapper/hive/SysProjServicesDao.xml
@@ -700,4 +700,10 @@
    </select>
    <select id="selectProjServicesByOrderItemId" resultMap="SysProjServicesMap">
        select a.* from sys_proj_services a
          inner join sys_beautician_state b on a.id=b.SERVICES_ID
          inner join sys_proj_use c on c.id=b.puse_id
        where ORDER_ITEM_ID=#{itemId} and a.STATE!='预约取消'
    </select>
</mapper>
zq-erp/src/main/resources/mybatis/mapper/hive/TjVipSumDao.xml
@@ -285,7 +285,7 @@
        <foreach collection="list" index="index" item="item"   separator=","  >
            (
            select IFNULL(count(1),0) from sys_order
            where STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
            where STATU in ('已付款', '欠款') and orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
            <if test="shopId != null">
                and shop_id=#{shopId}
            </if>
@@ -304,7 +304,7 @@
            select case a.perCustomCnt when 0 then 0 else a.totalSaleCnt/a.perCustomCnt end from (
                select
                (select IFNULL(count(1),0) from sys_order
                    where STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                    where STATU in ('已付款', '欠款') and orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                    <if test="shopId != null">
                        and shop_id=#{shopId}
                    </if>
@@ -313,7 +313,7 @@
                    </if>
                ) perCustomCnt,
                (select IFNULL(sum(b.COUNT),0) from sys_order a inner join sys_order_item b on a.ID=b.ORDER_ID
                    where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                    where a.STATU in ('已付款', '欠款') and a.orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                    <if test="shopId != null">
                        and shop_id=#{shopId}
                    </if>
@@ -334,7 +334,7 @@
            select case a.perCustomCnt when 0 then 0 else a.totalPay/a.perCustomCnt end from (
            select
            (select IFNULL(count(1),0) from sys_order
            where STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
            where STATU in ('已付款', '欠款') and orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
            <if test="shopId != null">
                and shop_id=#{shopId}
            </if>
@@ -369,7 +369,7 @@
                        inner join sys_store_info d on c.store_id = d.ID
                        inner join sys_order_item e on a.ID=e.ORDER_ID
                        inner join shopping_goods f on e.goods_id=f.id and f.good_type='家居产品'
                        where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                        where a.STATU in ('已付款', '欠款') and a.orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                        <if test="shopId != null">
                            and a.shop_id=#{shopId}
                        </if>
@@ -380,7 +380,7 @@
                    (select IFNULL(sum(b.COUNT * IFNULL(c.price, 0)),0) from sys_order a
                        inner join sys_order_item b on a.ID=b.ORDER_ID
                        inner join shopping_goods c on c.good_type != '家居产品' and b.goods_id=c.id
                        where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                        where a.STATU in ('已付款', '欠款') and a.orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                        <if test="shopId != null">
                            and a.shop_id=#{shopId}
                        </if>
@@ -406,7 +406,7 @@
                        inner join sys_store_info d on c.store_id = d.ID
                        inner join sys_order_item e on a.ID=e.ORDER_ID
                        inner join shopping_goods f on e.goods_id=f.id and f.good_type='家居产品'
                        where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                        where a.STATU in ('已付款', '欠款') and a.orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                        <if test="shopId != null">
                            and a.shop_id=#{shopId}
                        </if>
@@ -417,7 +417,7 @@
                    (select IFNULL(sum(b.COUNT * IFNULL(c.price, 0)),0) from sys_order a
                        inner join sys_order_item b on a.ID=b.ORDER_ID
                        inner join shopping_goods c on c.good_type != '家居产品' and b.goods_id=c.id
                        where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                        where a.STATU in ('已付款', '欠款') and a.orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                        <if test="shopId != null">
                            and a.shop_id=#{shopId}
                        </if>
@@ -452,7 +452,7 @@
                        inner join sys_store_info d on c.store_id = d.ID
                        inner join sys_order_item e on a.ID=e.ORDER_ID
                        inner join shopping_goods f on e.goods_id=f.id and f.good_type='家居产品'
                        where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                        where a.STATU in ('已付款', '欠款') and a.orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                        <if test="shopId != null">
                            and a.shop_id=#{shopId}
                        </if>
@@ -463,7 +463,7 @@
                    (select IFNULL(sum(b.COUNT * IFNULL(c.price, 0)),0) from sys_order a
                        inner join sys_order_item b on a.ID=b.ORDER_ID
                        inner join shopping_goods c on c.good_type != '家居产品' and b.goods_id=c.id
                        where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                        where a.STATU in ('已付款', '欠款') and a.orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                        <if test="shopId != null">
                            and a.shop_id=#{shopId}
                        </if>
@@ -528,9 +528,18 @@
            select
                #{item.beginTime} time,
                (select ifnull(sum(ifnull(card_cash,0) + ifnull(consume,0)),0) from achieve_new a where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>) orderAmount,
                (select ifnull(sum(case t3 when '现金业绩' then card_cash else 0 end),0) from achieve_new a where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>) cashAmount,
                (select ifnull(sum(case t3 when '划扣业绩' then consume else 0 end),0) from achieve_new a where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>) cardAmount,
                (select ifnull(sum(case t3 when '划扣业绩' then consume else 0 end),0) from achieve_new a where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>) cardUseAmount,
                (select ifnull(sum(case b.pay_method when '现金' then goods_cash else 0 end),0)
                    from achieve_new a
                    inner join sys_order_item b on a.order_item_id=b.ID
                where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>) cashAmount,
                (select ifnull(sum(case b.pay_method when '划扣' then goods_cash else 0 end),0)
                    from achieve_new a
                    inner join sys_order_item b on a.order_item_id=b.ID
                where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>) cardAmount,
                (select ifnull(sum(case b.pay_method when '划扣' then goods_cash else 0 end),0)
                    from achieve_new a
                    inner join sys_order_item b on a.order_item_id=b.ID
                where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>) cardUseAmount,
                (select ifnull(sum(ifnull(proj_percentage, 0)),0) from achieve_new a where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]> and order_type='订单') goodsAmount,
                (select ifnull(sum(ifnull(his_consume, 0)),0) from achieve_new a where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>) hisConsume,
                (select ifnull(sum(ifnull(free_consume, 0)),0) from achieve_new a where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>) freeConsume,
@@ -560,14 +569,14 @@
    <select id="selectStaffCashAchieve" resultType="java.util.TreeMap">
        select
        <foreach collection="list" index="index" item="item"   separator=","  >
            (select ifnull(sum(case t3 when '现金业绩' then card_cash else 0 end),0)
            (select ifnull(sum(case b.pay_method when '现金' then goods_cash else 0 end),0)
                from achieve_new a
                where <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>
                <if test="staffId != null and staffId != 0">
                    and a.beault_id=#{staffId}
                </if>
                inner join sys_order_item b on a.order_item_id=b.ID
            where <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>
            <if test="staffId != null and staffId != 0">
                and a.beault_id=#{staffId}
            </if>
            ) as t${index}
        </foreach>
        from area where id=1
    </select>
@@ -575,8 +584,9 @@
    <select id="selectStaffCardAchieve" resultType="java.util.TreeMap">
        select
        <foreach collection="list" index="index" item="item"   separator=","  >
            (select ifnull(sum(case t3 when '划扣业绩' then consume else 0 end),0)
            from achieve_new a
            (select ifnull(sum(case b.pay_method when '划扣' then goods_cash else 0 end),0)
                from achieve_new a
                inner join sys_order_item b on a.order_item_id=b.ID
            where <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>
            <if test="staffId != null and staffId != 0">
                and a.beault_id=#{staffId}
zq-erp/src/main/resources/readme-jyy
New file
@@ -0,0 +1,11 @@
删除
cardCash
projCash
只留下
goodsCash
产品现金业绩和划扣业绩consume
重构订单,收款,退款等方法不要共用逻辑
把所有历史订单的订单类型区分销售订单和退款订单
zq-erp/src/main/resources/static/templates/vipInfoImport.xls
Binary files differ
zq-erp/src/main/resources/static/templates/vipProjUse.xls
Binary files differ
zq-erp/src/main/resources/templates/views/admin/fenxiao/fenxiao-apply.html
@@ -18,12 +18,6 @@
        .panel-body{
            overflow: hidden;
        }
        .rowPanel{
            background: #ffffff;
            padding: 0px 10px ;
            padding-top: 10px;
            margin: 0px 0px 10px 0px;
        }
        .paginationStyle{
            background: #ffffff;
            padding: 10px 10px;
@@ -34,7 +28,7 @@
</head>
<body>
<div class="panel-body" id="app">
    <el-row class="rowPanel"  >
    <el-row style="display:flex;align-items: center;">
        <el-form ref="form" :model="form" inline >
            <el-form-item prop="nickName">
                <el-input v-model="form.nickName" placeholder="请输入会员姓名"></el-input>
@@ -50,17 +44,28 @@
        <el-table id="proj" :data="table.rows"  :height="height" stripe @sort-change="sortChange">
            <el-table-column
                    prop="userId"
                    label="订单号"
                    width="180">
                    label=""
                    width="300">
            </el-table-column>
            <el-table-column
                    prop="nickname"
                    label="分销员昵称"
                    width="180">
            </el-table-column>
            <el-table-column
                    prop="salesGrade"
                    label="分销等级"
                    width="180">
                <template slot-scope="scope">
                    <el-select v-model="scope.row.proJbruserValue"  @focus="getDatalist(scope.row)" placeholder="请选择" filterable allow-create>
                        <el-option v-for="item in salesGradeList " :key="item.id" :label="item.name" :value="item.id">
                        </el-option>
                    </el-select>
                </template>
            </el-table-column>
            <el-table-column label="操作">
                <template slot-scope="scope">
                    <el-button type="text" size="small">设置为分销员</el-button>
                    <el-button type="text" size="small" @click="addSaleManApply(scope.row)">设置为分销员</el-button>
                </template>
            </el-table-column>
        </el-table>
@@ -102,6 +107,8 @@
                order:'',
                sort:''
            },
            proJbruserValue : "",
            salesGradeList: [],
            height:'calc(100vh - 240px)',
        },
        created: function () {
@@ -109,6 +116,38 @@
            window.addEventListener("keydown", this.keydown);
        },
        methods: {
            //设置为分销员
            addSaleManApply(row){
                let _this = this;
                let userId = row.userId;
                let gradeId = row.proJbruserValue;
                alert(gradeId);
                let obj = {
                    userId: userId,
                    gradeId: gradeId,
                }
                AjaxProxy.requst({
                    app: _this,
                    data:obj,
                    url: basePath + '/fenXiao/fenXiaoUser/addSaleManApply',
                    callback: function (data) {
                        _this.$message.success(data.info);
                        this.loadData();
                    }
                });
            },
            // select下拉框获取焦点的时候查询对应的下拉框数据源
            getDatalist(row) {
                let _this = this;
                AjaxProxy.requst({
                    app: _this,
                    data:[],
                    url: basePath + '/fenXiao/fenXiaoUser/getShopSalesmanGrade',
                    callback: function (data) {
                        _this.salesGradeList = data.mapInfo.salesGrade;
                    }
                });
            },
            changePageSize(val) {
                this.table.pageSize = val;
                this.loadData();
zq-erp/src/main/resources/templates/views/admin/hive-erp/order/orderXq-form.html
@@ -133,14 +133,14 @@
                </el-col>
            </el-row>
            <el-row type="flex" justify="center" style="margin: 20px;">
                <el-button size="medium" type="primary">打印</el-button>
                <el-button size="medium" type="primary" @click="printf">打印</el-button>
            </el-row>
        </el-aside>
        <el-main style="background-color: white; margin-right: 15px; margin-left: 15px; padding: 20px 30px;">
            <el-tabs v-model="activeName" @tab-click="handleClick">
                <el-tab-pane label="订单明细" name="first">
                    <el-row>
                        <el-button size="mini" type="primary" @click="openPayMoneyDialog" v-if="isRefund">提交退款</el-button>
                        <el-button size="mini" type="primary" @click="openPayMoneyDialog" v-if="isRefund">提交退款<span v-if="totalRefund"> ¥ {{totalRefund}}</span></el-button>
                        <el-button size="mini" type="danger" @click="isRefund = false" v-if="isRefund">取消</el-button>
                        <el-button size="mini" type="primary" @click="isRefund = true" v-if="order.statu == '已付款' && !isRefund">退款</el-button>
                    </el-row>
@@ -180,6 +180,8 @@
                            </el-table-column>
                            <el-table-column  label="小计" :formatter="calOrderTotalFormatter">
                            </el-table-column>
                            <el-table-column  label="支付方式"  prop="payMethod">
                            </el-table-column>
                        </el-table>
                    </el-row>
                    <el-row v-show="isRefund">
@@ -214,12 +216,12 @@
                            </el-table-column>
                            <el-table-column label="退款单价">
                                <template slot-scope="scope">
                                    <el-input v-model="scope.row.refundPrice" v-if="scope.row.count > 0"></el-input>
                                    <el-input @change="calRefund" v-model="scope.row.refundPrice" v-if="scope.row.count > 0"></el-input>
                                </template>
                            </el-table-column>
                            <el-table-column label="退款数量">
                                <template slot-scope="scope">
                                    <el-input v-model.number="scope.row.refundCount" v-if="scope.row.count > 0"></el-input>
                                    <el-input @change="calRefund" v-model.number="scope.row.refundCount" v-if="scope.row.count > 0"></el-input>
                                </template>
                            </el-table-column>
                            <el-table-column label="是否退库存" align="center">
@@ -308,15 +310,19 @@
                                label="收款">
                        </el-table-column>
                        <el-table-column
                                prop="payMethod"
                                label="支付方式">
                        </el-table-column>
                        <el-table-column
                                prop="t3"
                                label="业绩类型">
                            <template slot-scope="scope">
                                <el-select v-model="scope.row.t3" placeholder="请选择业绩类型">
                                <el-select v-model="scope.row.achieveType" placeholder="请选择业绩类型">
                                    <el-option
                                            v-for="item in achieveTypeList"
                                            :key="item.key"
                                            :key="item.value"
                                            :label="item.value"
                                            :value="item.key">
                                            :value="item.value">
                                    </el-option>
                                </el-select>
                            </template>
@@ -325,7 +331,7 @@
                                prop="achieve"
                                label="业绩">
                            <template slot-scope="scope">
                                <el-input v-model="scope.row.t1"></el-input>
                                <el-input  @input="checkAchieveMoney" v-model="scope.row.goodsCash"></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column
@@ -354,9 +360,9 @@
                                           size="mini"
                                           @click="delAchieve(scope.$index, scope.row)">删除
                                </el-button>
                                <el-tooltip content="分享业绩" placement="top">
                                    <el-button @click="shareAchieve(scope.$index, scope.row)" icon="el-icon-share"
                                               size="mini" type="primary"></el-button>
                                <el-tooltip content="分享业绩" placement="top" v-if="!scope.row.isShare">
                                    <el-button  @click="shareAchieve(scope.$index, scope.row)" icon="el-icon-share"
                                                size="mini" type="primary"></el-button>
                                </el-tooltip>
                            </template>
                        </el-table-column>
@@ -379,6 +385,10 @@
                                prop="flowContent"
                                label="交易内容"
                                width="300">
                        </el-table-column>
                        <el-table-column
                                prop="createTime"
                                label="交易时间">
                        </el-table-column>
                        <el-table-column
                                prop="flowType"
@@ -449,9 +459,9 @@
            </el-col>
        </el-row>
<!--        <el-row style="text-align: center; margin: 20px 0 10px 0">-->
<!--            <el-checkbox v-model="printPaper">打印小票</el-checkbox>-->
<!--        </el-row>-->
        <!--        <el-row style="text-align: center; margin: 20px 0 10px 0">-->
        <!--            <el-checkbox v-model="printPaper">打印小票</el-checkbox>-->
        <!--        </el-row>-->
        <el-row style="text-align: center; margin: 10px 0 0 0">
            <el-button type="primary" @click="confirmSubmit">确认收款</el-button>
@@ -478,21 +488,14 @@
            activeName : "first",
            circleUrl : "https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png",
            userList : [],
            achieveTypeList : [
                {
                    "key" : "现金业绩",
                    "value" : "现金业绩"
                },{
                    "key" : "划扣业绩",
                    "value" : "划扣业绩"
                },
            ],
            achieveTypeList : [],
            orderItems : [],
            achieveItems : [],
            flowItems : [],
            payMethodItems : [],
            isRefund : false,
            isReturnAchieve : false,
            totalRefund : "",
            payMethods: [{
                value: '现金支付',
                img: '/images/pay/cash.png',
@@ -541,10 +544,28 @@
        created : function() {
            let _this = this;
            this.orderParam = /*[[${orderParam}]]*/
            this.queryOrderDetailData(this.orderParam);
                this.queryOrderDetailData(this.orderParam);
            // 业绩类型
            AjaxProxy.requst({
                app: _this,
                url: basePath + '/admin/customerDictionary/getListByParentCode/YJLX',
                callback: function (data) {
                    _this.achieveTypeList = data.rows;
                }
            });
        },
        methods : {
            calRefund() {
                let _this = this;
                var total = 0;
                _this.orderItems.forEach(item => {
                    if (item.refundPrice && item.refundCount) {
                        total += parseFloat(item.refundPrice * item.refundCount);
                    }
                })
                _this.totalRefund = total;
            },
            queryOrderDetailData(param) {
                let _this = this;
                AjaxProxy.requst({
@@ -682,7 +703,7 @@
                    }
                    if(_this.order.zkTotal - _this.order.refund - _this.order.arrears < total) {
                        this.$message.warning("退款金额不能超过收取金额");
                        this.$message.warning("退款金额不能超过收款金额");
                        return false;
                    }
                    _this.data.flows = flows;
@@ -839,34 +860,77 @@
            },
            saveAchieve() {
                let _this = this;
                AjaxProxy.requst({
                    app: _this,
                    data: _this.achieveItems,
                    contentType: 'application/json',
                    url: basePath + '/admin/achieve/add',
                    callback: function (data) {
                        _this.$message.success(data.info);
                    }
                });
            },
            shareAchieve(index, row) {
                var row2 = JSON.parse(JSON.stringify(row));
                row2.id = null;
                row2.isShare = true;
                this.achieveItems.push(row2);
            },
            delAchieve(index, row) {
                let _this = this;
                if (row.id) {
                if(_this.checkAchieveMoney()){
                    AjaxProxy.requst({
                        app: _this,
                        url: basePath + '/admin/achieve/del?id=' + row.id,
                        data: _this.achieveItems,
                        contentType: 'application/json',
                        url: basePath + '/admin/achieve/add',
                        callback: function (data) {
                            _this.$message.success(data.info);
                        }
                    });
                }
            },
            shareAchieve(index, row) {
                var row2 = JSON.parse(JSON.stringify(row));
                row2.id = null;
                row2.isShare = true;
                this.achieveItems.splice(index+1,0,row2);
                this.calculationAchieve();
            },
            //业绩均分订单金额
            calculationAchieve(){
                console.log("计算业绩");
                let jsqMap={};
                this.achieveItems.forEach(achieve=>{
                    key=achieve.achieveType+achieve.orderItemId;
                    if(!jsqMap[key]){
                        jsqMap[key]=1;
                    }else{
                        jsqMap[key]++;
                    }
                });
                this.achieveItems.forEach(achieve=>{
                    key=achieve.achieveType+achieve.orderItemId;
                    achieve.goodsCash=(achieve.zkTotal/jsqMap[key]).toFixed(2);
                });
            },
            //校验业绩是否大于订单收款金额
            checkAchieveMoney(){
                console.log("校验业绩是否大于订单收款金额");
                let jsqMap={};
                let isOk=true;
                for(let i=0 ; i< this.achieveItems.length; i++){
                    let achieve=this.achieveItems[i];
                    if(!isNaN(achieve.goodsCash)  ){
                        key=achieve.achieveType+achieve.orderItemId;
                        if(!jsqMap[key]){
                            jsqMap[key]=parseFloat(achieve.goodsCash);
                        }else{
                            jsqMap[key]=jsqMap[key]+parseFloat(achieve.goodsCash);
                        }
                        if(jsqMap[key]>achieve.zkTotal) {
                            this.$message.error("【"+achieve.goodsName + "】业绩分配金额大于支付金额");
                            isOk = false;
                            return;
                        }
                    }else{
                        this.$message.error("【"+achieve.goodsName + "】业绩分配金额请填写数字");
                        isOk=false;
                        return;
                    }
                };
                console.log("isOk",isOk);
                return isOk;
            },
            //删除业绩
            delAchieve(index, row) {
                let _this = this;
                _this.achieveItems.splice(index, 1);
                this.calculationAchieve();
            },
            checkAchieveIsDel(items) {
                var achieveIds = [];
@@ -886,7 +950,7 @@
                var id = this.order.id;
                layer.open({
                    type: 2,
                    title: "打印服务单",
                    title: "打印订单",
                    area: ['250px', '550px'],
                    maxmin: true,
                    content: [basePath + '/admin/redirect/hive/beautySalon/print-order?id=' + id]
zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/daily-list-new.html
@@ -26,7 +26,7 @@
                <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>
                    <button  matrix:btn="ygyjbbZb-exportExcel" onclick="exportExcel()" type="button" class="btn btn-default btn-sm"><i class="fa fa-download" ></i> 导出</button>
                    <button  matrix:btn="ygyjbb-exportExcel"  onclick="exportExcel()" type="button" class="btn btn-default btn-sm"><i class="fa fa-download" ></i> 导出</button>
                </div>
            </div>
            <div class="form-group mr-20">
@@ -71,12 +71,29 @@
                <input name="beginTime" type="text" class="form-control datetimepicker" id="beginTime">-
                <input name="endTime"  type="text" class="form-control datetimepicker" id="endTime">
            </div>
            <div class="form-group mr-20">
                <label >所属门店</label> <select id="select_id"
                    class="form-control autoFull"
                    th:data-url="@{/admin/shopInfo/findShops}" data-value="id"
                    data-filed="shopName" data-def="${obj.shopId}" name="shopId">
                    <option value="">--请选择所属门店--</option>
                <label>会员</label>
                <input autocomplete="off" placeholder="姓名/编号/电话"  name="vipQueryKey" type="text" class="form-control"  >
            </div>
            <div class="form-group mr-20">
                <label>美疗师</label>
                <select class="form-control autoFull select2"
                        th:data-url="@{/admin/getShopStaffByRoleName?roleName=美疗师}"
                        data-value="suId"
                        data-filed="suName"
                        name="beaultId"
                        id="beaultId">
                    <option value="">--请选择美容师--</option>
                </select>
            </div>
            <div class="form-group mr-20">
                <label>门店</label>
                <select class="form-control autoFull" data-filed="shopName" name="shopId" id="shopId"
                        th:data-url="@{/admin/shopInfo/findAllWithPermi}">
                    <option value=''>--请选择部所属门店--</option>
                </select>
            </div>
        </form>
@@ -87,32 +104,18 @@
                <tr>
                    <th data-formatter="MGrid.indexfn" data-align="center"
                        data-width="30px" data-footer-formatter="footCountTitle">序号</th>
                        <th data-field="datatime"  >时间</th>
                    <th data-field="datatime">时间</th>
                    <th data-field="orderNo" data-formatter="buildOpenDetail" >订单编号</th>
                    <th data-field="orderType">订单类型</th>
                    <th data-field="orderNo"  data-formatter="buildOpenDetail" >订单编号</th>
                    <th data-field="levelName">会员级别</th>
                    <th data-field="vipName">姓名</th>
                    <th data-field="proName">项目名称</th>
                    <th data-field="zkTotal" data-footer-formatter="countColumn">总现金业绩
                        <i data-toggle="tooltip" data-placement="top" title="总现金业绩=售卡+项目+产品" class="fa fa-question-circle"></i>
                    </th>
                    <th data-field="cardCash"  data-footer-formatter="countColumn"  >售卡业绩
                        <i data-toggle="tooltip" data-placement="top" title="售卡业绩:现金购买充值卡,套餐,充值的收款金额" class="fa fa-question-circle"></i>
                    </th>
                    <th data-field="projCash" data-footer-formatter="countColumn">项目业绩
                        <i data-toggle="tooltip" data-placement="top" title="项目业绩:现金购买单个项目的业绩" class="fa fa-question-circle"></i>
                    </th>
                    <th data-field="goodsCash" data-footer-formatter="countColumn">产品业绩
                        <i data-toggle="tooltip" data-placement="top" title="产品业绩:现金购买产品的业绩" class="fa fa-question-circle"></i>
                    </th>
                    <th data-field="consume" data-footer-formatter="countColumn">余额划扣业绩
                        <i data-toggle="tooltip" data-placement="top" title="余额划扣业绩:从客户的充值卡余额中划扣消费的金额" class="fa fa-question-circle"></i>
                    </th>
                    <th data-field="vipName">会员姓名</th>
                    <th data-field="proName">产品</th>
                    <th data-field="cateName">产品分类</th>
                    <th data-field="zkTotal" data-footer-formatter="countColumn">订单金额</th>
                    <th data-field="goodsCash" data-footer-formatter="countColumn">订单业绩</th>
                    <th data-field="payMethod">收款方式</th>
                    <th data-field="achieveType">业绩类型</th>
                    <th data-field="guwen">顾问</th>
                    <th data-field="meiliao">美疗师</th>
                    <th data-field="hisConsume" data-footer-formatter="countColumn">本金消耗
                        <i data-toggle="tooltip" data-placement="top" title="消耗金额:客户做服务时划扣的本金" class="fa fa-question-circle"></i>
                    </th>
@@ -122,8 +125,6 @@
                    <th data-field="projPercentage" data-footer-formatter="countColumn">服务提成
                        <i data-toggle="tooltip" data-placement="top" title="服务提成:为美疗师手动设置的项目服务提成" class="fa fa-question-circle"></i>
                    </th>
                    <th data-field="guwen">顾问</th>
                    <th data-field="meiliao">美疗师</th>
                    <th data-field="numberOfPeople" data-footer-formatter="countColumn">人头</th>
                    <th data-field="projNum" data-footer-formatter="countColumn">项目个数</th>
                    <th data-field="projTime" data-footer-formatter="countColumn">项目时间</th>
@@ -144,7 +145,7 @@
            }
         MTools.ininDatetimepicker(initParam);
        //限制结束时间不小于开始时间
         MTools.limitStartEndTime({});
         MTools.limitStartEndTime({});
        
        var date = new Date();
        var year = date.getFullYear();
@@ -163,6 +164,20 @@
                $(this).attr("selected", true);
            }
        });
        function buildOpenDetail(value, row, index){
            var html = [];
            if(row.orderType=='服务单'){
                html[0] = '<a  onClick="fnPublci.showServiceOrder(1 , \'' + value +'\')"   class="text-primary " >'+value+'</a>'
            }else{
                html[0] = '<a  onClick="fnPublci.showOrder(1 , \'' + value +'\')"   class="text-primary " >'+value+'</a>'
            }
            return html.join("");
        }
        $(function() {
            MTools.autoFullSelect();
@@ -188,7 +203,6 @@
        });
        function footCountTitle(data) {
            return "<b>合计</b>";
        };
@@ -204,25 +218,12 @@
        
        
        function exportExcel(){
            var param=MForm.toUrlParam("#serchform");
            window.location.href=basePath+"/admin/achieve/exportDailyInfoNew?"+param;
        }
        function buildOpenDetail(value, row, index){
            var html = [];
            if(row.orderType=='服务单'){
                html[0] = '<a  onClick="fnPublci.showServiceOrder(1 , \'' + value +'\')"   class="text-primary " >'+value+'</a>'
            }else{
                html[0] = '<a  onClick="fnPublci.showOrder(1 , \'' + value +'\')"   class="text-primary " >'+value+'</a>'
            }
            return html.join("");
        }
    </script>
</body>
</html>
zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html
@@ -288,6 +288,22 @@
                        </template>
                    </el-table-column>
                    <el-table-column
                            label="支付方式"
                            width="130">
                        <template slot-scope="scope">
                            <el-select  v-model="scope.row.payMethod"
                                        placeholder="请选择支付方式">
                                <el-option
                                        v-for="item in itemSimplePayMethods"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value"
                                        :disabled="item.disabled">
                                </el-option>
                            </el-select>
                        </template>
                    </el-table-column>
                    <el-table-column
                            label="小计">
                        <template slot-scope="scope">
                            {{scope.row.zkPrice * scope.row.count }}
@@ -377,7 +393,7 @@
        </el-col>
    </el-row>
    <!-- 业绩设置 -->
    <el-drawer
            title="业绩设置"
            :visible.sync="drawer"
@@ -414,27 +430,26 @@
                                prop="orderItem.payMoney"
                                label="收款">
                        </el-table-column>
                        <el-table-column
                                label="业绩类型" width="150">
                            <template slot-scope="scope">
                                <el-select v-model="scope.row.t3" placeholder="请选择业绩类型">
                                <el-select v-model="scope.row.achieveType" @change="calculationAchieve" placeholder="请选择业绩类型">
                                    <el-option
                                            v-for="item in achieveTypeList"
                                            :key="item.key"
                                            :key="item.value"
                                            :label="item.value"
                                            :value="item.key">
                                            :value="item.value">
                                    </el-option>
                                </el-select>
                            </template>
                        </el-table-column>
                        <el-table-column
                                label="业绩" width="100">
                                label="业绩" >
                            <template slot-scope="scope">
                                <el-input v-model="scope.row.achieveMoney"></el-input>
                                <el-input @input="checkAchieveMoney" v-model="scope.row.goodsCash"></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column
                        <el-table-column width="100"
                                label="提成">
                            <template slot-scope="scope">
                                <el-input v-model="scope.row.commission"></el-input>
@@ -461,7 +476,7 @@
                                           size="mini"
                                           @click="delAchieve(scope.$index, scope.row)">删除
                                </el-button>
                                <el-tooltip content="分享业绩" placement="top">
                                <el-tooltip content="分享业绩" placement="top" v-if="!scope.row.isShare">
                                    <el-button @click="shareAchieve(scope.$index, scope.row)" icon="el-icon-share"
                                               size="mini" type="primary"></el-button>
                                </el-tooltip>
@@ -474,6 +489,7 @@
        </el-row>
    </el-drawer>
    <!-- 收款 -->
    <el-dialog title="收款" :visible.sync="dialogSettleVisible">
        <el-row type="flex" align="middle" style="padding: 0 0 10px 0;">
            <el-col :span="5" style="text-align: center;">应收</el-col>
@@ -574,6 +590,13 @@
            vipList: [],
            currentVipInfo: {},
            vipLoading: false,
            itemSimplePayMethods:[{
                value: '现金',
                label:'现金',
            },{
                value: '划扣',
                label:'划扣',
            }],
            payMethods: [{
                value: '现金支付',
                img: '/images/pay/cash.png',
@@ -611,14 +634,11 @@
                type: '欠款'
            },],
            achieveList: [],
            //业绩岗位
            achievePostList : [
            ],
            //业绩类型
            achieveTypeList : [
                {
                    "key" : "现金业绩",
                    "value" : "现金业绩"
                },{
                    "key" : "划扣业绩",
                    "value" : "划扣业绩"
                },
            ],
            //会员可用的充值卡
            moneyCards: [],
@@ -660,12 +680,22 @@
            if (vipId) {
                _this.changeVip(vipId);
            }
            //获取用户列表
            //获取业绩用户列表
            AjaxProxy.requst({
                app: _this,
                url: basePath + '/admin/shopAll',
                callback: function (data) {
                    _this.userList = data.rows;
                }
            });
            // 业绩类型
            AjaxProxy.requst({
                app: _this,
                url: basePath + '/admin/customerDictionary/getListByParentCode/YJLX',
                callback: function (data) {
                    _this.achieveTypeList = data.rows;
                }
            });
@@ -714,9 +744,9 @@
                                                    orderItem: item,
                                                    staff: _this.staffUser,
                                                    saleId: _this.staffUser.suId,
                                                    achieveMoney: item.payMoney,
                                                    goodsCash: item.payMoney,
                                                    commission : 0,
                                                    t3 : '现金业绩',
                                                    achieveType : _this.achieveTypeList[0].value,
                                                    isShare: false,
                                                });
                                            });
@@ -801,7 +831,7 @@
             * @param{type} 1 = 购买 2=赠送
             * */
            pushToSelectGoods(goods, type) {
                let _this=this;
                //判断是否被选中
                let selected = false;
                this.order.items.forEach(item => {
@@ -841,8 +871,8 @@
                            orderItem: item,
                            staff: this.staffUser,
                            saleId: this.staffUser.suId,
                            achieveMoney: item.payMoney,
                            t3: '现金业绩',
                            goodsCash: item.payMoney,
                            achieveType : _this.achieveTypeList[0].value,
                            commission: 0,
                            isShare: false,
                        });
@@ -852,8 +882,8 @@
                            orderItem: item,
                            staff: this.loginUser,
                            saleId: this.loginUser.suId,
                            achieveMoney: item.payMoney,
                            t3: '现金业绩',
                            goodsCash: item.payMoney,
                            achieveType : _this.achieveTypeList[0].value,
                            commission: 0,
                            isShare: false,
                        });
@@ -900,11 +930,15 @@
                                }
                                _this.order.payMoney += parseFloat(item.payMoney);
                                //重新计算业绩金额
                                _this.achieveList.forEach(achieve=>{
                                    if(achieve.orderItem==item){
                                        achieve.achieveMoney=item.payMoney;
                                    if(achieve.orderItem.uuid==item.uuid){
                                        achieve.orderItem.payMoney=item.payMoney;
                                    }
                                })
                                _this.calculationAchieve();
                            });
                            _this.order.payMoney = _this.order.payMoney.toFixed(2);
                            //计算欠款
@@ -946,14 +980,18 @@
                    let _this = this;
                    if(submitType == 1) {
                        //校验支付方式
                        if (_this.payMoneys.length > 0) {
                            let flows = []
                            var total = 0;
                            _this.payMoneys.forEach(item => {
                            let isPayMethodOk=true;
                            for(let i=0; i<_this.payMoneys.length;i++){
                                let item = _this.payMoneys[i];
                                let flow = {};
                                flow.payMethod = item.type;
                                if (!item.money) {
                                    this.$message.warning("请输入" + item.type + "的付款金额");
                                    _this.$message.warning("请输入" + item.type + "的付款金额");
                                    isPayMethodOk=false;
                                    return false;
                                }
                                flow.amount = parseFloat(item.money);
@@ -963,7 +1001,7 @@
                                }
                                total += parseFloat(item.money);
                                flows.push(flow)
                            })
                            }
                            if (total != _this.order.payMoney) {
                                this.$message.warning("输入付款总金额与应付金额不符");
                                return false;
@@ -979,29 +1017,18 @@
                    _this.achieveList.forEach(achieve => {
                        for (let i = 0; i < _this.order.items.length; i++) {
                            let item = _this.order.items[i];
                            if (!item.achaeveList){
                                item.achaeveList = [];
                            if (!item.achieveList){
                                item.achieveList = [];
                            }
                            if (item.uuid == achieve.orderItem.uuid) {
                                let achieveNew = {
                                    uuid:item.uuid,
                                    beaultId: achieve.saleId,
                                    t1: achieve.achieveMoney,
                                    t3: achieve.t3,
                                    projPercentage: achieve.commission,
                                    achieveType: achieve.achieveType,
                                    goodsCash: achieve.goodsCash,
                                };
                                var flag = true;
                                for(var j = 0; j < item.achaeveList.length; j++) {
                                    if(item.achaeveList[j].uuid == achieveNew.uuid && item.achaeveList[j].beaultId == achieveNew.beaultId) {
                                        flag = false;
                                        break;
                                    }
                                }
                                if (flag) {
                                    item.achaeveList.push(achieveNew);
                                }
                               item.achieveList.push(achieveNew);
                                break;
                            }
                        }
@@ -1009,7 +1036,7 @@
                    console.log(_this.order);
                    //校验业绩金额
                    if (_this.checkAchieve()) {
                    if (_this.checkAchieveMoney()) {
                        let url = basePath + "/admin/order/payOrder";
                        if (submitType == 2) {
                            url = basePath + "/admin/order/saveOrder";
@@ -1065,29 +1092,7 @@
                }
            },
            /**
             * 校验订单业绩设置是否合理
             */
            checkAchieve() {
               /*
               //TODO 前端展示不检测,因为考虑到储值卡支付问题
               let _this = this;
                for (let i = 0; i < _this.order.items.length; i++) {
                    if (_this.achieveList.length > 0) {
                        let item = _this.order.items[i];
                        let sum = 0;
                        item.achieveList.forEach(achieve => {
                            console.log(sum, achieve);
                            sum += parseFloat(achieve.t1);
                        });
                        if (sum > item.payMoney) {
                            this.$message.warning("业绩金额不能大于支付金额【" + item.shoppingGoods.name + "】");
                            return false;
                        }
                    }
                }*/
                return true;
            },
            /**
             * 检查订单是否能够提交
@@ -1231,11 +1236,61 @@
            shareAchieve(index, row) {
                row2 = JSON.parse(JSON.stringify(row));
                row2.isShare = true;
                this.achieveList.push(row2);
                this.achieveList.splice(index+1,0,row2);
                //this.achieveList=;
                this.calculationAchieve();
            },
            //业绩均分订单金额
            calculationAchieve(){
                console.log("计算业绩");
                let jsqMap={};
                this.achieveList.forEach(achieve=>{
                    key=achieve.achieveType+achieve.orderItem.uuid;
                    if(!jsqMap[key]){
                        jsqMap[key]=1;
                    }else{
                        jsqMap[key]++;
                    }
                });
                this.achieveList.forEach(achieve=>{
                    key=achieve.achieveType+achieve.orderItem.uuid;
                    achieve.goodsCash=(achieve.orderItem.payMoney/jsqMap[key]).toFixed(2);
                });
            },
            //校验业绩是否大于订单收款金额
            checkAchieveMoney(){
                console.log("校验业绩是否大于订单收款金额");
                let jsqMap={};
                let isOk=true;
                for(let i=0 ; i< this.achieveList.length; i++){
                    let achieve=this.achieveList[i];
                    if(!isNaN(achieve.goodsCash)  ){
                        key=achieve.achieveType+achieve.orderItem.uuid;
                        if(!jsqMap[key]){
                            jsqMap[key]=parseFloat(achieve.goodsCash);
                        }else{
                            jsqMap[key]=jsqMap[key]+parseFloat(achieve.goodsCash);
                        }
                        if(jsqMap[key]>achieve.orderItem.payMoney) {
                            this.$message.error("【"+achieve.orderItem.shoppingGoods.name + "】业绩分配金额大于支付金额");
                            isOk = false;
                            return;
                        }
                    }else{
                        this.$message.error("【"+achieve.orderItem.shoppingGoods.name + "】业绩分配金额请填写数字");
                        isOk=false;
                        return;
                    }
                };
                console.log("isOk",isOk);
                return isOk;
            },
            //删除业绩
            delAchieve(index, row) {
                this.achieveList.splice(index, 1);
                this.calculationAchieve();
            },
            print() {
                let _this = this;
@@ -1342,6 +1397,10 @@
                    return false;
                }
                if(!this.checkAchieveMoney()){
                    return ;
                }
                _this.dialogSettleVisible = true;
            }
        }
zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html
@@ -108,7 +108,8 @@
                        </el-col>
                        <el-col :span="14" style="text-align: right;">
                            <label>¥ {{order.total}}</label>
                            <label>¥ {{(order.zkTotal - order.total).toFixed(2)}}</label>
                            <!-- 退款订单不能显示为负数 -->
                            <label>¥ {{(order.zkTotal - order.total>0?order.zkTotal - order.total:0).toFixed(2)}}</label>
                            <label>¥ {{order.zkTotal}}</label>
                            <label>¥ {{order.arrears}}</label>
                            <label>¥ {{order.repay}}</label>
@@ -179,6 +180,8 @@
                                    label="折扣单价">
                            </el-table-column>
                            <el-table-column  label="小计" :formatter="calOrderTotalFormatter">
                            </el-table-column>
                            <el-table-column  label="支付方式"  prop="payMethod">
                            </el-table-column>
                        </el-table>
                    </el-row>
@@ -254,11 +257,15 @@
                                        label="收款">
                                </el-table-column>
                                <el-table-column
                                        prop="t3"
                                        prop="payMethod"
                                        label="支付方式">
                                </el-table-column>
                                <el-table-column
                                        prop="achieveType"
                                        label="业绩类型">
                                </el-table-column>
                                <el-table-column
                                        prop="t1"
                                        prop="goodsCash"
                                        label="原业绩">
                                </el-table-column>
                                <el-table-column
@@ -308,15 +315,19 @@
                                label="收款">
                        </el-table-column>
                        <el-table-column
                                prop="payMethod"
                                label="支付方式">
                        </el-table-column>
                        <el-table-column
                                prop="t3"
                                label="业绩类型">
                            <template slot-scope="scope">
                                <el-select v-model="scope.row.t3" placeholder="请选择业绩类型">
                                <el-select v-model="scope.row.achieveType" placeholder="请选择业绩类型">
                                    <el-option
                                            v-for="item in achieveTypeList"
                                            :key="item.key"
                                            :key="item.value"
                                            :label="item.value"
                                            :value="item.key">
                                            :value="item.value">
                                    </el-option>
                                </el-select>
                            </template>
@@ -325,7 +336,7 @@
                                prop="achieve"
                                label="业绩">
                            <template slot-scope="scope">
                                <el-input v-model="scope.row.t1"></el-input>
                                <el-input  @input="checkAchieveMoney" v-model="scope.row.goodsCash"></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column
@@ -354,9 +365,9 @@
                                           size="mini"
                                           @click="delAchieve(scope.$index, scope.row)">删除
                                </el-button>
                                <el-tooltip content="分享业绩" placement="top">
                                    <el-button @click="shareAchieve(scope.$index, scope.row)" icon="el-icon-share"
                                               size="mini" type="primary"></el-button>
                                <el-tooltip content="分享业绩" placement="top" v-if="!scope.row.isShare">
                                    <el-button  @click="shareAchieve(scope.$index, scope.row)" icon="el-icon-share"
                                                size="mini" type="primary"></el-button>
                                </el-tooltip>
                            </template>
                        </el-table-column>
@@ -453,9 +464,9 @@
            </el-col>
        </el-row>
<!--        <el-row style="text-align: center; margin: 20px 0 10px 0">-->
<!--            <el-checkbox v-model="printPaper">打印小票</el-checkbox>-->
<!--        </el-row>-->
        <!--        <el-row style="text-align: center; margin: 20px 0 10px 0">-->
        <!--            <el-checkbox v-model="printPaper">打印小票</el-checkbox>-->
        <!--        </el-row>-->
        <el-row style="text-align: center; margin: 10px 0 0 0">
            <el-button type="primary" @click="confirmSubmit">确认收款</el-button>
@@ -482,15 +493,7 @@
            activeName : "first",
            circleUrl : "https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png",
            userList : [],
            achieveTypeList : [
                {
                    "key" : "现金业绩",
                    "value" : "现金业绩"
                },{
                    "key" : "划扣业绩",
                    "value" : "划扣业绩"
                },
            ],
            achieveTypeList : [],
            orderItems : [],
            achieveItems : [],
            flowItems : [],
@@ -546,8 +549,15 @@
        created : function() {
            let _this = this;
            this.orderParam = /*[[${orderParam}]]*/
            this.queryOrderDetailData(this.orderParam);
                this.queryOrderDetailData(this.orderParam);
            // 业绩类型
            AjaxProxy.requst({
                app: _this,
                url: basePath + '/admin/customerDictionary/getListByParentCode/YJLX',
                callback: function (data) {
                    _this.achieveTypeList = data.rows;
                }
            });
        },
        methods : {
            calRefund() {
@@ -659,6 +669,10 @@
                }
                _this.data.items = dataItems;
                _this.data.zkTotal =  _this.refundMoney;
                _this.data.total =  _this.total;
                AjaxProxy.requst({
                    app: _this,
                    data: _this.data,
@@ -712,6 +726,7 @@
                let _this = this;
                let items = this.orderItems;
                _this.refundMoney = 0;
                _this.total = 0;
                for(var i = 0; i < items.length; i++) {
                    let item = items[i]
@@ -727,6 +742,8 @@
                        }
                        _this.refundMoney += parseFloat(item.refundPrice * item.refundCount);
                        //记录一下未优惠之前的价格
                        _this.total += parseFloat(item.price * item.refundCount);
                    }
                }
@@ -737,7 +754,7 @@
                _this.dialogSettleVisible = true;
            },
            calOrderTotalFormatter(row, column) {
                return row.count * row.price;
                return row.count * row.zkPrice;
            },
            getVipMoneyCards() {
                let _this = this;
@@ -855,34 +872,77 @@
            },
            saveAchieve() {
                let _this = this;
                AjaxProxy.requst({
                    app: _this,
                    data: _this.achieveItems,
                    contentType: 'application/json',
                    url: basePath + '/admin/achieve/add',
                    callback: function (data) {
                        _this.$message.success(data.info);
                    }
                });
            },
            shareAchieve(index, row) {
                var row2 = JSON.parse(JSON.stringify(row));
                row2.id = null;
                row2.isShare = true;
                this.achieveItems.push(row2);
            },
            delAchieve(index, row) {
                let _this = this;
                if (row.id) {
                if(_this.checkAchieveMoney()){
                    AjaxProxy.requst({
                        app: _this,
                        url: basePath + '/admin/achieve/del?id=' + row.id,
                        data: _this.achieveItems,
                        contentType: 'application/json',
                        url: basePath + '/admin/achieve/add',
                        callback: function (data) {
                            _this.$message.success(data.info);
                        }
                    });
                }
            },
            shareAchieve(index, row) {
                var row2 = JSON.parse(JSON.stringify(row));
                row2.id = null;
                row2.isShare = true;
                this.achieveItems.splice(index+1,0,row2);
                this.calculationAchieve();
            },
            //业绩均分订单金额
            calculationAchieve(){
                console.log("计算业绩");
                let jsqMap={};
                this.achieveItems.forEach(achieve=>{
                    key=achieve.achieveType+achieve.orderItemId;
                    if(!jsqMap[key]){
                        jsqMap[key]=1;
                    }else{
                        jsqMap[key]++;
                    }
                });
                this.achieveItems.forEach(achieve=>{
                    key=achieve.achieveType+achieve.orderItemId;
                    achieve.goodsCash=(achieve.zkTotal/jsqMap[key]).toFixed(2);
                });
            },
            //校验业绩是否大于订单收款金额
            checkAchieveMoney(){
                console.log("校验业绩是否大于订单收款金额");
                let jsqMap={};
                let isOk=true;
                for(let i=0 ; i< this.achieveItems.length; i++){
                    let achieve=this.achieveItems[i];
                    if(!isNaN(achieve.goodsCash)  ){
                        key=achieve.achieveType+achieve.orderItemId;
                        if(!jsqMap[key]){
                            jsqMap[key]=parseFloat(achieve.goodsCash);
                        }else{
                            jsqMap[key]=jsqMap[key]+parseFloat(achieve.goodsCash);
                        }
                        if(jsqMap[key]>achieve.zkTotal) {
                            this.$message.error("【"+achieve.goodsName + "】业绩分配金额大于支付金额");
                            isOk = false;
                            break;
                        }
                    }else{
                        this.$message.error("【"+achieve.goodsName + "】业绩分配金额请填写数字");
                        isOk=false;
                        break;
                    }
                }
                console.log("isOk",isOk);
                return isOk;
            },
            //删除业绩
            delAchieve(index, row) {
                let _this = this;
                _this.achieveItems.splice(index, 1);
                this.calculationAchieve();
            },
            checkAchieveIsDel(items) {
                var achieveIds = [];
zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/pbxq-form.html
@@ -76,17 +76,17 @@
                        <el-table-column
                                prop="projInfo.name"
                                label="商品名称"
                                width="280">
                                width="400">
                        </el-table-column>
                        <el-table-column
                                :formatter="hkPrice"
                                label="划扣金额"
                                width="200">
                                width="100">
                        </el-table-column>
                        <el-table-column
                                prop="count"
                                label="次数"
                                width="200">
                                width="100">
                        </el-table-column>
                        <el-table-column
                                prop="projInfo.timeLength"
zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/underlineOrder.html
@@ -220,20 +220,26 @@
    function cancelOrder() {
        var id=myGrid.getSelectItemId();
        layer.confirm('确定取消此订单?', {
            btn: ['确认', '取消并删除', '取消'] //可以无限个按钮
            btn: ['确认', '取消'] //可以无限个按钮
        }, function(index, layero){
            $.post(basePath+'/admin/order/cancelOrder?id='+id+'&del=0', {}, function(data){
                parent.layer.msg(data.info,{icon: 1});
                if (data.status == '200') {
                    parent.layer.msg(data.info,{icon: 1});
                } else {
                    parent.layer.msg(data.info,{icon: 2});
                }
                layer.closeAll();
                myGrid.serchData();
            });
        }, function(index){
            $.post(basePath+'/admin/order/cancelOrder?id='+id+'&del=1', {}, function(data){
                parent.layer.msg(data.info,{icon: 1});
                layer.closeAll();
                myGrid.serchData();
            });
        }, function(index){
        },
        //     function(index){
        //     $.post(basePath+'/admin/order/cancelOrder?id='+id+'&del=1', {}, function(data){
        //         parent.layer.msg(data.info,{icon: 1});
        //         layer.closeAll();
        //         myGrid.serchData();
        //     });
        // },
            function(index){
            //按钮【按钮二】的回调
        });
    }
zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html
@@ -457,8 +457,8 @@
                                <el-table-column fixed="right" label="操作"  width="200">
                                    <template slot-scope="scope">
                                        <el-button type="text" size="small" @click="lookServiceOrder(scope.$index, scope.row)">查看</el-button>
                                        <el-button matrix:btn="serviceClub-paiban" type="text" size="small" v-if="scope.row.state=='待预约'" @click="paiban(scope.$index, scope.row)">排班</el-button>
                                        <el-button matrix:btn="serviceClub-paidan" type="text" size="small" v-if="scope.row.state=='预约成功待处理'" @click="giveServiceOrder(scope.$index, scope.row)">派单</el-button>
                                        <el-button matrix:btn="serviceClub-paiban" type="text" size="small" v-if="scope.row.state=='预约成功待处理'" @click="paiban(scope.$index, scope.row)">排班</el-button>
<!--                                        <el-button matrix:btn="serviceClub-paidan" type="text" size="small" v-if="scope.row.state=='预约成功待处理'" @click="giveServiceOrder(scope.$index, scope.row)">派单</el-button>-->
                                        <el-button matrix:btn="serviceClub-edit" type="text" size="small" v-if="scope.row.state=='预约成功待处理'" @click="modifyServiceOrder(scope.$index, scope.row)">修改</el-button>
                                        <el-button matrix:btn="serviceClub-peiliao" type="text" size="small" v-if="scope.row.state=='需配料'" @click="peiliao(scope.$index, scope.row)">配料</el-button>
                                        <el-button matrix:btn="serviceClub-huakou" type="text" size="small" v-if="scope.row.state=='服务完成'" @click="hkService(scope.$index, scope.row)">划扣</el-button>
@@ -532,14 +532,6 @@
                                <el-table-column
                                        prop="staffName"
                                        label="下单顾问">
                                </el-table-column>
                                <el-table-column
                                        prop="cashPay"
                                        label="现金支付金额">
                                </el-table-column>
                                <el-table-column
                                        prop="cardPay"
                                        label="卡支付金额">
                                </el-table-column>
                                <el-table-column
                                        prop="arrears"
zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-list-new.html
@@ -105,31 +105,17 @@
                    <th data-formatter="MGrid.indexfn" data-align="center"
                        data-width="30px" data-footer-formatter="footCountTitle">序号</th>
                    <th data-field="datatime">时间</th>
                    <th data-field="orderType">订单类型</th>
                    <th data-field="orderNo" data-formatter="buildOpenDetail" >订单编号</th>
                    <th data-field="levelName">会员级别</th>
                    <th data-field="vipName">姓名</th>
                    <th data-field="proName">项目名称</th>
                    <th data-field="zkTotal" data-footer-formatter="countColumn">总现金业绩
                        <i data-toggle="tooltip" data-placement="top" title="总现金业绩=售卡+项目+产品" class="fa fa-question-circle"></i>
                    </th>
                    <th data-field="cardCash"  data-footer-formatter="countColumn"  >售卡业绩
                        <i data-toggle="tooltip" data-placement="top" title="售卡业绩:现金购买充值卡,套餐,充值的收款金额" class="fa fa-question-circle"></i>
                    </th>
                    <th data-field="projCash" data-footer-formatter="countColumn">项目业绩
                        <i data-toggle="tooltip" data-placement="top" title="项目业绩:现金购买单个项目的业绩" class="fa fa-question-circle"></i>
                    </th>
                    <th data-field="goodsCash" data-footer-formatter="countColumn">产品业绩
                        <i data-toggle="tooltip" data-placement="top" title="产品业绩:现金购买产品的业绩" class="fa fa-question-circle"></i>
                    </th>
                    <th data-field="consume" data-footer-formatter="countColumn">余额划扣业绩
                        <i data-toggle="tooltip" data-placement="top" title="余额划扣业绩:从客户的充值卡余额中划扣消费的金额" class="fa fa-question-circle"></i>
                    </th>
                    <th data-field="orderType">订单类型</th>
                    <th data-field="vipName">会员姓名</th>
                    <th data-field="proName">产品</th>
                    <th data-field="cateName">产品分类</th>
                    <th data-field="zkTotal" data-footer-formatter="countColumn">订单金额</th>
                    <th data-field="goodsCash" data-footer-formatter="countColumn">订单业绩</th>
                    <th data-field="payMethod">收款方式</th>
                    <th data-field="achieveType">业绩类型</th>
                    <th data-field="guwen">顾问</th>
                    <th data-field="meiliao">美疗师</th>
                    <th data-field="hisConsume" data-footer-formatter="countColumn">本金消耗
                        <i data-toggle="tooltip" data-placement="top" title="消耗金额:客户做服务时划扣的本金" class="fa fa-question-circle"></i>
                    </th>
@@ -139,8 +125,6 @@
                    <th data-field="projPercentage" data-footer-formatter="countColumn">服务提成
                        <i data-toggle="tooltip" data-placement="top" title="服务提成:为美疗师手动设置的项目服务提成" class="fa fa-question-circle"></i>
                    </th>
                    <th data-field="guwen">顾问</th>
                    <th data-field="meiliao">美疗师</th>
                    <th data-field="numberOfPeople" data-footer-formatter="countColumn">人头</th>
                    <th data-field="projNum" data-footer-formatter="countColumn">项目个数</th>
                    <th data-field="projTime" data-footer-formatter="countColumn">项目时间</th>
zq-erp/src/test/java/com/matrix/SourceFlowTests.java
@@ -125,7 +125,7 @@
        for (SysOrder sysOrder : sysOrders) {
            sysOrder.setCashPay(sysOrder.getZkTotal());
            sysOrder.setCardPay(0);
            sysOrder.setCardPay(0D);
            sysOrderDao.update(sysOrder);
            List<SysOrderItem> items = sysOrderItemDao.selectByOrderId(sysOrder.getId());