Helius
2020-12-31 a330741b1ab67955217644c41d4ff38329f6c9b3
modify
1 files added
4 files modified
249 ■■■■■ changed files
zq-erp/src/main/java/com/matrix/system/app/action/ApiStatisticsAction.java 31 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/dto/BusinessesDto.java 11 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/vo/VipAchieveDataShowVo.java 147 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hiveErp/dao/TjVipSumDao.java 5 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/hive/TjVipSumDao.xml 55 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/action/ApiStatisticsAction.java
@@ -1,10 +1,14 @@
package com.matrix.system.app.action;
import com.matrix.core.constance.MatrixConstance;
import com.matrix.core.pojo.AjaxResult;
import com.matrix.core.pojo.PaginationVO;
import com.matrix.core.tools.WebUtil;
import com.matrix.system.app.dto.BusinessesDto;
import com.matrix.system.app.vo.BusinessesDataShowVo;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.hive.action.util.QueryUtil;
import com.matrix.system.hive.bean.AchieveNew;
import com.matrix.system.hive.bean.SysBusinessData;
import com.matrix.system.hive.dao.SysBusinessDataDao;
import com.matrix.system.hive.service.imp.DataAnalysisCustomerServiceImpl;
@@ -147,4 +151,31 @@
        return ajaxResult;
    }
    @ApiOperation(value = "查询员工业绩报表", notes = "查询员工业绩报表")
    @ApiResponses({
            @ApiResponse(code = 200, message = "ok", response = BusinessesDataShowVo.class)
    })
    @PostMapping(value = "/findVipAchieve")
    public AjaxResult findVipAchieve(@RequestBody BusinessesDto businessesDto) {
        AchieveNew achieveNew = new AchieveNew();
        if (BusinessesDto.DAY.equals(businessesDto.getType())) {
            achieveNew.setT1("%Y-%m-%d");
        } else {
            achieveNew.setT1("%Y-%m");
        }
        SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
        if (businessesDto.getStaffId() == null) {
            businessesDto.setStaffId(sysUsers.getSuId());
        }
        achieveNew.setVipId(businessesDto.getStaffId());
        PaginationVO pageVo = new PaginationVO();
        pageVo.setLimit(businessesDto.getPageSize());
        pageVo.setOffset((businessesDto.getPageNum() - 1) * businessesDto.getPageSize());
        return AjaxResult.buildSuccessInstance(tjVipSumDao.selectVipAchieveInPage(achieveNew, pageVo));
    }
}
zq-erp/src/main/java/com/matrix/system/app/dto/BusinessesDto.java
@@ -16,6 +16,9 @@
    @ApiModelProperty(value = "门店ID", example = "34")
    private Long shopId;
    @ApiModelProperty(value = "会员ID")
    private Long staffId;
    public String getType() {
        return type;
    }
@@ -31,4 +34,12 @@
    public void setShopId(Long shopId) {
        this.shopId = shopId;
    }
    public Long getStaffId() {
        return staffId;
    }
    public void setStaffId(Long staffId) {
        this.staffId = staffId;
    }
}
zq-erp/src/main/java/com/matrix/system/app/vo/VipAchieveDataShowVo.java
New file
@@ -0,0 +1,147 @@
package com.matrix.system.app.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
/**
 * @author wzy
 * @date 2020-12-31
 **/
@ApiModel(value = "VipAchieveDataShowVo", description = "员工业绩返回参数类")
public class VipAchieveDataShowVo {
    @ApiModelProperty(value = "时间")
    private String time;
    @ApiModelProperty(value = "订单业绩")
    private BigDecimal orderAmount;
    @ApiModelProperty(value = "现金业绩")
    private BigDecimal cashAmount;
    @ApiModelProperty(value = "售卡业绩")
    private BigDecimal cardAmount;
    @ApiModelProperty(value = "产品业绩")
    private BigDecimal goodsAmount;
    @ApiModelProperty(value = "划扣业绩")
    private BigDecimal cardUseAmount;
    @ApiModelProperty(value = "本金消耗")
    private BigDecimal hisConsume;
    @ApiModelProperty(value = "赠送消耗")
    private BigDecimal freeConsume;
    @ApiModelProperty(value = "提成")
    private BigDecimal commission;
    @ApiModelProperty(value = "人头数")
    private BigDecimal peopleNum;
    @ApiModelProperty(value = "项目数")
    private Integer projNum;
    @ApiModelProperty(value = "服务时长")
    private Integer serviceTime;
    public String getTime() {
        return time;
    }
    public void setTime(String time) {
        this.time = time;
    }
    public BigDecimal getOrderAmount() {
        return orderAmount;
    }
    public void setOrderAmount(BigDecimal orderAmount) {
        this.orderAmount = orderAmount;
    }
    public BigDecimal getCashAmount() {
        return cashAmount;
    }
    public void setCashAmount(BigDecimal cashAmount) {
        this.cashAmount = cashAmount;
    }
    public BigDecimal getCardAmount() {
        return cardAmount;
    }
    public void setCardAmount(BigDecimal cardAmount) {
        this.cardAmount = cardAmount;
    }
    public BigDecimal getGoodsAmount() {
        return goodsAmount;
    }
    public void setGoodsAmount(BigDecimal goodsAmount) {
        this.goodsAmount = goodsAmount;
    }
    public BigDecimal getCardUseAmount() {
        return cardUseAmount;
    }
    public void setCardUseAmount(BigDecimal cardUseAmount) {
        this.cardUseAmount = cardUseAmount;
    }
    public BigDecimal getHisConsume() {
        return hisConsume;
    }
    public void setHisConsume(BigDecimal hisConsume) {
        this.hisConsume = hisConsume;
    }
    public BigDecimal getFreeConsume() {
        return freeConsume;
    }
    public void setFreeConsume(BigDecimal freeConsume) {
        this.freeConsume = freeConsume;
    }
    public BigDecimal getCommission() {
        return commission;
    }
    public void setCommission(BigDecimal commission) {
        this.commission = commission;
    }
    public BigDecimal getPeopleNum() {
        return peopleNum;
    }
    public void setPeopleNum(BigDecimal peopleNum) {
        this.peopleNum = peopleNum;
    }
    public Integer getProjNum() {
        return projNum;
    }
    public void setProjNum(Integer projNum) {
        this.projNum = projNum;
    }
    public Integer getServiceTime() {
        return serviceTime;
    }
    public void setServiceTime(Integer serviceTime) {
        this.serviceTime = serviceTime;
    }
}
zq-erp/src/main/java/com/matrix/system/hiveErp/dao/TjVipSumDao.java
@@ -1,6 +1,9 @@
package com.matrix.system.hiveErp.dao;
import com.matrix.core.pojo.PaginationVO;
import com.matrix.system.app.vo.VipAchieveDataShowVo;
import com.matrix.system.hive.bean.AchieveNew;
import com.matrix.system.hiveErp.analysUtil.StatisticsTimeDaoParam;
import org.apache.ibatis.annotations.Param;
@@ -31,4 +34,6 @@
    Map<String, BigDecimal> selectFreeConsume(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId);
    Map<String, BigDecimal> selectCardRefund(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId);
    Map<String, BigDecimal> selectCashRefund(@Param("list") List<StatisticsTimeDaoParam> timeSpaceParam, @Param("shopId") Long shopId, @Param("companyId") Long companyId);
    List<VipAchieveDataShowVo> selectVipAchieveInPage(@Param("record") AchieveNew achieveNew, @Param("pageVo") PaginationVO pageVo);
}
zq-erp/src/main/resources/mybatis/mapper/hive/TjVipSumDao.xml
@@ -227,5 +227,60 @@
        </foreach>
        from area where id=1
    </select>
    <select id="selectVipAchieveInPage" resultType="com.matrix.system.app.vo.VipAchieveDataShowVo">
        select
            date_format(a.datatime, #{record.t1}) time,
            ROUND(sum(IFNULL(zk_total, 0)), 2) orderAmount,
            ROUND(sum(IFNULL(proj_cash, 0)), 2) cashAmount,
            ROUND(sum(IFNULL(card_cash, 0)), 2) cardAmount,
            ROUND(sum(IFNULL(goods_cash, 0)), 2) goodsAmount,
            ROUND(sum(IFNULL(consume, 0)), 2) cardUseAmount,
            ROUND(sum(IFNULL(his_consume, 0)), 2) hisConsume,
            ROUND(sum(IFNULL(free_consume, 0)), 2) freeConsume,
            ROUND(sum(IFNULL(proj_percentage, 0)), 2) commission,
            ROUND(sum(IFNULL(number_of_people, 0)), 2) peopleNum,
            ROUND(sum(IFNULL(proj_num, 0)), 2) projNum,
            ROUND(sum(IFNULL(proj_time, 0)), 2) serviceTime
        from (
            select * from (
                select * from (
                    select date_format(date_add(now(), INTERVAL -(@rowd := @rowd + 1) DAY), '%Y-%m-%d') datatime
                    from achieve_new a, (select @rowd := 0) t
                ) a
            ) a
            left join (
            select
                date_format(a.datatime, '%Y-%m-%d') datatime1,
                SUM((IFNULL(a.card_cash,0) +IFNULL(a.proj_cash,0) + IFNULL(a.goods_cash,0))) as zk_total,
                SUM(IFNULL(a.proj_cash,0)) proj_cash,
                SUM(IFNULL(a.goods_cash, 0)) goods_cash,
                SUM(IFNULL(a.card_cash,0)) card_cash,
                SUM(IFNULL(a.consume, 0)) consume
                from achieve_new a where a.sale_id=#{record.vipId}
            group by date_format(a.datatime, '%Y-%m-%d')
            ) b on a.datatime=b.datatime1
            left join (
            select
                date_format(b.datatime, '%Y-%m-%d') datatime2,
                SUM(IFNULL(b.his_consume, 0)) his_consume,
                SUM(IFNULL(b.free_consume, 0)) free_consume,
                SUM(IFNULL(b.proj_percentage, 0)) proj_percentage,
                SUM(IFNULL(b.number_of_people, 0)) number_of_people,
                SUM(IFNULL(b.proj_num, 0)) proj_num,
                SUM(IFNULL(b.proj_time, 0)) proj_time
            from achieve_new b where b.beault_id=#{record.vipId}
            group by date_format(b.datatime, '%Y-%m-%d')
            ) c on a.datatime=c.datatime2
        ) a
        group by date_format(a.datatime, #{record.t1})
        order by a.datatime desc
        <if test="pageVo !=null"><!-- 判断pageVo对象是否为空 -->
            <if test="pageVo.offset >=0  and pageVo.limit >0">
                limit
                #{pageVo.offset},#{pageVo.limit}
            </if>
        </if>
    </select>
</mapper>