From dfd4959471c057749b4db755ea141fca76e73357 Mon Sep 17 00:00:00 2001 From: wang-hao-jie <1550036656@qq.com> Date: 星期四, 02 十二月 2021 15:44:23 +0800 Subject: [PATCH] 违章记录 --- xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/OrderTaskController.java | 94 ++++++++++++++++++++++++++++++++++++---------- 1 files changed, 73 insertions(+), 21 deletions(-) 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 5fef915..64e9320 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 @@ -7,13 +7,8 @@ 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.Area; -import cn.exrick.xboot.your.entity.OrderDetail; -import cn.exrick.xboot.your.entity.OrderTask; -import cn.exrick.xboot.your.service.IAreaService; -import cn.exrick.xboot.your.service.ICustomerService; -import cn.exrick.xboot.your.service.IOrderDetailService; -import cn.exrick.xboot.your.service.IOrderTaskService; +import cn.exrick.xboot.your.entity.*; +import cn.exrick.xboot.your.service.*; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -58,6 +53,12 @@ @Autowired private UserService userService; + @Autowired + private IAreaSectionService iAreaSectionService; + + @Autowired + private ICarService iCarService; + @RequestMapping(value = "/get/{id}", method = RequestMethod.GET) @ApiOperation(value = "閫氳繃id鑾峰彇") public Result<OrderTask> get(@PathVariable String id) { @@ -66,12 +67,27 @@ 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); + + QueryWrapper<Area> wrapper3 = new QueryWrapper<Area>(); + wrapper3.eq("user_id",one.getFollowUserId()); + area = iAreaService.getOne(wrapper); + return area; + } + return area; + } + @RequestMapping(value = "/getByUserId", method = RequestMethod.GET) @ApiOperation(value = "鑾峰彇浠婃棩浠诲姟缁熻淇℃伅") public Result<Object> getAll() { - QueryWrapper<Area> wrapper = new QueryWrapper<Area>(); - wrapper.eq("user_id",securityUtil.getCurrUser().getId()); - Area area = iAreaService.getOne(wrapper); + Area area = getArea(securityUtil.getCurrUser().getId()); if(area==null){ return ResultUtil.error("璇疯仈绯荤鐞嗗憳缁戝畾鐗囧尯閰嶉�佸憳"); } @@ -80,22 +96,27 @@ String format = DateUtil.format(new Date(), "yyyy-MM-dd"); wrapper2.eq("area_id",area.getId()); wrapper2.eq("send_date",format); - int count = iOrderTaskService.count(wrapper2); + List<OrderTask> list = iOrderTaskService.list(wrapper2); int sum = iOrderTaskService.sum(area.getId(),format); Map<String,Object> map = new HashMap<String,Object>(); - map.put("count",count); + map.put("count",list.size()); map.put("sum",sum); + map.put("name",""); + if(list.size()>0){ + String areaSectionId = list.get(0).getAreaSectionId(); + AreaSection a = iAreaSectionService.getById(areaSectionId); + map.put("name",a.getName()); + list.clear(); + } return new ResultUtil<Object>().setData(map); } @RequestMapping(value = "/getTodayOrder", method = RequestMethod.GET) @ApiOperation(value = "鑾峰彇浠婃棩浠诲姟璇︽儏") public Result<List<OrderTask>> getTodayOrder() { - QueryWrapper<Area> wrapper = new QueryWrapper<Area>(); - wrapper.eq("user_id",securityUtil.getCurrUser().getId()); - Area area = iAreaService.getOne(wrapper); + Area area = getArea(securityUtil.getCurrUser().getId()); if(area==null){ return ResultUtil.error("璇疯仈绯荤鐞嗗憳缁戝畾鐗囧尯閰嶉�佸憳"); } @@ -119,9 +140,7 @@ return ResultUtil.error("姝ゅ晢鎴峰凡閰嶉��"); } }else{ - QueryWrapper<Area> wrapper = new QueryWrapper<Area>(); - wrapper.eq("user_id",securityUtil.getCurrUser().getId()); - Area area = iAreaService.getOne(wrapper); + Area area = getArea(securityUtil.getCurrUser().getId()); if(area==null){ return ResultUtil.error("璇疯仈绯荤鐞嗗憳缁戝畾鐗囧尯閰嶉�佸憳"); } @@ -152,9 +171,7 @@ @ApiOperation(value = "鑾峰彇鍏跺畠淇℃伅") public Result<Object> getTodayOtherInfo() { - QueryWrapper<Area> wrapper = new QueryWrapper<Area>(); - wrapper.eq("user_id",securityUtil.getCurrUser().getId()); - Area area = iAreaService.getOne(wrapper); + Area area = getArea(securityUtil.getCurrUser().getId()); if(area==null){ return ResultUtil.error("璇疯仈绯荤鐞嗗憳缁戝畾鐗囧尯閰嶉�佸憳"); } @@ -205,6 +222,41 @@ return new ResultUtil<Object>().setData(map); } + @RequestMapping(value = "/addImg", method = RequestMethod.POST) + @ApiOperation(value = "涓婁紶闂ㄥご鐓�") + public Object saveOrUpdate(String orderId,String imgUrl) { + OrderTask orderTask = iOrderTaskService.getById(orderId); + orderTask.setImg(imgUrl); + iOrderTaskService.saveOrUpdate(orderTask); + return ResultUtil.success("娣诲姞鎴愬姛"); + } + + @RequestMapping(value = "/signFor", method = RequestMethod.POST) + @ApiOperation(value = "绛炬敹") + public Object signFor(String orderId,int status,String content,String customerReceiveId) { + if(status==1){ + if(StrUtil.isEmpty(customerReceiveId)){ + return ResultUtil.error("姝e父绛炬敹锛屾帴璐т汉id蹇呭~"); + } + } + OrderTask orderTask = iOrderTaskService.getById(orderId); + orderTask.setStatus(status); + orderTask.setUserId(securityUtil.getCurrUser().getId()); + if(StrUtil.isNotEmpty(customerReceiveId)){ + orderTask.setCustomerReceiveId(customerReceiveId); + } + + if(!StrUtil.isEmpty(content)){ + orderTask.setRemarks(content); + }else{ + if(status==2){ + return ResultUtil.error("璇峰~鍐欏紓甯哥鏀跺師鍥�"); + } + } + iOrderTaskService.saveOrUpdate(orderTask); + return ResultUtil.success("娣诲姞鎴愬姛"); + } + @RequestMapping(value = "/getByPage", method = RequestMethod.GET) @ApiOperation(value = "鍒嗛〉鑾峰彇") public Result<IPage<OrderTask>> getByPage(PageVo page) { -- Gitblit v1.9.1