修复
This commit is contained in:
1 parent
b9e734c87d
commit
e85d651c46
5 files changed
+37
-15
No files matched your search
+4
-4
@@ -40,13 +40,13 @@ public class SmErpSpuImportDto {
|
||||
private Integer packageNum; // 装数
|
||||
|
||||
@ExcelProperty("进价")
|
||||
@JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
@JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
// @JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
// @JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
private Integer purchasePrice; // 进价
|
||||
|
||||
@ExcelProperty("零售价")
|
||||
@JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
@JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
// @JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
// @JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
private Integer retailPrice; // 零售价
|
||||
|
||||
@ExcelProperty("货商")
|
||||
|
||||
+11
@@ -69,4 +69,15 @@ public class SupermarketAppSpuVo {
|
||||
// @JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
private Integer promotionPrice;
|
||||
|
||||
|
||||
|
||||
@Schema(description="单位")
|
||||
private String unit;
|
||||
|
||||
|
||||
@Schema(description="规格")
|
||||
private String spec;
|
||||
|
||||
|
||||
|
||||
}
|
||||
-6
@@ -233,12 +233,6 @@ public class SmErpSpuController {
|
||||
@PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_export')" )
|
||||
public R importErpSpu(@RequestExcel List<SmErpSpuImportDto> dtos, BindingResult bindingResult) {
|
||||
List<SmErpSpuImportDto> collect = dtos.stream().filter(smErpSpuImportDto -> smErpSpuImportDto.getProductCode() != null).collect(Collectors.toList());
|
||||
// String taskId = taskStoreService.createTask(dtos.size());
|
||||
// smErpSpuService.asyncExecuteImport(taskId, collect);
|
||||
// return R.ok(Collections.singletonMap("taskId", taskId));
|
||||
System.out.println(collect);
|
||||
// List<SmErpSpuImportDto> collect1 = dtos.stream().filter(smErpSpuImportDto -> StringUtils.isBlank(smErpSpuImportDto.getClassification())).collect(Collectors.toList());
|
||||
// System.out.println(collect);
|
||||
if (CollectionUtils.isEmpty(collect)) {
|
||||
return R.failed("导入数据不能为空");
|
||||
}
|
||||
|
||||
+17
-4
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.common.sequence.sequence.Sequence;
|
||||
import com.bsd.pjcloud.supermarket.constant.InventoryTypeEnum;
|
||||
import com.bsd.pjcloud.supermarket.constant.OrderTypeEnum;
|
||||
@@ -30,6 +31,8 @@ import com.bsd.pjcloud.supermarket.vo.erp.SmErpUnitVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.cgplan.ErpSpuWithUnitPageVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.cgplan.ErpUnitVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.sm.smspu.SmErpPageScopeVo;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -74,6 +77,8 @@ public class SmErpSpuServiceImpl extends ServiceImpl<SmErpSpuMapper, SmErpSpuEnt
|
||||
|
||||
private final SmErpSupplierMapper smErpSupplierMapper;
|
||||
|
||||
private final RemoteMchService remoteMchService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private Sequence sequence;
|
||||
@@ -889,9 +894,14 @@ public class SmErpSpuServiceImpl extends ServiceImpl<SmErpSpuMapper, SmErpSpuEnt
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public R importErpSpu(List<SmErpSpuImportDto> smErpSpuImportDtos, BindingResult bindingResult) {
|
||||
Long deptId = SecurityUtils.getUser().getDeptId();
|
||||
R<MchManageVo> mchManageVoR = remoteMchService.getByDeptId(deptId);
|
||||
if (null==mchManageVoR.getData()){
|
||||
return R.failed("当前用户未绑定超市商户");
|
||||
}
|
||||
Long merchantId = mchManageVoR.getData().getId();
|
||||
//错误集合
|
||||
List<Map<String, Object>> errorList = new ArrayList<>();
|
||||
// List<SmErpSpuEntity> spuBatch = new ArrayList<>();
|
||||
//货号-商品映射
|
||||
Map<String, SmErpSpuEntity> productCodeToSpuMap = new HashMap<>();
|
||||
|
||||
@@ -932,7 +942,7 @@ public class SmErpSpuServiceImpl extends ServiceImpl<SmErpSpuMapper, SmErpSpuEnt
|
||||
dto.getClassification(),
|
||||
errorReasons,
|
||||
rowNumber,
|
||||
productCode
|
||||
productCode,deptId,merchantId
|
||||
);
|
||||
if (categoryId == null) {
|
||||
errorList.add(createErrorInfo(rowNumber, productCode, errorReasons));
|
||||
@@ -956,6 +966,7 @@ public class SmErpSpuServiceImpl extends ServiceImpl<SmErpSpuMapper, SmErpSpuEnt
|
||||
spu.setProductNature("电子称称重商品".equals(dto.getCommodityNature()) ? "2" : "1");
|
||||
spu.setCategoryId(categoryId);
|
||||
spu.setSupplierId(supplierId);
|
||||
spu.setDeptId(deptId);
|
||||
|
||||
SmErpSpuEntity existingSpu = existingSpuMap.get(productCode);
|
||||
if (existingSpu != null) {
|
||||
@@ -1147,7 +1158,8 @@ public class SmErpSpuServiceImpl extends ServiceImpl<SmErpSpuMapper, SmErpSpuEnt
|
||||
private Long resolveCategory(String categoryName,
|
||||
List<String> errorReasons,
|
||||
int rowNumber,
|
||||
String productCode) {
|
||||
String productCode,
|
||||
Long deptId,Long merchantId) {
|
||||
try {
|
||||
// 查询现有分类
|
||||
SmErpCategoryEntity existCategory = smErpCategoryMapper.selectOne(
|
||||
@@ -1163,7 +1175,8 @@ public class SmErpSpuServiceImpl extends ServiceImpl<SmErpSpuMapper, SmErpSpuEnt
|
||||
SmErpCategoryEntity newCategory = new SmErpCategoryEntity();
|
||||
newCategory.setName(categoryName);
|
||||
newCategory.setStatus("0");
|
||||
|
||||
newCategory.setDeptId(deptId);
|
||||
newCategory.setMerchantId(merchantId);
|
||||
int insertResult = smErpCategoryMapper.insert(newCategory);
|
||||
if (insertResult > 0) {
|
||||
return newCategory.getId();
|
||||
|
||||
+5
-1
@@ -34,7 +34,8 @@
|
||||
</select>
|
||||
|
||||
<select id="getAppPage" resultType="com.bsd.pjcloud.supermarket.vo.app.SupermarketAppSpuVo">
|
||||
SELECT sp.id,sp.slider_pic_urls,esp.product_name, esp.pic_url,stock.current_stock as stock, esp.sales_count, u.retail_price, u.promotion_price
|
||||
SELECT sp.id,sp.slider_pic_urls,esp.product_name, esp.pic_url,stock.current_stock as stock, esp.sales_count, u.retail_price, u.promotion_price,u.spec,
|
||||
u.unit
|
||||
FROM `sm_spu` sp
|
||||
LEFT JOIN sm_erp_spu esp
|
||||
on sp.erp_spu_id = esp.id
|
||||
@@ -47,6 +48,9 @@
|
||||
<if test="supermarketSpuQueryDTO.productName != null and supermarketSpuQueryDTO.productName != ''">
|
||||
and esp.product_name like concat('%', #{supermarketSpuQueryDTO.productName}, '%')
|
||||
</if>
|
||||
<if test="supermarketSpuQueryDTO.categoryId != null and supermarketSpuQueryDTO.categoryId != ''">
|
||||
and esp.category_id = #{supermarketSpuQueryDTO.categoryId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in new issue
Block a user