|
|
@ -8,6 +8,7 @@ import cc.yunxi.domain.po.*;
|
|
|
|
import cc.yunxi.domain.vo.device.*;
|
|
|
|
import cc.yunxi.domain.vo.device.*;
|
|
|
|
import cc.yunxi.domain.vo.file.FileUploadRespVO;
|
|
|
|
import cc.yunxi.domain.vo.file.FileUploadRespVO;
|
|
|
|
import cc.yunxi.service.*;
|
|
|
|
import cc.yunxi.service.*;
|
|
|
|
|
|
|
|
import cc.yunxi.service.impl.CommonService;
|
|
|
|
import cc.yunxi.utils.DeviceStatusManager;
|
|
|
|
import cc.yunxi.utils.DeviceStatusManager;
|
|
|
|
import cc.yunxi.utils.UserContext;
|
|
|
|
import cc.yunxi.utils.UserContext;
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
@ -56,6 +57,13 @@ public class DeviceController {
|
|
|
|
private IRecycleCleanOrderService cleanOrderService;
|
|
|
|
private IRecycleCleanOrderService cleanOrderService;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private IRecycleDeliveryOrderService deliveryOrderService;
|
|
|
|
private IRecycleDeliveryOrderService deliveryOrderService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private IRecyclerService recyclerService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private IClientService clientService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private ICommonService commonService;
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private IFileService fileService;
|
|
|
|
private IFileService fileService;
|
|
|
|
|
|
|
|
|
|
|
@ -213,15 +221,61 @@ public class DeviceController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//手机号登录
|
|
|
|
//手机号登录
|
|
|
|
@PostMapping("/login")
|
|
|
|
@PostMapping("/customerLogin")
|
|
|
|
@ApiModelProperty("手机号登录")
|
|
|
|
@ApiModelProperty("投递员手机号登录")
|
|
|
|
public CommonResult<LoginRespVO> login(@RequestBody LoginReqVO loginReqVO) {
|
|
|
|
public CommonResult<LoginRespVO> customerLogin(@RequestBody LoginReqVO loginReqVO) {
|
|
|
|
CommonResult<LoginRespVO> result = new CommonResult<>();
|
|
|
|
CommonResult<LoginRespVO> result = new CommonResult<>();
|
|
|
|
//todo
|
|
|
|
Client client = clientService.getLastestClientByPhone(loginReqVO.getPhone());
|
|
|
|
|
|
|
|
if (client == null) {
|
|
|
|
|
|
|
|
throw new BizIllegalException("登录失败:您还未注册,请先扫码注册!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
RecycleDevice device = deviceService.getByDeviceCode(loginReqVO.getDeviceCode());
|
|
|
|
|
|
|
|
if (device == null) {
|
|
|
|
|
|
|
|
throw new BizIllegalException("登录失败:未查询到对应设备信息!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
UserDTO userDTO = commonService.loginDeviceByClient(client);
|
|
|
|
|
|
|
|
LoginRespVO respVO = new LoginRespVO();
|
|
|
|
|
|
|
|
respVO.setUserId(client.getId());
|
|
|
|
|
|
|
|
respVO.setOpenId(client.getWxOpenid());
|
|
|
|
|
|
|
|
respVO.setUserName(client.getNickName());
|
|
|
|
|
|
|
|
respVO.setStatus(client.getEnabledMark());
|
|
|
|
|
|
|
|
respVO.setToken(userDTO.getToken());
|
|
|
|
|
|
|
|
respVO.setTimeExpire(userDTO.getTimeExpire());
|
|
|
|
|
|
|
|
respVO.setRole(1);
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/customerLogin")
|
|
|
|
|
|
|
|
@ApiModelProperty("清运员手机号登录")
|
|
|
|
|
|
|
|
public CommonResult<LoginRespVO> cleanerLogin(@RequestBody LoginReqVO loginReqVO) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Recycler recycler = recyclerService.getRecyclerByPhoneNumber(loginReqVO.getPhone());
|
|
|
|
|
|
|
|
if (recycler == null) {
|
|
|
|
|
|
|
|
throw new BizIllegalException("登录失败:你还不是清运员,请先注册!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
RecycleDevice device = deviceService.getByDeviceCode(loginReqVO.getDeviceCode());
|
|
|
|
|
|
|
|
if (device == null) {
|
|
|
|
|
|
|
|
throw new BizIllegalException("登录失败:未查询到对应设备信息!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String recyclerPhone = device.getBeLongRecyclerPhone();
|
|
|
|
|
|
|
|
if (StrUtil.isEmpty(recyclerPhone) || !recyclerPhone.equals(loginReqVO.getPhone())) {
|
|
|
|
|
|
|
|
throw new BizIllegalException("登录失败:你不是当前设备的清运员或当前设备未分配清运员!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//登录成功
|
|
|
|
|
|
|
|
UserDTO userDTO = commonService.loginDeviceByRecycler(recycler);
|
|
|
|
|
|
|
|
LoginRespVO respVO = new LoginRespVO();
|
|
|
|
|
|
|
|
respVO.setUserId(recycler.getId());
|
|
|
|
|
|
|
|
respVO.setOpenId(recycler.getOpenid());
|
|
|
|
|
|
|
|
respVO.setUserName(recycler.getStaffsName());
|
|
|
|
|
|
|
|
respVO.setStatus(recycler.getStatus());
|
|
|
|
|
|
|
|
respVO.setToken(userDTO.getToken());
|
|
|
|
|
|
|
|
respVO.setTimeExpire(userDTO.getTimeExpire());
|
|
|
|
|
|
|
|
respVO.setRole(1);
|
|
|
|
|
|
|
|
return CommonResult.success(respVO);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//投递重量上传
|
|
|
|
//投递重量上传
|
|
|
|
@PostMapping("/delivery")
|
|
|
|
@PostMapping("/delivery")
|
|
|
|
@ApiModelProperty("投递订单上传")
|
|
|
|
@ApiModelProperty("投递订单上传")
|
|
|
@ -411,8 +465,7 @@ public class DeviceController {
|
|
|
|
|
|
|
|
|
|
|
|
@ApiModelProperty("获取设备状态")
|
|
|
|
@ApiModelProperty("获取设备状态")
|
|
|
|
@PostMapping("/status")
|
|
|
|
@PostMapping("/status")
|
|
|
|
public CommonResult<String> command(@RequestBody DeviceVO deviceVO)
|
|
|
|
public CommonResult<String> command(@RequestBody DeviceVO deviceVO) {
|
|
|
|
{
|
|
|
|
|
|
|
|
String deviceCode = deviceVO.getDeviceCode();
|
|
|
|
String deviceCode = deviceVO.getDeviceCode();
|
|
|
|
CommandVO cmd = new CommandVO();
|
|
|
|
CommandVO cmd = new CommandVO();
|
|
|
|
cmd.setCmd(CMDEnum.status);
|
|
|
|
cmd.setCmd(CMDEnum.status);
|
|
|
|