|
@@ -62,8 +62,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
@Service
|
|
@Service
|
|
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
|
@Slf4j
|
|
@Slf4j
|
|
|
-public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
|
|
-{
|
|
|
|
|
|
|
+public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private FsStoreProductScrmMapper fsStoreProductMapper;
|
|
private FsStoreProductScrmMapper fsStoreProductMapper;
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -111,8 +110,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
* @return 商品
|
|
* @return 商品
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public FsStoreProductScrm selectFsStoreProductById(Long productId)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ public FsStoreProductScrm selectFsStoreProductById(Long productId) {
|
|
|
return fsStoreProductMapper.selectFsStoreProductById(productId);
|
|
return fsStoreProductMapper.selectFsStoreProductById(productId);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -123,8 +121,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
* @return 商品
|
|
* @return 商品
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public List<FsStoreProductScrm> selectFsStoreProductList(FsStoreProductScrm fsStoreProduct)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ public List<FsStoreProductScrm> selectFsStoreProductList(FsStoreProductScrm fsStoreProduct) {
|
|
|
return fsStoreProductMapper.selectFsStoreProductList(fsStoreProduct);
|
|
return fsStoreProductMapper.selectFsStoreProductList(fsStoreProduct);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -135,8 +132,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
* @return 结果
|
|
* @return 结果
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public int insertFsStoreProduct(FsStoreProductScrm fsStoreProduct)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ public int insertFsStoreProduct(FsStoreProductScrm fsStoreProduct) {
|
|
|
fsStoreProduct.setCreateTime(DateUtils.getNowDate());
|
|
fsStoreProduct.setCreateTime(DateUtils.getNowDate());
|
|
|
fsStoreProductMapper.insertFsStoreProduct(fsStoreProduct);
|
|
fsStoreProductMapper.insertFsStoreProduct(fsStoreProduct);
|
|
|
storeAuditLogUtil.addOperLog(fsStoreProduct.getProductId());
|
|
storeAuditLogUtil.addOperLog(fsStoreProduct.getProductId());
|
|
@@ -150,8 +146,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
* @return 结果
|
|
* @return 结果
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public int updateFsStoreProduct(FsStoreProductScrm fsStoreProduct)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ public int updateFsStoreProduct(FsStoreProductScrm fsStoreProduct) {
|
|
|
fsStoreProduct.setUpdateTime(DateUtils.getNowDate());
|
|
fsStoreProduct.setUpdateTime(DateUtils.getNowDate());
|
|
|
storeAuditLogUtil.addOperLog(fsStoreProduct.getProductId());
|
|
storeAuditLogUtil.addOperLog(fsStoreProduct.getProductId());
|
|
|
FsStoreProductScrm oldFsStoreProduct = fsStoreProductMapper.selectFsStoreProductById(fsStoreProduct.getProductId());
|
|
FsStoreProductScrm oldFsStoreProduct = fsStoreProductMapper.selectFsStoreProductById(fsStoreProduct.getProductId());
|
|
@@ -162,7 +157,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
Map<String, Object> diff = getDiff(oldFsStoreProduct, fsStoreProduct);
|
|
Map<String, Object> diff = getDiff(oldFsStoreProduct, fsStoreProduct);
|
|
|
Set<String> diff_columns = diff.keySet();
|
|
Set<String> diff_columns = diff.keySet();
|
|
|
JSONArray productColumns = configUtil.generateConfigByKey("medicalMall.func.switch").getJSONArray("productColumns");
|
|
JSONArray productColumns = configUtil.generateConfigByKey("medicalMall.func.switch").getJSONArray("productColumns");
|
|
|
- if(com.fs.common.utils.StringUtils.isNotEmpty(productColumns)){
|
|
|
|
|
|
|
+ if (com.fs.common.utils.StringUtils.isNotEmpty(productColumns)) {
|
|
|
//判断diff_columns是否在productColumns中,不是则将isAudit设置为0
|
|
//判断diff_columns是否在productColumns中,不是则将isAudit设置为0
|
|
|
for (String column : diff_columns) {
|
|
for (String column : diff_columns) {
|
|
|
if (!productColumns.contains(column)) {
|
|
if (!productColumns.contains(column)) {
|
|
@@ -170,7 +165,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
fsStoreProduct.setIsAudit("0");
|
|
fsStoreProduct.setIsAudit("0");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -217,8 +212,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
* @return 结果
|
|
* @return 结果
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public int deleteFsStoreProductByIds(Long[] productIds)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ public int deleteFsStoreProductByIds(Long[] productIds) {
|
|
|
storeAuditLogUtil.addBatchAuditArray(productIds, "", "");
|
|
storeAuditLogUtil.addBatchAuditArray(productIds, "", "");
|
|
|
return fsStoreProductMapper.deleteFsStoreProductByIds(productIds);
|
|
return fsStoreProductMapper.deleteFsStoreProductByIds(productIds);
|
|
|
}
|
|
}
|
|
@@ -230,8 +224,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
* @return 结果
|
|
* @return 结果
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public int deleteFsStoreProductById(Long productId)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ public int deleteFsStoreProductById(Long productId) {
|
|
|
return fsStoreProductMapper.deleteFsStoreProductById(productId);
|
|
return fsStoreProductMapper.deleteFsStoreProductById(productId);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -240,20 +233,20 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
List<FsStoreProductListVO> fsStoreProductListVOS = fsStoreProductMapper.selectFsStoreProductListVO(fsStoreProduct);
|
|
List<FsStoreProductListVO> fsStoreProductListVOS = fsStoreProductMapper.selectFsStoreProductListVO(fsStoreProduct);
|
|
|
|
|
|
|
|
for (FsStoreProductListVO item : fsStoreProductListVOS) {
|
|
for (FsStoreProductListVO item : fsStoreProductListVOS) {
|
|
|
- if(StringUtils.isNotBlank(item.getCompanyIds())){
|
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(item.getCompanyIds())) {
|
|
|
List<String> companyNameList = new ArrayList<>();
|
|
List<String> companyNameList = new ArrayList<>();
|
|
|
String[] split = item.getCompanyIds().split(",");
|
|
String[] split = item.getCompanyIds().split(",");
|
|
|
|
|
|
|
|
for (String companyId : split) {
|
|
for (String companyId : split) {
|
|
|
- if(StringUtils.isNotBlank(companyId)) {
|
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(companyId)) {
|
|
|
String companyName = companyCacheService.selectCompanyNameById(Long.valueOf(companyId));
|
|
String companyName = companyCacheService.selectCompanyNameById(Long.valueOf(companyId));
|
|
|
companyNameList.add(companyName);
|
|
companyNameList.add(companyName);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- item.setCompanyName(String.join(",",companyNameList));
|
|
|
|
|
|
|
+ item.setCompanyName(String.join(",", companyNameList));
|
|
|
}
|
|
}
|
|
|
//店铺名称
|
|
//店铺名称
|
|
|
- if(StringUtils.isNotEmpty(item.getStoreId()))
|
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(item.getStoreId()))
|
|
|
item.setStoreName(fsStoreScrmService.selectFsStoreByStoreId(Long.parseLong(item.getStoreId())).getStoreName());
|
|
item.setStoreName(fsStoreScrmService.selectFsStoreByStoreId(Long.parseLong(item.getStoreId())).getStoreName());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -265,7 +258,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
List<FsStoreProductListVO> fsStoreProductListVOS = fsStoreProductMapper.selectFsStoreProductBarCodeListVO(fsStoreProduct);
|
|
List<FsStoreProductListVO> fsStoreProductListVOS = fsStoreProductMapper.selectFsStoreProductBarCodeListVO(fsStoreProduct);
|
|
|
|
|
|
|
|
for (FsStoreProductListVO item : fsStoreProductListVOS) {
|
|
for (FsStoreProductListVO item : fsStoreProductListVOS) {
|
|
|
- if(StringUtils.isNotBlank(item.getCompanyIds())){
|
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(item.getCompanyIds())) {
|
|
|
List<String> companyNameList = new ArrayList<>();
|
|
List<String> companyNameList = new ArrayList<>();
|
|
|
String[] split = item.getCompanyIds().split(",");
|
|
String[] split = item.getCompanyIds().split(",");
|
|
|
|
|
|
|
@@ -273,14 +266,14 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
String companyName = companyCacheService.selectCompanyNameById(Long.valueOf(companyId));
|
|
String companyName = companyCacheService.selectCompanyNameById(Long.valueOf(companyId));
|
|
|
companyNameList.add(companyName);
|
|
companyNameList.add(companyName);
|
|
|
}
|
|
}
|
|
|
- item.setCompanyName(String.join(",",companyNameList));
|
|
|
|
|
|
|
+ item.setCompanyName(String.join(",", companyNameList));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return fsStoreProductListVOS;
|
|
return fsStoreProductListVOS;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public Map<String, Object> getFormatAttr(Long productId, String jsonStr,Long[] stores) {
|
|
|
|
|
|
|
+ public Map<String, Object> getFormatAttr(Long productId, String jsonStr, Long[] stores) {
|
|
|
JSONObject jsonObject = JSON.parseObject(jsonStr);
|
|
JSONObject jsonObject = JSON.parseObject(jsonStr);
|
|
|
Map<String, Object> resultMap = new LinkedHashMap<>(3);
|
|
Map<String, Object> resultMap = new LinkedHashMap<>(3);
|
|
|
if (jsonObject == null || jsonObject.get("attrs") == null || jsonObject.getJSONArray("attrs").isEmpty()) {
|
|
if (jsonObject == null || jsonObject.get("attrs") == null || jsonObject.getJSONArray("attrs").isEmpty()) {
|
|
@@ -346,13 +339,13 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
valueMap.put("brokerageThree", 0);
|
|
valueMap.put("brokerageThree", 0);
|
|
|
valueMap.put("integral", 0);
|
|
valueMap.put("integral", 0);
|
|
|
if (productId > 0) {
|
|
if (productId > 0) {
|
|
|
- FsStoreProductAttrValueScrm attrValueMap=new FsStoreProductAttrValueScrm();
|
|
|
|
|
|
|
+ FsStoreProductAttrValueScrm attrValueMap = new FsStoreProductAttrValueScrm();
|
|
|
attrValueMap.setProductId(productId);
|
|
attrValueMap.setProductId(productId);
|
|
|
attrValueMap.setSku(sku);
|
|
attrValueMap.setSku(sku);
|
|
|
List<FsStoreProductAttrValueScrm> values = fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueList(attrValueMap);
|
|
List<FsStoreProductAttrValueScrm> values = fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueList(attrValueMap);
|
|
|
- if (values != null&&values.size()==1) {
|
|
|
|
|
- valueMap.put("id",values.get(0).getId());
|
|
|
|
|
- valueMap.put("sku",values.get(0).getSku());
|
|
|
|
|
|
|
+ if (values != null && values.size() == 1) {
|
|
|
|
|
+ valueMap.put("id", values.get(0).getId());
|
|
|
|
|
+ valueMap.put("sku", values.get(0).getSku());
|
|
|
valueMap.put("image", values.get(0).getImage());
|
|
valueMap.put("image", values.get(0).getImage());
|
|
|
valueMap.put("price", values.get(0).getPrice());
|
|
valueMap.put("price", values.get(0).getPrice());
|
|
|
valueMap.put("cost", values.get(0).getCost());
|
|
valueMap.put("cost", values.get(0).getCost());
|
|
@@ -381,9 +374,9 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional
|
|
@Transactional
|
|
|
public R addOrEdit(FsStoreProductAddEditParam param) {
|
|
public R addOrEdit(FsStoreProductAddEditParam param) {
|
|
|
- ProductAttrCountDto countDto=computedProductCount(param.getValues());
|
|
|
|
|
- FsStoreProductScrm product=new FsStoreProductScrm();
|
|
|
|
|
- BeanUtils.copyProperties(param,product);
|
|
|
|
|
|
|
+ ProductAttrCountDto countDto = computedProductCount(param.getValues());
|
|
|
|
|
+ FsStoreProductScrm product = new FsStoreProductScrm();
|
|
|
|
|
+ BeanUtils.copyProperties(param, product);
|
|
|
product.setPrice(countDto.getMinPrice());
|
|
product.setPrice(countDto.getMinPrice());
|
|
|
product.setOtPrice(countDto.getMinOtPrice());
|
|
product.setOtPrice(countDto.getMinOtPrice());
|
|
|
product.setCost(countDto.getMinCost());
|
|
product.setCost(countDto.getMinCost());
|
|
@@ -395,35 +388,42 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
product.setStoreId(storeId);
|
|
product.setStoreId(storeId);
|
|
|
product.setIsDrug(param.getIsDrug().toString());
|
|
product.setIsDrug(param.getIsDrug().toString());
|
|
|
product.setInstructionManual(param.getInstructionManual());
|
|
product.setInstructionManual(param.getInstructionManual());
|
|
|
-
|
|
|
|
|
|
|
+ product.setReviewAudit(param.getReviewAudit());
|
|
|
|
|
+ product.setQualificationCertificate(param.getQualificationCertificate());
|
|
|
|
|
+ if (param.getQualificationCertificateStart() != null) {
|
|
|
|
|
+ product.setQualificationCertificateStart(LocalDate.parse(param.getQualificationCertificateStart()));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (param.getQualificationCertificateEnd() != null) {
|
|
|
|
|
+ product.setQualificationCertificateEnd(LocalDate.parse(param.getQualificationCertificateEnd()));
|
|
|
|
|
+ }
|
|
|
//获取商品编码
|
|
//获取商品编码
|
|
|
- if(!param.getValues().isEmpty()){
|
|
|
|
|
- if(param.getValues().get(0).getBarCode() != null){
|
|
|
|
|
|
|
+ if (!param.getValues().isEmpty()) {
|
|
|
|
|
+ if (param.getValues().get(0).getBarCode() != null) {
|
|
|
product.setBarCode(param.getValues().get(0).getBarCode());
|
|
product.setBarCode(param.getValues().get(0).getBarCode());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
//校验店铺资质信息
|
|
//校验店铺资质信息
|
|
|
//获取店铺
|
|
//获取店铺
|
|
|
FsStoreScrm store = fsStoreScrmService.selectFsStoreByStoreId(product.getStoreId());
|
|
FsStoreScrm store = fsStoreScrmService.selectFsStoreByStoreId(product.getStoreId());
|
|
|
- if(store == null || 1 != store.getStatus()){
|
|
|
|
|
|
|
+ if (store == null || 1 != store.getStatus()) {
|
|
|
return R.error("店铺不存在或未启用");
|
|
return R.error("店铺不存在或未启用");
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
//验证资质
|
|
//验证资质
|
|
|
- switch (product.getProductType()){
|
|
|
|
|
|
|
+ switch (product.getProductType()) {
|
|
|
case 1://非处方
|
|
case 1://非处方
|
|
|
break;
|
|
break;
|
|
|
case 2://处方
|
|
case 2://处方
|
|
|
- if(StringUtils.isEmpty(store.getDrugLicense()) || "".equals(store.getDrugLicense()) || LocalDate.now().isAfter(store.getDrugLicenseExpiryEnd())){
|
|
|
|
|
|
|
+ if (StringUtils.isEmpty(store.getDrugLicense()) || "".equals(store.getDrugLicense()) || LocalDate.now().isAfter(store.getDrugLicenseExpiryEnd())) {
|
|
|
return R.error("店铺药品资质为空或已过期,请完善后再添加");
|
|
return R.error("店铺药品资质为空或已过期,请完善后再添加");
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
case 3://食品
|
|
case 3://食品
|
|
|
- if(StringUtils.isEmpty(store.getFoodLicense()) || "".equals(store.getFoodLicense()) || LocalDate.now().isAfter(store.getFoodLicenseExpiryEnd())){
|
|
|
|
|
|
|
+ if (StringUtils.isEmpty(store.getFoodLicense()) || "".equals(store.getFoodLicense()) || LocalDate.now().isAfter(store.getFoodLicenseExpiryEnd())) {
|
|
|
return R.error("店铺食品资质为空或已过期,请完善后再添加");
|
|
return R.error("店铺食品资质为空或已过期,请完善后再添加");
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
case 4://器械
|
|
case 4://器械
|
|
|
- if(StringUtils.isEmpty(store.getMedicalDevice3()) || "".equals(store.getMedicalDevice3()) || LocalDate.now().isAfter(store.getMedicalDevice3ExpiryEnd())){
|
|
|
|
|
|
|
+ if (StringUtils.isEmpty(store.getMedicalDevice3()) || "".equals(store.getMedicalDevice3()) || LocalDate.now().isAfter(store.getMedicalDevice3ExpiryEnd())) {
|
|
|
return R.error("店铺器械资质为空或已过期,请完善后再添加");
|
|
return R.error("店铺器械资质为空或已过期,请完善后再添加");
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
@@ -432,11 +432,11 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if("纯正堂".equals(cloudHostProper.getCompanyName())){
|
|
|
|
|
|
|
+ if ("纯正堂".equals(cloudHostProper.getCompanyName())) {
|
|
|
product.setIsAudit("1");
|
|
product.setIsAudit("1");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if(param.getProductId() != null && param.getProductId() > 0){
|
|
|
|
|
|
|
+ if (param.getProductId() != null && param.getProductId() > 0) {
|
|
|
FsStoreProductScrm oldFsStoreProduct = fsStoreProductMapper.selectFsStoreProductById(product.getProductId());
|
|
FsStoreProductScrm oldFsStoreProduct = fsStoreProductMapper.selectFsStoreProductById(product.getProductId());
|
|
|
Boolean isAudit = configUtil.generateConfigByKey("medicalMall.func.switch").getBoolean("isAudit");
|
|
Boolean isAudit = configUtil.generateConfigByKey("medicalMall.func.switch").getBoolean("isAudit");
|
|
|
try {
|
|
try {
|
|
@@ -445,7 +445,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
Map<String, Object> diff = getDiff(oldFsStoreProduct, product);
|
|
Map<String, Object> diff = getDiff(oldFsStoreProduct, product);
|
|
|
Set<String> diff_columns = diff.keySet();
|
|
Set<String> diff_columns = diff.keySet();
|
|
|
JSONArray productColumns = configUtil.generateConfigByKey("medicalMall.func.switch").getJSONArray("productColumns");
|
|
JSONArray productColumns = configUtil.generateConfigByKey("medicalMall.func.switch").getJSONArray("productColumns");
|
|
|
- if(com.fs.common.utils.StringUtils.isNotEmpty(productColumns)){
|
|
|
|
|
|
|
+ if (com.fs.common.utils.StringUtils.isNotEmpty(productColumns)) {
|
|
|
//判断diff_columns是否在productColumns中,不是则将isAudit设置为0
|
|
//判断diff_columns是否在productColumns中,不是则将isAudit设置为0
|
|
|
for (String column : diff_columns) {
|
|
for (String column : diff_columns) {
|
|
|
if (!productColumns.contains(column)) {
|
|
if (!productColumns.contains(column)) {
|
|
@@ -453,7 +453,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
product.setIsAudit("0");
|
|
product.setIsAudit("0");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -467,15 +467,14 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
.value("规格")
|
|
.value("规格")
|
|
|
.detail(ListUtil.toList("默认"))
|
|
.detail(ListUtil.toList("默认"))
|
|
|
.build();
|
|
.build();
|
|
|
- List<ProductArrtDTO> items=new ArrayList<>();
|
|
|
|
|
|
|
+ List<ProductArrtDTO> items = new ArrayList<>();
|
|
|
items.add(fromatDetailDto);
|
|
items.add(fromatDetailDto);
|
|
|
param.getValues().get(0).setSku("默认");
|
|
param.getValues().get(0).setSku("默认");
|
|
|
- addProductAttr(product.getProductId(),items,param.getValues(),storeId);
|
|
|
|
|
|
|
+ addProductAttr(product.getProductId(), items, param.getValues(), storeId);
|
|
|
} else {
|
|
} else {
|
|
|
- addProductAttr(product.getProductId(),param.getItems(),param.getValues(),storeId);
|
|
|
|
|
|
|
+ addProductAttr(product.getProductId(), param.getItems(), param.getValues(), storeId);
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- else{
|
|
|
|
|
|
|
+ } else {
|
|
|
fsStoreProductMapper.insertFsStoreProduct(product);
|
|
fsStoreProductMapper.insertFsStoreProduct(product);
|
|
|
}
|
|
}
|
|
|
storeAuditLogUtil.addOperLog(product.getProductId());
|
|
storeAuditLogUtil.addOperLog(product.getProductId());
|
|
@@ -484,52 +483,52 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
.value("规格")
|
|
.value("规格")
|
|
|
.detail(ListUtil.toList("默认"))
|
|
.detail(ListUtil.toList("默认"))
|
|
|
.build();
|
|
.build();
|
|
|
- List<ProductArrtDTO> items=new ArrayList<>();
|
|
|
|
|
|
|
+ List<ProductArrtDTO> items = new ArrayList<>();
|
|
|
items.add(fromatDetailDto);
|
|
items.add(fromatDetailDto);
|
|
|
param.getValues().get(0).setSku("默认");
|
|
param.getValues().get(0).setSku("默认");
|
|
|
- addProductAttr(product.getProductId(),items,param.getValues(),storeId);
|
|
|
|
|
|
|
+ addProductAttr(product.getProductId(), items, param.getValues(), storeId);
|
|
|
} else {
|
|
} else {
|
|
|
- addProductAttr(product.getProductId(),param.getItems(),param.getValues(),storeId);
|
|
|
|
|
|
|
+ addProductAttr(product.getProductId(), param.getItems(), param.getValues(), storeId);
|
|
|
}
|
|
}
|
|
|
return R.ok();
|
|
return R.ok();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- private void addProductAttr(Long productId, List<ProductArrtDTO> items, List<FsStoreProductAttrValueScrm> values,Long storeId){
|
|
|
|
|
|
|
+ private void addProductAttr(Long productId, List<ProductArrtDTO> items, List<FsStoreProductAttrValueScrm> values, Long storeId) {
|
|
|
//清空attr
|
|
//清空attr
|
|
|
fsStoreProductAttrMapper.clear(productId);
|
|
fsStoreProductAttrMapper.clear(productId);
|
|
|
//清空values
|
|
//清空values
|
|
|
//查出商品属性所有ID;
|
|
//查出商品属性所有ID;
|
|
|
- List<FsStoreProductAttrValueScrm> attrValues=fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueByProductId(productId);
|
|
|
|
|
|
|
+ List<FsStoreProductAttrValueScrm> attrValues = fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueByProductId(productId);
|
|
|
fsStoreProductAttrValueMapper.deleteFsStoreProductAttrValueByProductId(productId);
|
|
fsStoreProductAttrValueMapper.deleteFsStoreProductAttrValueByProductId(productId);
|
|
|
//写入attr
|
|
//写入attr
|
|
|
- for(ProductArrtDTO vo:items){
|
|
|
|
|
- FsStoreProductAttrScrm attr=new FsStoreProductAttrScrm();
|
|
|
|
|
|
|
+ for (ProductArrtDTO vo : items) {
|
|
|
|
|
+ FsStoreProductAttrScrm attr = new FsStoreProductAttrScrm();
|
|
|
attr.setProductId(productId);
|
|
attr.setProductId(productId);
|
|
|
attr.setAttrName(vo.getValue());
|
|
attr.setAttrName(vo.getValue());
|
|
|
attr.setAttrValues(StringUtils.join(vo.getDetail(), ","));
|
|
attr.setAttrValues(StringUtils.join(vo.getDetail(), ","));
|
|
|
fsStoreProductAttrMapper.insertFsStoreProductAttr(attr);
|
|
fsStoreProductAttrMapper.insertFsStoreProductAttr(attr);
|
|
|
}
|
|
}
|
|
|
- Map<String,Object> map = new LinkedHashMap<>();
|
|
|
|
|
- map.put("attr",items);
|
|
|
|
|
|
|
+ Map<String, Object> map = new LinkedHashMap<>();
|
|
|
|
|
+ map.put("attr", items);
|
|
|
// map.put("value",values);
|
|
// map.put("value",values);
|
|
|
|
|
|
|
|
- for(FsStoreProductAttrValueScrm val: values){
|
|
|
|
|
|
|
+ for (FsStoreProductAttrValueScrm val : values) {
|
|
|
//更新套餐商品属性ID 获取套餐
|
|
//更新套餐商品属性ID 获取套餐
|
|
|
- Long id=val.getId();
|
|
|
|
|
- if(val.getDetail()!=null){
|
|
|
|
|
|
|
+ Long id = val.getId();
|
|
|
|
|
+ if (val.getDetail() != null) {
|
|
|
List<String> stringList = new ArrayList<>(val.getDetail().values());
|
|
List<String> stringList = new ArrayList<>(val.getDetail().values());
|
|
|
Collections.sort(stringList);
|
|
Collections.sort(stringList);
|
|
|
- val.setSku(StrUtil.join(",",stringList));
|
|
|
|
|
|
|
+ val.setSku(StrUtil.join(",", stringList));
|
|
|
}
|
|
}
|
|
|
val.setProductId(productId);
|
|
val.setProductId(productId);
|
|
|
val.setStoreId(storeId);
|
|
val.setStoreId(storeId);
|
|
|
fsStoreProductAttrValueMapper.insertFsStoreProductAttrValue(val);
|
|
fsStoreProductAttrValueMapper.insertFsStoreProductAttrValue(val);
|
|
|
- if(attrValues!=null&&attrValues.size()>0){
|
|
|
|
|
- for(FsStoreProductAttrValueScrm attrValue:attrValues){
|
|
|
|
|
- if(attrValue.getId().equals(id)){
|
|
|
|
|
- fsStoreProductGroupMapper.updateProducts(attrValue.getId(),val.getId());
|
|
|
|
|
- fsStoreProductPackageMapper.updateProducts(attrValue.getId(),val.getId());
|
|
|
|
|
|
|
+ if (attrValues != null && attrValues.size() > 0) {
|
|
|
|
|
+ for (FsStoreProductAttrValueScrm attrValue : attrValues) {
|
|
|
|
|
+ if (attrValue.getId().equals(id)) {
|
|
|
|
|
+ fsStoreProductGroupMapper.updateProducts(attrValue.getId(), val.getId());
|
|
|
|
|
+ fsStoreProductPackageMapper.updateProducts(attrValue.getId(), val.getId());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -709,9 +708,8 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
private ProductAttrCountDto computedProductCount(List<FsStoreProductAttrValueScrm> values) {
|
|
private ProductAttrCountDto computedProductCount(List<FsStoreProductAttrValueScrm> values) {
|
|
|
- BigDecimal val=new BigDecimal(0);
|
|
|
|
|
|
|
+ BigDecimal val = new BigDecimal(0);
|
|
|
//取最小价格
|
|
//取最小价格
|
|
|
BigDecimal minPrice = values
|
|
BigDecimal minPrice = values
|
|
|
.stream()
|
|
.stream()
|
|
@@ -764,35 +762,34 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public List<FsStoreProductListQueryVO> selectFsStoreProductListQuery(FsStoreProductQueryParam param) {
|
|
public List<FsStoreProductListQueryVO> selectFsStoreProductListQuery(FsStoreProductQueryParam param) {
|
|
|
SysConfig config = configService.selectConfigByConfigKey("medicalMall.func.switch");
|
|
SysConfig config = configService.selectConfigByConfigKey("medicalMall.func.switch");
|
|
|
MedicalMallConfig medicalMallConfig = JSON.parseObject(config.getConfigValue(), MedicalMallConfig.class);
|
|
MedicalMallConfig medicalMallConfig = JSON.parseObject(config.getConfigValue(), MedicalMallConfig.class);
|
|
|
boolean stores = medicalMallConfig != null && medicalMallConfig.isStores();
|
|
boolean stores = medicalMallConfig != null && medicalMallConfig.isStores();
|
|
|
- param.setIsStores(stores?1:0);
|
|
|
|
|
|
|
+ param.setIsStores(stores ? 1 : 0);
|
|
|
return fsStoreProductMapper.selectFsStoreProductListQuery(param);
|
|
return fsStoreProductMapper.selectFsStoreProductListQuery(param);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public FsStoreProductQueryVO selectFsStoreProductByIdQuery(Long productId,String storeId) {
|
|
|
|
|
|
|
+ public FsStoreProductQueryVO selectFsStoreProductByIdQuery(Long productId, String storeId) {
|
|
|
SysConfig config = configService.selectConfigByConfigKey("medicalMall.func.switch");
|
|
SysConfig config = configService.selectConfigByConfigKey("medicalMall.func.switch");
|
|
|
MedicalMallConfig medicalMallConfig = JSON.parseObject(config.getConfigValue(), MedicalMallConfig.class);
|
|
MedicalMallConfig medicalMallConfig = JSON.parseObject(config.getConfigValue(), MedicalMallConfig.class);
|
|
|
- return fsStoreProductMapper.selectFsStoreProductByIdQuery(productId,storeId,medicalMallConfig);
|
|
|
|
|
|
|
+ return fsStoreProductMapper.selectFsStoreProductByIdQuery(productId, storeId, medicalMallConfig);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void decProductStock(Long productId, Long productAttrValueId, Integer cartNum) {
|
|
public void decProductStock(Long productId, Long productAttrValueId, Integer cartNum) {
|
|
|
//处理属性sku
|
|
//处理属性sku
|
|
|
- fsStoreProductAttrValueMapper.decProductAttrStock(productAttrValueId,cartNum);
|
|
|
|
|
- fsStoreProductMapper.decProductAttrStock(productId,cartNum);
|
|
|
|
|
|
|
+ fsStoreProductAttrValueMapper.decProductAttrStock(productAttrValueId, cartNum);
|
|
|
|
|
+ fsStoreProductMapper.decProductAttrStock(productId, cartNum);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void incProductStock(Long num, Long productId, Long productAttrValueId) {
|
|
public void incProductStock(Long num, Long productId, Long productAttrValueId) {
|
|
|
//处理属性sku
|
|
//处理属性sku
|
|
|
- if (productAttrValueId!=null) {
|
|
|
|
|
|
|
+ if (productAttrValueId != null) {
|
|
|
attrValueService.incProductAttrStock(num, productId, productAttrValueId);
|
|
attrValueService.incProductAttrStock(num, productId, productAttrValueId);
|
|
|
}
|
|
}
|
|
|
//先处理商品库存
|
|
//先处理商品库存
|
|
@@ -824,7 +821,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
public List<FsStoreProductListQueryVO> selectFsStoreProductGoodQuery(int count) {
|
|
public List<FsStoreProductListQueryVO> selectFsStoreProductGoodQuery(int count) {
|
|
|
SysConfig config = configService.selectConfigByConfigKey("medicalMall.func.switch");
|
|
SysConfig config = configService.selectConfigByConfigKey("medicalMall.func.switch");
|
|
|
MedicalMallConfig medicalMallConfig = JSON.parseObject(config.getConfigValue(), MedicalMallConfig.class);
|
|
MedicalMallConfig medicalMallConfig = JSON.parseObject(config.getConfigValue(), MedicalMallConfig.class);
|
|
|
- return fsStoreProductMapper.selectFsStoreProductGoodQuery(count,medicalMallConfig);
|
|
|
|
|
|
|
+ return fsStoreProductMapper.selectFsStoreProductGoodQuery(count, medicalMallConfig);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -848,7 +845,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public Long selectFsStoreProductCount(int type, Long companyId) {
|
|
public Long selectFsStoreProductCount(int type, Long companyId) {
|
|
|
- return fsStoreProductMapper.selectFsStoreProductCompanyCount(type,companyId);
|
|
|
|
|
|
|
+ return fsStoreProductMapper.selectFsStoreProductCompanyCount(type, companyId);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -870,19 +867,17 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
@Override
|
|
@Override
|
|
|
public String importStoreProduct(List<FsStoreProductExportVO> list, boolean updateSupport) {
|
|
public String importStoreProduct(List<FsStoreProductExportVO> list, boolean updateSupport) {
|
|
|
storeAuditLogUtil.generateOperId();
|
|
storeAuditLogUtil.generateOperId();
|
|
|
- if (com.fs.common.utils.StringUtils.isNull(list) || list.size() == 0)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ if (com.fs.common.utils.StringUtils.isNull(list) || list.size() == 0) {
|
|
|
throw new CustomException("导入商品数据不能为空!");
|
|
throw new CustomException("导入商品数据不能为空!");
|
|
|
}
|
|
}
|
|
|
int successNum = 0;
|
|
int successNum = 0;
|
|
|
int failureNum = 0;
|
|
int failureNum = 0;
|
|
|
StringBuilder successMsg = new StringBuilder();
|
|
StringBuilder successMsg = new StringBuilder();
|
|
|
StringBuilder failureMsg = new StringBuilder();
|
|
StringBuilder failureMsg = new StringBuilder();
|
|
|
- for (FsStoreProductExportVO productVO : list){
|
|
|
|
|
- try
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ for (FsStoreProductExportVO productVO : list) {
|
|
|
|
|
+ try {
|
|
|
FsStoreProductScrm product = BeanCopyUtils.copy(productVO, FsStoreProductScrm.class);
|
|
FsStoreProductScrm product = BeanCopyUtils.copy(productVO, FsStoreProductScrm.class);
|
|
|
- if (product.getBarCode()==null || product.getBarCode()==""){
|
|
|
|
|
|
|
+ if (product.getBarCode() == null || product.getBarCode() == "") {
|
|
|
throw new CustomException("商品编号为空");
|
|
throw new CustomException("商品编号为空");
|
|
|
}
|
|
}
|
|
|
this.insertFsStoreProduct(product);
|
|
this.insertFsStoreProduct(product);
|
|
@@ -890,36 +885,36 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
.value("规格")
|
|
.value("规格")
|
|
|
.detail(ListUtil.toList("默认"))
|
|
.detail(ListUtil.toList("默认"))
|
|
|
.build();
|
|
.build();
|
|
|
- List<ProductArrtDTO> items=new ArrayList<>();
|
|
|
|
|
|
|
+ List<ProductArrtDTO> items = new ArrayList<>();
|
|
|
items.add(formatDetailDto);
|
|
items.add(formatDetailDto);
|
|
|
FsStoreProductAttrValueScrm p = new FsStoreProductAttrValueScrm();
|
|
FsStoreProductAttrValueScrm p = new FsStoreProductAttrValueScrm();
|
|
|
p.setProductId(product.getProductId());
|
|
p.setProductId(product.getProductId());
|
|
|
p.setSku("默认");
|
|
p.setSku("默认");
|
|
|
p.setStock(product.getStock().intValue());
|
|
p.setStock(product.getStock().intValue());
|
|
|
- if (product.getStock()==null){
|
|
|
|
|
|
|
+ if (product.getStock() == null) {
|
|
|
p.setStock(0);
|
|
p.setStock(0);
|
|
|
}
|
|
}
|
|
|
p.setSales(product.getSales().intValue());
|
|
p.setSales(product.getSales().intValue());
|
|
|
- if (product.getSales()==null){
|
|
|
|
|
|
|
+ if (product.getSales() == null) {
|
|
|
p.setStock(0);
|
|
p.setStock(0);
|
|
|
}
|
|
}
|
|
|
p.setPrice(product.getPrice());
|
|
p.setPrice(product.getPrice());
|
|
|
- if (product.getPrice()==null){
|
|
|
|
|
|
|
+ if (product.getPrice() == null) {
|
|
|
p.setPrice(new BigDecimal(0));
|
|
p.setPrice(new BigDecimal(0));
|
|
|
}
|
|
}
|
|
|
p.setImage(product.getImage());
|
|
p.setImage(product.getImage());
|
|
|
p.setCost(product.getCost());
|
|
p.setCost(product.getCost());
|
|
|
- if (product.getCost()==null){
|
|
|
|
|
|
|
+ if (product.getCost() == null) {
|
|
|
p.setCost(new BigDecimal(0));
|
|
p.setCost(new BigDecimal(0));
|
|
|
}
|
|
}
|
|
|
p.setBarCode(product.getBarCode());
|
|
p.setBarCode(product.getBarCode());
|
|
|
p.setGroupBarCode(product.getBarCode());
|
|
p.setGroupBarCode(product.getBarCode());
|
|
|
p.setOtPrice(product.getOtPrice());
|
|
p.setOtPrice(product.getOtPrice());
|
|
|
- if (product.getOtPrice()==null){
|
|
|
|
|
|
|
+ if (product.getOtPrice() == null) {
|
|
|
p.setOtPrice(new BigDecimal(0));
|
|
p.setOtPrice(new BigDecimal(0));
|
|
|
}
|
|
}
|
|
|
p.setWeight(productVO.getWeight());
|
|
p.setWeight(productVO.getWeight());
|
|
|
- if (productVO.getWeight()==null){
|
|
|
|
|
|
|
+ if (productVO.getWeight() == null) {
|
|
|
p.setWeight(new BigDecimal(0));
|
|
p.setWeight(new BigDecimal(0));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -938,23 +933,18 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
fsStoreProductAttrMapper.insertFsStoreProductAttr(attr);
|
|
fsStoreProductAttrMapper.insertFsStoreProductAttr(attr);
|
|
|
successNum++;
|
|
successNum++;
|
|
|
successMsg.append("<br/>" + successNum + "、商品 " + product.getProductName() + " 导入成功");
|
|
successMsg.append("<br/>" + successNum + "、商品 " + product.getProductName() + " 导入成功");
|
|
|
- }
|
|
|
|
|
- catch (Exception e)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
|
|
|
failureNum++;
|
|
failureNum++;
|
|
|
- String msg = "<br/>" + failureNum + "、商品 " + productVO.getProductName() + " 导入失败:";
|
|
|
|
|
|
|
+ String msg = "<br/>" + failureNum + "、商品 " + productVO.getProductName() + " 导入失败:";
|
|
|
failureMsg.append(msg + e.getMessage());
|
|
failureMsg.append(msg + e.getMessage());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
- if (failureNum > 0)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ if (failureNum > 0) {
|
|
|
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
|
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
|
|
throw new CustomException(failureMsg.toString());
|
|
throw new CustomException(failureMsg.toString());
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ } else {
|
|
|
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
|
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
|
|
}
|
|
}
|
|
|
return successMsg.toString();
|
|
return successMsg.toString();
|
|
@@ -962,7 +952,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void batchModify(ModifyMoreDTO modifyMoreDTO) {
|
|
public void batchModify(ModifyMoreDTO modifyMoreDTO) {
|
|
|
- storeAuditLogUtil.addBatchAuditList(modifyMoreDTO.getProductId(),"",null);
|
|
|
|
|
|
|
+ storeAuditLogUtil.addBatchAuditList(modifyMoreDTO.getProductId(), "", null);
|
|
|
fsStoreProductMapper.batchModify(modifyMoreDTO);
|
|
fsStoreProductMapper.batchModify(modifyMoreDTO);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -982,7 +972,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
StringBuilder failureMsg = new StringBuilder();
|
|
StringBuilder failureMsg = new StringBuilder();
|
|
|
|
|
|
|
|
//存储商品Id
|
|
//存储商品Id
|
|
|
- List<Long> jstProductIds=new LinkedList<>();
|
|
|
|
|
|
|
+ List<Long> jstProductIds = new LinkedList<>();
|
|
|
for (FsStoreProductExcelVO productVO : productList) {
|
|
for (FsStoreProductExcelVO productVO : productList) {
|
|
|
try {
|
|
try {
|
|
|
|
|
|
|
@@ -1076,17 +1066,17 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
Integer erpOpen = sysConfig.getErpOpen();
|
|
Integer erpOpen = sysConfig.getErpOpen();
|
|
|
if (erpOpen == null || erpOpen == 0) {
|
|
if (erpOpen == null || erpOpen == 0) {
|
|
|
//不作操作
|
|
//不作操作
|
|
|
- } else{
|
|
|
|
|
|
|
+ } else {
|
|
|
//判断erp类型
|
|
//判断erp类型
|
|
|
Integer erpType = sysConfig.getErpType();
|
|
Integer erpType = sysConfig.getErpType();
|
|
|
if (erpType == null) {
|
|
if (erpType == null) {
|
|
|
//不作操作
|
|
//不作操作
|
|
|
- }else if (erpType == 3) {
|
|
|
|
|
|
|
+ } else if (erpType == 3) {
|
|
|
ErpGoods params = new ErpGoods();
|
|
ErpGoods params = new ErpGoods();
|
|
|
params.setStoreProductId(product.getProductId());
|
|
params.setStoreProductId(product.getProductId());
|
|
|
//瀚智OMS 维护添加商品
|
|
//瀚智OMS 维护添加商品
|
|
|
hzOMSErpGoodsService.addGoodsScrm(params);
|
|
hzOMSErpGoodsService.addGoodsScrm(params);
|
|
|
- }else if(erpType == 5){
|
|
|
|
|
|
|
+ } else if (erpType == 5) {
|
|
|
jstProductIds.add(product.getProductId());
|
|
jstProductIds.add(product.getProductId());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1099,7 +1089,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//验证聚水潭商品Id
|
|
//验证聚水潭商品Id
|
|
|
- if(!jstProductIds.isEmpty()){
|
|
|
|
|
|
|
+ if (!jstProductIds.isEmpty()) {
|
|
|
//同步聚水潭商品
|
|
//同步聚水潭商品
|
|
|
ErpGoods params = new ErpGoods();
|
|
ErpGoods params = new ErpGoods();
|
|
|
params.setProductIdList(jstProductIds);
|
|
params.setProductIdList(jstProductIds);
|
|
@@ -1142,7 +1132,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
@Transactional
|
|
@Transactional
|
|
|
public void batchAudit(ProductAuditDTO auditDTO) {
|
|
public void batchAudit(ProductAuditDTO auditDTO) {
|
|
|
fsStoreProductMapper.batchAudit(auditDTO);
|
|
fsStoreProductMapper.batchAudit(auditDTO);
|
|
|
- storeAuditLogUtil.addBatchAuditList(auditDTO.getProductIds(),auditDTO.getReason(),auditDTO.getAttachImage());
|
|
|
|
|
|
|
+ storeAuditLogUtil.addBatchAuditList(auditDTO.getProductIds(), auditDTO.getReason(), auditDTO.getAttachImage());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -1151,9 +1141,10 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public List<FsStoreProductActivityListVO> selectFsStoreProductByIdsAudit(String productIds) {SysConfig config = configService.selectConfigByConfigKey("medicalMall.func.switch");
|
|
|
|
|
|
|
+ public List<FsStoreProductActivityListVO> selectFsStoreProductByIdsAudit(String productIds) {
|
|
|
|
|
+ SysConfig config = configService.selectConfigByConfigKey("medicalMall.func.switch");
|
|
|
MedicalMallConfig medicalMallConfig = JSON.parseObject(config.getConfigValue(), MedicalMallConfig.class);
|
|
MedicalMallConfig medicalMallConfig = JSON.parseObject(config.getConfigValue(), MedicalMallConfig.class);
|
|
|
- return fsStoreProductMapper.selectFsStoreProductByIdsAudit(productIds,medicalMallConfig);
|
|
|
|
|
|
|
+ return fsStoreProductMapper.selectFsStoreProductByIdsAudit(productIds, medicalMallConfig);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -1161,10 +1152,10 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
public R bulkCopyFsStoreProductByIds(Long[] productIds) {
|
|
public R bulkCopyFsStoreProductByIds(Long[] productIds) {
|
|
|
storeAuditLogUtil.addBatchAuditArray(productIds, "", "");
|
|
storeAuditLogUtil.addBatchAuditArray(productIds, "", "");
|
|
|
List<FsStoreProductScrm> list = fsStoreProductMapper.bulkCopyFsStoreProductByIds(productIds);
|
|
List<FsStoreProductScrm> list = fsStoreProductMapper.bulkCopyFsStoreProductByIds(productIds);
|
|
|
- if(list != null && !list.isEmpty()){
|
|
|
|
|
|
|
+ if (list != null && !list.isEmpty()) {
|
|
|
for (FsStoreProductScrm product : list) {
|
|
for (FsStoreProductScrm product : list) {
|
|
|
List<FsStoreProductAttrValueScrm> param = fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueByProductId(product.getProductId());
|
|
List<FsStoreProductAttrValueScrm> param = fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueByProductId(product.getProductId());
|
|
|
- if(!("益善缘".equals(cloudHostProper.getCompanyName()))) {
|
|
|
|
|
|
|
+ if (!("益善缘".equals(cloudHostProper.getCompanyName()))) {
|
|
|
//获取店铺
|
|
//获取店铺
|
|
|
FsStoreScrm store = fsStoreScrmService.selectFsStoreByStoreId(product.getStoreId());
|
|
FsStoreScrm store = fsStoreScrmService.selectFsStoreByStoreId(product.getStoreId());
|
|
|
if (store == null || 1 != store.getStatus()) {
|
|
if (store == null || 1 != store.getStatus()) {
|
|
@@ -1205,10 +1196,10 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
.value("规格")
|
|
.value("规格")
|
|
|
.detail(ListUtil.toList("默认"))
|
|
.detail(ListUtil.toList("默认"))
|
|
|
.build();
|
|
.build();
|
|
|
- List<ProductArrtDTO> items=new ArrayList<>();
|
|
|
|
|
|
|
+ List<ProductArrtDTO> items = new ArrayList<>();
|
|
|
items.add(fromatDetailDto);
|
|
items.add(fromatDetailDto);
|
|
|
param.get(0).setSku("默认");
|
|
param.get(0).setSku("默认");
|
|
|
- addProductAttr(product.getProductId(),items,param,product.getStoreId());
|
|
|
|
|
|
|
+ addProductAttr(product.getProductId(), items, param, product.getStoreId());
|
|
|
} else {
|
|
} else {
|
|
|
List<FsStoreProductAttrScrm> items = fsStoreProductAttrMapper.selectFsStoreProductAttrByProductId(product.getProductId());
|
|
List<FsStoreProductAttrScrm> items = fsStoreProductAttrMapper.selectFsStoreProductAttrByProductId(product.getProductId());
|
|
|
|
|
|
|
@@ -1216,33 +1207,33 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
fsStoreProductAttrMapper.clear(fsStoreProductId);
|
|
fsStoreProductAttrMapper.clear(fsStoreProductId);
|
|
|
//清空values
|
|
//清空values
|
|
|
//查出商品属性所有ID;
|
|
//查出商品属性所有ID;
|
|
|
- List<FsStoreProductAttrValueScrm> attrValues=fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueByProductId(fsStoreProductId);
|
|
|
|
|
|
|
+ List<FsStoreProductAttrValueScrm> attrValues = fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueByProductId(fsStoreProductId);
|
|
|
fsStoreProductAttrValueMapper.deleteFsStoreProductAttrValueByProductId(fsStoreProductId);
|
|
fsStoreProductAttrValueMapper.deleteFsStoreProductAttrValueByProductId(fsStoreProductId);
|
|
|
|
|
|
|
|
//写入attr
|
|
//写入attr
|
|
|
- for(FsStoreProductAttrScrm vo:items){
|
|
|
|
|
|
|
+ for (FsStoreProductAttrScrm vo : items) {
|
|
|
vo.setProductId(fsStoreProductId);
|
|
vo.setProductId(fsStoreProductId);
|
|
|
fsStoreProductAttrMapper.insertFsStoreProductAttr(vo);
|
|
fsStoreProductAttrMapper.insertFsStoreProductAttr(vo);
|
|
|
}
|
|
}
|
|
|
- Map<String,Object> map = new LinkedHashMap<>();
|
|
|
|
|
- map.put("attr",items);
|
|
|
|
|
|
|
+ Map<String, Object> map = new LinkedHashMap<>();
|
|
|
|
|
+ map.put("attr", items);
|
|
|
// map.put("value",values);
|
|
// map.put("value",values);
|
|
|
|
|
|
|
|
- for(FsStoreProductAttrValueScrm val: param){
|
|
|
|
|
|
|
+ for (FsStoreProductAttrValueScrm val : param) {
|
|
|
//更新套餐商品属性ID 获取套餐
|
|
//更新套餐商品属性ID 获取套餐
|
|
|
- Long id=val.getId();
|
|
|
|
|
- if(val.getDetail()!=null){
|
|
|
|
|
|
|
+ Long id = val.getId();
|
|
|
|
|
+ if (val.getDetail() != null) {
|
|
|
List<String> stringList = new ArrayList<>(val.getDetail().values());
|
|
List<String> stringList = new ArrayList<>(val.getDetail().values());
|
|
|
Collections.sort(stringList);
|
|
Collections.sort(stringList);
|
|
|
- val.setSku(StrUtil.join(",",stringList));
|
|
|
|
|
|
|
+ val.setSku(StrUtil.join(",", stringList));
|
|
|
}
|
|
}
|
|
|
val.setProductId(fsStoreProductId);
|
|
val.setProductId(fsStoreProductId);
|
|
|
fsStoreProductAttrValueMapper.insertFsStoreProductAttrValue(val);
|
|
fsStoreProductAttrValueMapper.insertFsStoreProductAttrValue(val);
|
|
|
- if(attrValues!=null && !attrValues.isEmpty()){
|
|
|
|
|
- for(FsStoreProductAttrValueScrm attrValue:attrValues){
|
|
|
|
|
- if(attrValue.getId().equals(id)){
|
|
|
|
|
- fsStoreProductGroupMapper.updateProducts(attrValue.getId(),val.getId());
|
|
|
|
|
- fsStoreProductPackageMapper.updateProducts(attrValue.getId(),val.getId());
|
|
|
|
|
|
|
+ if (attrValues != null && !attrValues.isEmpty()) {
|
|
|
|
|
+ for (FsStoreProductAttrValueScrm attrValue : attrValues) {
|
|
|
|
|
+ if (attrValue.getId().equals(id)) {
|
|
|
|
|
+ fsStoreProductGroupMapper.updateProducts(attrValue.getId(), val.getId());
|
|
|
|
|
+ fsStoreProductPackageMapper.updateProducts(attrValue.getId(), val.getId());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1263,22 +1254,23 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
public R instructionsViewable(FsStoreCartCountParam param) {
|
|
public R instructionsViewable(FsStoreCartCountParam param) {
|
|
|
//判断商品是否存在
|
|
//判断商品是否存在
|
|
|
FsStoreProductScrm productScrm = fsStoreProductMapper.selectFsStoreProductById(param.getProductId());
|
|
FsStoreProductScrm productScrm = fsStoreProductMapper.selectFsStoreProductById(param.getProductId());
|
|
|
- if(productScrm == null || productScrm.getProductType() == null){
|
|
|
|
|
|
|
+ if (productScrm == null || productScrm.getProductType() == null) {
|
|
|
return R.error("商品数据不存在,或类型异常!");
|
|
return R.error("商品数据不存在,或类型异常!");
|
|
|
- }else if(productScrm.getProductType() != 2){
|
|
|
|
|
- return R.ok().put("data",true);
|
|
|
|
|
|
|
+ } else if (productScrm.getProductType() != 2) {
|
|
|
|
|
+ return R.ok().put("data", true);
|
|
|
}
|
|
}
|
|
|
- return R.ok().put("data",fsStoreProductMapper.instructionsViewable(param) > 0);
|
|
|
|
|
|
|
+ return R.ok().put("data", fsStoreProductMapper.instructionsViewable(param) > 0);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public List<Map<String, String>> getStoreProductColumns() {
|
|
public List<Map<String, String>> getStoreProductColumns() {
|
|
|
- List<Map<String, String> > list = fsStoreProductMapper.getStoreProductColumns();
|
|
|
|
|
|
|
+ List<Map<String, String>> list = fsStoreProductMapper.getStoreProductColumns();
|
|
|
List<Map<String, String>> result = new ArrayList<>();
|
|
List<Map<String, String>> result = new ArrayList<>();
|
|
|
for (Map<String, String> column : list) {
|
|
for (Map<String, String> column : list) {
|
|
|
Map<String, String> camelCaseColumn = new HashMap<>();
|
|
Map<String, String> camelCaseColumn = new HashMap<>();
|
|
|
String columnName = column.get("colName");
|
|
String columnName = column.get("colName");
|
|
|
- String camelCaseName = com.fs.common.utils.StringUtils.toCamelCase(columnName);;
|
|
|
|
|
|
|
+ String camelCaseName = com.fs.common.utils.StringUtils.toCamelCase(columnName);
|
|
|
|
|
+ ;
|
|
|
camelCaseColumn.put("colName", camelCaseName);
|
|
camelCaseColumn.put("colName", camelCaseName);
|
|
|
camelCaseColumn.put("colComment", column.get("colComment"));
|
|
camelCaseColumn.put("colComment", column.get("colComment"));
|
|
|
result.add(camelCaseColumn);
|
|
result.add(camelCaseColumn);
|