Merge branch 'master' of http://gitea.zianxin.com/zianxin-tec/biz-api-cloud
This commit is contained in:
commit
9012a87c50
19 files changed
+178
-93
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("货商")
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ public class InventoryDetailQueryDTO {
|
||||
* 单据日期
|
||||
*/
|
||||
@Schema(description="单据日期")
|
||||
private LocalDate ddDate;
|
||||
private LocalDate inventoryDate;
|
||||
|
||||
@Schema(description="1入库 2出库")
|
||||
private Integer orderType;
|
||||
|
||||
+6
-6
@@ -107,8 +107,8 @@ public class SmErpSpuEntity extends Model<SmErpSpuEntity> {
|
||||
* 成本单价,单位: 分
|
||||
*/
|
||||
@Schema(description="成本单价,单位: 分")
|
||||
@JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
@JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
// @JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
// @JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
private Integer costPrice;
|
||||
|
||||
/**
|
||||
@@ -158,16 +158,16 @@ public class SmErpSpuEntity extends Model<SmErpSpuEntity> {
|
||||
* 进价(分为单位)
|
||||
*/
|
||||
@Schema(description="进价(分为单位)")
|
||||
@JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
@JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
// @JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
// @JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
private Integer purchasePrice;
|
||||
|
||||
/**
|
||||
* 零售价(分为单位)
|
||||
*/
|
||||
@Schema(description="零售价(分为单位)")
|
||||
@JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
@JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
// @JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
// @JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
private Integer retailPrice;
|
||||
|
||||
/**
|
||||
|
||||
+8
-8
@@ -67,16 +67,16 @@ public class SmErpUnitEntity extends Model<SmErpUnitEntity> {
|
||||
* 进价/单位分
|
||||
*/
|
||||
@Schema(description="进价/单位分")
|
||||
@JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
@JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
// @JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
// @JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
private Integer purchasePrice;
|
||||
|
||||
/**
|
||||
* 零售价/单位分
|
||||
*/
|
||||
@Schema(description="零售价/单位分")
|
||||
@JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
@JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
// @JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
// @JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
private Integer retailPrice;
|
||||
|
||||
/**
|
||||
@@ -89,16 +89,16 @@ public class SmErpUnitEntity extends Model<SmErpUnitEntity> {
|
||||
* 促销价
|
||||
*/
|
||||
@Schema(description="促销价")
|
||||
@JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
@JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
// @JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
// @JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
private Integer promotionPrice;
|
||||
|
||||
/**
|
||||
* 成本价
|
||||
*/
|
||||
@Schema(description="成本价")
|
||||
@JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
@JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
// @JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
// @JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
private Integer costPrice;
|
||||
|
||||
/**
|
||||
|
||||
+3
@@ -120,4 +120,7 @@ public class SmSpuEntity extends Model<SmSpuEntity> {
|
||||
*/
|
||||
@Schema(description="租户编号")
|
||||
private Long tenantId;
|
||||
|
||||
@Schema(description="商户id")
|
||||
private Long merchantId;
|
||||
}
|
||||
+30
-1
@@ -1,6 +1,10 @@
|
||||
package com.bsd.pjcloud.supermarket.vo.app;
|
||||
|
||||
|
||||
import com.bsd.pjcloud.common.core.util.MoneyDeserializer;
|
||||
import com.bsd.pjcloud.common.core.util.MoneySerializer;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -35,7 +39,7 @@ public class SupermarketAppSpuVo {
|
||||
* 库存
|
||||
*/
|
||||
@Schema(description="剩余库存")
|
||||
private Integer stock;
|
||||
private Double stock;
|
||||
|
||||
|
||||
/**
|
||||
@@ -49,6 +53,31 @@ public class SupermarketAppSpuVo {
|
||||
@Schema(description = "销量")
|
||||
private Integer salesCount;
|
||||
|
||||
/**
|
||||
* 零售价/单位分
|
||||
*/
|
||||
@Schema(description="零售价/单位分")
|
||||
// @JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
// @JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
private Integer retailPrice;
|
||||
|
||||
/**
|
||||
* 促销价
|
||||
*/
|
||||
@Schema(description="促销价")
|
||||
// @JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
// @JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
private Integer promotionPrice;
|
||||
|
||||
|
||||
|
||||
@Schema(description="单位")
|
||||
private String unit;
|
||||
|
||||
|
||||
@Schema(description="规格")
|
||||
private String spec;
|
||||
|
||||
|
||||
|
||||
}
|
||||
+5
-8
@@ -10,20 +10,17 @@ import lombok.Data;
|
||||
* @date 2024-12-20 11:08:08
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "货商类别下拉")
|
||||
@Schema(description = "货商下拉")
|
||||
public class SmErpSupplierSimpleVo {
|
||||
|
||||
|
||||
/**
|
||||
* 类别ID
|
||||
*/
|
||||
@Schema(description="类别ID")
|
||||
private Long id;
|
||||
@Schema(description="id")
|
||||
private Long supplierId;
|
||||
|
||||
/**
|
||||
* 货商类别名称
|
||||
*/
|
||||
@Schema(description="货商类别名称")
|
||||
private String typeName;
|
||||
@Schema(description="货商名称")
|
||||
private String supplierName;
|
||||
|
||||
}
|
||||
+3
-33
@@ -39,19 +39,13 @@ public class InventoryRecordPageVo {
|
||||
|
||||
|
||||
@Schema(description="供应商id")
|
||||
private Long supplierId;
|
||||
private Long supplierName;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description="备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
@@ -60,33 +54,16 @@ public class InventoryRecordPageVo {
|
||||
@Schema(description="创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 审批状态
|
||||
*/
|
||||
@Schema(description="审批状态")
|
||||
private String checkStatus;
|
||||
|
||||
|
||||
@Schema(description="关联码")
|
||||
private String linkCode;
|
||||
|
||||
|
||||
/**
|
||||
* 库存商品id
|
||||
*/
|
||||
@Schema(description="库存商品id")
|
||||
private Long erpSpuId;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@Schema(description="数量")
|
||||
@Schema(description="入库数量")
|
||||
private Integer quantity;
|
||||
|
||||
/**
|
||||
* 进价
|
||||
*/
|
||||
@Schema(description="进价")
|
||||
@Schema(description="入库单价")
|
||||
@JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
@JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
private Integer unitPrice;
|
||||
@@ -125,11 +102,4 @@ public class InventoryRecordPageVo {
|
||||
@Schema(description="装数")
|
||||
private Integer packageNum;
|
||||
|
||||
/**
|
||||
* 进价(分为单位)
|
||||
*/
|
||||
@Schema(description="进价(分为单位)")
|
||||
@JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
@JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
private Integer purchasePrice;
|
||||
}
|
||||
@@ -64,6 +64,11 @@
|
||||
<artifactId>pjcloud-supermarket-api</artifactId>
|
||||
<version>5.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-wallet-api</artifactId>
|
||||
<version>5.7.0</version>
|
||||
</dependency>
|
||||
<!--必备: log 依赖-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
|
||||
+23
-11
@@ -257,17 +257,29 @@ public class SmErpInventoryRecordsController {
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页获取出入库明细" , description = "出库明细,入库明细" )
|
||||
@GetMapping("/inventoryDetail/page" )
|
||||
public R getInventoryDetailPage(@ParameterObject Page page, @ParameterObject InventoryDetailQueryDTO inventoryDetailQueryDTO) {
|
||||
|
||||
LambdaQueryWrapper<SmErpInventoryRecordsEntity> wrapper = Wrappers.lambdaQuery();
|
||||
if (StringUtils.isNotBlank(inventoryDetailQueryDTO.getKey())){
|
||||
wrapper.like(SmErpInventoryRecordsEntity::getProductName,inventoryDetailQueryDTO.getKey());
|
||||
}
|
||||
wrapper.eq(Objects.nonNull(inventoryDetailQueryDTO.getDdDate()),SmErpInventoryRecordsEntity::getInventoryDate,inventoryDetailQueryDTO.getDdDate());
|
||||
wrapper.eq(SmErpInventoryRecordsEntity::getOrderType,inventoryDetailQueryDTO.getOrderType());
|
||||
//todo 审核成功条件
|
||||
// wrapper.eq(SmErpCgPlanEntity::getCheckStatus,);
|
||||
@GetMapping("/inventoryType/page" )
|
||||
public R getinventoryTypePage(@ParameterObject Page page, @ParameterObject InventoryDetailQueryDTO inventoryDetailQueryDTO) {
|
||||
return R.ok(smErpInventoryRecordsService.getInventoryDetailPage(page, inventoryDetailQueryDTO));
|
||||
}
|
||||
/**
|
||||
*
|
||||
*根据单号获取明细
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页获取出入库明细" , description = "出库明细,入库明细" )
|
||||
@GetMapping("/inventoryDetail" )
|
||||
public R getInventoryDetailByInventoryCode(@RequestParam("id")String inventoryCode) {
|
||||
return R.ok(smErpInventoryRecordsService.getInventoryDetailByInventoryCode(inventoryCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页获取出入库汇总" , description = "出库汇总,入库汇总" )
|
||||
@GetMapping("/inventoryTypeSum/page" )
|
||||
public R getInventoryTypeSumPage(@ParameterObject Page page, @ParameterObject InventoryDetailQueryDTO inventoryDetailQueryDTO) {
|
||||
return R.ok(smErpInventoryRecordsService.getInventoryTypeSumPage(page, inventoryDetailQueryDTO));
|
||||
}
|
||||
}
|
||||
+1
-7
@@ -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("导入数据不能为空");
|
||||
}
|
||||
@@ -290,7 +284,7 @@ public class SmErpSpuController {
|
||||
* 条件查询spu单表 列表信息
|
||||
* @param supermarketSpuQueryDTO 商品spu
|
||||
* @return
|
||||
*/
|
||||
*///todo 待完善,返回的参数不全,有问题
|
||||
@Operation(summary = "APP根据条件查询分页SPU" , description = "APP条件分页查询" )
|
||||
@PostMapping("/app/selectListAll" )
|
||||
@PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_view')" )
|
||||
|
||||
+17
@@ -9,12 +9,15 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.supermarket.entity.SmErpSpuEntity;
|
||||
import com.bsd.pjcloud.supermarket.entity.SmSpuEntity;
|
||||
import com.bsd.pjcloud.supermarket.mapper.SmErpSpuMapper;
|
||||
import com.bsd.pjcloud.supermarket.service.SmErpSpuService;
|
||||
import com.bsd.pjcloud.supermarket.service.SmSpuService;
|
||||
import com.bsd.pjcloud.supermarket.vo.sm.smspu.SmSpuEditVo;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
@@ -45,6 +48,7 @@ public class SmSpuController {
|
||||
|
||||
private final SmErpSpuService smErpSpuService;
|
||||
|
||||
private final RemoteMchService remoteMchService;
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
@@ -86,6 +90,15 @@ public class SmSpuController {
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('supermarket_smSpu_add')" )
|
||||
public R save(@RequestBody SmSpuEntity smSpu) {
|
||||
Long deptId = SecurityUtils.getUser().getDeptId();
|
||||
//查询商户,设置商户id
|
||||
R<MchManageVo> byDeptId = remoteMchService.getByDeptId(deptId);
|
||||
MchManageVo data = byDeptId.getData();
|
||||
if (Objects.isNull(data) || !data.getTypes().contains("2")){
|
||||
return R.failed("当前用户未绑定超市商户");
|
||||
}
|
||||
smSpu.setDeptId(deptId);
|
||||
smSpu.setMerchantId(data.getId());
|
||||
return R.ok(smSpuService.save(smSpu));
|
||||
}
|
||||
|
||||
@@ -128,4 +141,8 @@ public class SmSpuController {
|
||||
public List<SmSpuEntity> export(SmSpuEntity smSpu,Long[] ids) {
|
||||
return smSpuService.list(Wrappers.lambdaQuery(smSpu).in(ArrayUtil.isNotEmpty(ids), SmSpuEntity::getId, ids));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+1
-1
@@ -20,5 +20,5 @@ public interface SmErpInventoryRecordsMapper extends PjcloudBaseMapper<SmErpInve
|
||||
* @param of
|
||||
* @return
|
||||
*/
|
||||
Page<InventoryRecordPageVo> getInventoryDetailPageByScope(@Param("inventoryDetailQueryDTO") InventoryDetailQueryDTO inventoryDetailQueryDTO, DataScope of);
|
||||
Page<InventoryRecordPageVo> getInventoryDetailPageByScope(Page page,@Param("inventoryDetailQueryDTO") InventoryDetailQueryDTO inventoryDetailQueryDTO, DataScope of);
|
||||
}
|
||||
+16
@@ -42,4 +42,20 @@ public interface SmErpInventoryRecordsService extends IService<SmErpInventoryRec
|
||||
* @return
|
||||
*/
|
||||
Object getInventoryDetailPage(Page page, InventoryDetailQueryDTO inventoryDetailQueryDTO);
|
||||
|
||||
|
||||
/**
|
||||
* 出库入库明细详情查询
|
||||
* @param inventoryCode
|
||||
* @return
|
||||
*/
|
||||
Object getInventoryDetailByInventoryCode(String inventoryCode);
|
||||
|
||||
/**
|
||||
* 出库入库汇总查询
|
||||
* @param page
|
||||
* @param inventoryDetailQueryDTO
|
||||
* @return
|
||||
*/
|
||||
Object getInventoryTypeSumPage(Page page, InventoryDetailQueryDTO inventoryDetailQueryDTO);
|
||||
}
|
||||
+13
-1
@@ -70,6 +70,8 @@ public class SmErpInventoryRecordsServiceImpl extends ServiceImpl<SmErpInventory
|
||||
int insert = baseMapper.insert(smErpCgDdEntity);
|
||||
|
||||
List<SmErpInventoryRecordsItemEntity> cgPlanItemEntities = BeanUtils.toBean(items, SmErpInventoryRecordsItemEntity.class);
|
||||
// int sum1 = cgPlanItemEntities.stream().mapToInt(SmErpInventoryRecordsItemEntity::getTotalAmount).sum();
|
||||
|
||||
List<UpdateStockDTO> updateStockDTOS = new ArrayList<>();
|
||||
for (SmErpInventoryRecordsItemEntity cgPlanItemEntity : cgPlanItemEntities) {
|
||||
cgPlanItemEntity.setInventoryId(smErpCgDdEntity.getId());
|
||||
@@ -234,10 +236,20 @@ public class SmErpInventoryRecordsServiceImpl extends ServiceImpl<SmErpInventory
|
||||
|
||||
@Override
|
||||
public Object getInventoryDetailPage(Page page, InventoryDetailQueryDTO inventoryDetailQueryDTO) {
|
||||
Page<InventoryRecordPageVo> pagedata=baseMapper.getInventoryDetailPageByScope(inventoryDetailQueryDTO, DataScope.of());
|
||||
Page<InventoryRecordPageVo> pagedata=baseMapper.getInventoryDetailPageByScope(page,inventoryDetailQueryDTO, DataScope.of());
|
||||
|
||||
return pagedata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getInventoryDetailByInventoryCode(String inventoryCode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getInventoryTypeSumPage(Page page, InventoryDetailQueryDTO inventoryDetailQueryDTO) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+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
@@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
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.supermarket.dto.SupermarketSpuAppQueryDTO;
|
||||
import com.bsd.pjcloud.supermarket.entity.SmSpuEntity;
|
||||
import com.bsd.pjcloud.supermarket.mapper.SmErpSpuMapper;
|
||||
@@ -13,6 +15,8 @@ import com.bsd.pjcloud.supermarket.mapper.SmSpuMapper;
|
||||
import com.bsd.pjcloud.supermarket.service.SmSpuService;
|
||||
import com.bsd.pjcloud.supermarket.vo.app.SupermarketAppSpuVo;
|
||||
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.springframework.stereotype.Service;
|
||||
|
||||
@@ -32,6 +36,7 @@ public class SmSpuServiceImpl extends ServiceImpl<SmSpuMapper, SmSpuEntity> impl
|
||||
private final SmErpSpuMapper smErpSpuMapper;
|
||||
|
||||
private final SmErpUnitMapper smErpUnitMapper;
|
||||
|
||||
@Override
|
||||
public Object pageScope(Page page, SmSpuEntity smSpu) {
|
||||
IPage<SmErpPageScopeVo> pageData = baseMapper.selectSmErpPageScopeVo(page,smSpu, DataScope.of());
|
||||
|
||||
+9
-3
@@ -29,8 +29,14 @@
|
||||
<result property="deviceType" column="device_type"/>
|
||||
</resultMap>
|
||||
<select id="getInventoryDetailPageByScope"
|
||||
resultType="com.bsd.pjcloud.supermarket.vo.inventoryrecord.InventoryRecordPageVo">
|
||||
SELECT r.inventory_code,
|
||||
resultType="com.bsd.pjcloud.supermarket.vo.inventoryrecord.InventoryRecordPageVo" parameterType="com.bsd.pjcloud.supermarket.dto.inventoryrecords.InventoryDetailQueryDTO">
|
||||
SELECT
|
||||
i.id,
|
||||
i.quantity,
|
||||
i.remark,
|
||||
i.unit_price,
|
||||
i.total_amount,
|
||||
r.inventory_code,
|
||||
u.bar_code,
|
||||
sp.product_name,
|
||||
u.spec,
|
||||
@@ -55,7 +61,7 @@
|
||||
<if test="inventoryDetailQueryDTO.orderType != null and inventoryDetailQueryDTO.orderType != ''">
|
||||
and r.order_type = #{inventoryDetailQueryDTO.orderType}
|
||||
</if>
|
||||
<if test="inventoryDetailQueryDTO.inventoryDate != null and inventoryDetailQueryDTO.inventoryDate != ''">
|
||||
<if test="inventoryDetailQueryDTO.inventoryDate != null">
|
||||
and r.inventory_date = #{inventoryDetailQueryDTO.inventoryDate}
|
||||
</if>
|
||||
<if test="inventoryDetailQueryDTO.key != null and inventoryDetailQueryDTO.key != ''">
|
||||
|
||||
+11
-5
@@ -34,17 +34,23 @@
|
||||
</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, esp.retail_price, esp.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
|
||||
LEFT JOIN sm_erp_spu esp
|
||||
on sp.erp_spu_id = esp.id
|
||||
LEFT JOIN sm_erp_unit u
|
||||
on esp.id=u.spu_id
|
||||
LEFT JOIN sm_erp_stock stock
|
||||
on esp.id = stock.erp_spu_id
|
||||
on esp.id = stock.erp_spu_id
|
||||
<where>
|
||||
esp.status = 0 and esp.merchant_id=${supermarketSpuQueryDTO.merchantId}
|
||||
esp.status = 0 and sp.merchant_id=${supermarketSpuQueryDTO.merchantId}
|
||||
<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