设备对接字段优化

master
guochaojie 4 months ago
parent 342cc33f65
commit 8631cc8a4d

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

@ -54,6 +54,9 @@ public class RecycleDevice {
@TableField(value = "BE_LONG_RECYCLER_PHONE") @TableField(value = "BE_LONG_RECYCLER_PHONE")
@ApiModelProperty("回收员手机号") @ApiModelProperty("回收员手机号")
private String beLongRecyclerPhone; private String beLongRecyclerPhone;
@TableField(value = "DEVICE_CODE_QR")
@ApiModelProperty("设备二维码")
private String deviceCodeQr;
@TableField(value = "LATITUDE") @TableField(value = "LATITUDE")
@ApiModelProperty("纬度") @ApiModelProperty("纬度")
private String latitude; private String latitude;

@ -41,8 +41,8 @@ public class CleanOrderVO {
private String phone; private String phone;
@ApiModelProperty("登录方式") @ApiModelProperty("登录方式")
private String loginType; private String loginType;
@ApiModelProperty("上报类型") @ApiModelProperty(value = "公司id", required = true)
private String reportType; private String companyId;
@ApiModelProperty("上报时间") @ApiModelProperty("上报时间")
private String reportTime; private String reportTime;
@ApiModelProperty("抓拍") @ApiModelProperty("抓拍")

@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
@ -39,6 +41,9 @@ public class DeliveryOrderVO {
private String userId; private String userId;
@ApiModelProperty("用户手机") @ApiModelProperty("用户手机")
private String phone; private String phone;
@ApiModelProperty(value = "所属公司", required = true, example = "1")
@NotBlank(message = "所属公司不能为空")
private String companyId;
@ApiModelProperty("登录方式") @ApiModelProperty("登录方式")
private String loginType; private String loginType;
@ApiModelProperty("上报时间") @ApiModelProperty("上报时间")

@ -25,8 +25,10 @@ public class DeviceRespVO {
@ApiModelProperty(value = "是否开启清理锁", required = true, example = "1") @ApiModelProperty(value = "是否开启清理锁", required = true, example = "1")
@NotNull(message = "是否开启清理锁不能为空") @NotNull(message = "是否开启清理锁不能为空")
private Integer cleanLock; private Integer cleanLock;
@ApiModelProperty("是否开启手机号登录") @ApiModelProperty(value = "是否开启手机号登录",required = true, example = "1")
private String usePhoneLogin; private String usePhoneLogin;
@ApiModelProperty(value = "公司id", required = true)
private String companyId;
@ApiModelProperty("设备桶清单") @ApiModelProperty("设备桶清单")
private List<Bucket> bucketList; private List<Bucket> bucketList;
@ApiModelProperty("设备二维码") @ApiModelProperty("设备二维码")

Loading…
Cancel
Save