| | |
| | | url: jdbc:mysql://127.0.0.1:3306/tobacco?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8 |
| | | username: root |
| | | # Jasypt加密 可到common-utils中找到JasyptUtil加解密工具类生成加密结果 格式为ENC(加密结果) 以下解密结果为123456 |
| | | password: wanghaojie |
| | | #password: 123456 |
| | | #password: wanghaojie |
| | | password: 123456 |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driverClassName: com.mysql.jdbc.Driver |
| | | # Druid StatViewServlet配置 |
| | |
| | | service-base-url: http://127.0.0.1:${server.port}/ |
| | | web: |
| | | resources: |
| | | static-locations: classpath:/static |
| | | cache: |
| | | cachecontrol: |
| | | # 静态资源缓存30天 |
| | |
| | | # 暂未使用ES 排除client自动装配类 |
| | | - org.springframework.boot.autoconfigure.data.elasticsearch.ReactiveElasticsearchRestClientAutoConfiguration |
| | | |
| | | mvc: |
| | | static-path-pattern: //** |
| | | xboot: |
| | | # 全局限流 |
| | | ratelimit: |
| | | # 开启 |
| | | enable: true |
| | | enable: false |
| | | # 每1秒内(单位毫秒) |
| | | timeout: 1000 |
| | | # 总限制200个请求(单位个) |
| | |
| | | # IP限流 |
| | | iplimit: |
| | | # 开启 |
| | | enable: true |
| | | enable: false |
| | | # 每1秒内(单位毫秒) |
| | | timeout: 1000 |
| | | # 每个ip限制20个请求(单位个) |
| | |
| | | - /xboot/orderSyn/** |
| | | - /hk/** |
| | | - /xboot/wx/** |
| | | - /index.html |
| | | - /xboot/pcStatistic/** |
| | | - /xboot/pcStatistic2/** |
| | | - /xboot/area/getAll |
| | | - /xboot/areaSection/getAll2 |
| | | - /xboot/message/** |
| | | - /xboot/updateApp/** |
| | | - /xboot/fingerprint/getUserByCode |
| | | # 限流及黑名单不拦截的路径 |
| | | limitUrls: |
| | | - /**/*.js |
| | |
| | | title: XBoot API接口文档 |
| | | description: XBoot Api Documentation |
| | | version: 1.0.0 |
| | | termsOfServiceUrl: http://xboot.exrick.cn |
| | | termsOfServiceUrl: http://xxxx |
| | | contact: |
| | | name: Exrick |
| | | url: http://blog.exrick.cn |
| | | email: 1012139570@qq.com |
| | | name: xxx |
| | | url: http://blog.xxx.cn |
| | | email: xxxx@qq.com |
| | | # 分组名 |
| | | group: 1.XBoot管理接口 v1.0 |
| | | group2: 2.XBoot APP接口 v1.0 |
| | | group: 1.接口 v1.0 |
| | | group2: 2.APP接口 v1.0 |
| | | |
| | | # Mybatis-plus |
| | | mybatis-plus: |
| | |
| | | |
| | | User user = securityUtil.getCurrUser(); |
| | | // 在线DEMO所需 |
| | | if ("test".equals(user.getUsername()) || "test2".equals(user.getUsername())) { |
| | | return ResultUtil.error("演示账号不支持修改密码"); |
| | | if (user.getType()==0) { |
| | | return ResultUtil.error("业务账号不支持修改密码"); |
| | | } |
| | | |
| | | if (!new BCryptPasswordEncoder().matches(password, user.getPassword())) { |
| | |
| | | * 实体类名 |
| | | * 建议仅需修改 |
| | | */ |
| | | private static final String CLASS_NAME = "Student"; |
| | | private static final String CLASS_NAME = "AreaMap"; |
| | | |
| | | /** |
| | | * 类说明描述 |
| | | * 建议仅需修改 |
| | | */ |
| | | private static final String DESCRIPTION = "测试"; |
| | | private static final String DESCRIPTION = "区域坐标"; |
| | | |
| | | /** |
| | | * 作者名 |
| | | * 建议仅需修改 |
| | | */ |
| | | private static final String AUTHOR = "Exrick"; |
| | | private static final String AUTHOR = "whj"; |
| | | |
| | | /** |
| | | * 是否生成树形结构相关接口 |
| | |
| | | @ApiOperation(value = "编辑或更新数据") |
| | | public Result<Area> saveOrUpdate(Area area) { |
| | | QueryWrapper<Area> wrapper = new QueryWrapper<>(); |
| | | if (!area.getUserId().equals("0")){ |
| | | wrapper.eq("user_id",area.getUserId()); |
| | | if (StrUtil.isNotEmpty(area.getCarId())){ |
| | | wrapper.eq("car_id",area.getCarId()); |
| | | Area area1 = iAreaService.getOne(wrapper); |
| | | if (area1 != null && !area.getId().equals(area1.getId())){ |
| | | return new ResultUtil<Area>().setErrorMsg("该配送员已被其他片区绑定,请先解绑"); |
| | | return new ResultUtil<Area>().setErrorMsg("该车辆已被其它片区绑定,请先解绑"); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package cn.exrick.xboot.your.controller; |
| | | |
| | | import cn.exrick.xboot.core.common.utils.PageUtil; |
| | | import cn.exrick.xboot.core.common.utils.ResultUtil; |
| | | import cn.exrick.xboot.core.common.vo.PageVo; |
| | | import cn.exrick.xboot.core.common.vo.Result; |
| | | import cn.exrick.xboot.your.entity.AreaMap; |
| | | import cn.exrick.xboot.your.service.IAreaMapService; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author whj |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @Api(tags = "区域坐标管理接口") |
| | | @RequestMapping("/xboot/areaMap") |
| | | @Transactional |
| | | public class AreaMapController { |
| | | |
| | | @Autowired |
| | | private IAreaMapService iAreaMapService; |
| | | |
| | | @RequestMapping(value = "/get/{id}", method = RequestMethod.GET) |
| | | @ApiOperation(value = "通过id获取") |
| | | public Result<AreaMap> get(@PathVariable String id) { |
| | | |
| | | AreaMap areaMap = iAreaMapService.getById(id); |
| | | return new ResultUtil<AreaMap>().setData(areaMap); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getAll", method = RequestMethod.GET) |
| | | @ApiOperation(value = "获取全部数据") |
| | | public Result<List<AreaMap>> getAll() { |
| | | |
| | | List<AreaMap> list = iAreaMapService.list(); |
| | | return new ResultUtil<List<AreaMap>>().setData(list); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getAllById", method = RequestMethod.GET) |
| | | @ApiOperation(value = "获取全部数据") |
| | | public Result<List<AreaMap>> getAllById(String id) { |
| | | QueryWrapper<AreaMap> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("area_id",id); |
| | | wrapper.orderByAsc("seq"); |
| | | List<AreaMap> list = iAreaMapService.list(wrapper); |
| | | return new ResultUtil<List<AreaMap>>().setData(list); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getByPage", method = RequestMethod.GET) |
| | | @ApiOperation(value = "分页获取") |
| | | public Result<IPage<AreaMap>> getByPage(PageVo page) { |
| | | |
| | | IPage<AreaMap> data = iAreaMapService.page(PageUtil.initMpPage(page)); |
| | | return new ResultUtil<IPage<AreaMap>>().setData(data); |
| | | } |
| | | |
| | | @RequestMapping(value = "/insertOrUpdate", method = RequestMethod.POST) |
| | | @ApiOperation(value = "编辑或更新数据") |
| | | public Result<AreaMap> saveOrUpdate(AreaMap areaMap) { |
| | | if (iAreaMapService.saveOrUpdate(areaMap)) { |
| | | return new ResultUtil<AreaMap>().setData(areaMap); |
| | | } |
| | | return new ResultUtil<AreaMap>().setErrorMsg("操作失败"); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/delById2", method = RequestMethod.POST) |
| | | @ApiOperation(value = "通过areaid删除") |
| | | public Result<Object> delById2(String id) { |
| | | QueryWrapper<AreaMap> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("area_id",id); |
| | | iAreaMapService.remove(wrapper); |
| | | return ResultUtil.success("通过id删除数据成功"); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/delByIds", method = RequestMethod.POST) |
| | | @ApiOperation(value = "批量通过id删除") |
| | | public Result<Object> delAllByIds(@RequestParam String[] ids) { |
| | | |
| | | for (String id : ids) { |
| | | iAreaMapService.removeById(id); |
| | | } |
| | | return ResultUtil.success("批量通过id删除数据成功"); |
| | | } |
| | | } |
| | |
| | | |
| | | import cn.exrick.xboot.core.common.utils.PageUtil; |
| | | import cn.exrick.xboot.core.common.utils.ResultUtil; |
| | | import cn.exrick.xboot.core.common.utils.SecurityUtil; |
| | | import cn.exrick.xboot.core.common.vo.PageVo; |
| | | import cn.exrick.xboot.core.common.vo.Result; |
| | | import cn.exrick.xboot.core.entity.User; |
| | | import cn.exrick.xboot.your.entity.*; |
| | | import cn.exrick.xboot.your.service.*; |
| | | import cn.exrick.xboot.your.vo.CarVo; |
| | |
| | | @Autowired |
| | | private IDrivingRecordService iDrivingRecordService; |
| | | @Autowired |
| | | private ICustomerService iCustomerService; |
| | | private SecurityUtil securityUtil; |
| | | |
| | | |
| | | @RequestMapping(value = "/get/{id}", method = RequestMethod.GET) |
| | |
| | | |
| | | List<Car> list = iCarService.list(); |
| | | return new ResultUtil<List<Car>>().setData(list); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getBindCar", method = RequestMethod.GET) |
| | | @ApiOperation(value = "获取绑定的车辆") |
| | | public Result<Car> getBindCar() { |
| | | String userId = securityUtil.getCurrUser().getId(); |
| | | QueryWrapper<Car> carQueryWrapper = new QueryWrapper<Car>(); |
| | | carQueryWrapper.eq("user_id",userId).or().eq("follow_user_id",userId); |
| | | Car car = iCarService.getOne(carQueryWrapper); |
| | | return new ResultUtil<Car>().setData(car); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getAll", method = RequestMethod.GET) |
| | |
| | | |
| | | @RequestMapping(value = "/bindCar", method = RequestMethod.POST) |
| | | @ApiOperation(value = "绑定车辆人员") |
| | | public Result<Car> bindCar(String carId,String userId) { |
| | | Car car = iCarService.getById(carId); |
| | | car.setUserId(userId); |
| | | iCarService.saveOrUpdate(car); |
| | | public Result<Car> bindCar(String carId,String userId) {//A车张三 李四 B车王五,赵六 |
| | | User user = securityUtil.getCurrUser(); |
| | | QueryWrapper<Car> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("user_id",user.getId()).or().eq("follow_user_id",user.getId()); |
| | | Car one = iCarService.getOne(queryWrapper);//原来的车 |
| | | |
| | | if(one!=null){ |
| | | //如果还是选了原来的车则不用变 |
| | | if(one.getId().equals(carId)){ |
| | | |
| | | }else{ |
| | | //如果选了另一辆车,先把原来的车的人员清空 |
| | | if(user.getType2()==0){ |
| | | one.setUserId(""); |
| | | }else{ |
| | | one.setFollowUserId(""); |
| | | } |
| | | iCarService.saveOrUpdate(one); |
| | | |
| | | //绑定上新选的车 |
| | | Car car = iCarService.getById(carId); |
| | | if(car!=null){ |
| | | if(user.getType2()==0){ |
| | | car.setUserId(user.getId()); |
| | | }else{ |
| | | car.setFollowUserId(user.getId()); |
| | | } |
| | | iCarService.saveOrUpdate(car); |
| | | } |
| | | } |
| | | }else{ |
| | | Car car = iCarService.getById(carId); |
| | | if(car!=null){ |
| | | if(user.getType2()==0){ |
| | | car.setUserId(user.getId()); |
| | | }else{ |
| | | car.setFollowUserId(user.getId()); |
| | | } |
| | | iCarService.saveOrUpdate(car); |
| | | } |
| | | } |
| | | return ResultUtil.success("绑定成功"); |
| | | } |
| | | |
| | |
| | | public Result<Customer> saveOrUpdate(Customer customer) { |
| | | |
| | | if (iCustomerService.saveOrUpdate(customer)) { |
| | | |
| | | if(StrUtil.isNotEmpty(customer.getLinker())){ |
| | | QueryWrapper<CustomerReceive> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("customer_id",customer.getId()); |
| | | wrapper.eq("name",customer.getLinker()); |
| | | CustomerReceive one = iCustomerReceiveService.getOne(wrapper); |
| | | if(one==null){ |
| | | one = new CustomerReceive(); |
| | | one.setCustomerId(customer.getId()); |
| | | one.setFstatus(0); |
| | | one.setStatus(1); |
| | | one.setName(customer.getLinker()); |
| | | one.setPhone(customer.getPhone()); |
| | | iCustomerReceiveService.saveOrUpdate(one); |
| | | } |
| | | } |
| | | return new ResultUtil<Customer>().setData(customer); |
| | | } |
| | | return new ResultUtil<Customer>().setErrorMsg("操作失败"); |
| | |
| | | if(StrUtil.isNotEmpty(lng)){ |
| | | customer.setLng(lng); |
| | | }else{ |
| | | return ResultUtil.error("请将信息填写完整"); |
| | | return ResultUtil.error("请将定位信息填写完整"); |
| | | } |
| | | if(StrUtil.isNotEmpty(lat)){ |
| | | customer.setLat(lat); |
| | | }else{ |
| | | return ResultUtil.error("请将信息填写完整"); |
| | | return ResultUtil.error("请将定位信息填写完整"); |
| | | } |
| | | |
| | | QueryWrapper<Customer> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("lng",lng); |
| | | wrapper.eq("lat",lat); |
| | | List<Customer> list = iCustomerService.list(wrapper); |
| | | if(list.size()>0){ |
| | | for(Customer c:list){ |
| | | c.setLikeCusotmerId(customerId); |
| | | iCustomerService.saveOrUpdate(c); |
| | | } |
| | | //customer.setLikeCusotmerId(list.get(0).getId()); |
| | | } |
| | | |
| | | |
| | | if(StrUtil.isNotEmpty(address)){ |
| | | customer.setRegisteredAddress(address); |
| | | }else{ |
| | | return ResultUtil.error("请将信息填写完整"); |
| | | return ResultUtil.error("请将位置信息填写完整"); |
| | | } |
| | | if(StrUtil.isNotEmpty(headImg)){ |
| | | customer.setHeadImg(headImg); |
| | | }else{ |
| | | return ResultUtil.error("请将信息填写完整"); |
| | | return ResultUtil.error("请将门头照信息填写完整"); |
| | | } |
| | | customer.setKstatus(2); |
| | | if (iCustomerService.saveOrUpdate(customer)) { |
| | |
| | | |
| | | import cn.exrick.xboot.core.common.utils.PageUtil; |
| | | import cn.exrick.xboot.core.common.utils.ResultUtil; |
| | | import cn.exrick.xboot.core.common.utils.SecurityUtil; |
| | | import cn.exrick.xboot.core.common.vo.PageVo; |
| | | import cn.exrick.xboot.core.common.vo.Result; |
| | | import cn.exrick.xboot.core.entity.User; |
| | | import cn.exrick.xboot.core.service.UserService; |
| | | import cn.exrick.xboot.your.entity.Customer; |
| | | import cn.exrick.xboot.your.entity.CustomerReceive; |
| | | import cn.exrick.xboot.your.entity.Fingerprint; |
| | | import cn.exrick.xboot.your.service.ICustomerReceiveService; |
| | | import cn.exrick.xboot.your.service.ICustomerService; |
| | | import cn.exrick.xboot.your.service.IFingerprintService; |
| | | 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 com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | @Autowired |
| | | private ICustomerService iCustomerService; |
| | | |
| | | @Autowired |
| | | private IAreaService iAreaService; |
| | | |
| | | @Autowired |
| | | private ICarService iCarService; |
| | | |
| | | @Autowired |
| | | private SecurityUtil securityUtil; |
| | | |
| | | @RequestMapping(value = "/get/{id}", method = RequestMethod.GET) |
| | | @ApiOperation(value = "通过id获取") |
| | | public Result<Fingerprint> get(@PathVariable String id) { |
| | |
| | | |
| | | @RequestMapping(value = "/getAllByAreaId", method = RequestMethod.GET) |
| | | @ApiOperation(value = "获取全部片区内指纹数据") |
| | | public Result<List<Fingerprint>> getAllByAreaId(String areaId) { |
| | | public Result<List<Fingerprint>> getAllByAreaId() { |
| | | Area area = getArea(securityUtil.getCurrUser().getId()); |
| | | if(area==null){ |
| | | return ResultUtil.error("该用户还未绑定片区"); |
| | | } |
| | | QueryWrapper<Fingerprint> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("area_id",areaId); |
| | | wrapper.eq("area_id",area.getId()); |
| | | List<Fingerprint> list = iFingerprintService.list(wrapper); |
| | | return new ResultUtil<List<Fingerprint>>().setData(list); |
| | | } |
| | | |
| | | public Area getArea(String userId){ |
| | | QueryWrapper<Area> wrapper = new QueryWrapper<Area>(); |
| | | wrapper.eq("user_id",userId); |
| | | Area area = iAreaService.getOne(wrapper); |
| | | if(area==null){ |
| | | QueryWrapper<Car> carQueryWrapper = new QueryWrapper<Car>(); |
| | | carQueryWrapper.eq("user_id",userId); |
| | | Car one = iCarService.getOne(carQueryWrapper); |
| | | |
| | | QueryWrapper<Area> wrapper3 = new QueryWrapper<Area>(); |
| | | wrapper3.eq("user_id",one.getFollowUserId()); |
| | | area = iAreaService.getOne(wrapper3); |
| | | return area; |
| | | } |
| | | return area; |
| | | } |
| | | |
| | | @RequestMapping(value = "/getCount", method = RequestMethod.GET) |
| | |
| | | wrapper.eq("code",code); |
| | | wrapper.isNotNull("user_id"); |
| | | Fingerprint one = iFingerprintService.getOne(wrapper); |
| | | User byUsername = userService.findByUsername(one.getUsername()); |
| | | if(byUsername==null){ |
| | | return ResultUtil.error("用户已删除"); |
| | | } |
| | | return new ResultUtil<Object>().setData(one); |
| | | } |
| | | |
| | |
| | | wrapper.eq("customer_id",customerId); |
| | | Fingerprint one = iFingerprintService.getOne(wrapper); |
| | | if(one==null){ |
| | | |
| | | QueryWrapper<Fingerprint> wrapper2 = new QueryWrapper<>(); |
| | | wrapper2.eq("code",code); |
| | | wrapper2.eq("area_id",c.getAreaId()); |
| | | Fingerprint one2 = iFingerprintService.getOne(wrapper2); |
| | | if(one2!=null){ |
| | | c.setLikeCusotmerId(one2.getCustomerId()); |
| | | iCustomerService.saveOrUpdate(c); |
| | | } |
| | | return ResultUtil.error("指纹与商户不匹配"); |
| | | } |
| | | |
| | |
| | | return new ResultUtil<OrderTask>().setData(orderTask); |
| | | } |
| | | |
| | | public Area getArea(String userId){ |
| | | QueryWrapper<Area> wrapper = new QueryWrapper<Area>(); |
| | | wrapper.eq("user_id",userId); |
| | | Area area = iAreaService.getOne(wrapper); |
| | | if(area==null){ |
| | | QueryWrapper<Car> carQueryWrapper = new QueryWrapper<Car>(); |
| | | carQueryWrapper.eq("user_id",userId); |
| | | Car one = iCarService.getOne(carQueryWrapper); |
| | | // public Area getArea(String userId){ |
| | | // QueryWrapper<Area> wrapper = new QueryWrapper<Area>(); |
| | | // wrapper.eq("user_id",userId); |
| | | // Area area = iAreaService.getOne(wrapper); |
| | | // if(area==null){ |
| | | // QueryWrapper<Car> carQueryWrapper = new QueryWrapper<Car>(); |
| | | // carQueryWrapper.eq("user_id",userId); |
| | | // Car one = iCarService.getOne(carQueryWrapper); |
| | | // if(one==null){ |
| | | // return null; |
| | | // } |
| | | // if(StrUtil.isEmpty(one.getFollowUserId())){ |
| | | // return null; |
| | | // } |
| | | // |
| | | // QueryWrapper<Area> wrapper3 = new QueryWrapper<Area>(); |
| | | // wrapper3.eq("user_id",one.getFollowUserId()); |
| | | // area = iAreaService.getOne(wrapper3); |
| | | // return area; |
| | | // } |
| | | // return area; |
| | | // } |
| | | |
| | | QueryWrapper<Area> wrapper3 = new QueryWrapper<Area>(); |
| | | wrapper3.eq("user_id",one.getFollowUserId()); |
| | | area = iAreaService.getOne(wrapper3); |
| | | |
| | | private String getFormatDate(String sendTime){ |
| | | if(StrUtil.isNotEmpty(sendTime)){ |
| | | return sendTime; |
| | | }else{ |
| | | return DateUtil.format(new Date(), "yyyy-MM-dd"); |
| | | } |
| | | } |
| | | |
| | | public Area getArea(String userId){ |
| | | QueryWrapper<Car> carQueryWrapper = new QueryWrapper<Car>(); |
| | | carQueryWrapper.eq("user_id",userId).or().eq("follow_user_id",userId); |
| | | Car one = iCarService.getOne(carQueryWrapper); |
| | | if(one==null){ |
| | | return null; |
| | | }else{ |
| | | QueryWrapper<Area> wrapper = new QueryWrapper<Area>(); |
| | | wrapper.eq("car_id",one.getId()); |
| | | Area area = iAreaService.getOne(wrapper); |
| | | return area; |
| | | } |
| | | return area; |
| | | } |
| | | |
| | | @RequestMapping(value = "/getByUserId", method = RequestMethod.GET) |
| | | @ApiOperation(value = "获取今日任务统计信息") |
| | | public Result<Object> getAll() { |
| | | public Result<Object> getAll(String sendTime) { |
| | | Area area = getArea(securityUtil.getCurrUser().getId()); |
| | | if(area==null){ |
| | | return ResultUtil.error("请联系管理员绑定片区配送员"); |
| | | return ResultUtil.error("请联系管理员绑定该车辆"); |
| | | } |
| | | |
| | | QueryWrapper<OrderTask> wrapper2 = new QueryWrapper<OrderTask>(); |
| | | String format = DateUtil.format(new Date(), "yyyy-MM-dd"); |
| | | String format = getFormatDate(sendTime); |
| | | wrapper2.eq("area_id",area.getId()); |
| | | wrapper2.eq("send_date",format); |
| | | List<OrderTask> list = iOrderTaskService.list(wrapper2); |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/getTodayOrder", method = RequestMethod.GET) |
| | | @ApiOperation(value = "获取今日任务详情") |
| | | public Result<List<OrderTask>> getTodayOrder() { |
| | | @ApiOperation(value = "获取今日配送任务详情列表") |
| | | public Result<List<OrderTask>> getTodayOrder(String sendTime) { |
| | | Area area = getArea(securityUtil.getCurrUser().getId()); |
| | | if(area==null){ |
| | | return ResultUtil.error("请联系管理员绑定片区配送员"); |
| | | return ResultUtil.error("请联系管理员绑定该车辆"); |
| | | } |
| | | |
| | | QueryWrapper<OrderTask> wrapper2 = new QueryWrapper<OrderTask>(); |
| | | String format = DateUtil.format(new Date(), "yyyy-MM-dd"); |
| | | String format = getFormatDate(sendTime); |
| | | wrapper2.eq("a.area_id",area.getId()); |
| | | wrapper2.eq("a.send_date",format); |
| | | wrapper2.orderByAsc("a.seq"); |
| | | wrapper2.orderByAsc("a.seq").orderByAsc("a.status"); |
| | | List<OrderTask> list = iOrderTaskService.list2(wrapper2); |
| | | return new ResultUtil<List<OrderTask>>().setData(list); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getTodayOrderDetail", method = RequestMethod.GET) |
| | | @ApiOperation(value = "获取当前配送商户详情") |
| | | public Result<OrderTask> getTodayOrderDetail(String orderId) { |
| | | public Result<OrderTask> getTodayOrderDetail(String orderId,String sendTime) { |
| | | OrderTask orderTask = new OrderTask(); |
| | | if(!StrUtil.isEmpty(orderId)){ |
| | | orderTask = iOrderTaskService.getById(orderId); |
| | |
| | | }else{ |
| | | Area area = getArea(securityUtil.getCurrUser().getId()); |
| | | if(area==null){ |
| | | return ResultUtil.error("请联系管理员绑定片区配送员"); |
| | | return ResultUtil.error("请联系管理员绑定该车辆"); |
| | | } |
| | | |
| | | QueryWrapper<OrderTask> wrapper2 = new QueryWrapper<OrderTask>(); |
| | | String format = DateUtil.format(new Date(), "yyyy-MM-dd"); |
| | | String format = getFormatDate(sendTime); |
| | | wrapper2.eq("area_id",area.getId()); |
| | | wrapper2.eq("send_date",format); |
| | | wrapper2.eq("status",0); |
| | |
| | | |
| | | @RequestMapping(value = "/getTodayOtherInfo", method = RequestMethod.GET) |
| | | @ApiOperation(value = "获取其它信息") |
| | | public Result<Object> getTodayOtherInfo() { |
| | | public Result<Object> getTodayOtherInfo(String sendTime) { |
| | | |
| | | Area area = getArea(securityUtil.getCurrUser().getId()); |
| | | if(area==null){ |
| | | return ResultUtil.error("请联系管理员绑定片区配送员"); |
| | | return ResultUtil.error("请联系管理员绑定该车辆"); |
| | | } |
| | | |
| | | QueryWrapper<OrderTask> wrapper2 = new QueryWrapper<OrderTask>(); |
| | | String format = DateUtil.format(new Date(), "yyyy-MM-dd"); |
| | | String format = getFormatDate(sendTime); |
| | | wrapper2.eq("area_id",area.getId()); |
| | | wrapper2.eq("send_date",format); |
| | | wrapper2.ne("status",0); |
| | |
| | | return ResultUtil.success("添加成功"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getTaKan", method = RequestMethod.GET) |
| | | @ApiOperation(value = "获取踏勘商户") |
| | | public Result<List<Customer>> getTaKan() { |
| | | Area area = getArea(securityUtil.getCurrUser().getId()); |
| | | if(area==null){ |
| | | return ResultUtil.error("请联系管理员绑定该车辆"); |
| | | } |
| | | |
| | | QueryWrapper<Customer> wrapper2 = new QueryWrapper<Customer>(); |
| | | wrapper2.eq("area_id",area.getId()); |
| | | wrapper2.eq("kstatus",0); |
| | | List<Customer> list = iCustomerService.list(wrapper2); |
| | | return new ResultUtil<List<Customer>>().setData(list); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getByPage", method = RequestMethod.GET) |
| | | @ApiOperation(value = "分页获取") |
| | | public Result<IPage<OrderTask>> getByPage(PageVo page) { |
| | |
| | | import cn.exrick.xboot.file.service.FileService; |
| | | import cn.exrick.xboot.your.entity.Alarm; |
| | | import cn.exrick.xboot.your.entity.Car; |
| | | import cn.exrick.xboot.your.entity.EventLog; |
| | | import cn.exrick.xboot.your.service.IAlarmService; |
| | | import cn.exrick.xboot.your.service.ICarService; |
| | | import cn.exrick.xboot.your.service.IEventLogService; |
| | | import cn.exrick.xboot.your.util.FaceSystem; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.json.JSONArray; |
| | |
| | | private IAlarmService iAlarmService; |
| | | @Autowired |
| | | private RedisTemplateHelper redisTemplate; |
| | | @Autowired |
| | | private IEventLogService iEventLogService; |
| | | |
| | | |
| | | @RequestMapping(value = "/faceImg", method = RequestMethod.POST) |
| | |
| | | QueryWrapper<Car> wrapper = new QueryWrapper<Car>(); |
| | | wrapper.eq("car_no",deviceName.substring(0,deviceName.length()-1)); |
| | | Car one = iCarService.getOne(wrapper); |
| | | if(one==null){ |
| | | return; |
| | | } |
| | | |
| | | User user = userService.get(one.getUserId()); |
| | | User user1 = userService.get(one.getFollowUserId()); |
| | |
| | | String avatar2 = os.getHttp() + os.getEndpoint() + "/" + f.getId(); |
| | | if(user!=null){ |
| | | String avatar = user.getAvatar(); |
| | | int result1 = FaceSystem.getResult(avatar, avatar2); |
| | | if(result1<70){ |
| | | flag++; |
| | | }else{ |
| | | deleteFile(f.getId()); |
| | | if(StrUtil.isNotEmpty(avatar)){ |
| | | int result1 = FaceSystem.getResult(avatar, avatar2); |
| | | if(result1<60){ |
| | | flag++; |
| | | }else{ |
| | | deleteFile(f.getId());//是一个人删除图片 flag=0 |
| | | //如果抓拍图片跟司机照片对比是一个人,则下面的都不执行了。 |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(user1!=null){ |
| | | //如果抓拍图片跟司机照片对比不是一个人,则再对比下配送员。 |
| | | if(user1!=null&&flag>0){ |
| | | String avatar = user1.getAvatar(); |
| | | int result1 = FaceSystem.getResult(avatar, avatar2); |
| | | if(result1<70){ |
| | | flag++; |
| | | }else{ |
| | | deleteFile(f.getId()); |
| | | if(StrUtil.isNotEmpty(avatar)){ |
| | | int result1 = FaceSystem.getResult(avatar, avatar2); |
| | | if(result1<60){ |
| | | flag++; |
| | | }else{ |
| | | deleteFile(f.getId()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(flag>0){ |
| | | if(flag>1){ |
| | | Alarm alarm = new Alarm(); |
| | | alarm.setCarNo(one.getCarNo()); |
| | | alarm.setCarId(one.getId()); |
| | |
| | | alarm.setValue("车厢异常开启"); |
| | | alarm.setAlarmImg(avatar2); |
| | | iAlarmService.saveOrUpdate(alarm); |
| | | |
| | | EventLog eventLog = new EventLog(); |
| | | eventLog.setCarNo(one.getCarNo()); |
| | | eventLog.setType(5); |
| | | eventLog.setRefId(avatar2); |
| | | iEventLogService.saveOrUpdate(eventLog); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | |
| | | @Autowired |
| | | private IAlarmService iAlarmService; |
| | | |
| | | @Autowired |
| | | private ICustomerService iCustomerService; |
| | | |
| | | @RequestMapping(value = "/getIndex1", method = RequestMethod.GET) |
| | | @ApiOperation(value = "获取首页数据") |
| | | public Result<Object> getIndex1() { |
| | |
| | | for (String str : scan) { |
| | | map.put(str.substring(12),redisTemplateHelper.get(str)); |
| | | } |
| | | QueryWrapper<Customer> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("kstatus",0); |
| | | map.put("taKan",iCustomerService.count(wrapper)); |
| | | return new ResultUtil<Object>().setData(map); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getTaKanList", method = RequestMethod.GET) |
| | | @ApiOperation(value = "获取踏勘商户列表") |
| | | public Result<Object> getTaKanList() { |
| | | QueryWrapper<Customer> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("kstatus",0); |
| | | return new ResultUtil<Object>().setData(iCustomerService.list(wrapper)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getTodayTask", method = RequestMethod.GET) |
| | |
| | | QueryWrapper<OrderTask> wrapper2 = new QueryWrapper<OrderTask>(); |
| | | String format = DateUtil.format(new Date(), "yyyy-MM-dd"); |
| | | wrapper2.eq("a.send_date",format); |
| | | // wrapper2.orderByAsc("a.seq"); |
| | | //wrapper2.orderByAsc("a.seq"); |
| | | List<OrderTask> list = iOrderTaskService.list3(format); |
| | | return new ResultUtil<Object>().setData(list); |
| | | } |
| | |
| | | public double trans2(double v2){ |
| | | return (double) Math.round(v2 * 100) / 100; |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/getYiHuDuoZheng", method = RequestMethod.GET) |
| | | @ApiOperation(value = "获取配送分析详情") |
| | | public Result<Object> getYiHuDuoZheng() { |
| | | |
| | | List<Customer> list = iCustomerService.getYiHuDuoZheng(); |
| | | Map<String,Object> map = new HashMap<>(); |
| | | map.put("name","一户多证"); |
| | | List<Object> childrens = new ArrayList<>(); |
| | | for(Customer c:list){ |
| | | Map<String,Object> map2 = new HashMap<>(); |
| | | map2.put("name",c.getName()); |
| | | |
| | | List<Object> names = new ArrayList<>(); |
| | | Map<String,Object> map3 = new HashMap<>(); |
| | | map3.put("name",c.getCode()); |
| | | names.add(map3); |
| | | |
| | | map2.put("children",names); |
| | | |
| | | childrens.add(map2); |
| | | } |
| | | map.put("children",childrens); |
| | | |
| | | return new ResultUtil<Object>().setData(map); |
| | | } |
| | | } |
| | |
| | | //openId:微信id |
| | | @RequestMapping(value = "/bindWx", method = RequestMethod.POST) |
| | | @ApiOperation(value = "微信绑定零售许可证") |
| | | public Object bindWx(String licence,String openId){ |
| | | public Object bindWx(String licence,String openId,String linker,String phone){ |
| | | QueryWrapper<Customer> wrapper2 = new QueryWrapper<>(); |
| | | wrapper2.eq("open_id",openId); |
| | | Customer c = iCustomerService.getOne(wrapper2); |
| | |
| | | |
| | | QueryWrapper<Customer> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("licence",licence); |
| | | if(StrUtil.isNotEmpty(linker)){ |
| | | wrapper.eq("linker",linker); |
| | | } |
| | | if(StrUtil.isNotEmpty(phone)){ |
| | | wrapper.eq("phone",phone); |
| | | } |
| | | Customer one = iCustomerService.getOne(wrapper); |
| | | if(one==null){ |
| | | return ResultUtil.error("零售许可证无效");//首次登陆需绑定零售许可证 |
| | |
| | | } |
| | | String carId = orderTask.getCarId(); |
| | | Car car = iCarService.getById(carId); |
| | | String[] carids = new String[1]; |
| | | carids[0]= car.getCode(); |
| | | String latestGps = haiKangPost.findLatestGps(carids); |
| | | JSONObject jsonObject = JSONUtil.parseObj(latestGps); |
| | | String data = jsonObject.getStr("data"); |
| | | JSONArray objects = JSONUtil.parseArray(data); |
| | | JSONObject jsonObject2 = objects.getJSONObject(0); |
| | | Integer lng = jsonObject2.getInt("longitude"); |
| | | Integer lat = jsonObject2.getInt("latitude"); |
| | | |
| | | DecimalFormat df = new DecimalFormat("#.000000"); |
| | | Map<String,Object> map = new HashMap<>(); |
| | | map.put("lng",df.format(lng/360000.0)); |
| | | map.put("lat",df.format(lat/360000.0)); |
| | | map.put("content","还有3单,预计1小时后送达"); |
| | | map.put("lng",118.167491); |
| | | map.put("lat",39.651253); |
| | | map.put("content","暂无车辆数据"); |
| | | if(StrUtil.isEmpty(car.getCode())){ |
| | | return ResultUtil.data(map); |
| | | } |
| | | try { |
| | | String[] carids = new String[1]; |
| | | carids[0]= car.getCode(); |
| | | String latestGps = haiKangPost.findLatestGps(carids); |
| | | JSONObject jsonObject = JSONUtil.parseObj(latestGps); |
| | | String data = jsonObject.getStr("data"); |
| | | JSONArray objects = JSONUtil.parseArray(data); |
| | | JSONObject jsonObject2 = objects.getJSONObject(0); |
| | | Integer lng = jsonObject2.getInt("longitude"); |
| | | Integer lat = jsonObject2.getInt("latitude"); |
| | | |
| | | DecimalFormat df = new DecimalFormat("#.000000"); |
| | | map.put("lng",df.format(lng/360000.0)); |
| | | map.put("lat",df.format(lat/360000.0)); |
| | | }catch (Exception e){ |
| | | |
| | | } |
| | | QueryWrapper<OrderTask> wrapper = new QueryWrapper<OrderTask>(); |
| | | wrapper.eq("area_id",orderTask.getAreaId()); |
| | | wrapper.eq("send_date",format); |
| | | wrapper.eq("status",0); |
| | | wrapper.orderByAsc("seq"); |
| | | List<OrderTask> list = iOrderTaskService.list(wrapper); |
| | | |
| | | if(list.size()>0){ |
| | | if(list.get(0).getSeq()<orderTask.getSeq()){ |
| | | int i = orderTask.getSeq() - list.get(0).getSeq(); |
| | | map.put("content","还有"+i+"单,预计"+(i*5)+"分钟后送达"); |
| | | } |
| | | if(list.get(0).getSeq()==orderTask.getSeq()){ |
| | | int i = orderTask.getSeq() - list.get(0).getSeq(); |
| | | map.put("content","预计5分钟内送达"); |
| | | } |
| | | } |
| | | return ResultUtil.data(map); |
| | | } |
| | | |
| | |
| | | //3:不系安全带 |
| | | //4:抽烟 |
| | | //5:车厢异常开启 |
| | | //6:超速 |
| | | @ApiModelProperty(value = "具体类型如下") |
| | | private int type; |
| | | |
| | |
| | | @ApiModelProperty(value = "配送人id") |
| | | private String userId; |
| | | |
| | | @ApiModelProperty(value = "车辆id") |
| | | private String carId; |
| | | |
| | | @ApiModelProperty(value = "商户总数") |
| | | private int customerSum; |
| | | |
| | |
| | | @Transient |
| | | @TableField(exist = false) |
| | | private String nickName; |
| | | |
| | | @Transient |
| | | @TableField(exist = false) |
| | | private String carNo; |
| | | } |
New file |
| | |
| | | package cn.exrick.xboot.your.entity; |
| | | |
| | | import cn.exrick.xboot.core.base.XbootBaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.hibernate.annotations.DynamicInsert; |
| | | import org.hibernate.annotations.DynamicUpdate; |
| | | |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.Table; |
| | | import javax.persistence.Transient; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Exrick |
| | | */ |
| | | @Data |
| | | @Entity |
| | | @DynamicInsert |
| | | @DynamicUpdate |
| | | @Table(name = "t_area_map") |
| | | @TableName("t_area_map") |
| | | @ApiModel(value = "片区坐标") |
| | | public class AreaMap extends XbootBaseEntity { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "片区id") |
| | | private String areaId; |
| | | |
| | | @ApiModelProperty(value = "lng") |
| | | private String lng; |
| | | |
| | | @ApiModelProperty(value = "lat") |
| | | private String lat; |
| | | |
| | | @ApiModelProperty(value = "顺序") |
| | | private int seq; |
| | | } |
| | |
| | | @ApiModelProperty(value = "0:正常 1:不活跃(默认=0)") |
| | | private int status; |
| | | |
| | | @ApiModelProperty(value = "1:需要勘验,2:已勘验") |
| | | @ApiModelProperty(value = "0:勘验任务 1:需要更新信息,2:已更新") |
| | | private Integer kstatus; |
| | | |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") |
| | |
| | | @ApiModelProperty(value = "登陆次数") |
| | | private int loginNum; |
| | | |
| | | @ApiModelProperty(value = "相似商户,一户多证嫌疑") |
| | | private String likeCusotmerId; |
| | | |
| | | @Transient |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "接货人列表") |
New file |
| | |
| | | package cn.exrick.xboot.your.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import cn.exrick.xboot.your.entity.AreaMap; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 区域坐标数据处理层 |
| | | * @author whj |
| | | */ |
| | | public interface AreaMapMapper extends BaseMapper<AreaMap> { |
| | | |
| | | } |
| | |
| | | */ |
| | | public interface AreaMapper extends BaseMapper<Area> { |
| | | |
| | | @Select("SELECT a.*,b.nickname as temp FROM t_area a LEFT JOIN t_user b ON a.user_id=b.id ${ew.customSqlSegment} ") |
| | | @Results({@Result(column="temp", property="nickName", jdbcType = JdbcType.VARCHAR)}) |
| | | @Select("SELECT a.*,b.car_no as temp FROM t_area a LEFT JOIN t_car b ON a.car_id=b.id ${ew.customSqlSegment} ") |
| | | @Results({@Result(column="temp", property="carNo", jdbcType = JdbcType.VARCHAR)}) |
| | | IPage<Area> page2(Page initMpPage, @Param(Constants.WRAPPER) QueryWrapper<Area> wrapper); |
| | | |
| | | @Select("SELECT * FROM t_area") |
| | | @Select("SELECT * FROM t_area order by name asc") |
| | | @Results({@Result(column="id", property="children", many = @Many(select = "cn.exrick.xboot.your.mapper.AreaSectionMapper.getListByParentId"))}) |
| | | List<Area> list2(); |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import cn.exrick.xboot.your.entity.Customer; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Result; |
| | | import org.apache.ibatis.annotations.Results; |
| | | import org.apache.ibatis.annotations.Select; |
| | | import org.apache.ibatis.type.JdbcType; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 商户表数据处理层 |
| | |
| | | |
| | | @Select("select sum(login_num) from t_customer") |
| | | int sumLogin(); |
| | | |
| | | @Select("SELECT a.*,b.name as temp FROM t_customer a,t_customer b where a.like_cusotmer_id=b.id") |
| | | @Results({@Result(column="temp", property="code", jdbcType = JdbcType.VARCHAR)}) |
| | | List<Customer> getYiHuDuoZheng(); |
| | | } |
| | |
| | | @Select("SELECT sum(num) FROM t_order_task where area_id=#{arg0} and DATE_FORMAT(send_date,'%Y-%m-%d')=#{arg1}") |
| | | Integer sum(String areaId, String format); |
| | | |
| | | @Select("SELECT a.*,b.name as temp FROM t_order_task a LEFT JOIN t_customer b ON a.customer_id=b.id ${ew.customSqlSegment} ") |
| | | @Results({@Result(column="temp", property="customerName", jdbcType = JdbcType.VARCHAR)}) |
| | | @Select("SELECT a.*,b.name as temp,b.linker as temp2 FROM t_order_task a LEFT JOIN t_customer b ON a.customer_id=b.id ${ew.customSqlSegment} ") |
| | | @Results({@Result(column="temp", property="customerName", jdbcType = JdbcType.VARCHAR), |
| | | @Result(column="temp2", property="code", jdbcType = JdbcType.VARCHAR)}) |
| | | List<OrderTask> list2(@Param(Constants.WRAPPER) QueryWrapper<OrderTask> wrapper2); |
| | | |
| | | @Select("SELECT sum(num) FROM t_order_task") |
| | |
| | | @Select("SELECT count(id) FROM t_order_task where likes=1") |
| | | int countLike(); |
| | | |
| | | @Select("select b.car_no as carNo1,c.name as name1,d.name as name2,count(a.area_section_id) as num1,sum(case when a.status=0 then 1 else 0 end) as num2 ,sum(case when a.status=1 then 1 else 0 end) as num3 from t_order_task a LEFT JOIN t_car b on a.car_id=b.id LEFT JOIN t_area c on a.area_id=c.id LEFT JOIN t_area_ection d on a.area_section_id=d.id where DATE_FORMAT(a.send_date,'%Y-%m-%d')=#{date} GROUP BY a.area_section_id,b.car_no,c.name,d.name") |
| | | @Select("select b.car_no as carNo1,c.name as name1,d.name as name2,count(a.area_section_id) as num1,sum(case when a.status=0 then 1 else 0 end) as num2 ,sum(case when a.status=1 then 1 else 0 end) as num3 from t_order_task a LEFT JOIN t_car b on a.car_id=b.id LEFT JOIN t_area c on a.area_id=c.id LEFT JOIN t_area_ection d on a.area_section_id=d.id where DATE_FORMAT(a.send_date,'%Y-%m-%d')=#{date} GROUP BY a.area_section_id,b.car_no,c.name,d.name order by c.name asc") |
| | | @Results({@Result(column="carNo1", property="carNo", jdbcType = JdbcType.VARCHAR), |
| | | @Result(column="name1", property="areaName", jdbcType = JdbcType.VARCHAR), |
| | | @Result(column="name2", property="areaSectionName", jdbcType = JdbcType.VARCHAR), |
| | |
| | | private ICustomerService iCustomerService; |
| | | |
| | | @Autowired |
| | | private ICarService iCarService; |
| | | |
| | | @Autowired |
| | | private ICustomerReceiveService iCustomerReceiveService; |
| | | |
| | | @Scheduled(cron="0 30 23 * * ?")//每晚凌晨1点执行 |
| | |
| | | for(OrderTaskOriginal original:list){ |
| | | OrderTask orderTask = new OrderTask(); |
| | | orderTask.setCode(original.getCode()); |
| | | orderTask.setAreaId(getArea(original.getAreaName())); |
| | | Area area = getArea(original.getAreaName()); |
| | | orderTask.setAreaId(area.getId()); |
| | | orderTask.setCarId(area.getCarId()); |
| | | orderTask.setAreaSectionId(getAreaSection(orderTask.getAreaId(),original.getAreaSection())); |
| | | orderTask.setCustomerId(getCustomer(original.getCustomerCode(),original.getCustomerName(),original.getCustomerPhone(),original.getLinker(),orderTask.getAreaId(),orderTask.getAreaSectionId())); |
| | | orderTask.setEndDate(original.getPacketDate()); |
| | |
| | | } |
| | | |
| | | orderTask.setNum(original.getNum()); |
| | | orderTask.setCarId(getCarId(orderTask.getAreaId())); |
| | | |
| | | iOrderTaskService.saveOrUpdate(orderTask); |
| | | |
| | | updateCustomerRecive(orderTask.getCustomerId(),original.getLinker(),original.getCustomerPhone()); |
| | |
| | | return one.getId(); |
| | | } |
| | | |
| | | public String getArea(String name){ |
| | | public Area getArea(String name){ |
| | | QueryWrapper<Area> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("name",name); |
| | | Area one = iAreaService.getOne(queryWrapper); |
| | |
| | | Area area = new Area(); |
| | | area.setName(name); |
| | | iAreaService.saveOrUpdate(area); |
| | | return area.getId(); |
| | | return area; |
| | | } |
| | | return one.getId(); |
| | | return one; |
| | | } |
| | | |
| | | public String getAreaSection(String areaId,String name){ |
| | |
| | | } |
| | | |
| | | public String getCarId(String areaId){ |
| | | // Area area = iAreaService.getById(areaId); |
| | | Area area = iAreaService.getById(areaId); |
| | | return area.getCarId(); |
| | | // String userId = area.getUserId(); |
| | | // if(StrUtil.isNotEmpty(userId)){ |
| | | // QueryWrapper<Car> queryWrapper = new QueryWrapper<>(); |
| | |
| | | // }else{ |
| | | // return null; |
| | | // } |
| | | return iAreaService.getCarId(areaId); |
| | | //return iAreaService.getCarId(areaId); |
| | | } |
| | | |
| | | public String dateStringFormat(Date strDate) { |
| | |
| | | @Autowired |
| | | private IEquipmentService iEquipmentService; |
| | | |
| | | @Autowired |
| | | private IEventLogService eventLogService; |
| | | |
| | | public static final String HEAD = "statistic1::"; |
| | | |
| | | @Scheduled(cron="0 15 * * * ?")//每小时15分钟时执行 |
| | |
| | | |
| | | |
| | | redisTemplate.set(HEAD+"outCar",iEquipmentService.countByTypeAndStatus(0)+"");//出发车辆 |
| | | redisTemplate.set(HEAD+"open","0");//危险开启 |
| | | QueryWrapper<EventLog> wrapper2=new QueryWrapper<>(); |
| | | wrapper2.eq("type",5); |
| | | redisTemplate.set(HEAD+"open",eventLogService.count(wrapper2)+"");//危险开启 |
| | | |
| | | QueryWrapper<Customer> wrapper = new QueryWrapper<>(); |
| | | String format = DateUtil.format(new Date(), "yyyy-MM-dd"); |
| | |
| | | @Autowired |
| | | private IAlarmService iAlarmService; |
| | | |
| | | @Autowired |
| | | private ICarService iCarService; |
| | | |
| | | @Scheduled(cron="0 0 1 * * ?")//每晚凌晨1点执行 |
| | | public void execute(){ |
| | | List<User> all = userService.findAll(); |
| | |
| | | int count2 = iOrderTaskService.count(wrapper22); |
| | | one.setSends2(count2);//送达次数 |
| | | |
| | | QueryWrapper<Area> wrapper3 = new QueryWrapper<>(); |
| | | wrapper3.eq("user_id",user.getId()); |
| | | Area area = iAreaService.getOne(wrapper3); |
| | | // QueryWrapper<Area> wrapper3 = new QueryWrapper<>(); |
| | | // wrapper3.eq("user_id",user.getId()); |
| | | // Area area = iAreaService.getOne(wrapper3); |
| | | Area area = getArea(user.getId()); |
| | | if(area!=null){ |
| | | QueryWrapper<Customer> wrapper4 = new QueryWrapper<>(); |
| | | wrapper4.eq("area_id",area.getId()); |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | public Area getArea(String userId){ |
| | | QueryWrapper<Car> carQueryWrapper = new QueryWrapper<Car>(); |
| | | carQueryWrapper.eq("follow_user_id",userId); |
| | | Car one = iCarService.getOne(carQueryWrapper); |
| | | if(one==null){ |
| | | return null; |
| | | }else{ |
| | | QueryWrapper<Area> wrapper = new QueryWrapper<Area>(); |
| | | wrapper.eq("car_id",one.getId()); |
| | | Area area = iAreaService.getOne(wrapper); |
| | | return area; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package cn.exrick.xboot.your.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import cn.exrick.xboot.your.entity.AreaMap; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 区域坐标接口 |
| | | * @author whj |
| | | */ |
| | | public interface IAreaMapService extends IService<AreaMap> { |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import cn.exrick.xboot.your.entity.Customer; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 商户表接口 |
| | | * @author zhangzeli |
| | |
| | | Month getCustomerCount(Integer year); |
| | | |
| | | int sumLogin(); |
| | | |
| | | List<Customer> getYiHuDuoZheng(); |
| | | } |
New file |
| | |
| | | package cn.exrick.xboot.your.serviceimpl; |
| | | |
| | | import cn.exrick.xboot.your.mapper.AreaMapMapper; |
| | | import cn.exrick.xboot.your.entity.AreaMap; |
| | | import cn.exrick.xboot.your.service.IAreaMapService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 区域坐标接口实现 |
| | | * @author whj |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | @Transactional |
| | | public class IAreaMapServiceImpl extends ServiceImpl<AreaMapMapper, AreaMap> implements IAreaMapService { |
| | | |
| | | @Autowired |
| | | private AreaMapMapper areaMapMapper; |
| | | } |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 商户表接口实现 |
| | | * @author zhangzeli |
| | |
| | | public int sumLogin() { |
| | | return customerMapper.sumLogin(); |
| | | } |
| | | |
| | | @Override |
| | | public List<Customer> getYiHuDuoZheng() { |
| | | return customerMapper.getYiHuDuoZheng(); |
| | | } |
| | | } |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.awt.*; |
| | | |
| | | @Component |
| | | public class MQTT { |
| | |
| | | }else if(eventType.equals("132375")){ |
| | | alarm.setType(4); |
| | | alarm.setValue("抽烟"); |
| | | }else if(eventType.equals("132405")){ |
| | | alarm.setType(6); |
| | | alarm.setValue("超速"); |
| | | }else{ |
| | | return; |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cn.exrick.xboot.your.mapper.AreaMapMapper"> |
| | | |
| | | </mapper> |