|
|
|
@ -93,14 +93,15 @@ public class DeviceController {
|
|
|
|
|
result.put("deviceCode", device.getDeviceCode());//设备代码
|
|
|
|
|
result.put("deviceName", deviceVO.getDeviceCode());//设备名称
|
|
|
|
|
result.put("userStatus", device.getUseStatus());//设备状态
|
|
|
|
|
result.put("companyId", device.getBeLongCompanyId());//所属公司
|
|
|
|
|
List<Object> list = new ArrayList<>();
|
|
|
|
|
for (RecycleBucket bucket : buckets) {
|
|
|
|
|
Map<String, Object> _bucket = new HashMap<>();
|
|
|
|
|
_bucket.put("bucketCode", bucket.getBucketCode());//桶编码
|
|
|
|
|
_bucket.put("doorNum", bucket.getDoorNum());//门号
|
|
|
|
|
_bucket.put("showOrd", bucket.getShowOrd());//显示顺序
|
|
|
|
|
_bucket.put("productCode", bucket.getProductCode());//
|
|
|
|
|
_bucket.put("productSubCode", bucket.getProductSubCode());//
|
|
|
|
|
_bucket.put("productCode", bucket.getProductCode());//产品大类
|
|
|
|
|
_bucket.put("productSubCode", bucket.getProductSubCode());//产品子类
|
|
|
|
|
_bucket.put("isShow", bucket.getIsShow());//是否显示
|
|
|
|
|
_bucket.put("showName", bucket.getShowName());//显示名称
|
|
|
|
|
BigDecimal price = calculatePrice(bucket, config);//综合计算价格
|
|
|
|
@ -150,6 +151,8 @@ public class DeviceController {
|
|
|
|
|
respVO.setUserStatus(device.getUseStatus());
|
|
|
|
|
respVO.setCleanLock(Integer.valueOf(config.getCleanLock()));
|
|
|
|
|
respVO.setUsePhoneLogin(config.getAllowPhoneLogin());
|
|
|
|
|
//二维码
|
|
|
|
|
fillQrCode(device.getDeviceCodeQr(), respVO);
|
|
|
|
|
//桶配置
|
|
|
|
|
fillBucketConfig(respVO, buckets, config);
|
|
|
|
|
//宣传配置
|
|
|
|
@ -207,6 +210,18 @@ public class DeviceController {
|
|
|
|
|
respVO.setPosterList(posters);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void fillQrCode(String qrCode, DeviceRespVO respVO) {
|
|
|
|
|
ArrayList<DeviceRespVO.Poster> posters = new ArrayList<>();
|
|
|
|
|
List<FileUploadRespVO> files = JSONUtil.toList(qrCode, FileUploadRespVO.class);
|
|
|
|
|
if (files.size() > 0) {
|
|
|
|
|
FileUploadRespVO file = files.get(0);
|
|
|
|
|
byte[] download = fileService.download(file.getUrl());
|
|
|
|
|
String base64 = fileService.encodeToBase64(download);
|
|
|
|
|
respVO.setQrCode(base64);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private BigDecimal calculatePrice(RecycleBucket bucket, RecycleDeviceConfig config) {
|
|
|
|
|
BigDecimal bucketPrice = bucket.getPrice();
|
|
|
|
|
if (null != bucketPrice && bucketPrice.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
|
@ -301,10 +316,9 @@ public class DeviceController {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/customerLogin")
|
|
|
|
|
@PostMapping("/cleanerLogin")
|
|
|
|
|
@ApiOperation("清运员手机号登录")
|
|
|
|
|
public CommonResult<LoginRespVO> cleanerLogin(@RequestBody LoginReqVO loginReqVO) {
|
|
|
|
|
|
|
|
|
|
Recycler recycler = recyclerService.getRecyclerByPhoneNumber(loginReqVO.getPhone());
|
|
|
|
|
if (recycler == null) {
|
|
|
|
|
throw new BizIllegalException("登录失败:你还不是清运员,请先注册!");
|
|
|
|
@ -336,7 +350,6 @@ public class DeviceController {
|
|
|
|
|
@PostMapping("/delivery")
|
|
|
|
|
@ApiOperation("投递订单上传")
|
|
|
|
|
public CommonResult<String> delivery(@RequestBody DeliveryOrderVO orderVO) {
|
|
|
|
|
// UserDTO user = UserContext.getUser();
|
|
|
|
|
RecycleDevice device = deviceService.getByDeviceCode(orderVO.getDeviceCode());
|
|
|
|
|
|
|
|
|
|
if (null == device || StrUtil.isEmpty(device.getBeLongCompanyId())) {
|
|
|
|
|