wang-hao-jie
2022-01-07 0f2202dfcea3309c1b0e7515f6db5fbdc83d51d1
违章记录
18个文件已修改
1个文件已添加
218 ■■■■ 已修改文件
xboot-core/src/main/java/cn/exrick/xboot/core/config/security/WebSecurityConfig.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-core/src/main/java/cn/exrick/xboot/core/config/security/permission/CorsFilter.java 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-core/src/main/java/cn/exrick/xboot/core/entity/User.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-base/src/main/java/cn/exrick/xboot/base/controller/manage/UserController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AreaSectionController.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/StatisticController.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/wx/IndexController.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Customer.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/AreaMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/CustomerMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/OrderTaskMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/OrderSynScheduleImpl.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/StatisticPcScheduleImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IAreaService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/ICustomerService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IOrderTaskService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IAreaServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/ICustomerServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IOrderTaskServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-core/src/main/java/cn/exrick/xboot/core/config/security/WebSecurityConfig.java
@@ -98,9 +98,11 @@
        registry.and()
                // 表单登录方式
                .formLogin()
                .loginPage("/xboot/common/needLogin")
                //.loginPage("/xboot/common/needLogin")
                .loginPage("/index.html")
                // 登录请求url
                .loginProcessingUrl("/xboot/login")
                //.loginProcessingUrl("/login")
                .permitAll()
                // 成功处理类
                .successHandler(successHandler)
@@ -120,7 +122,7 @@
                .authenticated()
                .and()
                // 允许跨域
                .cors().and()
                //.cors().and()
                // 关闭跨站请求防护
                .csrf().disable()
                // 前后端分离采用JWT 不需要session
xboot-core/src/main/java/cn/exrick/xboot/core/config/security/permission/CorsFilter.java
New file
@@ -0,0 +1,74 @@
package cn.exrick.xboot.core.config.security.permission;
import org.springframework.stereotype.Component;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
 * 跨域过滤器
 * @author jitwxs
 * @since 2018/10/16 20:53
 */
@Component
public class CorsFilter implements Filter {
    @Override
    public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
        HttpServletResponse response = (HttpServletResponse) res;
        HttpServletRequest request = (HttpServletRequest) req;
        // 不使用*,自动适配跨域域名,避免携带Cookie时失效
        String origin = request.getHeader("Origin");
        if(!isNullOrEmpty(origin)) {
            response.setHeader("Access-Control-Allow-Origin", origin);
        }
        // 自适应所有自定义头
        String headers = request.getHeader("Access-Control-Request-Headers");
        if(!isNullOrEmpty(headers)) {
            response.setHeader("Access-Control-Allow-Headers", headers);
            response.setHeader("Access-Control-Expose-Headers", headers);
        }
        // 允许跨域的请求方法类型
        response.setHeader("Access-Control-Allow-Methods", "*");
        // 预检命令(OPTIONS)缓存时间,单位:秒
        response.setHeader("Access-Control-Max-Age", "3600");
        // 明确许可客户端发送Cookie,不允许删除字段即可
        response.setHeader("Access-Control-Allow-Credentials", "true");
        chain.doFilter(request, response);
    }
    public boolean isNullOrEmpty(String str) {
        if (null == str || "".equalsIgnoreCase(str.trim())
                || "null".equals(str.trim())) {
            return true;
        }
        return false;
    }
    @Override
    public void init(FilterConfig filterConfig) {
    }
    @Override
    public void destroy() {
    }
    /*
    注册过滤器:
    @Bean
    public FilterRegistrationBean registerFilter() {
        FilterRegistrationBean<CorsFilter> bean = new FilterRegistrationBean<>();
        bean.addUrlPatterns("/*");
        bean.setFilter(new CorsFilter());
        // 过滤顺序,从小到大依次过滤
        bean.setOrder(Ordered.HIGHEST_PRECEDENCE);
        return bean;
    }
     */
}
xboot-core/src/main/java/cn/exrick/xboot/core/entity/User.java
@@ -61,7 +61,7 @@
    private String mobile;
    @ApiModelProperty(value = "邮箱")
    @Pattern(regexp = NameUtil.regEmail, message = "邮箱格式不正确")
    //@Pattern(regexp = NameUtil.regEmail, message = "邮箱格式不正确")
    private String email;
    @ApiModelProperty(value = "省市县地址")
xboot-modules/xboot-base/src/main/java/cn/exrick/xboot/base/controller/manage/UserController.java
@@ -355,9 +355,9 @@
        if (!old.getMobile().equals(u.getMobile()) && userService.findByMobile(u.getMobile()) != null) {
            return ResultUtil.error("该手机号已绑定其他账户");
        }
        if (!old.getEmail().equals(u.getEmail()) && userService.findByEmail(u.getEmail()) != null) {
            return ResultUtil.error("该邮箱已绑定其他账户");
        }
//        if (!old.getEmail().equals(u.getEmail()) && userService.findByEmail(u.getEmail()) != null) {
//            return ResultUtil.error("该邮箱已绑定其他账户");
//        }
        if (StrUtil.isNotBlank(u.getDepartmentId())) {
            Department d = departmentService.get(u.getDepartmentId());
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AreaSectionController.java
@@ -47,6 +47,16 @@
        return new ResultUtil<List<AreaSection>>().setData(list);
    }
    @RequestMapping(value = "/getAll2", method = RequestMethod.GET)
    @ApiOperation(value = "获取全部数据")
    public Result<List<AreaSection>> getAll2(String areaId) {
        QueryWrapper<AreaSection> wrapper = new QueryWrapper<>();
        wrapper.eq("area_id",areaId);
        List<AreaSection> list = iAreaSectionService.list(wrapper);
        return new ResultUtil<List<AreaSection>>().setData(list);
    }
    @RequestMapping(value = "/getByPage", method = RequestMethod.GET)
    @ApiOperation(value = "分页获取")
    public Result<IPage<AreaSection>> getByPage(String areaId,PageVo page) {
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/StatisticController.java
@@ -119,6 +119,40 @@
        return new ResultUtil<Object>().setData(list);
    }
    @RequestMapping(value = "/getAnalysisDetail", method = RequestMethod.GET)
    @ApiOperation(value = "获取配送分析详情")
    public Result<Object> getAnalysisDetail(String areaName,String selectName) {
        QueryWrapper<Area> wrapper = new QueryWrapper<Area>();
        wrapper.eq("name",areaName);
        Area one = iAreaService.getOne(wrapper);
        QueryWrapper<AreaSection> wrapper2 = new QueryWrapper<AreaSection>();
        wrapper2.eq("area_id",one.getId());
        wrapper2.eq("name",selectName);
        AreaSection one1 = iAreaSectionService.getOne(wrapper2);
        List<OrderTask> list = iOrderTaskService.groupByTime(one.getId(),one1.getId());
        List<String> list1 = new ArrayList<>();
        List<Integer> list2 = new ArrayList<>();
        List<Integer> list3 = new ArrayList<>();
        List<Integer> list4 = new ArrayList<>();
        for(OrderTask obj:list){
            list1.add(obj.getCustomerName());
            list2.add(Integer.valueOf(obj.getTime()/60000));
            list3.add(Integer.valueOf(obj.getNum()/60000));
            list4.add(Integer.valueOf(obj.getLevel()/60000));
        }
        Map<String,Object> map = new HashMap<>();
        map.put("name",list1);
        map.put("avg",list2);
        map.put("min",list3);
        map.put("max",list4);
        return new ResultUtil<Object>().setData(map);
    }
    public double trans2(double v2){
        return (double) Math.round(v2 * 100) / 100;
    }
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/wx/IndexController.java
@@ -76,6 +76,8 @@
        if(one==null){
            return ResultUtil.error(openid);//首次登陆需绑定零售许可证
        }else {
            one.setLoginNum(one.getLoginNum()+1);
            iCustomerService.saveOrUpdate(one);
            return ResultUtil.data(one,"登录成功");
        }
    }
@@ -83,7 +85,7 @@
    public static JSONObject getSessionKeyOrOpenId(String code){
        //微信端登录code
        String wxCode = code;
        String requestUrl = "https://api.weixin.qq.com/sns/jscode2session?appid=wx0f10f6d253f3ee6b&secret=4d4cbc8da31a96559114ad693de70631&grant_type=authorization_code&js_code="+code;
        String requestUrl = "https://api.weixin.qq.com/sns/jscode2session?appid=wx77c0d2c54010b7e4&secret=2282710e890670e916c189347d70a7c5&grant_type=authorization_code&js_code="+code;
        JSONObject jsonObject = JSONUtil.parseObj( HttpUtil.get(requestUrl));
        return jsonObject;
    }
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Customer.java
@@ -81,6 +81,9 @@
    @ApiModelProperty(value = "微信id")
    private String openId;
    @ApiModelProperty(value = "登陆次数")
    private int loginNum;
    @Transient
    @TableField(exist = false)
    @ApiModelProperty(value = "接货人列表")
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/AreaMapper.java
@@ -25,4 +25,7 @@
    @Select("SELECT * FROM t_area")
    @Results({@Result(column="id", property="children", many = @Many(select = "cn.exrick.xboot.your.mapper.AreaSectionMapper.getListByParentId"))})
    List<Area> list2();
    @Select("SELECT b.id FROM t_area a,t_car b where a.user_id=b.follow_user_id and a.id=#{arg0}")
    String getCarId(String areaId);
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/CustomerMapper.java
@@ -30,4 +30,7 @@
            "sum(case when create_time < '${year}-12' then 1 else 0 end) as december\n" +
            "from t_customer")
    Month getCustomerCount(@Param("year")Integer year);
    @Select("select sum(login_num) from t_customer")
    int sumLogin();
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/OrderTaskMapper.java
@@ -63,4 +63,12 @@
            "from t_order_task t\n" +
            "where year(t.send_date)=#{year}")
    Month getSendNum(@Param("year")int year);
    @Select("select b.name as name1,avg(a.time) as num1,min(a.time) as num2,max(a.time) as num3 from t_order_task a LEFT JOIN t_customer b on a.customer_id=b.id where date_sub(curdate(), interval 1 month) <= date(a.send_date) and a.status=1 and a.area_id=#{arg0} and a.area_section_id=#{arg1} GROUP BY b.name")
    @Results({
            @Result(column="name1", property="customerName", jdbcType = JdbcType.VARCHAR),
            @Result(column="num1", property="time", jdbcType = JdbcType.INTEGER),
            @Result(column="num2", property="num", jdbcType = JdbcType.INTEGER),
            @Result(column="num3", property="level", jdbcType = JdbcType.INTEGER)})
    List<OrderTask> groupByTime(String areaId, String selectId);
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/OrderSynScheduleImpl.java
@@ -1,7 +1,6 @@
package cn.exrick.xboot.your.schedulings;
import cn.exrick.xboot.your.entity.*;
import cn.exrick.xboot.your.service.*;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
@@ -42,9 +41,10 @@
    @Autowired
    private ICustomerReceiveService iCustomerReceiveService;
    @Scheduled(cron="0 30 23 * * ?")//每晚凌晨1点执行
    //@Scheduled(cron="0 22 17 * * ?")//每晚凌晨1点执行
    //@Scheduled(cron="0 30 23 * * ?")//每晚凌晨1点执行
    @Scheduled(cron="0 20 10 * * ?")//每晚凌晨1点执行
    public void execute(){
        System.out.println("开始处理订单");
        QueryWrapper<OrderTaskOriginal> queryWrapper = new QueryWrapper<>();
        queryWrapper.between("create_time",dateStringFormat(new Date()),dateStringFormat2(new Date()));
        List<OrderTaskOriginal> list = iOrderTaskOriginalService.list(queryWrapper);
@@ -58,9 +58,14 @@
            orderTask.setEndDate(original.getPacketDate());
            orderTask.setSendDate(original.getSendDate());
            orderTask.setOrderDate(original.getOrderDate());
            orderTask.setSeq(original.getSeq());
            if(original.getSeq()!=null){
                orderTask.setSeq(original.getSeq());
            }else{
                orderTask.setSeq(999);
            }
            orderTask.setNum(original.getNum());
            //orderTask.setCarId(orderTask.getAreaId());
            orderTask.setCarId(getCarId(orderTask.getAreaId()));
            iOrderTaskService.saveOrUpdate(orderTask);
            updateCustomerRecive(orderTask.getCustomerId(),original.getLinker(),original.getCustomerPhone());
@@ -78,6 +83,7 @@
            }
        }
        System.out.println("处理订单结束");
    }
@@ -148,16 +154,17 @@
    }
    public String getCarId(String areaId){
        Area area = iAreaService.getById(areaId);
        String userId = area.getUserId();
        if(StrUtil.isNotEmpty(userId)){
            QueryWrapper<Car> queryWrapper = new QueryWrapper<>();
            queryWrapper.eq("follow_user_id",userId);
            Car one = iCarService.getOne(queryWrapper);
            return one.getId();
        }else{
            return null;
        }
//        Area area = iAreaService.getById(areaId);
//        String userId = area.getUserId();
//        if(StrUtil.isNotEmpty(userId)){
//            QueryWrapper<Car> queryWrapper = new QueryWrapper<>();
//            queryWrapper.eq("follow_user_id",userId);
//            Car one = iCarService.getOne(queryWrapper);
//            return one.getId();
//        }else{
//            return null;
//        }
        return iAreaService.getCarId(areaId);
    }
    public String dateStringFormat(Date strDate) {
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/StatisticPcScheduleImpl.java
@@ -73,7 +73,7 @@
        redisTemplate.set(HEAD+"call",iRemoteCallService.count()+"");//远程呼叫次数
        redisTemplate.set(HEAD+"paiCha","0");//事故隐患排查
        //redisTemplate.set(HEAD+"wx",iCustomerService.sumLogin()+"");//小程序登陆次数
        redisTemplate.set(HEAD+"wx",iCustomerService.sumLogin()+"");//小程序登陆次数
        redisTemplate.set(HEAD+"wxRate",iCustomerService.countOpenId()+"");//小程序使用率
        int i = iOrderTaskService.countLike();
        redisTemplate.set(HEAD+"like",i+"");//互动次数
@@ -86,11 +86,11 @@
        redisTemplate.set(HEAD+"outCar",iEquipmentService.countByTypeAndStatus(0)+"");//出发车辆
        redisTemplate.set(HEAD+"outCar","0");//危险开启
        redisTemplate.set(HEAD+"open","0");//危险开启
        QueryWrapper<Customer> wrapper = new QueryWrapper<>();
        String format = DateUtil.format(new Date(), "yyyy-MM-dd");
        wrapper.between("create_time",format+" 00:00:00",format+" 23:59:59");
        redisTemplate.set(HEAD+"outCar",iCustomerService.count(wrapper)+"");//今日新增商户
        redisTemplate.set(HEAD+"addCustomer",iCustomerService.count(wrapper)+"");//今日新增商户
    }
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IAreaService.java
@@ -16,4 +16,6 @@
    IPage<Area> page2(Page initMpPage, QueryWrapper<Area> wrapper);
    List<Area> list2();
    String getCarId(String areaId);
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/ICustomerService.java
@@ -13,4 +13,6 @@
    int countOpenId();
    Month getCustomerCount(Integer year);
    int sumLogin();
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IOrderTaskService.java
@@ -28,4 +28,6 @@
    Month getSendNum(int year);
    List<OrderTask> sumTime(String id);
    List<OrderTask> groupByTime(String areaId, String selectId);
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IAreaServiceImpl.java
@@ -36,4 +36,9 @@
    public List<Area> list2() {
        return areaMapper.list2();
    }
    @Override
    public String getCarId(String areaId) {
        return areaMapper.getCarId(areaId);
    }
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/ICustomerServiceImpl.java
@@ -40,4 +40,9 @@
    public Month getCustomerCount(Integer year) {
        return customerMapper.getCustomerCount(year);
    }
    @Override
    public int sumLogin() {
        return customerMapper.sumLogin();
    }
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IOrderTaskServiceImpl.java
@@ -64,6 +64,12 @@
    public List<OrderTask> sumTime(String id) {
        return orderTaskMapper.sumTime(id);
    }
    @Override
    public List<OrderTask> groupByTime(String areaId, String selectId) {
        return orderTaskMapper.groupByTime(areaId,selectId);
    }
    @Override
    public Month getSendNum(int year){
        return orderTaskMapper.getSendNum(year);