xuhy
2023-04-10 1b6c4cd60f3882c400d30af367bd4c5960fbd4a1
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TAgentController.java
@@ -2,6 +2,9 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.stylefeng.guns.core.base.controller.BaseController;
import com.stylefeng.guns.core.base.tips.SuccessTip;
import com.stylefeng.guns.core.exception.GunsException;
import com.stylefeng.guns.core.exception.ServiceExceptionEnum;
import com.stylefeng.guns.core.util.DateUtil;
import com.stylefeng.guns.modular.system.controller.resp.TAgentResp;
import com.stylefeng.guns.modular.system.controller.util.ExcelUtil;
@@ -94,9 +97,28 @@
     * 跳转区域页面
     */
    @RequestMapping("/areaDetail")
    public String areaDetail(Model model) {
    public String areaDetail(String area,String areaId,Model model) {
        String[] split1 = areaId.split("/");
        List<TRegion> tRegions = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0));
        model.addAttribute("province",tRegions);
        List<Integer> provinceIds = tRegions.stream().map(TRegion::getId).collect(Collectors.toList());
        // 查询市
        List<TRegion> tRegions1 = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", split1[0]));
        model.addAttribute("cityList",tRegions1);
        if(StringUtils.hasLength(area) && StringUtils.hasLength(areaId)){
            String[] split = area.split("/");
            model.addAttribute("provinceName",split[0]);
            model.addAttribute("cityName",split[1]);
            model.addAttribute("provinceId",split1[0]);
            model.addAttribute("cityId",split1[1]);
        }else {
            model.addAttribute("provinceName","");
            model.addAttribute("cityName","");
            model.addAttribute("provinceId","");
            model.addAttribute("cityId","");
        }
        return PREFIX + "tAgentArea.html";
    }
@@ -127,7 +149,14 @@
    @RequestMapping(value = "/add")
    @ResponseBody
    public Object add(TAgent tAgent) {
        System.err.println(tAgent);
        String[] split1 = tAgent.getArea().split("/");
        int count = tAgentService.selectCount(new EntityWrapper<TAgent>().eq("provinceName", split1[0]).eq("cityName",split1[1]));
        if(count>0){
            return new SuccessTip(500,"该代理商已存在!");
        }
        String[] split = tAgent.getAreaId().split("/");
        // 查询省市
        // 黑龙江省/大兴安岭地区
@@ -220,7 +249,7 @@
            DateFormat format = new SimpleDateFormat("yyyyMMdd");
            String time1 = format.format(date);
            String fileName = "Agent"+time1+".xls";
            String[] title = new String[] {"时间","姓名","联系电话","代理区域","订单数量",
            String[] title = new String[] {"时间","姓名","联系电话","代理区域","客服电话","订单数量",
                    "有效订单","已发放优惠券","已使用优惠券","累计优惠券金额","司机充值","司机数","状态"};
            EntityWrapper<TAgent> wrapper = tAgentService.getAgentWrapper(principal,principalPhone,createTime);
            // 是否异常
@@ -236,20 +265,21 @@
                values[i][1] = d.getPrincipal();
                values[i][2] = d.getPrincipalPhone();
                values[i][3] = d.getProvinceName()+d.getCityName();
                values[i][4] = String.valueOf(d.getOrderSum());
                values[i][5] = String.valueOf(d.getValidOrder());
                values[i][6] = String.valueOf(d.getIssuedCoupon());
                values[i][7] = String.valueOf(d.getUsedCoupon());
                values[i][8] = String.valueOf(d.getCouponPriceSum());
                values[i][9] = String.valueOf(d.getDriverRecharge() == null ? "0":d.getDriverRecharge());
                values[i][10] = String.valueOf(d.getDriverCount());
                values[i][4] = StringUtils.hasLength(d.getServiceCalls())?d.getServiceCalls():"";
                values[i][5] = String.valueOf(d.getOrderSum());
                values[i][6] = String.valueOf(d.getValidOrder());
                values[i][7] = String.valueOf(d.getIssuedCoupon());
                values[i][8] = String.valueOf(d.getUsedCoupon());
                values[i][9] = String.valueOf(d.getCouponPriceSum());
                values[i][10] = String.valueOf(d.getDriverRecharge() == null ? "0":d.getDriverRecharge());
                values[i][11] = String.valueOf(d.getDriverCount());
                Integer status1 = d.getStatus();
                if(1 == status1){
                    values[i][11] = "正常";
                    values[i][12] = "正常";
                }else if(2 == status1){
                    values[i][11] = "冻结";
                    values[i][12] = "冻结";
                }else {
                    values[i][11] = "删除";
                    values[i][12] = "删除";
                }
            }
            HSSFWorkbook wb = ExcelUtil.getHSSFWorkbook("Variance"+time1, title, values, null);