|
|
@ -317,7 +317,7 @@ public class DeviceController {
|
|
|
|
|
|
|
|
|
|
|
|
private String uploadImages(List<Snap> snaps) {
|
|
|
|
private String uploadImages(List<Snap> snaps) {
|
|
|
|
List<FileUploadRespVO> list = new ArrayList<>();
|
|
|
|
List<FileUploadRespVO> list = new ArrayList<>();
|
|
|
|
if (null == list || list.size() == 0) {
|
|
|
|
if (null == snaps || snaps.size() == 0) {
|
|
|
|
log.error("上传图片失败,图片列表为空!!!");
|
|
|
|
log.error("上传图片失败,图片列表为空!!!");
|
|
|
|
return "";
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -782,11 +782,26 @@ public class DeviceController {
|
|
|
|
return CommonResult.success(bucketCode, "success");
|
|
|
|
return CommonResult.success(bucketCode, "success");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("控制柜接口 实时重量上传")
|
|
|
|
@ApiOperation("控制柜接口 重量上传")
|
|
|
|
@PostMapping("/weight")
|
|
|
|
@PostMapping("/weight")
|
|
|
|
public CommonResult<String> weight(@RequestBody WeightVO weight) {
|
|
|
|
public CommonResult<String> weight(@RequestBody WeightVO weight) {
|
|
|
|
String deviceCode = weight.getDeviceCode();
|
|
|
|
String deviceCode = weight.getDeviceCode();
|
|
|
|
String bucketCode = weight.getBucketCode();
|
|
|
|
String bucketCode = weight.getBucketCode();
|
|
|
|
|
|
|
|
// String orderNo = weight.getOrderNo();
|
|
|
|
|
|
|
|
// BigDecimal _weight = weight.getWeight();
|
|
|
|
|
|
|
|
// if (StrUtil.isEmpty(orderNo)) {
|
|
|
|
|
|
|
|
// RecycleBucket bucket = bucketService.getByBucketCode(bucketCode);
|
|
|
|
|
|
|
|
// if (bucket != null) {
|
|
|
|
|
|
|
|
// BigDecimal currentWeight = bucket.getCurrentWeight();
|
|
|
|
|
|
|
|
// if (null != currentWeight && currentWeight.compareTo(_weight) < 0) {
|
|
|
|
|
|
|
|
// bucket.setCurrentWeight(_weight);
|
|
|
|
|
|
|
|
// bucketService.updateById(bucket);
|
|
|
|
|
|
|
|
// log.info("更新桶重量:{},更新前:{},更新后:{}", bucketCode, currentWeight, _weight);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// }
|
|
|
|
StringBuilder key = new StringBuilder();
|
|
|
|
StringBuilder key = new StringBuilder();
|
|
|
|
key.append("weight_").append(deviceCode).append("_").append(bucketCode);
|
|
|
|
key.append("weight_").append(deviceCode).append("_").append(bucketCode);
|
|
|
|
redisTool.setValue(key.toString(), JSONUtil.toJsonStr(weight), 1000 * 60L);//一分钟过期
|
|
|
|
redisTool.setValue(key.toString(), JSONUtil.toJsonStr(weight), 1000 * 60L);//一分钟过期
|
|
|
@ -902,22 +917,38 @@ public class DeviceController {
|
|
|
|
String adjustSet = config.getDeliveryAdjustSet();
|
|
|
|
String adjustSet = config.getDeliveryAdjustSet();
|
|
|
|
RecycleDeliveryOrder order = BeanUtils.copyBean(delivery, RecycleDeliveryOrder.class);
|
|
|
|
RecycleDeliveryOrder order = BeanUtils.copyBean(delivery, RecycleDeliveryOrder.class);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 投递完成 更新桶状态
|
|
|
|
|
|
|
|
BigDecimal currentWeight = bucket.getCurrentWeight();
|
|
|
|
|
|
|
|
BigDecimal price = calculatePrice(bucket, config);
|
|
|
|
|
|
|
|
BigDecimal weight = delivery.getReportWeight();
|
|
|
|
|
|
|
|
BigDecimal money = weight.multiply(price).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//桶身信息
|
|
|
|
|
|
|
|
order.setOriginalWeight(currentWeight);
|
|
|
|
|
|
|
|
order.setPrice(price);
|
|
|
|
|
|
|
|
order.setTotalPrice(money);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
order.setProductCode(bucket.getProductCode());
|
|
|
|
|
|
|
|
order.setProductSubCode(bucket.getProductSubCode());
|
|
|
|
|
|
|
|
order.setDoorNum(bucket.getDoorNum());
|
|
|
|
|
|
|
|
order.setBagNo(bucket.getBagNo());
|
|
|
|
|
|
|
|
order.setDeliverId(user.getId());
|
|
|
|
|
|
|
|
order.setPhone(user.getPhone());
|
|
|
|
|
|
|
|
order.setCleanStatus(0);//清运状态
|
|
|
|
|
|
|
|
order.setCreatorUserId(user.getId());
|
|
|
|
|
|
|
|
order.setCreatorTime(new Date());
|
|
|
|
|
|
|
|
|
|
|
|
//抓拍信息
|
|
|
|
//抓拍信息
|
|
|
|
Object value = redisTool.getValue(orderNo);
|
|
|
|
Object value = redisTool.getValue(orderNo);
|
|
|
|
if (null != value) {
|
|
|
|
if (null != value) {
|
|
|
|
order.setPhoto(value.toString());
|
|
|
|
order.setPhoto(value.toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//用户信息
|
|
|
|
|
|
|
|
order.setCreatorTime(new Date());
|
|
|
|
|
|
|
|
order.setCreatorUserId(user.getId());
|
|
|
|
|
|
|
|
order.setLoginType("2");//扫码登录
|
|
|
|
|
|
|
|
order.setCleanStatus(0);//清运状态
|
|
|
|
|
|
|
|
//审核信息
|
|
|
|
//审核信息
|
|
|
|
order.setAdjustSet(Integer.valueOf(adjustSet));
|
|
|
|
order.setAdjustSet(Integer.valueOf(adjustSet));
|
|
|
|
if ("1".equals(adjustSet)) {//自动审核
|
|
|
|
if ("1".equals(adjustSet)) {//自动审核
|
|
|
|
order.setAdjustStatus(1);
|
|
|
|
order.setAdjustStatus(1);
|
|
|
|
order.setAdjustWeight(delivery.getReportWeight());
|
|
|
|
order.setAdjustWeight(delivery.getReportWeight());
|
|
|
|
order.setAdjustPrice(delivery.getTotalPrice());
|
|
|
|
order.setAdjustPrice(money);
|
|
|
|
order.setAdjustComm("自动审核");
|
|
|
|
order.setAdjustComm("自动审核");
|
|
|
|
} else {//手动审核
|
|
|
|
} else {//手动审核
|
|
|
|
order.setAdjustSet(Integer.valueOf(adjustSet));
|
|
|
|
order.setAdjustSet(Integer.valueOf(adjustSet));
|
|
|
@ -926,16 +957,19 @@ public class DeviceController {
|
|
|
|
order.setAdjustPrice(BigDecimal.ZERO);
|
|
|
|
order.setAdjustPrice(BigDecimal.ZERO);
|
|
|
|
order.setAdjustComm("");
|
|
|
|
order.setAdjustComm("");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean save = deliveryOrderService.save(order);
|
|
|
|
boolean save = deliveryOrderService.save(order);
|
|
|
|
if (save) {
|
|
|
|
if (save) {
|
|
|
|
// 投递完成 更新桶状态
|
|
|
|
|
|
|
|
BigDecimal currentWeight = bucket.getCurrentWeight();
|
|
|
|
|
|
|
|
if (null != currentWeight) {
|
|
|
|
if (null != currentWeight) {
|
|
|
|
currentWeight = currentWeight.add(delivery.getReportWeight());
|
|
|
|
currentWeight = currentWeight.add(weight);
|
|
|
|
bucket.setCurrentWeight(currentWeight);
|
|
|
|
bucket.setCurrentWeight(currentWeight);
|
|
|
|
bucketService.updateById(bucket);
|
|
|
|
bucketService.updateById(bucket);
|
|
|
|
log.info("投递成功更新桶重量,桶编号:{},当前重量:{}", bucketCode, currentWeight);
|
|
|
|
log.info("投递成功更新桶重量,桶编号:{},当前重量:{}", bucketCode, currentWeight);
|
|
|
|
|
|
|
|
if (null != value) {
|
|
|
|
redisTool.deleteKey(orderNo);//删除缓存的图片
|
|
|
|
redisTool.deleteKey(orderNo);//删除缓存的图片
|
|
|
|
|
|
|
|
log.info("删除缓存的图片,单号:{},图片信息:{}", orderNo, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return CommonResult.error(400, "投递单保存失败!");
|
|
|
|
return CommonResult.error(400, "投递单保存失败!");
|
|
|
@ -959,6 +993,21 @@ public class DeviceController {
|
|
|
|
if (null != value) {
|
|
|
|
if (null != value) {
|
|
|
|
order.setPhoto(value.toString());
|
|
|
|
order.setPhoto(value.toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
BigDecimal price = calculatePrice(bucket, config);
|
|
|
|
|
|
|
|
BigDecimal weight = clean.getWeight();
|
|
|
|
|
|
|
|
BigDecimal money = price.multiply(weight).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
|
|
//回收类目信息
|
|
|
|
|
|
|
|
UserDTO user = UserContext.getUser();
|
|
|
|
|
|
|
|
order.setProductCode(bucket.getProductCode());
|
|
|
|
|
|
|
|
order.setProductSubCode(bucket.getProductSubCode());
|
|
|
|
|
|
|
|
order.setDoorNum(null != bucket.getDoorNum() ? "" + bucket.getDoorNum() : "");
|
|
|
|
|
|
|
|
order.setPrice(price);
|
|
|
|
|
|
|
|
order.setTotalPrice(money);
|
|
|
|
|
|
|
|
order.setBagNo(bucket.getBagNo());
|
|
|
|
|
|
|
|
order.setCleanUserId(user.getId());
|
|
|
|
|
|
|
|
order.setPhone(user.getPhone());
|
|
|
|
|
|
|
|
order.setCreatorUserId(user.getId());
|
|
|
|
|
|
|
|
order.setCreatorTime(new Date());
|
|
|
|
//审核信息
|
|
|
|
//审核信息
|
|
|
|
order.setAdjustSet(Integer.valueOf(adjustSet));
|
|
|
|
order.setAdjustSet(Integer.valueOf(adjustSet));
|
|
|
|
if ("1".equals(adjustSet)) {
|
|
|
|
if ("1".equals(adjustSet)) {
|
|
|
@ -966,7 +1015,7 @@ public class DeviceController {
|
|
|
|
order.setAdjustComm("自动审核");
|
|
|
|
order.setAdjustComm("自动审核");
|
|
|
|
order.setEntryStatus(1);//已入库
|
|
|
|
order.setEntryStatus(1);//已入库
|
|
|
|
order.setAdjustWeight(clean.getWeight());
|
|
|
|
order.setAdjustWeight(clean.getWeight());
|
|
|
|
order.setAdjustPrice(clean.getTotalPrice());
|
|
|
|
order.setAdjustPrice(money);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
order.setAdjustStatus(0);
|
|
|
|
order.setAdjustStatus(0);
|
|
|
|
order.setAdjustComm("");
|
|
|
|
order.setAdjustComm("");
|
|
|
@ -978,9 +1027,11 @@ public class DeviceController {
|
|
|
|
if (save) {
|
|
|
|
if (save) {
|
|
|
|
bucket.setCurrentWeight(BigDecimal.ZERO);
|
|
|
|
bucket.setCurrentWeight(BigDecimal.ZERO);
|
|
|
|
bucketService.updateById(bucket);
|
|
|
|
bucketService.updateById(bucket);
|
|
|
|
if (null != value)
|
|
|
|
if (null != value) {
|
|
|
|
redisTool.deleteKey(orderNo);//删除缓存的图片
|
|
|
|
redisTool.deleteKey(orderNo);//删除缓存的图片
|
|
|
|
}else {
|
|
|
|
log.info("删除缓存的图片,单号:{},图片信息:{}", orderNo, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
return CommonResult.error(400, "清运单保存失败!");
|
|
|
|
return CommonResult.error(400, "清运单保存失败!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return CommonResult.success("清运单保存成功!", "success");
|
|
|
|
return CommonResult.success("清运单保存成功!", "success");
|
|
|
|