From ae32c3a7d77e2ed114555623c70e3fbd1d6aba59 Mon Sep 17 00:00:00 2001 From: wang-hao-jie <1550036656@qq.com> Date: 星期四, 10 三月 2022 08:47:45 +0800 Subject: [PATCH] 违章记录 --- xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/StatisticController.java | 43 +++ xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/OrderTaskMapper.java | 7 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Customer.java | 5 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/MQTT.java | 4 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Area.java | 7 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Alarm.java | 1 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/StatisticScheduleImpl.java | 24 + xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/FingerprintController.java | 56 +++ xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CustomerController.java | 38 ++ xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IAreaMapServiceImpl.java | 26 ++ xboot-modules/xboot-generator/src/main/java/cn/exrick/xboot/generator/XbootMPGenerator.java | 6 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/CustomerMapper.java | 9 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AreaMapController.java | 97 +++++++ xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/ICustomerServiceImpl.java | 7 xboot-modules/xboot-your/src/main/resources/mapper/AreaMapMapper.xml | 5 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/AreaMapper.java | 6 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/OrderSynScheduleImpl.java | 20 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CarController.java | 59 ++++ xboot-admin/src/main/resources/application.yml | 31 + xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/AreaMap.java | 42 +++ xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/wx/IndexController.java | 62 +++- xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/face/FaceImgController.java | 43 ++ xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/ICustomerService.java | 4 xboot-modules/xboot-base/src/main/java/cn/exrick/xboot/base/controller/manage/UserController.java | 4 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/OrderTaskController.java | 96 +++++-- xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AreaController.java | 6 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/AreaMapMapper.java | 14 + xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/StatisticPcScheduleImpl.java | 7 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IAreaMapService.java | 14 + 29 files changed, 632 insertions(+), 111 deletions(-) diff --git a/xboot-admin/src/main/resources/application.yml b/xboot-admin/src/main/resources/application.yml index 7b0ffcc..1080fec 100644 --- a/xboot-admin/src/main/resources/application.yml +++ b/xboot-admin/src/main/resources/application.yml @@ -26,8 +26,8 @@ url: jdbc:mysql://127.0.0.1:3306/tobacco?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8 username: root # Jasypt鍔犲瘑 鍙埌common-utils涓壘鍒癑asyptUtil鍔犺В瀵嗗伐鍏风被鐢熸垚鍔犲瘑缁撴灉 鏍煎紡涓篍NC(鍔犲瘑缁撴灉) 浠ヤ笅瑙e瘑缁撴灉涓�123456 - password: wanghaojie - #password: 123456 + #password: wanghaojie + password: 123456 type: com.alibaba.druid.pool.DruidDataSource driverClassName: com.mysql.jdbc.Driver # Druid StatViewServlet閰嶇疆 @@ -132,6 +132,7 @@ service-base-url: http://127.0.0.1:${server.port}/ web: resources: + static-locations: classpath:/static cache: cachecontrol: # 闈欐�佽祫婧愮紦瀛�30澶� @@ -143,11 +144,13 @@ # 鏆傛湭浣跨敤ES 鎺掗櫎client鑷姩瑁呴厤绫� - org.springframework.boot.autoconfigure.data.elasticsearch.ReactiveElasticsearchRestClientAutoConfiguration + mvc: + static-path-pattern: //** xboot: # 鍏ㄥ眬闄愭祦 ratelimit: # 寮�鍚� - enable: true + enable: false # 姣�1绉掑唴锛堝崟浣嶆绉掞級 timeout: 1000 # 鎬婚檺鍒�200涓姹傦紙鍗曚綅涓級 @@ -155,7 +158,7 @@ # IP闄愭祦 iplimit: # 寮�鍚� - enable: true + enable: false # 姣�1绉掑唴锛堝崟浣嶆绉掞級 timeout: 1000 # 姣忎釜ip闄愬埗20涓姹傦紙鍗曚綅涓級 @@ -293,6 +296,14 @@ - /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 @@ -329,14 +340,14 @@ 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: diff --git a/xboot-modules/xboot-base/src/main/java/cn/exrick/xboot/base/controller/manage/UserController.java b/xboot-modules/xboot-base/src/main/java/cn/exrick/xboot/base/controller/manage/UserController.java index 237ca33..e177184 100644 --- a/xboot-modules/xboot-base/src/main/java/cn/exrick/xboot/base/controller/manage/UserController.java +++ b/xboot-modules/xboot-base/src/main/java/cn/exrick/xboot/base/controller/manage/UserController.java @@ -231,8 +231,8 @@ 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())) { diff --git a/xboot-modules/xboot-generator/src/main/java/cn/exrick/xboot/generator/XbootMPGenerator.java b/xboot-modules/xboot-generator/src/main/java/cn/exrick/xboot/generator/XbootMPGenerator.java index 4646b23..0eb8dcc 100644 --- a/xboot-modules/xboot-generator/src/main/java/cn/exrick/xboot/generator/XbootMPGenerator.java +++ b/xboot-modules/xboot-generator/src/main/java/cn/exrick/xboot/generator/XbootMPGenerator.java @@ -33,19 +33,19 @@ * 瀹炰綋绫诲悕 * 寤鸿浠呴渶淇敼 */ - 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"; /** * 鏄惁鐢熸垚鏍戝舰缁撴瀯鐩稿叧鎺ュ彛 diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AreaController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AreaController.java index 7268357..8cba742 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AreaController.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AreaController.java @@ -62,11 +62,11 @@ @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("璇ラ厤閫佸憳宸茶鍏朵粬鐗囧尯缁戝畾,璇峰厛瑙g粦"); + return new ResultUtil<Area>().setErrorMsg("璇ヨ溅杈嗗凡琚叾瀹冪墖鍖虹粦瀹�,璇峰厛瑙g粦"); } } diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AreaMapController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AreaMapController.java new file mode 100644 index 0000000..1d6ce28 --- /dev/null +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AreaMapController.java @@ -0,0 +1,97 @@ +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鍒犻櫎鏁版嵁鎴愬姛"); + } +} diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CarController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CarController.java index c6a087a..df00ea4 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CarController.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CarController.java @@ -2,8 +2,10 @@ 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; @@ -42,7 +44,7 @@ @Autowired private IDrivingRecordService iDrivingRecordService; @Autowired - private ICustomerService iCustomerService; + private SecurityUtil securityUtil; @RequestMapping(value = "/get/{id}", method = RequestMethod.GET) @@ -59,6 +61,16 @@ 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) @@ -181,10 +193,47 @@ @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("缁戝畾鎴愬姛"); } diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CustomerController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CustomerController.java index 445dcd3..e2a6718 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CustomerController.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CustomerController.java @@ -72,6 +72,22 @@ 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("鎿嶄綔澶辫触"); @@ -84,22 +100,36 @@ 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)) { diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/FingerprintController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/FingerprintController.java index 0bbfb16..d8b960e 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/FingerprintController.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/FingerprintController.java @@ -2,16 +2,13 @@ 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; @@ -45,6 +42,15 @@ @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) { @@ -64,11 +70,32 @@ @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) @@ -95,6 +122,10 @@ 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); } @@ -108,6 +139,15 @@ 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("鎸囩汗涓庡晢鎴蜂笉鍖归厤"); } diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/OrderTaskController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/OrderTaskController.java index 5ed99cf..47dd585 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/OrderTaskController.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/OrderTaskController.java @@ -75,33 +75,62 @@ 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); @@ -124,25 +153,25 @@ } @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); @@ -152,11 +181,11 @@ }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); @@ -179,15 +208,15 @@ @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); @@ -289,6 +318,21 @@ 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) { diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/face/FaceImgController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/face/FaceImgController.java index 9809a1d..72b5a32 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/face/FaceImgController.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/face/FaceImgController.java @@ -13,8 +13,10 @@ 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; @@ -56,6 +58,8 @@ private IAlarmService iAlarmService; @Autowired private RedisTemplateHelper redisTemplate; + @Autowired + private IEventLogService iEventLogService; @RequestMapping(value = "/faceImg", method = RequestMethod.POST) @@ -76,6 +80,9 @@ 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()); @@ -100,25 +107,31 @@ 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()); @@ -128,6 +141,12 @@ 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) { diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/StatisticController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/StatisticController.java index 3f3936e..f171853 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/StatisticController.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/StatisticController.java @@ -62,6 +62,9 @@ @Autowired private IAlarmService iAlarmService; + @Autowired + private ICustomerService iCustomerService; + @RequestMapping(value = "/getIndex1", method = RequestMethod.GET) @ApiOperation(value = "鑾峰彇棣栭〉鏁版嵁") public Result<Object> getIndex1() { @@ -70,7 +73,18 @@ 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) @@ -79,7 +93,7 @@ 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); } @@ -261,4 +275,31 @@ 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); + } } diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/wx/IndexController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/wx/IndexController.java index 8511fd7..676b95d 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/wx/IndexController.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/wx/IndexController.java @@ -95,7 +95,7 @@ //openId锛氬井淇d @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); @@ -109,6 +109,12 @@ 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("闆跺敭璁稿彲璇佹棤鏁�");//棣栨鐧婚檰闇�缁戝畾闆跺敭璁稿彲璇� @@ -157,21 +163,47 @@ } 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); } diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Alarm.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Alarm.java index 8c389dd..3e04ee8 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Alarm.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Alarm.java @@ -33,6 +33,7 @@ //3:涓嶇郴瀹夊叏甯� //4:鎶界儫 //5:杞﹀帰寮傚父寮�鍚� + //6:瓒呴�� @ApiModelProperty(value = "鍏蜂綋绫诲瀷濡備笅") private int type; diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Area.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Area.java index 9f4c0ac..bc3f254 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Area.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Area.java @@ -40,6 +40,9 @@ @ApiModelProperty(value = "閰嶉�佷汉id") private String userId; + @ApiModelProperty(value = "杞﹁締id") + private String carId; + @ApiModelProperty(value = "鍟嗘埛鎬绘暟") private int customerSum; @@ -61,4 +64,8 @@ @Transient @TableField(exist = false) private String nickName; + + @Transient + @TableField(exist = false) + private String carNo; } \ No newline at end of file diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/AreaMap.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/AreaMap.java new file mode 100644 index 0000000..5c04b0e --- /dev/null +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/AreaMap.java @@ -0,0 +1,42 @@ +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; +} \ No newline at end of file diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Customer.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Customer.java index b39ad27..abf8729 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Customer.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Customer.java @@ -58,7 +58,7 @@ @ApiModelProperty(value = "0:姝e父 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") @@ -84,6 +84,9 @@ @ApiModelProperty(value = "鐧婚檰娆℃暟") private int loginNum; + @ApiModelProperty(value = "鐩镐技鍟嗘埛,涓�鎴峰璇佸珜鐤�") + private String likeCusotmerId; + @Transient @TableField(exist = false) @ApiModelProperty(value = "鎺ヨ揣浜哄垪琛�") diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/AreaMapMapper.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/AreaMapMapper.java new file mode 100644 index 0000000..c9938ad --- /dev/null +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/AreaMapMapper.java @@ -0,0 +1,14 @@ +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> { + +} \ No newline at end of file diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/AreaMapper.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/AreaMapper.java index 2e2eff1..47c1b41 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/AreaMapper.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/AreaMapper.java @@ -18,11 +18,11 @@ */ 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(); diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/CustomerMapper.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/CustomerMapper.java index 70f48e6..04581dc 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/CustomerMapper.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/CustomerMapper.java @@ -4,7 +4,12 @@ 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; /** * 鍟嗘埛琛ㄦ暟鎹鐞嗗眰 @@ -33,4 +38,8 @@ @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(); } \ No newline at end of file diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/OrderTaskMapper.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/OrderTaskMapper.java index 096edbb..5935eaa 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/OrderTaskMapper.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/OrderTaskMapper.java @@ -23,8 +23,9 @@ @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") @@ -36,7 +37,7 @@ @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), diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/OrderSynScheduleImpl.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/OrderSynScheduleImpl.java index 683ddf3..154a2db 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/OrderSynScheduleImpl.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/OrderSynScheduleImpl.java @@ -36,9 +36,6 @@ private ICustomerService iCustomerService; @Autowired - private ICarService iCarService; - - @Autowired private ICustomerReceiveService iCustomerReceiveService; @Scheduled(cron="0 30 23 * * ?")//姣忔櫄鍑屾櫒1鐐规墽琛� @@ -52,7 +49,9 @@ 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()); @@ -65,7 +64,7 @@ } orderTask.setNum(original.getNum()); - orderTask.setCarId(getCarId(orderTask.getAreaId())); + iOrderTaskService.saveOrUpdate(orderTask); updateCustomerRecive(orderTask.getCustomerId(),original.getLinker(),original.getCustomerPhone()); @@ -125,7 +124,7 @@ 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); @@ -133,9 +132,9 @@ 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){ @@ -154,7 +153,8 @@ } 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<>(); @@ -164,7 +164,7 @@ // }else{ // return null; // } - return iAreaService.getCarId(areaId); + //return iAreaService.getCarId(areaId); } public String dateStringFormat(Date strDate) { diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/StatisticPcScheduleImpl.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/StatisticPcScheduleImpl.java index 8a476c4..1156308 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/StatisticPcScheduleImpl.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/StatisticPcScheduleImpl.java @@ -51,6 +51,9 @@ @Autowired private IEquipmentService iEquipmentService; + @Autowired + private IEventLogService eventLogService; + public static final String HEAD = "statistic1::"; @Scheduled(cron="0 15 * * * ?")//姣忓皬鏃�15鍒嗛挓鏃舵墽琛� @@ -86,7 +89,9 @@ 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"); diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/StatisticScheduleImpl.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/StatisticScheduleImpl.java index 7083ce9..ea2857e 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/StatisticScheduleImpl.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/StatisticScheduleImpl.java @@ -36,6 +36,9 @@ @Autowired private IAlarmService iAlarmService; + @Autowired + private ICarService iCarService; + @Scheduled(cron="0 0 1 * * ?")//姣忔櫄鍑屾櫒1鐐规墽琛� public void execute(){ List<User> all = userService.findAll(); @@ -98,9 +101,10 @@ 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()); @@ -129,4 +133,18 @@ } } + + 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; + } + } } diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IAreaMapService.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IAreaMapService.java new file mode 100644 index 0000000..9ebdbf1 --- /dev/null +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IAreaMapService.java @@ -0,0 +1,14 @@ +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> { + +} \ No newline at end of file diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/ICustomerService.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/ICustomerService.java index 7bb0572..08d1cde 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/ICustomerService.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/ICustomerService.java @@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService; import cn.exrick.xboot.your.entity.Customer; +import java.util.List; + /** * 鍟嗘埛琛ㄦ帴鍙� * @author zhangzeli @@ -15,4 +17,6 @@ Month getCustomerCount(Integer year); int sumLogin(); + + List<Customer> getYiHuDuoZheng(); } \ No newline at end of file diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IAreaMapServiceImpl.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IAreaMapServiceImpl.java new file mode 100644 index 0000000..c04668b --- /dev/null +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IAreaMapServiceImpl.java @@ -0,0 +1,26 @@ +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; +} \ No newline at end of file diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/ICustomerServiceImpl.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/ICustomerServiceImpl.java index 9ccb7eb..9371ced 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/ICustomerServiceImpl.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/ICustomerServiceImpl.java @@ -11,6 +11,8 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.List; + /** * 鍟嗘埛琛ㄦ帴鍙e疄鐜� * @author zhangzeli @@ -45,4 +47,9 @@ public int sumLogin() { return customerMapper.sumLogin(); } + + @Override + public List<Customer> getYiHuDuoZheng() { + return customerMapper.getYiHuDuoZheng(); + } } \ No newline at end of file diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/MQTT.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/MQTT.java index db8c882..3738147 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/MQTT.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/MQTT.java @@ -15,7 +15,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.awt.*; @Component public class MQTT { @@ -122,6 +121,9 @@ }else if(eventType.equals("132375")){ alarm.setType(4); alarm.setValue("鎶界儫"); + }else if(eventType.equals("132405")){ + alarm.setType(6); + alarm.setValue("瓒呴��"); }else{ return; } diff --git a/xboot-modules/xboot-your/src/main/resources/mapper/AreaMapMapper.xml b/xboot-modules/xboot-your/src/main/resources/mapper/AreaMapMapper.xml new file mode 100644 index 0000000..d7a900b --- /dev/null +++ b/xboot-modules/xboot-your/src/main/resources/mapper/AreaMapMapper.xml @@ -0,0 +1,5 @@ +<?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> \ No newline at end of file -- Gitblit v1.9.1