feat:智能柜订单详情
This commit is contained in:
1 parent
b9e5399403
commit
a255c59dfa
8 files changed
+57
-28
No files matched your search
@@ -481,6 +481,7 @@ CREATE TABLE hard_spu_repertory
|
||||
spu_id bigint NOT NULL COMMENT '商品id',
|
||||
before_count int NOT NULL COMMENT '更新前的库存数量',
|
||||
count int DEFAULT 0 COMMENT '更新库存数量',
|
||||
biz_id bigint DEFAULT NULL COMMENT '上架业务关联id',
|
||||
biz_type tinytext NOT NULL COMMENT '上架类型',
|
||||
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
|
||||
create_time datetime DEFAULT NULL COMMENT '创建时间',
|
||||
|
||||
+3
-9
@@ -12,16 +12,10 @@ import java.util.List;
|
||||
public class DeductionSpuRepertoryDto {
|
||||
|
||||
/**
|
||||
* 智能柜编号
|
||||
* 流程id
|
||||
*/
|
||||
@NotNull(message = "智能柜编号不能为空")
|
||||
private Long hardDoorId;
|
||||
|
||||
/**
|
||||
* 货柜编号
|
||||
*/
|
||||
@NotNull(message = "货柜编号不能为空")
|
||||
private String cabinetNo;
|
||||
@NotNull(message = "流程id不能为空")
|
||||
private Long flowId;
|
||||
|
||||
/**
|
||||
* 上架数量
|
||||
|
||||
+6
@@ -57,6 +57,12 @@ public class HardSpuRepertoryEntity extends Model<HardSpuRepertoryEntity> {
|
||||
@Schema(description = "更新库存数量")
|
||||
private Integer count;
|
||||
|
||||
/**
|
||||
* 上架业务关联id
|
||||
*/
|
||||
@Schema(description = "上架业务关联id")
|
||||
private Long bizId;
|
||||
|
||||
/**
|
||||
* 上架类型
|
||||
*/
|
||||
|
||||
+6
-6
@@ -15,6 +15,7 @@ import com.bsd.pjcloud.hard.api.constant.HardDoorOpenTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardDoorFlowDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardDoorFlowOpenDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardDoorFlowEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardDoorFlowVo;
|
||||
import com.bsd.pjcloud.hard.service.HardDoorFlowService;
|
||||
import com.bsd.pjcloud.thirdparty.dto.door.DoorOpenCallbackDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.door.DoorStatusCallbackDto;
|
||||
@@ -89,13 +90,12 @@ public class HardDoorFlowController {
|
||||
|
||||
@Operation(summary = "上架开门", description = "上架开门")
|
||||
@PostMapping("/open-repertory")
|
||||
public R openRepertory(@Validated @RequestBody HardDoorFlowOpenDto dto) {
|
||||
public R<Long> 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();
|
||||
return R.ok(hardDoorFlowService.openDoorRepertory(dto));
|
||||
}
|
||||
|
||||
/* ************************************* end app end ************************************* */
|
||||
@@ -125,7 +125,7 @@ public class HardDoorFlowController {
|
||||
@Operation(summary = "复杂查询", description = "复杂查询")
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('dzc_hardDoorFlow_view')")
|
||||
public R pageJoin(@ParameterObject Page page, @ParameterObject HardDoorFlowDto dto) {
|
||||
public R<Page<HardDoorFlowVo>> pageJoin(@ParameterObject Page page, @ParameterObject HardDoorFlowDto dto) {
|
||||
DataScope dataScope = null;
|
||||
return R.ok(hardDoorFlowService.scopePageJoin(page, dto, dataScope));
|
||||
}
|
||||
@@ -133,8 +133,8 @@ public class HardDoorFlowController {
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('dzc_hardDoorFlow_view')")
|
||||
public R getById(@PathVariable("id") Long id) {
|
||||
return R.ok(hardDoorFlowService.getById(id));
|
||||
public R<HardDoorFlowVo> join(@PathVariable("id") Long id) {
|
||||
return R.ok(hardDoorFlowService.join(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "新增智能柜流程", description = "新增智能柜流程")
|
||||
|
||||
+4
-4
@@ -43,27 +43,27 @@ public class HardSpuController {
|
||||
|
||||
/* ************************************* start APP start ************************************* */
|
||||
|
||||
@Operation(summary = "上架", description = "上架")
|
||||
@Operation(summary = "app上架", description = "上架")
|
||||
@PostMapping("/app/putaway")
|
||||
public R appPutaway(@Valid @RequestBody HardPutawayDto dto) {
|
||||
hardSpuService.putaway(dto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "下架", description = "下架")
|
||||
@Operation(summary = "app下架", description = "下架")
|
||||
@PostMapping("/app/un-putaway")
|
||||
public R appUnPutaway(@Valid @RequestBody HardPutawayDto dto) {
|
||||
hardSpuService.unPutaway(dto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "查询货柜补货商品列表", description = "查询货柜补货商品列表")
|
||||
@Operation(summary = "app查询货柜补货商品列表", 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 = "查询货柜商品列表")
|
||||
@Operation(summary = "app查询货柜商品列表", description = "查询货柜商品列表")
|
||||
@GetMapping("/app/cabinet-list")
|
||||
public R appCabinetList(@RequestParam Long hardId, @RequestParam String cabinetNo) {
|
||||
return R.ok(hardSpuService.getByCabinetNo(hardId, cabinetNo));
|
||||
|
||||
+3
-1
@@ -20,6 +20,8 @@ public interface HardDoorFlowService extends IService<HardDoorFlowEntity> {
|
||||
*/
|
||||
Page<HardDoorFlowVo> scopePageJoin(Page page, HardDoorFlowDto dto, DataScope dataScope);
|
||||
|
||||
HardDoorFlowVo join(Long id);
|
||||
|
||||
/**
|
||||
* 检修开门
|
||||
*/
|
||||
@@ -38,7 +40,7 @@ public interface HardDoorFlowService extends IService<HardDoorFlowEntity> {
|
||||
/**
|
||||
* 上架开门
|
||||
*/
|
||||
void openDoorRepertory(HardDoorFlowOpenDto dto);
|
||||
Long openDoorRepertory(HardDoorFlowOpenDto dto);
|
||||
|
||||
/**
|
||||
* 处理开门回调
|
||||
|
||||
+21
-3
@@ -8,6 +8,7 @@ import cn.hutool.json.JSONUtil;
|
||||
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.admin.api.dto.UserInfo;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
|
||||
import com.bsd.pjcloud.admin.api.utils.DataUtil;
|
||||
import com.bsd.pjcloud.admin.api.vo.UserVO;
|
||||
@@ -85,6 +86,22 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
return pageList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HardDoorFlowVo join(Long id) {
|
||||
HardDoorFlowEntity detail = baseMapper.selectById(id);
|
||||
if (ObjectUtil.isEmpty(detail)) return null;
|
||||
HardDoorFlowVo result = BeanUtil.toBean(detail, HardDoorFlowVo.class);
|
||||
// 用户
|
||||
List<UserVO> usrList = remoteUserService.getUserDeptByIds(List.of(result.getUserId())).getData();
|
||||
if (ObjectUtil.isNotEmpty(usrList)) {
|
||||
DataUtil.convertUserDept(result, usrList.get(0));
|
||||
}
|
||||
// 设备
|
||||
HardManagerEntity hardManager = hardManagerMapper.selectById(result.getHardDoorId());
|
||||
if (ObjectUtil.isNotEmpty(hardManager)) HardUtil.convertHard(result, hardManager);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据旷世识别id查询
|
||||
*/
|
||||
@@ -98,7 +115,7 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
* 开门
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void openDoor(HardDoorFlowOpenDto dto, HardDoorManagerVo hardDoorVo) {
|
||||
public Long openDoor(HardDoorFlowOpenDto dto, HardDoorManagerVo hardDoorVo) {
|
||||
HardDoorFlowEntity saveObj = HardDoorFlowEntity.builder().flowStatus(HardDoorFlowEnum.FLOW_AUTH.getType()).userId(dto.getUserId()).bizType(dto.getFlowType().getType()).isOpen(YesNoEnum.NO.getCode()).build();
|
||||
baseMapper.insert(saveObj);
|
||||
HardDoorManagerEntity hardDoorStatus = hardDoorManagerService.refresh(hardDoorVo.getDeviceCode());
|
||||
@@ -121,6 +138,7 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
updateObj.setAuthId(dto.getAuthId());
|
||||
}
|
||||
flowStatusControl(updateObj, openDto, openVo, null);
|
||||
return updateObj.getId();
|
||||
}
|
||||
|
||||
|
||||
@@ -172,10 +190,10 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
* 上架开门
|
||||
*/
|
||||
@Override
|
||||
public void openDoorRepertory(HardDoorFlowOpenDto dto) {
|
||||
public Long openDoorRepertory(HardDoorFlowOpenDto dto) {
|
||||
// 查询智能柜
|
||||
HardDoorManagerVo doorDetail = hardDoorManagerService.checkDeviceAndCabinet(dto.getHardDoorId(), dto.getCabinetNo());
|
||||
getSelf().openDoor(dto, doorDetail);
|
||||
return getSelf().openDoor(dto, doorDetail);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+13
-5
@@ -12,16 +12,15 @@ import com.bsd.pjcloud.common.core.util.R;
|
||||
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.HardDoorFlowEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuRepertoryEntity;
|
||||
import com.bsd.pjcloud.hard.api.utils.HardUtil;
|
||||
import com.bsd.pjcloud.hard.api.vo.spu.HardSpuRepertoryVo;
|
||||
import com.bsd.pjcloud.hard.mapper.manager.HardManagerMapper;
|
||||
import com.bsd.pjcloud.hard.mapper.spu.HardSpuRepertoryMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardDoorFlowService;
|
||||
import com.bsd.pjcloud.hard.service.HardSpuRepertoryService;
|
||||
import com.bsd.pjcloud.hard.service.HardSpuService;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
|
||||
@@ -46,12 +45,11 @@ import java.util.List;
|
||||
public class HardSpuRepertoryServiceImpl extends ServiceImpl<HardSpuRepertoryMapper, HardSpuRepertoryEntity> implements HardSpuRepertoryService {
|
||||
|
||||
private final HardSpuService hardSpuService;
|
||||
private final HardDoorFlowService hardDoorFlowService;
|
||||
|
||||
private final RemoteMchService remoteMchService;
|
||||
private final RemoteUserService remoteUserService;
|
||||
|
||||
private final HardManagerMapper hardManagerMapper;
|
||||
|
||||
@Override
|
||||
public Page<HardSpuRepertoryVo> scopePageJoin(Page page, HardSpuRepertoryDto dto, DataScope dataScope) {
|
||||
Page<HardSpuRepertoryVo> pageList = baseMapper.scopePageJoin(page, dto, dataScope);
|
||||
@@ -155,6 +153,15 @@ public class HardSpuRepertoryServiceImpl extends ServiceImpl<HardSpuRepertoryMap
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean appRepertoryDone(DeductionSpuRepertoryDto body, Long userId) {
|
||||
// 查询流程是否存在
|
||||
HardDoorFlowEntity hardDoorFlow = hardDoorFlowService.getById(body.getFlowId());
|
||||
if (ObjectUtil.isEmpty(hardDoorFlow)) {
|
||||
throw new RuntimeException("上架流程不存在");
|
||||
}
|
||||
Long count = baseMapper.selectCount(new LambdaQueryWrapper<HardSpuRepertoryEntity>().eq(HardSpuRepertoryEntity::getBizId, body.getFlowId()));
|
||||
if (count > 0) {
|
||||
throw new RuntimeException("改上架已结束");
|
||||
}
|
||||
List<DeductionSpuRepertoryDto.Item> list = body.getList().stream().filter(v -> v.getPlusCount() > 0).toList();
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
throw new RuntimeException("上架商品不能为空");
|
||||
@@ -176,6 +183,7 @@ public class HardSpuRepertoryServiceImpl extends ServiceImpl<HardSpuRepertoryMap
|
||||
entity.setUserId(userId);
|
||||
entity.setBeforeCount(beforeCount);
|
||||
entity.setCount(i.getPlusCount() + beforeCount);
|
||||
entity.setBizId(body.getFlowId());
|
||||
entity.setBizType(HardSpuRepertoryTypeEnum.PERSION.getType());
|
||||
spuRepertoryList.add(entity);
|
||||
|
||||
|
||||
Reference in new issue
Block a user