feat:app上架员端
This commit is contained in:
1 parent
2ecc2e78ce
commit
b9e5399403
21 files changed
+256
-52
No files matched your search
@@ -137,6 +137,8 @@ CREATE TABLE hard_door_flow
|
||||
flow_status varchar(32) DEFAULT NULL COMMENT '流程状态',
|
||||
error varchar(512) DEFAULT NULL COMMENT '流程错误信息',
|
||||
error_desc varchar(64) DEFAULT NULL COMMENT '流程错误描述(展示)',
|
||||
# 购买成功
|
||||
pay_time datetime DEFAULT NULL COMMENT '购买成功时间',
|
||||
# 其他字段
|
||||
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
|
||||
create_time datetime DEFAULT NULL COMMENT '创建时间',
|
||||
|
||||
+4
-4
@@ -18,7 +18,7 @@ public enum HardDoorFlowEnum {
|
||||
FLOW_CALLBACK_VIDEO("40", "智能柜视频回调", "50"),
|
||||
FLOW_SUBMIT_RECOGNITION("50", "旷世提交识别", "60"),
|
||||
FLOW_CALLBACK_RECOGNITION("60", "旷世识别响应", "70"),
|
||||
FLOW_PAY_ORDER("60", "订单结算", null),
|
||||
FLOW_PAY_ORDER("70", "订单结算", null),
|
||||
;
|
||||
private final String type;
|
||||
private final String description;
|
||||
@@ -31,9 +31,9 @@ public enum HardDoorFlowEnum {
|
||||
|
||||
public static HardDoorFlowEnum getNextType(HardDoorFlowEnum type) {
|
||||
if (ObjectUtil.isEmpty(type)) return null;
|
||||
String nextType = Arrays.stream(values()).filter(v -> ObjectUtil.equals(type, v.getType())).findFirst().get().getNextType();
|
||||
if (ObjectUtil.isEmpty(nextType)) return null;
|
||||
return valueOfByType(nextType);
|
||||
HardDoorFlowEnum currentFlow = valueOfByType(type.getType());
|
||||
if (ObjectUtil.isEmpty(currentFlow) || ObjectUtil.isEmpty(currentFlow.getNextType())) return null;
|
||||
return valueOfByType(currentFlow.getNextType());
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -13,7 +13,7 @@ import java.util.Arrays;
|
||||
@Getter
|
||||
public enum HardSpuRepertoryTypeEnum {
|
||||
HANDLER("10", "手动上架"),
|
||||
AUTO("20", "自动上架"),
|
||||
PERSION("20", "上架员上架"),
|
||||
;
|
||||
private final String type;
|
||||
private final String description;
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.bsd.pjcloud.hard.api.dto.spu;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
public class DeductionSpuRepertoryDto {
|
||||
|
||||
/**
|
||||
* 智能柜编号
|
||||
*/
|
||||
@NotNull(message = "智能柜编号不能为空")
|
||||
private Long hardDoorId;
|
||||
|
||||
/**
|
||||
* 货柜编号
|
||||
*/
|
||||
@NotNull(message = "货柜编号不能为空")
|
||||
private String cabinetNo;
|
||||
|
||||
/**
|
||||
* 上架数量
|
||||
*/
|
||||
@NotEmpty(message = "商品列表不能为空")
|
||||
private List<DeductionSpuRepertoryDto.Item> list;
|
||||
|
||||
@Data
|
||||
public static class Item {
|
||||
|
||||
@NotNull(message = "商品id不能为空")
|
||||
private Long hardSpuId;
|
||||
|
||||
@NotNull(message = "增加库存不能为空")
|
||||
private Integer plusCount;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
package com.bsd.pjcloud.hard.api.dto.spu;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
+6
@@ -176,6 +176,12 @@ public class HardDoorFlowEntity extends Model<HardDoorFlowEntity> {
|
||||
@Schema(description = "sku识别主动获取时间")
|
||||
private LocalDateTime skuDrivingTime;
|
||||
|
||||
/**
|
||||
* 支付时间
|
||||
*/
|
||||
@Schema(description = "支付时间")
|
||||
private LocalDateTime payTime;
|
||||
|
||||
/**
|
||||
* 流程状态
|
||||
*/
|
||||
|
||||
+4
-1
@@ -2,12 +2,13 @@ package com.bsd.pjcloud.hard.api.vo.manager;
|
||||
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardDoorCabinetEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardDoorManagerEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.base.BaseHardInterface;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class HardDoorManagerVo extends HardDoorManagerEntity {
|
||||
public class HardDoorManagerVo extends HardDoorManagerEntity implements BaseHardInterface {
|
||||
/**
|
||||
* 硬件设备相关
|
||||
*/
|
||||
@@ -15,6 +16,8 @@ public class HardDoorManagerVo extends HardDoorManagerEntity {
|
||||
|
||||
private String hardType;
|
||||
|
||||
private List<String> hardTypeCodes;
|
||||
|
||||
private List<HardDoorCabinetEntity> cabinetList;
|
||||
|
||||
}
|
||||
+10
-2
@@ -83,12 +83,20 @@ public class HardDoorFlowController {
|
||||
hardDoorFlowService.disposeRecognitionCallback(dto);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ************************************* end 远程调用 end ************************************* */
|
||||
|
||||
/* ************************************* start app start ************************************* */
|
||||
|
||||
@Operation(summary = "上架开门", description = "上架开门")
|
||||
@PostMapping("/open-repertory")
|
||||
public R openRepertory(@Validated @RequestBody HardDoorFlowOpenDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
dto.setFlowType(HardDoorFlowBizEnum.REPERTORY_OPEN);
|
||||
dto.setOpenType(HardDoorOpenTypeEnum.NO_RECORD_VIDEO);
|
||||
dto.setUserId(user.getId());
|
||||
hardDoorFlowService.openDoorRepertory(dto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/* ************************************* end app end ************************************* */
|
||||
|
||||
|
||||
+18
-1
@@ -41,6 +41,23 @@ public class HardDoorManagerController {
|
||||
private final HardDoorManagerService hardDoorManagerService;
|
||||
private final HardDoorCabinetService hardDoorCabinetService;
|
||||
|
||||
/* ************************************* start APP start ************************************* */
|
||||
|
||||
@Operation(summary = "app查询智能柜列表", description = "app查询智能柜列表")
|
||||
@GetMapping("/app/page")
|
||||
public R<Page<HardDoorManagerVo>> appPage(@ParameterObject Page page, @ParameterObject HardDoorManagerDto dto) {
|
||||
DataScope dataScope = null;
|
||||
return R.ok(hardDoorManagerService.scopePageJoin(page, dto, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "app查询智能柜详情", description = "app查询智能柜详情")
|
||||
@GetMapping("/app/detail")
|
||||
public R appDetail(@RequestParam Long hardDoorId) {
|
||||
return R.ok(hardDoorManagerService.getByHardDoorId(hardDoorId));
|
||||
}
|
||||
|
||||
/* ************************************* start APP start ************************************* */
|
||||
|
||||
@Operation(summary = "绑定设备", description = "绑定设备")
|
||||
@PostMapping("/bind")
|
||||
public R bind(@RequestBody HardDoorManagerEntity dto) {
|
||||
@@ -89,7 +106,7 @@ public class HardDoorManagerController {
|
||||
@GetMapping("/get-by-hard-id")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardDoorManager_view')")
|
||||
public R<HardDoorManagerVo> getByHardId(@RequestParam Long hardId) {
|
||||
return R.ok(hardDoorManagerService.getByHardId(hardId));
|
||||
return R.ok(hardDoorManagerService.getByHardDoorId(hardId));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id删除智能柜设置", description = "通过id删除智能柜设置")
|
||||
|
||||
+31
@@ -13,6 +13,7 @@ import com.bsd.pjcloud.hard.api.dto.spu.HardSpuDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.spu.HardSpuJoinVo;
|
||||
import com.bsd.pjcloud.hard.service.HardSpuService;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
@@ -40,6 +41,36 @@ public class HardSpuController {
|
||||
|
||||
private final HardSpuService hardSpuService;
|
||||
|
||||
/* ************************************* start APP start ************************************* */
|
||||
|
||||
@Operation(summary = "上架", description = "上架")
|
||||
@PostMapping("/app/putaway")
|
||||
public R appPutaway(@Valid @RequestBody HardPutawayDto dto) {
|
||||
hardSpuService.putaway(dto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "下架", description = "下架")
|
||||
@PostMapping("/app/un-putaway")
|
||||
public R appUnPutaway(@Valid @RequestBody HardPutawayDto dto) {
|
||||
hardSpuService.unPutaway(dto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "查询货柜补货商品列表", description = "查询货柜补货商品列表")
|
||||
@GetMapping("/app/cabinet-putaway-list")
|
||||
public R appCabinetPutawayList(@RequestParam Long hardDoorId, @RequestParam String cabinetNo) {
|
||||
return R.ok(hardSpuService.appCabinetPutawayList(hardDoorId, cabinetNo));
|
||||
}
|
||||
|
||||
@Operation(summary = "查询货柜商品列表", description = "查询货柜商品列表")
|
||||
@GetMapping("/app/cabinet-list")
|
||||
public R appCabinetList(@RequestParam Long hardId, @RequestParam String cabinetNo) {
|
||||
return R.ok(hardSpuService.getByCabinetNo(hardId, cabinetNo));
|
||||
}
|
||||
|
||||
/* ************************************* end APP end ************************************* */
|
||||
|
||||
@Operation(summary = "拉取旷世商品", description = "拉取旷世商品")
|
||||
@GetMapping("/async-all")
|
||||
public R asyncAll() {
|
||||
|
||||
+10
-3
@@ -10,9 +10,11 @@ import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.DeductionSpuRepertoryDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.HardSpuRepertoryDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuRepertoryEntity;
|
||||
import com.bsd.pjcloud.hard.service.HardSpuRepertoryService;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
@@ -25,7 +27,6 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 硬件商品库存更新记录
|
||||
@@ -39,10 +40,16 @@ public class HardSpuRepertoryController {
|
||||
|
||||
private final HardSpuRepertoryService hardSpuRepertoryService;
|
||||
|
||||
/* ************************************* start app start ************************************* */
|
||||
/* ************************************* start APP start ************************************* */
|
||||
|
||||
@Operation(summary = "app上架完成", description = "app上架完成")
|
||||
@PostMapping("/app/repertory-done")
|
||||
public R<Boolean> appRepertoryDone(@Valid @RequestBody DeductionSpuRepertoryDto body) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
return R.ok(hardSpuRepertoryService.appRepertoryDone(body, user.getId()));
|
||||
}
|
||||
|
||||
/* ************************************* end app end ************************************* */
|
||||
/* ************************************* end APP end ************************************* */
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
|
||||
-1
@@ -55,7 +55,6 @@ public interface HardDoorFlowService extends IService<HardDoorFlowEntity> {
|
||||
*/
|
||||
void disposeVideoCallback(DoorVideoCallbackDto dto);
|
||||
|
||||
|
||||
/**
|
||||
* 处理旷世识别回调
|
||||
*/
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ public interface HardDoorManagerService extends IService<HardDoorManagerEntity>
|
||||
/**
|
||||
* 根据硬件id查询详情
|
||||
*/
|
||||
HardDoorManagerVo getByHardId(Long hardId);
|
||||
HardDoorManagerVo getByHardDoorId(Long hardId);
|
||||
|
||||
/**
|
||||
* 根据硬件设备编号查询详情
|
||||
|
||||
+7
@@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.DeductionSpuRepertoryDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.HardSpuRepertoryDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuRepertoryEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.spu.HardSpuRepertoryVo;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -28,4 +30,9 @@ public interface HardSpuRepertoryService extends IService<HardSpuRepertoryEntity
|
||||
* 删除
|
||||
*/
|
||||
void delByIds(ArrayList<Long> list);
|
||||
|
||||
/**
|
||||
* app上架完成
|
||||
*/
|
||||
Boolean appRepertoryDone(DeductionSpuRepertoryDto body, Long userId);
|
||||
}
|
||||
+5
@@ -45,6 +45,11 @@ public interface HardSpuService extends IService<HardSpuEntity> {
|
||||
*/
|
||||
List<Map<Integer, List<HardSpuJoinVo>>> getByCabinetNo(Long hardId, String cabinetNo);
|
||||
|
||||
/**
|
||||
* 查询货柜补货商品列表
|
||||
*/
|
||||
List<HardSpuJoinVo> appCabinetPutawayList(Long hardDoorId, String cabinetNo);
|
||||
|
||||
/**
|
||||
* 上架
|
||||
*/
|
||||
|
||||
+1
-1
@@ -97,7 +97,7 @@ public class HardAuthServiceImpl extends ServiceImpl<HardAuthMapper, HardAuthEnt
|
||||
HardAuthEntity authEntity = baseMapper.selectById(dto.getAuthId());
|
||||
if (ObjectUtil.isEmpty(authEntity)) throw new RuntimeException("授权信息不存在");
|
||||
// 查询设备信息
|
||||
HardDoorManagerVo hardDoorDetail = hardDoorManagerService.getByHardId(authEntity.getHardId());
|
||||
HardDoorManagerVo hardDoorDetail = hardDoorManagerService.getByHardDoorId(authEntity.getHardId());
|
||||
if (ObjectUtil.isEmpty(hardDoorDetail)) throw new RuntimeException("授权信息不存在");
|
||||
HardAuthEntity updateObj = HardAuthEntity.builder().id(dto.getAuthId()).authStatus(dto.getAuthStatus()).authTime(LocalDateTime.now()).build();
|
||||
baseMapper.updateById(updateObj);
|
||||
|
||||
+28
-32
@@ -173,7 +173,9 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
*/
|
||||
@Override
|
||||
public void openDoorRepertory(HardDoorFlowOpenDto dto) {
|
||||
|
||||
// 查询智能柜
|
||||
HardDoorManagerVo doorDetail = hardDoorManagerService.checkDeviceAndCabinet(dto.getHardDoorId(), dto.getCabinetNo());
|
||||
getSelf().openDoor(dto, doorDetail);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -181,18 +183,14 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
*/
|
||||
@Override
|
||||
public void disposeLocakCallback(DoorOpenCallbackDto dto) {
|
||||
if (ObjectUtil.isEmpty(dto) || ObjectUtil.isEmpty(dto.getType())) {
|
||||
if (ObjectUtil.isEmpty(dto) || ObjectUtil.isEmpty(dto.getType()) || ObjectUtil.equals(dto.getResultCode(), "FAIL")) {
|
||||
log.info("|{}|disposeLocakCallback 意外的错误,参数错误dto|{}|", TAG, JSONUtil.toJsonStr(dto));
|
||||
return;
|
||||
}
|
||||
if (ObjectUtil.equals(dto.getResultCode(), "FAIL")) {
|
||||
log.info("|{}|disposeLocakCallback 意外的错误,关门回调直接返回dto|{}|", TAG, JSONUtil.toJsonStr(dto));
|
||||
return;
|
||||
}
|
||||
// 查询流程
|
||||
HardDoorFlowEntity flowDetail = baseMapper.selectById(dto.getOutOpenNo());
|
||||
if (ObjectUtil.isEmpty(flowDetail)) {
|
||||
log.info("|{}|disposeLocakCallback 意外的错误,流程不存在dto|{}|", TAG, JSONUtil.toJsonStr(dto));
|
||||
if (ObjectUtil.isEmpty(flowDetail) || ObjectUtil.isNotEmpty(flowDetail.getOpenCallbackTime())) {
|
||||
log.info("|{}|disposeLocakCallback 意外的错误,流程不存在或者重复dto|{}|", TAG, JSONUtil.toJsonStr(dto));
|
||||
return;
|
||||
}
|
||||
boolean isOpenDoor = ObjectUtil.equals(dto.getType(), "OPEN");
|
||||
@@ -232,23 +230,14 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
*/
|
||||
@Override
|
||||
public void disposeVideoCallback(DoorVideoCallbackDto dto) {
|
||||
if (ObjectUtil.isEmpty(dto) || ObjectUtil.isEmpty(dto.getVideoList())) {
|
||||
log.info("|{}|disposeVideoCallback 意外的错误,参数错误dto|{}|", TAG, JSONUtil.toJsonStr(dto));
|
||||
return;
|
||||
}
|
||||
if (ObjectUtil.equals(dto.getResultCode(), "FAIL")) {
|
||||
log.info("|{}|disposeVideoCallback 意外的错误,关门回调直接返回dto|{}|", TAG, JSONUtil.toJsonStr(dto));
|
||||
if (ObjectUtil.isEmpty(dto) || ObjectUtil.isEmpty(dto.getVideoList()) || ObjectUtil.equals(dto.getResultCode(), "FAIL")) {
|
||||
log.info("|{}|disposeVideoCallback 意外的错误,参数错误或者状态错误dto|{}|", TAG, JSONUtil.toJsonStr(dto));
|
||||
return;
|
||||
}
|
||||
// 查询流程
|
||||
HardDoorFlowEntity flowDetail = baseMapper.selectById(dto.getOutOpenNo());
|
||||
if (ObjectUtil.isEmpty(flowDetail)) {
|
||||
log.info("|{}|disposeVideoCallback 意外的错误,流程不存在dto|{}|", TAG, JSONUtil.toJsonStr(dto));
|
||||
return;
|
||||
}
|
||||
// 判断是否已提交
|
||||
if (ObjectUtil.isNotEmpty(flowDetail.getSkuSubmitTime())) {
|
||||
log.info("|{}|disposeVideoCallback 该流程已经提交识别|{}|", TAG, JSONUtil.toJsonStr(dto));
|
||||
if (ObjectUtil.isEmpty(flowDetail) || ObjectUtil.isNotEmpty(flowDetail.getSkuSubmitTime())) {
|
||||
log.info("|{}|disposeVideoCallback 意外的错误,流程不存在或重复dto|{}|", TAG, JSONUtil.toJsonStr(dto));
|
||||
return;
|
||||
}
|
||||
// 提交视频
|
||||
@@ -267,9 +256,6 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
ksMap.put("origin_time", System.currentTimeMillis());
|
||||
ksMap.put("sku_scope", ksSpuMap);
|
||||
// 更新流程
|
||||
HardDoorFlowEntity vodeoUpdateObj = HardDoorFlowEntity.builder().id(flowDetail.getId()).videoCallbackVo(JSONUtil.toJsonStr(dto)).videoCallbackTime(LocalDateTime.now()).build();
|
||||
baseMapper.updateById(vodeoUpdateObj);
|
||||
// 更新流程
|
||||
getSelf().flowStatusControl(flowDetail, null, dto, null);
|
||||
// 提交识别
|
||||
KsRecognitionDto ksRecognitionDto = new KsRecognitionDto();
|
||||
@@ -289,6 +275,7 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
return;
|
||||
}
|
||||
// 更新流程
|
||||
flowDetail.setSkuSubmitRecogId(ksRecognitionVo.getKs_recog_id());
|
||||
getSelf().flowStatusControl(flowDetail, ksRecognitionDto, ksRecognitionVo, null);
|
||||
}
|
||||
|
||||
@@ -303,8 +290,8 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
}
|
||||
// 更新流程
|
||||
HardDoorFlowEntity flowDetail = get(dto.getKs_recog_id());
|
||||
if (ObjectUtil.isEmpty(flowDetail)) {
|
||||
log.error("|{}|disposeRecognitionCallback 意外的错误,流程不存在dto|{}|", TAG, JSONUtil.toJsonStr(dto));
|
||||
if (ObjectUtil.isEmpty(flowDetail) || ObjectUtil.isNotEmpty(flowDetail.getSkuCallbackTime())) {
|
||||
log.error("|{}|disposeRecognitionCallback 意外的错误,流程不存在或重复dto|{}|", TAG, JSONUtil.toJsonStr(dto));
|
||||
return;
|
||||
}
|
||||
// 查询授权流程
|
||||
@@ -313,10 +300,6 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
log.error("|{}|disposeRecognitionCallback 意外的错误,授权流程不存在dto|{}|", TAG, JSONUtil.toJsonStr(dto));
|
||||
return;
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(flowDetail.getSkuCallbackTime())) {
|
||||
log.error("|{}|disposeRecognitionCallback 该流程识别已经回调dto|{}|", TAG, JSONUtil.toJsonStr(dto));
|
||||
return;
|
||||
}
|
||||
String ksFlowCode = dto.getState().getCode();
|
||||
String ksRecognitionCode = dto.getResult().getStatus().getCode();
|
||||
if (ObjectUtil.notEqual(ksFlowCode, "2") || ObjectUtil.notEqual(ksRecognitionCode, "2")) {
|
||||
@@ -343,7 +326,10 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
return;
|
||||
}
|
||||
try {
|
||||
hardOrderService.payHardDoorOrder(orderDetail, resultSkuList);
|
||||
Long orderId = hardOrderService.payHardDoorOrder(orderDetail, resultSkuList);
|
||||
if (ObjectUtil.isNotEmpty(orderId)) {
|
||||
getSelf().flowStatusControl(flowDetail, null, null, null);
|
||||
}
|
||||
// 完成授权流程
|
||||
HardAuthEntity updateAuthObj = HardAuthEntity.builder().id(authDetail.getId()).isDone(YesNoEnum.YES.getCode()).isDoneTime(LocalDateTime.now()).build();
|
||||
hardAuthMapper.updateById(updateAuthObj);
|
||||
@@ -360,7 +346,7 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void flowStatusControl(HardDoorFlowEntity flow, Object dto, Object vo, String error) {
|
||||
if (ObjectUtil.isAllNotEmpty(flow.getId(), flow.getFlowStatus())) {
|
||||
if (!ObjectUtil.isAllNotEmpty(flow.getId(), flow.getFlowStatus())) {
|
||||
log.error("|{}|flowStatusControl 意外的错误,流程id或者flowstatus为空", TAG);
|
||||
return;
|
||||
}
|
||||
@@ -380,6 +366,9 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
updateObj.setRequestOpenDto(JSONUtil.toJsonStr(dto));
|
||||
updateObj.setRequestOpenVo(JSONUtil.toJsonStr(vo));
|
||||
updateObj.setRequestOpenTime(LocalDateTime.now());
|
||||
if (ObjectUtil.isNotEmpty(flow.getAuthId())) {
|
||||
updateObj.setAuthId(flow.getAuthId());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(flow.getHardId())) {
|
||||
updateObj.setHardId(flow.getHardId());
|
||||
}
|
||||
@@ -423,6 +412,9 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
updateObj.setSkuSubmitDto(JSONUtil.toJsonStr(dto));
|
||||
updateObj.setSkuSubmitVo(JSONUtil.toJsonStr(vo));
|
||||
updateObj.setSkuSubmitTime(LocalDateTime.now());
|
||||
if (ObjectUtil.isNotEmpty(flow.getSkuSubmitRecogId())) {
|
||||
updateObj.setSkuSubmitRecogId(flow.getSkuSubmitRecogId());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(error)) {
|
||||
updateObj.setErrorDesc("商品提交识别提交错误");
|
||||
}
|
||||
@@ -437,6 +429,10 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FLOW_PAY_ORDER -> {
|
||||
updateObj.setPayTime(LocalDateTime.now());
|
||||
break;
|
||||
}
|
||||
}
|
||||
baseMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
+27
-4
@@ -5,13 +5,18 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.hard.api.dto.manager.HardDoorManagerDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.manager.HardManagerDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.HardChangeVolume;
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardDoorCabinetEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardDoorManagerEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardManagerEntity;
|
||||
import com.bsd.pjcloud.hard.api.utils.HardUtil;
|
||||
import com.bsd.pjcloud.hard.api.vo.manager.HardDoorManagerVo;
|
||||
import com.bsd.pjcloud.hard.mapper.manager.HardDoorManagerMapper;
|
||||
import com.bsd.pjcloud.hard.mapper.manager.HardManagerMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardDoorCabinetService;
|
||||
import com.bsd.pjcloud.hard.service.HardDoorManagerService;
|
||||
import com.bsd.pjcloud.thirdparty.api.feign.RemoterThirdDoorApiService;
|
||||
@@ -39,18 +44,22 @@ public class HardDoorManagerServiceImpl extends ServiceImpl<HardDoorManagerMappe
|
||||
|
||||
private final HardDoorCabinetService hardDoorCabinetService;
|
||||
|
||||
private final HardManagerMapper hardManagerMapper;
|
||||
|
||||
private final RemoterThirdDoorApiService thirdDoorApiService;
|
||||
|
||||
@Override
|
||||
public Page<HardDoorManagerVo> scopePageJoin(Page page, HardDoorManagerDto dto, DataScope dataScope) {
|
||||
return baseMapper.scopePageJoin(page, dto, dataScope);
|
||||
Page<HardDoorManagerVo> pageList = baseMapper.scopePageJoin(page, dto, dataScope);
|
||||
disposeList(pageList.getRecords(), dto);
|
||||
return pageList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据硬件id查询详情
|
||||
*/
|
||||
@Override
|
||||
public HardDoorManagerVo getByHardId(Long hardId) {
|
||||
public HardDoorManagerVo getByHardDoorId(Long hardId) {
|
||||
HardDoorManagerVo hardDoor = baseMapper.pageJoin(hardId);
|
||||
if (ObjectUtil.isNotEmpty(hardDoor)) {
|
||||
List<HardDoorCabinetEntity> cabinetList = hardDoorCabinetService.getListByHardDoorId(hardDoor.getId());
|
||||
@@ -84,7 +93,7 @@ public class HardDoorManagerServiceImpl extends ServiceImpl<HardDoorManagerMappe
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void bind(HardDoorManagerEntity dto) {
|
||||
// 查询设备
|
||||
HardDoorManagerVo hardDoorDetail = getByHardId(dto.getHardId());
|
||||
HardDoorManagerVo hardDoorDetail = getByHardDoorId(dto.getHardId());
|
||||
if (ObjectUtil.isEmpty(hardDoorDetail)) {
|
||||
HardDoorManagerEntity saveOrUpdate = new HardDoorManagerEntity();
|
||||
saveOrUpdate.setHardId(dto.getHardId());
|
||||
@@ -171,7 +180,7 @@ public class HardDoorManagerServiceImpl extends ServiceImpl<HardDoorManagerMappe
|
||||
@Override
|
||||
public void changeVolume(HardChangeVolume dto) {
|
||||
// 查询设备
|
||||
HardDoorManagerVo hardDoorDetail = getByHardId(dto.getHardId());
|
||||
HardDoorManagerVo hardDoorDetail = getByHardDoorId(dto.getHardId());
|
||||
if (ObjectUtil.isEmpty(hardDoorDetail)) {
|
||||
throw new RuntimeException("设备不存在");
|
||||
}
|
||||
@@ -207,4 +216,18 @@ public class HardDoorManagerServiceImpl extends ServiceImpl<HardDoorManagerMappe
|
||||
doorVo.setCabinetList(cabinetList);
|
||||
return doorVo;
|
||||
}
|
||||
|
||||
private void disposeList(List<HardDoorManagerVo> list, HardDoorManagerDto dto) {
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
// 设备
|
||||
List<Long> hardIds = list.stream().map(HardDoorManagerVo::getHardId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(hardIds)) {
|
||||
HardManagerDto hardManagerDto = new HardManagerDto();
|
||||
hardManagerDto.setIds(hardIds);
|
||||
List<HardManagerEntity> hardList = hardManagerMapper.list(hardManagerDto);
|
||||
if (ObjectUtil.isNotEmpty(hardList)) {
|
||||
HardUtil.convertHardList(list, CollectionUtils.convertMap(hardList, HardManagerEntity::getId));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
@@ -38,6 +38,7 @@ public class HardSpuJoinServiceImpl extends ServiceImpl<HardSpuJoinMapper, HardS
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getHardDoorId()), HardSpuJoinEntity::getHardDoorId, dto.getHardDoorId())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getCabinetNo()), HardSpuJoinEntity::getCabinetNo, dto.getCabinetNo())
|
||||
.isNotNull(ObjectUtil.isNotEmpty(dto.getIsSpu()) && dto.getIsSpu(), HardSpuJoinEntity::getSpuId)
|
||||
.orderByAsc(HardSpuJoinEntity::getHardDoorNumber)
|
||||
.orderByDesc(HardSpuJoinEntity::getSpuId)
|
||||
);
|
||||
if (ObjectUtil.isEmpty(list)) return new ArrayList<>();
|
||||
|
||||
+44
@@ -13,6 +13,7 @@ import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.hard.api.constant.spu.HardSpuRepertoryTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.manager.HardManagerDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.DeductionSpuRepertoryDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.HardSpuRepertoryDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardManagerEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuEntity;
|
||||
@@ -148,6 +149,49 @@ public class HardSpuRepertoryServiceImpl extends ServiceImpl<HardSpuRepertoryMap
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* app上架完成
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean appRepertoryDone(DeductionSpuRepertoryDto body, Long userId) {
|
||||
List<DeductionSpuRepertoryDto.Item> list = body.getList().stream().filter(v -> v.getPlusCount() > 0).toList();
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
throw new RuntimeException("上架商品不能为空");
|
||||
}
|
||||
// 查询商品列表
|
||||
List<Long> spuIds = list.stream().map(DeductionSpuRepertoryDto.Item::getHardSpuId).toList();
|
||||
List<HardSpuEntity> spuList = hardSpuService.listByIds(spuIds);
|
||||
// 更新上架记录
|
||||
List<HardSpuRepertoryEntity> spuRepertoryList = new ArrayList<>();
|
||||
List<HardSpuEntity> spuUpdateList = new ArrayList<>();
|
||||
for (DeductionSpuRepertoryDto.Item i : list) {
|
||||
spuList.stream().filter(v -> v.getId().equals(i.getHardSpuId())).findFirst().ifPresent(spu -> {
|
||||
HardSpuRepertoryEntity entity = new HardSpuRepertoryEntity();
|
||||
Integer beforeCount = 0;
|
||||
if (ObjectUtil.isNotEmpty(spu.getRepertoryCount())) {
|
||||
beforeCount = spu.getRepertoryCount();
|
||||
}
|
||||
entity.setSpuId(spu.getId());
|
||||
entity.setUserId(userId);
|
||||
entity.setBeforeCount(beforeCount);
|
||||
entity.setCount(i.getPlusCount() + beforeCount);
|
||||
entity.setBizType(HardSpuRepertoryTypeEnum.PERSION.getType());
|
||||
spuRepertoryList.add(entity);
|
||||
|
||||
HardSpuEntity spuEntity = new HardSpuEntity();
|
||||
spuEntity.setId(spu.getId());
|
||||
spuEntity.setRepertoryCount(entity.getCount());
|
||||
spuUpdateList.add(spuEntity);
|
||||
});
|
||||
}
|
||||
// 添加上架记录
|
||||
baseMapper.insert(spuRepertoryList);
|
||||
// 更新商品库存
|
||||
hardSpuService.updateBatchById(spuUpdateList);
|
||||
return false;
|
||||
}
|
||||
|
||||
private void disposeList(List<HardSpuRepertoryVo> list, HardSpuRepertoryDto dto) {
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
// 商户
|
||||
|
||||
+12
-1
@@ -121,7 +121,7 @@ public class HardSpuServiceImpl extends ServiceImpl<HardSpuMapper, HardSpuEntity
|
||||
public List<Map<Integer, List<HardSpuJoinVo>>> getByCabinetNo(Long hardId, String cabinetNo) {
|
||||
List<Map<Integer, List<HardSpuJoinVo>>> result = new LinkedList<>();
|
||||
// 查询设备
|
||||
HardDoorManagerVo doorManagerVo = hardDoorManagerService.getByHardId(hardId);
|
||||
HardDoorManagerVo doorManagerVo = hardDoorManagerService.getByHardDoorId(hardId);
|
||||
if (ObjectUtil.isEmpty(doorManagerVo)) return result;
|
||||
int doorCount = 6;
|
||||
int storeySpuMaxCount = 10;
|
||||
@@ -158,6 +158,17 @@ public class HardSpuServiceImpl extends ServiceImpl<HardSpuMapper, HardSpuEntity
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询货柜补货商品列表
|
||||
*/
|
||||
@Override
|
||||
public List<HardSpuJoinVo> appCabinetPutawayList(Long hardDoorId, String cabinetNo) {
|
||||
HardSpuJoinDto spuJoinDto = new HardSpuJoinDto();
|
||||
spuJoinDto.setHardDoorId(hardDoorId);
|
||||
spuJoinDto.setCabinetNo(cabinetNo);
|
||||
return hardSpuJoinService.scopeList(spuJoinDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上架id
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user