| | |
| | | |
| | | 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("指纹与商户不匹配"); |
| | | } |
| | | |