Helius
2020-12-28 2c678522fc2adf031c28feb6563648f7133ff4b1
modify
1 files added
1 files renamed
6 files modified
168 ■■■■■ changed files
zq-erp/src/main/java/com/matrix/system/app/action/ApiRankingAction.java 52 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/dto/RankingDto.java 54 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/vo/RankingVo.java 15 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrder.java 10 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/dao/SysOrderDao.java 3 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/service/SysOrderService.java 3 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java 6 ●●●●● 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/java/com/matrix/system/app/action/ApiRankingAction.java
@@ -1,13 +1,25 @@
package com.matrix.system.app.action;
import com.matrix.core.pojo.AjaxResult;
import com.matrix.system.app.vo.RankingDto;
import com.matrix.core.tools.DateUtil;
import com.matrix.system.app.dto.RankingDto;
import com.matrix.system.app.vo.RankingVo;
import com.matrix.system.common.tools.DataAuthUtil;
import com.matrix.system.hive.action.util.QueryUtil;
import com.matrix.system.hive.bean.SysOrder;
import com.matrix.system.hive.service.AchieveNewService;
import com.matrix.system.hive.service.SysOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
 * @author wzy
@@ -18,19 +30,47 @@
@RequestMapping(value ="/api/ranking")
public class ApiRankingAction {
    public AjaxResult findStaffAchieveRanking() {
    @Autowired
    private SysOrderService sysOrderService;
    @Autowired
    private AchieveNewService achieveNewService;
    @ApiOperation(value = "顾问业绩排行榜", notes = "顾问业绩排行榜")
    @ApiResponses({
            @ApiResponse(code = 200, message = "ok", response = RankingVo.class)
    })
    @PostMapping(value = "/findStaffAchieveRanking")
    public AjaxResult findStaffAchieveRanking(@RequestBody RankingDto rankingDto) {
        return null;
    }
    @ApiOperation(value = "门店业绩排行榜", notes = "门店业绩排行榜")
    @ApiResponses({
            @ApiResponse(code = 200, message = "ok", response = RankingDto.class)
            @ApiResponse(code = 200, message = "ok", response = RankingVo.class)
    })
    public AjaxResult findShopAchieveRanking() {
        return null;
    @PostMapping(value = "/findShopAchieveRanking")
    public AjaxResult findShopAchieveRanking(@RequestBody RankingDto rankingDto) {
        AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("");
        if (RankingDto.SALE.equals(rankingDto.getDataType())) {
            SysOrder sysOrder = new SysOrder();
            QueryUtil.setQueryLimitCom(sysOrder);
            sysOrder.setType(rankingDto.getType());
            sysOrder.setOrderTime(DateUtil.stringToDate(rankingDto.getTime(), DateUtil.DATE_FORMAT_DD));
            List<RankingVo> list = sysOrderService.findApiShopAchieveRanking(sysOrder);
            ajaxResult.setRows(list);
        } else {
        }
        return ajaxResult;
    }
    public AjaxResult findBeauticianAchieveRanking() {
    @ApiOperation(value = "美疗师业绩排行榜", notes = "美疗师业绩排行榜")
    @ApiResponses({
            @ApiResponse(code = 200, message = "ok", response = RankingVo.class)
    })
    @PostMapping(value = "/findBeauticianAchieveRanking")
    public AjaxResult findBeauticianAchieveRanking(@RequestBody RankingDto rankingDto) {
        return null;
    }
}
zq-erp/src/main/java/com/matrix/system/app/dto/RankingDto.java
New file
@@ -0,0 +1,54 @@
package com.matrix.system.app.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * @author wzy
 * @date 2020-12-28
 **/
@ApiModel(value = "RankingDto", description = "排行榜参数接收类")
public class RankingDto {
    public static final String SALE = "1";
    public static final String CONSUME = "2";
    public static final String DAY = "1";
    public static final String MONTH = "2";
    public static final String YEAR = "3";
    @ApiModelProperty(value = "数据类型 1-销售 2-消耗")
    private String dataType;
    @ApiModelProperty(value = "排行榜类型 1-日榜 2-月榜 3-年榜")
    private String type;
    @ApiModelProperty(value = "时间")
    private String time;
    public String getDataType() {
        return dataType;
    }
    public void setDataType(String dataType) {
        this.dataType = dataType;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getTime() {
        return time;
    }
    public void setTime(String time) {
        this.time = time;
    }
}
zq-erp/src/main/java/com/matrix/system/app/vo/RankingVo.java
File was renamed from zq-erp/src/main/java/com/matrix/system/app/vo/RankingDto.java
@@ -9,8 +9,8 @@
 * @author wzy
 * @date 2020-12-28
 **/
@ApiModel(value = "RankingDto", description = "排行榜返回参数类")
public class RankingDto {
@ApiModel(value = "RankingVo", description = "排行榜返回参数类")
public class RankingVo {
    @ApiModelProperty(value = "姓名")
    private String name;
@@ -21,6 +21,17 @@
    @ApiModelProperty(value = "金额")
    private BigDecimal amount;
    @ApiModelProperty(value = "店铺名称")
    private String shopName;
    public String getShopName() {
        return shopName;
    }
    public void setShopName(String shopName) {
        this.shopName = shopName;
    }
    public String getName() {
        return name;
    }
zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrder.java
@@ -161,6 +161,16 @@
     */
    private Integer times;
    private String type;
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public Integer getTimes() {
        return times;
    }
zq-erp/src/main/java/com/matrix/system/hive/dao/SysOrderDao.java
@@ -3,6 +3,7 @@
import com.matrix.core.pojo.PaginationVO;
import com.matrix.system.app.dto.OrderListDto;
import com.matrix.system.app.vo.OrderDetailVo;
import com.matrix.system.app.vo.RankingVo;
import com.matrix.system.hive.bean.SysOrder;
import org.apache.ibatis.annotations.Param;
@@ -43,4 +44,6 @@
    int selectApiOrderListTotal(@Param("record") OrderListDto orderListDto);
    OrderDetailVo selectApiOrderDetailById(@Param("orderId") Long orderId);
    List<RankingVo> selectShopAchieveRanking(@Param("record") SysOrder sysOrder);
}
zq-erp/src/main/java/com/matrix/system/hive/service/SysOrderService.java
@@ -4,6 +4,7 @@
import com.matrix.core.pojo.PaginationVO;
import com.matrix.system.app.dto.OrderListDto;
import com.matrix.system.app.vo.OrderDetailVo;
import com.matrix.system.app.vo.RankingVo;
import com.matrix.system.hive.bean.SysOrder;
import com.matrix.system.hive.plugin.util.BaseServices;
import com.matrix.system.hive.pojo.CzXkVo;
@@ -136,4 +137,6 @@
    int findApiOrderListTotal(OrderListDto orderListDto);
    OrderDetailVo findApiOrderDetailByOrderId(Long orderId);
    List<RankingVo> findApiShopAchieveRanking(SysOrder sysOrder);
}
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java
@@ -10,6 +10,7 @@
import com.matrix.system.app.vo.OrderDetailAchieveItemVo;
import com.matrix.system.app.vo.OrderDetailItemVo;
import com.matrix.system.app.vo.OrderDetailVo;
import com.matrix.system.app.vo.RankingVo;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.common.dao.BusParameterSettingsDao;
import com.matrix.system.common.dao.SysUsersDao;
@@ -1250,4 +1251,9 @@
        orderDetail.setItems(items);
        return orderDetail;
    }
    @Override
    public List<RankingVo> findApiShopAchieveRanking(SysOrder sysOrder) {
        return sysOrderDao.selectShopAchieveRanking(sysOrder);
    }
}
zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderDao.xml
@@ -550,4 +550,29 @@
        left join sys_users c on a.STAFF_ID=c.su_id
        where a.id=#{orderId}
    </select>
    <select id="selectShopAchieveRanking" resultType="com.matrix.system.app.vo.RankingVo">
        select
               b.shop_short_name name,
               b.SHOP_IMAG photo,
               sum(IFNULL(a.ZK_TOTAL,0)) amount
        from sys_order a
        left join sys_shop_info b on a.SHOP_ID=b.ID
        <where>
            <if test="record.companyId != null">
                and a.company_id=#{record.companyId}
            </if>
            <if test='record.type == "1" and record.orderTime != null'>
                and date_format(order_time, '%Y-%m-%d') = date_format(#{record.orderTime}, '%Y-%m-%d')
            </if>
            <if test='record.type == "2" and record.orderTime != null'>
                and date_format(order_time, '%Y-%m') = date_format(#{record.orderTime}, '%Y-%m')
            </if>
            <if test='record.type == "3" and record.orderTime != null'>
                and date_format(order_time, '%Y') = date_format(#{record.orderTime}, '%Y')
            </if>
        </where>
        group by a.SHOP_ID
        order by amount desc, a.shop_id
    </select>
</mapper>