综合服务模块
This commit is contained in:
1 parent
828ae90b61
commit
d58eaf0216
20 files changed
+48
-212
No files matched your search
File renamed without changes.
@@ -1,8 +1,4 @@
|
||||
|
||||
项目描述 ....
|
||||
|
||||
|
||||
|
||||
# 综合服务模块
|
||||
|
||||
| 姓名 | 角色 | 时间 |
|
||||
| ---- | ---- |---------|
|
||||
+2
-2
@@ -6,11 +6,11 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-supermarket-erp</artifactId>
|
||||
<artifactId>pjcloud-integrated</artifactId>
|
||||
<version>5.7.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pjcloud-supermarket-erp-api</artifactId>
|
||||
<artifactId>pjcloud-integrated-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<!-- 连表查询注解 -->
|
||||
+2
-2
@@ -6,11 +6,11 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-supermarket-erp</artifactId>
|
||||
<artifactId>pjcloud-integrated</artifactId>
|
||||
<version>5.7.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pjcloud-supermarket-erp-biz</artifactId>
|
||||
<artifactId>pjcloud-integrated-biz</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<!--必备: undertow容器-->
|
||||
File renamed without changes.
+3
@@ -0,0 +1,3 @@
|
||||
#com.bsd.pjcloud.supermarketerp.api.feign.RemoteSupermarketCategoryService
|
||||
#com.bsd.pjcloud.supermarketerp.api.feign.RemoteSupermarketSpuService
|
||||
#com.bsd.pjcloud.supermarketerp.api.feign.RemoteSupermarketUnitSkuService
|
||||
File renamed without changes.
File renamed without changes.
@@ -10,12 +10,12 @@
|
||||
<version>5.7.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pjcloud-supermarket-erp</artifactId>
|
||||
<artifactId>pjcloud-integrated</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<!--项目子模块-->
|
||||
<modules>
|
||||
<module>pjcloud-supermarket-erp-api</module>
|
||||
<module>pjcloud-supermarket-erp-biz</module>
|
||||
<module>pjcloud-integrated-api</module>
|
||||
<module>pjcloud-integrated-biz</module>
|
||||
</modules>
|
||||
</project>
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
/*
|
||||
@author pigx archetype
|
||||
* <p>
|
||||
* feign client 存放目录,注意 @EnablePigxFeignClients 的扫描范围
|
||||
*/
|
||||
package com.bsd.pjcloud.erp.api.feign;
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
/*
|
||||
* @author pigx archetype
|
||||
* <p>
|
||||
* 常量和枚举定义
|
||||
*/
|
||||
package com.bsd.pjcloud.erp.constant;
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
/*
|
||||
* @author pigx archetype
|
||||
* <p>
|
||||
* 实体 存放目录
|
||||
*/
|
||||
package com.bsd.pjcloud.erp.entity;
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
package com.bsd.pjcloud.supermarketerp.api.feign;
|
||||
|
||||
|
||||
import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
/**
|
||||
* @author zjf
|
||||
* @date 2018/6/22
|
||||
*/
|
||||
@FeignClient(contextId = "remoteSupermarketCategoryServic", value = ServiceNameConstants.SUPERMARKET_SERVICE)
|
||||
public interface RemoteSupermarketCategoryService {
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有的分类
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/supermarketCategory/simpleAll")
|
||||
R getSimpleAll();
|
||||
|
||||
}
|
||||
-89
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2018-2025, pjcloud All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the pig4cloud.com developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: pjcloud
|
||||
*
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.supermarketerp.api.feign;
|
||||
|
||||
|
||||
import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.supermarketerp.dto.SupermarketSpuQueryDTO;
|
||||
import com.bsd.pjcloud.supermarketerp.dto.SupermarketSpuUpdateStockReqDTO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* @author zjf
|
||||
* @date 2018/6/22
|
||||
*/
|
||||
@FeignClient(contextId = "remoteSupermarketSpuService", value = ServiceNameConstants.SUPERMARKET_SERVICE)
|
||||
public interface RemoteSupermarketSpuService {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有的超市spu列表信息,根据条件
|
||||
* @return R
|
||||
*/
|
||||
@PostMapping("/supermarketSpu/ad/selectListAll")
|
||||
R getSupermarketSpuScope(@RequestBody SupermarketSpuQueryDTO supermarketSpuQueryDTO);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据spu id 查询spu详情,详情包括辅助条码和包装单位基本信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/supermarketSpu/ad/SpuDetails")
|
||||
R getSupermarketSpuDetailById(@RequestParam("id")Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 更新库存
|
||||
* @param updateStockReqDTO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/supermarketSpu/ad/updateSpuStock")
|
||||
R updateSpuStock(@RequestBody SupermarketSpuUpdateStockReqDTO updateStockReqDTO);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有的超市spu列表信息,根据条件
|
||||
* @return R
|
||||
*/
|
||||
@PostMapping("/supermarketSpu/app/selectListAll")
|
||||
R getSupermarketSpu(@RequestBody SupermarketSpuQueryDTO supermarketSpuQueryDTO);
|
||||
|
||||
|
||||
/**
|
||||
* 购物车效验库存
|
||||
* @param spuId
|
||||
* @param incrCount 扣减数量,正数负数都行
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/supermarketSpu/app/checkSpuStock")
|
||||
R checkSpuStock(@RequestParam(value ="spuId")Long spuId,@RequestParam("incrCount")Integer incrCount);
|
||||
|
||||
}
|
||||
-51
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2018-2025, pjcloud All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the pig4cloud.com developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: pjcloud
|
||||
*
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.supermarketerp.api.feign;
|
||||
|
||||
|
||||
import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.supermarketerp.vo.SupermarketUnitWithSpuVo;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zjf
|
||||
* @date 2018/6/22
|
||||
*/
|
||||
@FeignClient(contextId = "remoteSupermarketUnitSkuService", value = ServiceNameConstants.SUPERMARKET_SERVICE)
|
||||
public interface RemoteSupermarketUnitSkuService {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* sku 包装单位
|
||||
* 根据包装ids查询
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/supermarketUnit/ad/getSupermarketUnits")
|
||||
R<List<SupermarketUnitWithSpuVo>> getSupermarketUnits(@RequestBody List<Long> ids);
|
||||
}
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
com.bsd.pjcloud.supermarketerp.api.feign.RemoteSupermarketCategoryService
|
||||
com.bsd.pjcloud.supermarketerp.api.feign.RemoteSupermarketSpuService
|
||||
com.bsd.pjcloud.supermarketerp.api.feign.RemoteSupermarketUnitSkuService
|
||||
+2
-1
@@ -15,7 +15,8 @@ public enum InventoryTypeEnum {
|
||||
CKRK("3", "CGRK"),
|
||||
CKTH("4", "CGTH"),
|
||||
LSCK("5", "LSCK"),
|
||||
LSTH("6", "LSTH")
|
||||
LSTH("6", "LSTH"),
|
||||
KCPD("7", "KCPD")
|
||||
;
|
||||
private final String type;
|
||||
private final String value;
|
||||
|
||||
+4
@@ -175,4 +175,8 @@ public class SmErpInventoryRecordsEntity extends Model<SmErpInventoryRecordsEnti
|
||||
|
||||
@Schema(description="收货数量")
|
||||
private Integer receiveAmount;
|
||||
|
||||
@Schema(description="货商名称")
|
||||
@TableField(exist = false)
|
||||
private String supplierName;
|
||||
}
|
||||
+30
-11
@@ -54,6 +54,8 @@ public class SmErpInventoryRecordsServiceImpl extends ServiceImpl<SmErpInventory
|
||||
private final SmErpUnitMapper smErpUnitMapper;
|
||||
|
||||
private final RemoteUserService remoteUserService;
|
||||
|
||||
private final SmErpSupplierMapper smErpSupplierMapper;
|
||||
@Override
|
||||
@Transactional
|
||||
public Object saveInventoryRecord(InventoryRecordSaveDTO inventoryRecordSaveDTO) {
|
||||
@@ -77,17 +79,24 @@ public class SmErpInventoryRecordsServiceImpl extends ServiceImpl<SmErpInventory
|
||||
for (SmErpInventoryRecordsItemEntity cgPlanItemEntity : cgPlanItemEntities) {
|
||||
cgPlanItemEntity.setInventoryId(smErpCgDdEntity.getId());
|
||||
cgPlanItemEntity.setDeptId(deptId);
|
||||
String orderType = smErpCgDdEntity.getOrderType();
|
||||
cgPlanItemEntity.setOrderType(orderType);
|
||||
UpdateStockDTO updateStockDTO = new UpdateStockDTO();
|
||||
updateStockDTO.setId(cgPlanItemEntity.getErpSpuId());
|
||||
if (orderType.equals(OrderTypeEnum.RK.getType())){
|
||||
updateStockDTO.setIncrCount(cgPlanItemEntity.getQuantity());
|
||||
}else if (orderType.equals(OrderTypeEnum.CK.getType())){
|
||||
updateStockDTO.setIncrCount(-cgPlanItemEntity.getQuantity());
|
||||
Double quantity = cgPlanItemEntity.getQuantity();
|
||||
String orderType = smErpCgDdEntity.getOrderType();
|
||||
|
||||
if (null==orderType){
|
||||
//如果是盘点保存的话,那么这个就是手动录入的了
|
||||
}else {
|
||||
throw new RuntimeException("订单类型错误");
|
||||
cgPlanItemEntity.setOrderType(orderType);
|
||||
if (orderType.equals(OrderTypeEnum.RK.getType())){
|
||||
updateStockDTO.setIncrCount(quantity);
|
||||
}else if (orderType.equals(OrderTypeEnum.CK.getType())){
|
||||
updateStockDTO.setIncrCount(-quantity);
|
||||
}else {
|
||||
throw new RuntimeException("订单类型错误");
|
||||
}
|
||||
}
|
||||
|
||||
updateStockDTOS.add(updateStockDTO);
|
||||
}
|
||||
smErpInventoryRecordsItemMapper.insert(cgPlanItemEntities);
|
||||
@@ -120,6 +129,10 @@ public class SmErpInventoryRecordsServiceImpl extends ServiceImpl<SmErpInventory
|
||||
Set<Long> userIds = records.stream()
|
||||
.map(SmErpInventoryRecordsEntity::getHandlerUserId)
|
||||
.collect(Collectors.toSet());
|
||||
//收集supplierIds
|
||||
Set<Long> supplierIds = records.stream()
|
||||
.map(SmErpInventoryRecordsEntity::getSupplierId)
|
||||
.collect(Collectors.toSet());
|
||||
//请求得到所有的userIds
|
||||
Map<Long, SysUser> userMap = remoteUserService.getUserMap(userIds).getData();
|
||||
|
||||
@@ -133,6 +146,9 @@ public class SmErpInventoryRecordsServiceImpl extends ServiceImpl<SmErpInventory
|
||||
Map<Long,SmErpSpuEntity> spuMap = smErpSpuEntities.stream().collect(Collectors.toMap(SmErpSpuEntity::getId, spu -> spu));
|
||||
|
||||
|
||||
List<SmErpSupplierEntity> smErpSupplierEntities = smErpSupplierMapper.selectList(new LambdaQueryWrapper<SmErpSupplierEntity>().in(SmErpSupplierEntity::getSupplierId, supplierIds));
|
||||
Map<Long,SmErpSupplierEntity> supplierMap = smErpSupplierEntities.stream().collect(Collectors.toMap(SmErpSupplierEntity::getSupplierId, supplier -> supplier));
|
||||
|
||||
// 按采购计划分组商品名称
|
||||
Map<Long, List<String>> planGoodsMap = cgPlanItemEntities.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
@@ -142,15 +158,18 @@ public class SmErpInventoryRecordsServiceImpl extends ServiceImpl<SmErpInventory
|
||||
Collectors.toList()
|
||||
)
|
||||
));
|
||||
|
||||
// 设置商品名称到主表实体
|
||||
records.forEach(plan -> {
|
||||
//移动端自动扣款入库,无需经办人
|
||||
if (null!=plan.getHandlerUserId()){
|
||||
SysUser sysUser = userMap.getOrDefault(plan.getHandlerUserId(), new SysUser());
|
||||
plan.setHandlerUserName(sysUser.getUsername());
|
||||
List<String> names = planGoodsMap.getOrDefault(plan.getId(), Collections.emptyList());
|
||||
plan.setProductName(String.join(", ", names));
|
||||
}
|
||||
List<String> names = planGoodsMap.getOrDefault(plan.getId(), Collections.emptyList());
|
||||
plan.setProductName(String.join(", ", names));
|
||||
String supplierName = supplierMap.getOrDefault(plan.getSupplierId(), new SmErpSupplierEntity()).getSupplierName();
|
||||
plan.setSupplierName(supplierName);
|
||||
|
||||
});
|
||||
return pageData;
|
||||
@@ -331,9 +350,9 @@ public class SmErpInventoryRecordsServiceImpl extends ServiceImpl<SmErpInventory
|
||||
List<InventoryRecordEditItemDTO> items = inventoryRecordEditDTO.getItems();
|
||||
List<SmErpInventoryRecordsItemEntity> smErpInventoryRecordsItemEntityList = BeanUtils.toBean(items, SmErpInventoryRecordsItemEntity.class);
|
||||
|
||||
List<SmErpInventoryRecordsItemEntity> updateItems = smErpInventoryRecordsItemEntityList.stream().
|
||||
filter(smErpInventoryRecordsItemEntity -> smErpInventoryRecordsItemEntity.getId() == null).collect(Collectors.toList());
|
||||
List<SmErpInventoryRecordsItemEntity> insertItems = smErpInventoryRecordsItemEntityList.stream().
|
||||
filter(smErpInventoryRecordsItemEntity -> smErpInventoryRecordsItemEntity.getId() == null).collect(Collectors.toList());
|
||||
List<SmErpInventoryRecordsItemEntity> updateItems = smErpInventoryRecordsItemEntityList.stream().
|
||||
filter(smErpInventoryRecordsItemEntity -> smErpInventoryRecordsItemEntity.getId() != null).collect(Collectors.toList());
|
||||
smErpInventoryRecordsItemMapper.updateById(updateItems);
|
||||
smErpInventoryRecordsItemMapper.insert(insertItems);
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
<module>pjcloud-app-server</module>
|
||||
<module>pjcloud-thirdparty</module>
|
||||
<module>pjcloud-canteen</module>
|
||||
<!-- <module>pjcloud-supermarket-erp</module>-->
|
||||
<module>pjcloud-integrated</module>
|
||||
<module>pjcloud-wallet</module>
|
||||
<module>pjcloud-supermarket</module>
|
||||
<module>pjcloud-hardware</module>
|
||||
|
||||
Reference in new issue
Block a user