xuhy
2023-04-03 bec9ef7332b0c0d1afc9b28918748efc63a60bcc
首页数据统计
20个文件已修改
4个文件已添加
857 ■■■■■ 已修改文件
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/DataStatisticsController.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/THomePageController.java 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TImgController.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TSystemConfigController.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/resp/DataStatisticsOrderYearResp.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/resp/PerformanceTableResp.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/resp/TOrderServerResp.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/TOrderMapper.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/TRevenueMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TOrderMapper.xml 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TRevenueMapper.xml 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITAgentService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITDriverService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITOrderService.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITRevenueService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TAgentServiceImpl.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TDriverServiceImpl.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TOrderServiceImpl.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TRevenueServiceImpl.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/webapp/WEB-INF/view/system/tImg/tImg.html 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/webapp/WEB-INF/view/system/tSystemConfig/tSystemConfigPriceRules.html 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/webapp/static/modular/system/tImg/tImg_info.js 120 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/webapp/static/modular/system/tSystemConfig/tSystemConfig.js 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/DataStatisticsController.java
New file
@@ -0,0 +1,34 @@
package com.stylefeng.guns.modular.system.controller.general;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.stylefeng.guns.core.base.controller.BaseController;
import com.stylefeng.guns.modular.system.model.THtml;
import com.stylefeng.guns.modular.system.service.ITHtmlService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
 * 数据统计 控制器
 *
 * @author fengshuonan
 * @Date 2023-03-24 10:50:08
 */
@Controller
@RequestMapping("/dataStatistics")
public class DataStatisticsController extends BaseController {
    @Autowired
    private ITHtmlService tHtmlService;
    /**
     * 代理商统计
     */
    @RequestMapping(value = "/agentData")
    @ResponseBody
    public Object list(String condition) {
        return tHtmlService.selectList(null);
    }
}
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/THomePageController.java
@@ -1,8 +1,15 @@
package com.stylefeng.guns.modular.system.controller.general;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.stylefeng.guns.core.base.controller.BaseController;
import com.stylefeng.guns.core.common.constant.state.Order;
import com.stylefeng.guns.core.shiro.ShiroKit;
import com.stylefeng.guns.modular.system.service.IUserService;
import com.stylefeng.guns.modular.system.controller.resp.TOrderServerResp;
import com.stylefeng.guns.modular.system.enums.OrderStateEnum;
import com.stylefeng.guns.modular.system.model.TAgent;
import com.stylefeng.guns.modular.system.model.TDriver;
import com.stylefeng.guns.modular.system.model.TOrder;
import com.stylefeng.guns.modular.system.service.*;
import com.stylefeng.guns.modular.system.util.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@@ -10,8 +17,8 @@
import org.springframework.web.bind.annotation.RequestMapping;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Objects;
import java.time.LocalDate;
import java.util.*;
/**
 * 控制器
@@ -25,6 +32,14 @@
    @Autowired
    private IUserService userService;
    @Autowired
    private ITAgentService tAgentService;
    @Autowired
    private ITDriverService tDriverService;
    @Autowired
    private ITOrderService tOrderService;
    @Autowired
    private ITRevenueService tRevenueService;
    private String PREFIX = "/system/tHomePage/";
@@ -32,17 +47,64 @@
     * 跳转到地图
     */
    @RequestMapping("/map")
    public String map() {
    public String map(Integer agentId,Integer type,Model model) {
        if(Objects.nonNull(agentId)){
            // 查询统计在线司机,待接单,服务中,已完成,已取消
            Map<String,Integer> map = new HashMap<>(4);
            int serverCount = tDriverService.selectCount(new EntityWrapper<TDriver>()
                    .eq("agentId", agentId)
                    .eq("serverStatus", 2));
            tOrderService.getDataStatisticsCount(agentId,map);
            model.addAttribute("map",map);
            // 查询服务中的订单列表
            List<TOrderServerResp> orderServerRespList = tOrderService.getDataStatisticsServerList(agentId);
            model.addAttribute("serverList",orderServerRespList);
            // 查询今天所有订单
            List<TOrder> allList = tOrderService.getDataStatisticsAllList(agentId);
            // TODO 拿到所有司机地址
        }else {
            // TODO 查询广东全区域数据
        }
        return PREFIX + "tHomePageMap.html";
    }
    /**
     * 跳转到地图
     * 跳转到首页统计
     */
    @RequestMapping("/statistics")
    public String statistics(Model model) {
    public String statistics(Integer agentId,String dayDate,String yearDate,String monthDate,Integer type,Model model) {
        model.addAttribute("txt",new SimpleDateFormat("yyyy年MM月dd日").format(new Date()) + DateUtil.getWeekDay(new Date()) + ",欢迎" +
                Objects.requireNonNull(ShiroKit.getUser()).getName() + "登录");
        if(Objects.nonNull(agentId)){
            // 统计代理商
            tAgentService.getDataStatistics(agentId,model);
            // 统计司机数
            tDriverService.getDataStatistics(agentId,model);
            // TODO 订单统计:按今天,昨天,本周,本月
            // 订单统计,每年按月份
            tOrderService.getDataStatisticsByYear(agentId,yearDate,model);
            // 业绩排名 performanceTable
            if (1 == type){
                // 单量
                tOrderService.getDataStatisticsOrderCount(agentId,monthDate,model);
            }else {
                // 收入、佣金
                tRevenueService.getDataStatisticsIncomeOrCommission(agentId,monthDate,type,model);
            }
        }else {
            // TODO 查询广东全区域数据
        }
        return PREFIX + "tHomePageStatistics.html";
    }
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TImgController.java
@@ -1,7 +1,12 @@
package com.stylefeng.guns.modular.system.controller.general;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.stylefeng.guns.core.base.controller.BaseController;
import com.stylefeng.guns.modular.system.model.TSystemConfig;
import com.stylefeng.guns.modular.system.service.ITSystemConfigService;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.Model;
@@ -11,6 +16,10 @@
import org.springframework.web.bind.annotation.RequestParam;
import com.stylefeng.guns.modular.system.model.TImg;
import com.stylefeng.guns.modular.system.service.ITImgService;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 * 控制器
@@ -26,12 +35,21 @@
    @Autowired
    private ITImgService tImgService;
    @Autowired
    private ITSystemConfigService tSystemConfigService;
    /**
     * 跳转到首页
     */
    @RequestMapping("")
    public String index() {
    public String index(Model model) {
        TSystemConfig config = tSystemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", 8)
                .last("LIMIT 1"));
        JSONObject jsonObject = JSONObject.parseObject(config.getContent());
        model.addAttribute("num2",jsonObject.getInteger("num2"));
        List<TImg> tImgList = tImgService.selectList(new EntityWrapper<TImg>()
                .eq("type", 1));
        model.addAttribute("imgList",tImgList);
        return PREFIX + "tImg.html";
    }
@@ -94,6 +112,32 @@
    }
    /**
     * 修改图片
     */
    @RequestMapping(value = "/updateSubmit")
    @ResponseBody
    public Object updateSubmit(String tImg) {
        System.err.println(tImg);
        // 删除所有图片
        tImgService.delete(new EntityWrapper<TImg>()
                .eq("type",1));
        if(StringUtils.hasLength(tImg)){
            String[] split = tImg.split(",");
            List<TImg> tImgList = new ArrayList<>(split.length);
            for (String s : split) {
                TImg tImg1 = new TImg();
                // 保存所有图片
                tImg1.setType(1);
                tImg1.setCreateTime(new Date());
                tImg1.setImg(s);
                tImgList.add(tImg1);
            }
            tImgService.insertBatch(tImgList);
        }
        return SUCCESS_TIP;
    }
    /**
     * 详情
     */
    @RequestMapping(value = "/detail/{tImgId}")
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TSystemConfigController.java
@@ -148,6 +148,12 @@
            }
            objects.add(jsonObject1);
        }
        TSystemConfig config = tSystemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", 8)
                .last("LIMIT 1"));
        JSONObject jsonObj = JSONObject.parseObject(config.getContent());
        Integer zcOne = jsonObj.getInteger("num1");
        model.addAttribute("zcOne",zcOne);
        model.addAttribute("array",objects);
        JSONObject extraCost = JSONObject.parseObject(jsonObject.getString("ExtraCost"));
        model.addAttribute("ExtraCost",extraCost);
@@ -234,6 +240,38 @@
    }
    /**
     * 修改价格规则开关
     */
    @RequestMapping(value = "/openOrClose")
    @ResponseBody
    public Object openOrClose(Integer num1) {
        TSystemConfig config = tSystemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", 8)
                .last("LIMIT 1"));
        JSONObject jsonObject = JSONObject.parseObject(config.getContent());
        jsonObject.remove(jsonObject.getString("num1"));
        jsonObject.put("num1",num1);
        config.setContent(JSONObject.toJSONString(jsonObject));
        tSystemConfigService.updateById(config);
        return SUCCESS_TIP;
    }
    /**
     * 修改启动页状态
     */
    @RequestMapping(value = "/updateStartState")
    @ResponseBody
    public Object updateStartState(Integer num2) {
        TSystemConfig config = tSystemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", 8)
                .last("LIMIT 1"));
        JSONObject jsonObject = JSONObject.parseObject(config.getContent());
        jsonObject.remove(jsonObject.getString("num2"));
        jsonObject.put("num2",num2);
        config.setContent(JSONObject.toJSONString(jsonObject));
        tSystemConfigService.updateById(config);
        return SUCCESS_TIP;
    }
    /**
     * 详情
     */
    @RequestMapping(value = "/detail/{tSystemConfigId}")
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/resp/DataStatisticsOrderYearResp.java
New file
@@ -0,0 +1,32 @@
package com.stylefeng.guns.modular.system.controller.resp;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
@ApiModel(value = "首页数据统计(查询每年每月订单数量)")
public class DataStatisticsOrderYearResp implements Serializable {
    @ApiModelProperty(value = "月份")
    private String month;
    @ApiModelProperty(value = "数量")
    private Integer orderCount;
    public String getMonth() {
        return month;
    }
    public void setMonth(String month) {
        this.month = month;
    }
    public Integer getOrderCount() {
        return orderCount;
    }
    public void setOrderCount(Integer orderCount) {
        this.orderCount = orderCount;
    }
}
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/resp/PerformanceTableResp.java
New file
@@ -0,0 +1,43 @@
package com.stylefeng.guns.modular.system.controller.resp;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
public class PerformanceTableResp implements Serializable {
    @ApiModelProperty(value = "时间")
    private String monthTime;
    @ApiModelProperty(value = "姓名")
    private String userName;
    @ApiModelProperty(value = "单量/收入/佣金")
    private BigDecimal amount;
    public String getMonthTime() {
        return monthTime;
    }
    public void setMonthTime(String monthTime) {
        this.monthTime = monthTime;
    }
    public String getUserName() {
        return userName;
    }
    public void setUserName(String userName) {
        this.userName = userName;
    }
    public BigDecimal getAmount() {
        return amount;
    }
    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }
}
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/resp/TOrderServerResp.java
New file
@@ -0,0 +1,18 @@
package com.stylefeng.guns.modular.system.controller.resp;
import com.stylefeng.guns.modular.system.model.TOrder;
import io.swagger.annotations.ApiModelProperty;
public class TOrderServerResp extends TOrder {
    @ApiModelProperty(value = "司机姓名")
    private String driverName;
    public String getDriverName() {
        return driverName;
    }
    public void setDriverName(String driverName) {
        this.driverName = driverName;
    }
}
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/TOrderMapper.java
@@ -1,11 +1,15 @@
package com.stylefeng.guns.modular.system.dao;
import com.stylefeng.guns.modular.system.controller.resp.DataStatisticsOrderYearResp;
import com.stylefeng.guns.modular.system.controller.resp.PerformanceTableResp;
import com.stylefeng.guns.modular.system.controller.resp.TOrderResp;
import com.stylefeng.guns.modular.system.controller.resp.TOrderServerResp;
import com.stylefeng.guns.modular.system.model.TOrder;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.time.LocalDate;
import java.util.List;
/**
@@ -35,4 +39,27 @@
                                  @Param("source") Integer source,@Param("userName")String userName, @Param("userPhone")String userPhone,
                                  @Param("state")Integer state,@Param("driverName")String driverName,@Param("isException") Integer isException,
                                  @Param("roleType")Integer roleType,@Param("objectId")Integer objectId);
    /**
     * 通过年份查询订单数量
     * @param agentId
     * @return
     */
    List<DataStatisticsOrderYearResp> getDataStatisticsByYear(@Param("agentId") Integer agentId,@Param("yearDate")String yearDate);
    /**
     * 单量
     * @param agentId
     * @param monthDate
     * @return
     */
    List<PerformanceTableResp> getDataStatisticsOrderCount(@Param("agentId")Integer agentId, @Param("monthDate")String monthDate);
    Integer getDataStatisticsCount(@Param("agentId")Integer agentId, @Param("type")Integer type, @Param("localDate")LocalDate localDate);
    Integer getDataStatisticsServerCount(@Param("agentId")Integer agentId, @Param("localDate") LocalDate localDate);
    List<TOrderServerResp> getDataStatisticsServerList(@Param("agentId")Integer agentId,@Param("localDate") LocalDate localDate);
    List<TOrder> getDataStatisticsAllList(@Param("agentId")Integer agentId,@Param("localDate") LocalDate localDate);
}
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/TRevenueMapper.java
@@ -1,5 +1,6 @@
package com.stylefeng.guns.modular.system.dao;
import com.stylefeng.guns.modular.system.controller.resp.PerformanceTableResp;
import com.stylefeng.guns.modular.system.controller.resp.RevenueExpenditureResp;
import com.stylefeng.guns.modular.system.model.TRevenue;
import com.baomidou.mybatisplus.mapper.BaseMapper;
@@ -42,4 +43,6 @@
     * @return
     */
    RevenueExpenditureResp commissionOrBalanceDetail(@Param("code")String code, @Param("type")Integer type);
    List<PerformanceTableResp> getDataStatisticsIncomeOrCommission(@Param("agentId")Integer agentId,@Param("type") Integer type, @Param("monthDate")String monthDate);
}
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TOrderMapper.xml
@@ -64,6 +64,14 @@
            a.phone AS userPhone,a.cancelCount,a.status AS userStatus,d.name AS driverName,d.phone AS driverPhone
    </sql>
    <sql id="Base_Column_Server_Order">
        o.id, o.code, o.userId, o.driverId, o.`source`, o.agentId, o.branchOfficeId, o.startTime, o.startAddress, o.startLat, o.startLng, o.endAddress, o.endLat, o.endLng,
        o.boardingTime, o.getoffTime, o.estimatedPrice, o.orderMoney, o.payMoney, o.discountedPrice, o.couponId, o.payType, o.payTime, o.`state`, o.status, o.createTime,
        o.startDistance,o.startPrice,o.overDriveDistance,o.overDrivePrice,o.longDistance,o.longDistancePrice,o.overLongDistance,o.overLongDistancePrice,
        o.waitTime,o.waitTimePrice,o.outWaitTime,o.outWaitTimePrice,o.badWeatherDistance,o.badWeatherPrice,o.overBadWeatherDistance,o.overBadWeatherPrice,
        d.name AS driverName,d.phone AS driverPhone
    </sql>
    <select id="getOrderList" resultType="com.stylefeng.guns.modular.system.controller.resp.TOrderResp">
        select <include refid="Base_Column_Order"></include>
        from t_order o
@@ -103,5 +111,100 @@
        </where>
        ORDER BY o.createTime
    </select>
    <select id="getDataStatisticsByYear" resultType="com.stylefeng.guns.modular.system.controller.resp.DataStatisticsOrderYearResp">
        SELECT createTime AS `month`,COUNT(id) AS orderCount
        FROM t_order
        <where>
            <if test="agentId != null">
                AND agentId = #{agentId}
            </if>
            <if test="yearDate != null and yearDate != ''">
                AND date_format(createTime, '%Y') LIKE concat('',#{yearDate},'%')
            </if>
        </where>
        GROUP BY date_format(createTime, '%Y-%m')
    </select>
    <select id="getDataStatisticsOrderCount" resultType="com.stylefeng.guns.modular.system.controller.resp.PerformanceTableResp">
        SELECT date_format(o.createTime, '%Y-%m') AS monthTime,COUNT(o.id) AS amount,d.name AS userName
        FROM t_order o
        LEFT JOIN t_driver d ON o.driverId = d.id
        <where>
            <if test="agentId != null">
                AND o.agentId = #{agentId}
            </if>
            <if test="monthDate != null and monthDate != ''">
                AND date_format(o.createTime, '%Y-%m') LIKE concat('',#{monthDate},'%')
            </if>
            AND (o.`state` = 108 OR o.`state` = 109)
        </where>
        GROUP BY monthTime,userName
        ORDER BY amount DESC
    </select>
    <select id="getDataStatisticsCount" resultType="java.lang.Integer">
        SELECT COUNT(id)
        FROM t_order
        <where>
            <if test="agentId != null">
                AND agentId = #{agentId}
            </if>
            <if test="type != null">
                AND `state` = #{type}
            </if>
            <if test="localDate != null">
                AND date_format(createTime, '%Y-%m-%d') LIKE concat('',#{localDate},'%')
            </if>
        </where>
    </select>
    <select id="getDataStatisticsServerCount" resultType="java.lang.Integer">
        SELECT COUNT(id)
        FROM t_order
        <where>
            <if test="agentId != null">
                AND agentId = #{agentId}
            </if>
            <if test="localDate != null">
                AND date_format(createTime, '%Y-%m-%d') LIKE concat('',#{localDate},'%')
            </if>
            AND (`state` = 102
                OR `state` = 103
                OR `state` = 104
                OR `state` = 105
                OR `state` = 106
                OR `state` = 107
            )
        </where>
    </select>
    <select id="getDataStatisticsServerList" resultType="com.stylefeng.guns.modular.system.controller.resp.TOrderServerResp">
        select <include refid="Base_Column_Server_Order"></include>
        FROM t_order o
        LEFT JOIN t_driver d ON o.driverId = d.id
        <where>
            <if test="agentId != null">
                AND o.agentId = #{agentId}
            </if>
            <if test="localDate != null">
                AND date_format(o.createTime, '%Y-%m-%d') LIKE concat('',#{localDate},'%')
            </if>
            AND (o.`state` = 102
            OR o.`state` = 103
            OR o.`state` = 104
            OR o.`state` = 105
            OR o.`state` = 106
            OR o.`state` = 107
            )
        </where>
    </select>
    <select id="getDataStatisticsAllList" resultType="com.stylefeng.guns.modular.system.model.TOrder">
        select <include refid="Base_Column_List"></include>
        FROM t_order
        <where>
            <if test="agentId != null">
                AND agentId = #{agentId}
            </if>
            <if test="localDate != null">
                AND date_format(createTime, '%Y-%m-%d') LIKE concat('',#{localDate},'%')
            </if>
        </where>
    </select>
</mapper>
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TRevenueMapper.xml
@@ -125,5 +125,43 @@
        WHERE
            cw.type = 2 AND cw.businessType = #{type} AND cw.code = #{code}
    </select>
    <select id="getDataStatisticsIncomeOrCommission" resultType="com.stylefeng.guns.modular.system.controller.resp.PerformanceTableResp">
        SELECT date_format(r.createTime, '%Y-%m') AS monthTime,COUNT(o.id) AS amount,d.name AS userName
        FROM t_revenue r
        LEFT JOIN t_driver d ON r.userId = d.id
        LEFT JOIN t_order o ON r.orderId = o.id
        <where>
            <if test="agentId != null">
                AND o.agentId = #{agentId}
            </if>
            <if test="monthDate != null and monthDate != ''">
                AND date_format(r.createTime, '%Y-%m') LIKE concat('',#{monthDate},'%')
            </if>
            AND r.type = 1
            AND r.userType = 2
        </where>
        GROUP BY monthTime,userName
    </select>
    <select id="getDataStatisticsCommission" resultType="com.stylefeng.guns.modular.system.controller.resp.PerformanceTableResp">
        SELECT date_format(r.createTime, '%Y-%m') AS monthTime,SUM(r.amount) AS amount,d.name AS userName
        FROM t_revenue r
        LEFT JOIN t_driver d ON r.userId = d.id
        LEFT JOIN t_order o ON r.orderId = o.id
        <where>
            <if test="agentId != null">
                AND o.agentId = #{agentId}
            </if>
            <if test="monthDate != null and monthDate != ''">
                AND date_format(r.createTime, '%Y-%m') LIKE concat('',#{monthDate},'%')
            </if>
            <if test="type != null">
                AND r.type = #{type}
            </if>
            AND r.userType = 2
        </where>
        GROUP BY monthTime,userName
        ORDER BY amount DESC
    </select>
</mapper>
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITAgentService.java
@@ -35,4 +35,11 @@
    void detail(Integer agentId, Model model);
    List<TAgentResp> getAgentResp(List<TAgent> tAgents);
    /**
     * 统计代理商
     * @param agentId
     * @param model
     */
    void getDataStatistics(Integer agentId, Model model);
}
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITDriverService.java
@@ -78,4 +78,11 @@
     * @param model
     */
    void driverCommissionDetail(Integer tDriverId, Model model);
    /**
     * 统计司机数
     * @param agentId
     * @param model
     */
    void getDataStatistics(Integer agentId, Model model);
}
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITOrderService.java
@@ -2,11 +2,13 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.stylefeng.guns.modular.system.controller.resp.TOrderResp;
import com.stylefeng.guns.modular.system.controller.resp.TOrderServerResp;
import com.stylefeng.guns.modular.system.model.TOrder;
import com.baomidou.mybatisplus.service.IService;
import org.springframework.ui.Model;
import java.util.List;
import java.util.Map;
/**
 * <p>
@@ -44,4 +46,41 @@
     * @param model
     */
    void orderExceptionDetail(Integer orderId, Model model);
    /**
     * 订单统计,每年按月份
     * @param agentId
     * @param model
     */
    void getDataStatisticsByYear(Integer agentId,String yearDate, Model model);
    /**
     * 单量
     * @param agentId
     * @param monthDate
     * @param model
     */
    void getDataStatisticsOrderCount(Integer agentId, String monthDate, Model model);
    /**
     * 查询统计待接单,服务中,已完成,已取消
     * @param agentId
     * @param map
     */
    void getDataStatisticsCount(Integer agentId, Map<String, Integer> map);
    /**
     * 查询服务中的订单列表
     * @param agentId
     * @return
     */
    List<TOrderServerResp> getDataStatisticsServerList(Integer agentId);
    /**
     * 查询今天所有订单
     * @param agentId
     * @return
     */
    List<TOrder> getDataStatisticsAllList(Integer agentId);
}
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITRevenueService.java
@@ -52,4 +52,13 @@
     * @param model
     */
    void orderDetail(String code, Model model);
    /**
     * 查询收入或佣金
     * @param agentId
     * @param monthDate
     * @param type
     * @param model
     */
    void getDataStatisticsIncomeOrCommission(Integer agentId, String monthDate, Integer type, Model model);
}
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TAgentServiceImpl.java
@@ -21,6 +21,7 @@
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;
@@ -190,4 +191,19 @@
        }
        return tAgentRespList;
    }
    @Override
    public void getDataStatistics(Integer agentId, Model model) {
        // 代理商总数
        Integer agentTotal = tAgentMapper.selectCount(new EntityWrapper<TAgent>()
                .eq("id", agentId));
        // 代理商最近一个月新增数量
        LocalDate now = LocalDate.now();
        LocalDate localDate = now.plusMonths(1);
        Integer agentMonthTotal = tAgentMapper.selectCount(new EntityWrapper<TAgent>()
                .eq("id", agentId)
                .between("createTime", localDate, now));
        model.addAttribute("agentTotal",agentTotal);
        model.addAttribute("agentMonthTotal",agentMonthTotal);
    }
}
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TDriverServiceImpl.java
@@ -486,4 +486,19 @@
//        commissionResp.setAccumulatedCommission(BigDecimal.ZERO);
    }
    @Override
    public void getDataStatistics(Integer agentId, Model model) {
        // 司机总数
        Integer driverTotal = tDriverMapper.selectCount(new EntityWrapper<TDriver>()
                .eq("agentId", agentId));
        // 司机最近一月数量
        LocalDate now = LocalDate.now();
        LocalDate localDate = now.plusMonths(1);
        Integer driverMonthTotal = tDriverMapper.selectCount(new EntityWrapper<TDriver>()
                .eq("agentId", agentId)
                .between("createTime", localDate, now));
        model.addAttribute("driverTotal",driverTotal);
        model.addAttribute("driverMonthTotal",driverMonthTotal);
    }
}
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TOrderServiceImpl.java
@@ -3,10 +3,14 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.stylefeng.guns.core.shiro.ShiroKit;
import com.stylefeng.guns.core.util.DateUtil;
import com.stylefeng.guns.modular.system.controller.resp.DataStatisticsOrderYearResp;
import com.stylefeng.guns.modular.system.controller.resp.PerformanceTableResp;
import com.stylefeng.guns.modular.system.controller.resp.TOrderResp;
import com.stylefeng.guns.modular.system.controller.resp.TOrderServerResp;
import com.stylefeng.guns.modular.system.dao.TAppUserMapper;
import com.stylefeng.guns.modular.system.dao.TBranchOfficeMapper;
import com.stylefeng.guns.modular.system.dao.TDriverMapper;
import com.stylefeng.guns.modular.system.enums.OrderStateEnum;
import com.stylefeng.guns.modular.system.model.TAppUser;
import com.stylefeng.guns.modular.system.model.TBranchOffice;
import com.stylefeng.guns.modular.system.model.TDriver;
@@ -21,8 +25,10 @@
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
@@ -137,4 +143,41 @@
        this.orderDetail(orderId,model);
        model.addAttribute("orderId",orderId);
    }
    @Override
    public void getDataStatisticsByYear(Integer agentId,String yearDate, Model model) {
        List<DataStatisticsOrderYearResp> data = tOrderMapper.getDataStatisticsByYear(agentId,yearDate);
        System.err.println(data);
        model.addAttribute("yearResp",data);
    }
    @Override
    public void getDataStatisticsOrderCount(Integer agentId, String monthDate, Model model) {
        List<PerformanceTableResp> list = tOrderMapper.getDataStatisticsOrderCount(agentId,monthDate);
        model.addAttribute("performanceResp",list);
    }
    @Override
    public void getDataStatisticsCount(Integer agentId, Map<String, Integer> map) {
        Integer pendingOrderCount = tOrderMapper.getDataStatisticsCount(agentId, OrderStateEnum.PENDING_ORDER.getCode(), LocalDate.now());
        Integer finishCount = tOrderMapper.getDataStatisticsCount(agentId, OrderStateEnum.FINISH.getCode(),LocalDate.now());
        Integer cancelCount = tOrderMapper.getDataStatisticsCount(agentId, OrderStateEnum.CANCELED.getCode(),LocalDate.now());
        Integer serverCount = tOrderMapper.getDataStatisticsServerCount(agentId, LocalDate.now());
        map.put("pendingOrderCount",pendingOrderCount);
        map.put("finishCount",finishCount);
        map.put("cancelCount",cancelCount);
        map.put("serverCount",serverCount);
    }
    @Override
    public List<TOrderServerResp> getDataStatisticsServerList(Integer agentId) {
        return tOrderMapper.getDataStatisticsServerList(agentId,LocalDate.now());
    }
    @Override
    public List<TOrder> getDataStatisticsAllList(Integer agentId) {
        return tOrderMapper.getDataStatisticsAllList(agentId,LocalDate.now());
    }
}
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TRevenueServiceImpl.java
@@ -3,6 +3,7 @@
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.stylefeng.guns.core.shiro.ShiroKit;
import com.stylefeng.guns.modular.system.controller.resp.PerformanceTableResp;
import com.stylefeng.guns.modular.system.controller.resp.RevenueExpenditureResp;
import com.stylefeng.guns.modular.system.dao.*;
import com.stylefeng.guns.modular.system.enums.CashWithdrawalTypeEnum;
@@ -22,6 +23,7 @@
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
@@ -128,4 +130,16 @@
            model.addAttribute("evaluateContent","");
        }
    }
    @Override
    public void getDataStatisticsIncomeOrCommission(Integer agentId, String monthDate, Integer type, Model model) {
        List<PerformanceTableResp> list = new ArrayList<>();
        if(2 == type){
            list = tRevenueMapper.getDataStatisticsIncomeOrCommission(agentId,1,monthDate);
        }
        if (3 == type){
            list = tRevenueMapper.getDataStatisticsIncomeOrCommission(agentId,2,monthDate);
        }
        model.addAttribute("performanceResp",list);
    }
}
management/guns-admin/src/main/resources/application.yml
@@ -78,7 +78,7 @@
spring:
  profiles: local
  datasource:
    url: jdbc:mysql://192.168.0.80:3306/super_save_driving?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8
    url: jdbc:mysql://192.168.110.80:3306/super_save_driving?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8
    username: root
    password: 123456
    db-name: super_save_driving #用来搜集数据库的所有表
management/guns-admin/src/main/webapp/WEB-INF/view/system/tImg/tImg.html
@@ -9,19 +9,60 @@
                <div class="row row-lg">
                    <div class="col-sm-12" style="text-align: left" >
                        <input hidden id="num2" value="${num2}">
                        <div class="initialLevel col-sm-12 control-label form-group" >
                            <div class="initialLevel col-sm-12 control-label form-group"  >
                                <label>状态</label>
                                <input type="radio" class="control-label" name="content" style="width: 2%" checked>开启
                                <input type="radio" class="control-label" name="content" style="width: 2%">关闭
                                <input type="radio" class="control-label" id="start" name="content" style="width: 2%"
                                   @if(isNotEmpty(num2)){
                                       ${1 == num2 ? 'checked=checked' : ''}
                                   @}
                                /> 开启
                                <input type="radio" class="control-label" id="end" name="content" style="width: 2%"
                                   @if(isNotEmpty(num2)){
                                       ${0 == num2 ? 'checked=checked' : ''}
                                   @}
                                /> 关闭
                            </div>
                        </div>
                        <div class="initialLevel col-sm-12 control-label form-group"  >
                            <div class="initialLevel col-sm-3 control-label form-group"  >
                                <span style="color:red">*</span>
                                <label class="control-label" >图片:</label>
                                <#uploadImg id="img" fileImg=""/>
<!--                        <div class="initialLevel col-sm-12 control-label form-group"  >-->
<!--                            <div class="initialLevel col-sm-3 control-label form-group"  >-->
<!--                                <span style="color:red">*</span>-->
<!--                                <label class="control-label" >图片:</label>-->
<!--                                <#uploadImg id="img" fileImg=""/>-->
<!--                            </div>-->
<!--                        </div>-->
                        <div class="row picture">
                            <div class="col-sm-12">
                                <div class="form-group">
                                    <label class="col-sm-1 control-label" style="width: 4%">图片</label>
                                    <div class="col-sm-9">
                                        <div id="imgPreIds">
                                            <div id="imgs" style="float: left;">
                                                @if(isNotEmpty(imgList)){
                                                    @for(img in imgList){
                                                        <div style="float: left;margin-right: 20px;">
                                                            <img name="startImg" src="${img.img}" style="width: 100px">
                                                            <i class="fa fa-close" onclick="delImg(this)" style="color: red;font-size: 18px;position: absolute;"></i>
                                                        </div>
                                                    @}
                                                @}
                                            </div>
                                            <div style="float: left;" id="imgUpload">
                                                <img width="100px" height="100px"
                                                     src="https://guangzhiyu-1311825864.cos.ap-chengdu.myqcloud.com/shangchuanpic.png"
                                                     onclick="TImgInfoDlg.uploadPhoto(this);">
                                            </div>
                                            <input type="file" id="btn_file" name="schoolimg"
                                                   style="display: none" onchange="TImgInfoDlg.schoolprow()">
                                            <div id="divHidden">
                                                <!--隐藏上传回调后的图片路径-->
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
@@ -29,7 +70,7 @@
                    <div class="row btn-group-m-t">
                        <div class="col-sm-12" style="text-align: center">
                            <#button btnCss="info" name="保存" id="ensure" icon="fa-check" clickFun="TImgInfoDlg.editSubmit()"/>
                            <#button btnCss="info" name="保存" id="ensure" icon="fa-check" clickFun="TImgInfoDlg.updateSubmit()"/>
                        </div>
                    </div>
@@ -39,11 +80,37 @@
    </div>
</div>
<script src="${ctxPath}/static/modular/system/tImg/tImg.js"></script>
<script src="${ctxPath}/static/modular/system/tImg/tImg_info.js"></script>
<script type="text/javascript">
    $(function () {
        var idCardPositive = new $WebUpload("img");
        idCardPositive.setUploadBarId("progressBar");
        idCardPositive.init();
    });
    $("#start").change(function(){
        var ajax = new $ax(Feng.ctxPath + "/tSystemConfig/updateStartState", function (data) {
            Feng.success("修改成功!");
            location.reload()
            TSystemConfig.table.refresh();
        }, function (data) {
            Feng.error("修改失败!" + data.responseJSON.message + "!");
        });
        console.log($("#num2").val())
        ajax.set("num2",1);
        ajax.start();
    })
    $("#end").change(function(){
        var ajax = new $ax(Feng.ctxPath + "/tSystemConfig/updateStartState", function (data) {
            Feng.success("修改成功!");
            location.reload()
            TSystemConfig.table.refresh();
        }, function (data) {
            Feng.error("修改失败!" + data.responseJSON.message + "!");
        });
        console.log($("#num2").val())
        ajax.set("num2",0);
        ajax.start();
    })
</script>
@}
management/guns-admin/src/main/webapp/WEB-INF/view/system/tSystemConfig/tSystemConfigPriceRules.html
@@ -83,7 +83,17 @@
                                <input class="control-label" id="num16" name="num16" value="${ExtraCost.num4}" type="number" style="height: 30px;width: 80px">
                                <span class="control-label" >元/分钟</span>
                            </div>
                            <input hidden id="zcOne" value="${zcOne}">
                            <div class="initialLevel col-sm-12 control-label form-group"  >
                                <div class="col-sm-1">
                                    <input type="checkbox" class="js-switch1" id="isTaxiCar"
                                       @if(isNotEmpty(zcOne)){
                                        ${1 == zcOne ? 'checked=checked' : ''}
                                       @}
                                    />
                                </div>
                                @if(1 == zcOne){
                                    <div class="initialLevel col-sm-10 control-label form-group"  >
                                <span class="control-label" >恶劣天气</span>
                                <input class="control-label" id="num17" name="num17" value="${ExtraCost.num5}" type="number" style="height: 30px;width: 80px">
                                <span class="control-label" >公里以内,加收</span>
@@ -95,6 +105,8 @@
                                <span class="control-label" >倍计费,最高收取</span>
                                <input class="control-label" id="num21" name="num21" value="${ExtraCost.num9}" type="number" style="height: 30px;width: 80px">
                                <span class="control-label" >元</span>
                                    </div>
                                @}
                            </div>
                        </div>
@@ -113,4 +125,26 @@
</div>
<script src="${ctxPath}/static/modular/system/tSystemConfig/tSystemConfig.js"></script>
<script src="${ctxPath}/static/modular/system/tSystemConfig/tSystemConfig_info.js"></script>
<script type="text/javascript">
    var elem1 = document.querySelector(".js-switch1");
    var init1 = new Switchery(elem1);
    $("#isTaxiCar").change(function(){
        var ajax = new $ax(Feng.ctxPath + "/tSystemConfig/openOrClose", function (data) {
            Feng.success("修改成功!");
            location.reload()
            TSystemConfig.table.refresh();
        }, function (data) {
            Feng.error("修改失败!" + data.responseJSON.message + "!");
        });
        console.log($("#zcOne").val())
        if(1 == $("#zcOne").val()){
            ajax.set("num1",0);
        }else {
            ajax.set("num1",1);
        }
        ajax.start();
    })
</script>
@}
management/guns-admin/src/main/webapp/static/modular/system/tImg/tImg_info.js
@@ -79,6 +79,7 @@
    this.clearData();
    this.collectData();
    console.log(11111)
    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/tImg/update", function(data){
        Feng.success("修改成功!");
@@ -91,6 +92,125 @@
    ajax.start();
}
/**
 * 提交图片
 */
TImgInfoDlg.updateSubmit = function() {
    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/tImg/updateSubmit", function(data){
        Feng.success("修改成功!");
        window.parent.TImg.table.refresh();
        TImgInfoDlg.close();
    },function(data){
        Feng.error("修改失败!" + data.responseJSON.message + "!");
    });
    var reqData = "";
    var n = $('img[name="startImg"]').length
    for (let i = 0; i < n; i++) {
        if(i == (n-1)){
            reqData += $('img[name="startImg"]')[i].src
        }else {
            reqData += $('img[name="startImg"]')[i].src + ",";
        }
    }
    console.log(reqData)
    ajax.set("tImg",reqData);
    ajax.start();
}
let thisImg;
TImgInfoDlg.uploadPhoto = function(e) {
    thisImg = $(e);
    $("#btn_file").click();
}
TImgInfoDlg.schoolprow = function() {
    let file = document.querySelector('input[name=schoolimg]').files[0];
    // let reader = new FileReader();
    if (file) {
        let inputList = $("#imgs div");
        let index = inputList.length
        if(index > 10){
            Feng.error("图片不能超过10张");
            return
        }
        upload(file, thisImg);
        // reader.readAsDataURL(file);
        //获取已上传的图片数从第二张开始算
        // if (index < 9) {
        //     let imgHtml = "<img width=\"100px\" height=\"100px\" src=\"https://guangzhiyu-1311825864.cos.ap-chengdu.myqcloud.com/shangchuanpic.png\"\n" +
        //                                                  "onclick=\"TbCommodityInfoDlg.uploadPhoto(this);\">";
        //     $("#imgUpload").append(imgHtml);
        // }
    }
}
function upload(file, thisImg) {
    let formData = new FormData();
    formData.append("myfile", file);
    $.ajax({
        url: Feng.ctxPath + "/mgr/saveApk",
        type: "POST",
        data: formData,
        contentType: false,
        processData: false,
        success: function (data) {
            /*$(thisImg).attr("src", data);
             $(thisImg).addClass("imgP");
             //图片
            $("#divHidden").empty();*/
            $('#imgs').append('<div style="float: left;margin-right: 20px;"><img name="startImg" src="' + data + '" style="width: 100px"> <i class="fa fa-close" onclick="delImg(this)" style="color: red;font-size: 18px;position: absolute;"></i></div>')
            // $(".imgP").each(function (r, v) {
            //     $("#imgUpload").append("<div style=\"width: 110px;height: 110px;float: left;\"><input class='imgHidden' type='hidden' value='"+v.src+"'><div style=width: 110px;height: 110px;float: left;><img src="+v.src+" width=\"100px\" class=\"describeImgUrl\"></div>+")
            // });
            layer.msg('上传成功!', {
                icon: 6
            });
        },
        error: function () {
            layer.msg('上传失败!', {
                icon: 5
            });
        }
    })
}
$(function() {
    var avatarUp = new $WebUpload("detailsImg");
    avatarUp.setUploadBarId("progressBar");
    avatarUp.init();
    var avatarUp = new $WebUpload("goodsImg");
    avatarUp.setUploadBarId("progressBar");
    avatarUp.init();
    // 手动指定上传文件调用的接口(不同文件类型不同接口)
    // UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
    // UE.Editor.prototype.getActionUrl = function (action) {
    // 这里很重要,很重要,很重要,要和配置中的imageActionName值一样
    // if (action == 'uploadimage') {
    //     // 这里调用后端我们写的图片上传接口
    //     return '/ueditor/uploadFileData';
    // } else if (action == 'uploadvideo') {
    //     return '/ueditor/uploadFileData';
    // } else {
    //     return this._bkGetActionUrl.call(this, action);
    // }
    // };
    let urls =  $("#urls").val()
    let id= $("#id").val();
    if (id!=null&&id!=""){
        $("#category").val($("#category_").val());
        let s1_=  $("#s1_").val();
        $("#s1").val(s1_);
    }
});
function delImg(e){
    $(e).parent().remove();
}
management/guns-admin/src/main/webapp/static/modular/system/tSystemConfig/tSystemConfig.js
@@ -296,6 +296,18 @@
    $(o).parent("div").parent("div").remove()
};
TSystemConfig.openOrClose = function () {
    console.log(111111111111)
    var ajax = new $ax(Feng.ctxPath + "/tSystemConfig/openOrClose", function (data) {
        Feng.success("修改成功!");
        TSystemConfig.table.refresh();
    }, function (data) {
        Feng.error("修改失败!" + data.responseJSON.message + "!");
    });
    ajax.set("num1",$("#zcOne").val());
    ajax.start();
};
/**
 * 查询列表
 */