小程序控制生成清运单

master
guochaojie 4 months ago
parent 114410481f
commit 54d1638601

@ -890,7 +890,7 @@ public class DeviceController {
@PostMapping("/finishDelivery")
@ApiOperation("小程序接口 结束投递")
@ApiOperation("小程序接口 上传投递单")
public CommonResult<String> finishDelivery(@RequestBody DeliveryOrder delivery) {
UserDTO user = UserContext.getUser();
String bucketCode = delivery.getBucketCode();
@ -913,6 +913,7 @@ public class DeviceController {
order.setLoginType("2");//扫码登录
order.setCleanStatus(0);//清运状态
//审核信息
order.setAdjustSet(Integer.valueOf(adjustSet));
if ("1".equals(adjustSet)) {//自动审核
order.setAdjustStatus(1);
order.setAdjustWeight(delivery.getReportWeight());
@ -933,6 +934,8 @@ public class DeviceController {
currentWeight = currentWeight.add(delivery.getReportWeight());
bucket.setCurrentWeight(currentWeight);
bucketService.updateById(bucket);
log.info("投递成功更新桶重量,桶编号:{},当前重量:{}", bucketCode, currentWeight);
redisTool.deleteKey(orderNo);//删除缓存的图片
}
} else {
return CommonResult.error(400, "投递单保存失败!");
@ -941,10 +944,56 @@ public class DeviceController {
}
@PostMapping("/finishClean")
@ApiOperation("小程序接口 结束投递")
@ApiOperation("小程序接口 上传清运单")
public CommonResult<String> finishClean(@RequestBody CleanOrder clean) {
RecycleCleanOrder order = BeanUtils.copyBean(clean, RecycleCleanOrder.class);
String bucketCode = order.getBucketCode();
String companyId = order.getCompanyId();
String orderNo = order.getOrderNo();
return null;
RecycleBucket bucket = bucketService.getByBucketCode(bucketCode);
RecycleDeviceConfig config = configService.getByCompanyId(companyId);
String adjustSet = config.getCleanAdjustSet();
//抓拍信息
Object value = redisTool.getValue(orderNo);
if (null != value) {
order.setPhoto(value.toString());
}
//审核信息
order.setAdjustSet(Integer.valueOf(adjustSet));
if ("1".equals(adjustSet)) {
order.setAdjustStatus(1);
order.setAdjustComm("自动审核");
order.setEntryStatus(1);//已入库
order.setAdjustWeight(clean.getWeight());
order.setAdjustPrice(clean.getTotalPrice());
} else {
order.setAdjustStatus(0);
order.setAdjustComm("");
order.setAdjustWeight(BigDecimal.ZERO);
order.setAdjustPrice(BigDecimal.ZERO);
order.setEntryStatus(0);
}
boolean save = cleanOrderService.save(order);
if (save) {
bucket.setCurrentWeight(BigDecimal.ZERO);
bucketService.updateById(bucket);
if (null != value)
redisTool.deleteKey(orderNo);//删除缓存的图片
}else {
return CommonResult.error(400, "清运单保存失败!");
}
return CommonResult.success("清运单保存成功!", "success");
}
}
@ApiOperation("小程序接口 获取桶内总重")
@PostMapping("/bucketWeight/{bucketCode}")
public CommonResult<BigDecimal> getBucketWeight(@PathVariable String bucketCode) {
RecycleBucket bucket = bucketService.getByBucketCode(bucketCode);
if (null != bucket && bucket.getCurrentWeight() != null
&& bucket.getCurrentWeight().compareTo(BigDecimal.ZERO) > 0) {
return CommonResult.success(bucket.getCurrentWeight());
}
return CommonResult.error(400, "桶内桶内无重量!");
}
}

@ -1,4 +1,45 @@
package cc.yunxi.domain.vo.device;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class CleanOrder {
@ApiModelProperty("订单号")
private String orderNo;
@ApiModelProperty("设备编码")
private String deviceCode;
@ApiModelProperty("桶编码")
private String bucketCode;
@ApiModelProperty("门号")
private String doorNum;
@ApiModelProperty("回收大类")
private String productCode;
@ApiModelProperty("回收子类")
private String productSubCode;
@ApiModelProperty("单价")
private BigDecimal price;
@ApiModelProperty("重量")
private BigDecimal weight;
@ApiModelProperty("本单金额")
private BigDecimal totalPrice;
@ApiModelProperty("清运员用户id")
private String cleanUserId;
@ApiModelProperty("清运员手机号")
private String phone;
@ApiModelProperty("垃圾袋编号")
private String bagNo;
@ApiModelProperty("抓拍照片")
private String photo;
@ApiModelProperty("公司id")
private String companyId;
@ApiModelProperty("开始时间")
private Date startTime;
@ApiModelProperty("完成时间")
private Date finishTime;
@ApiModelProperty("上报时间")
private Date reportTime;
}

Loading…
Cancel
Save