|
|
@@ -387,9 +387,9 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
@Override
|
|
|
@Transactional
|
|
|
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.setOtPrice(countDto.getMinOtPrice());
|
|
|
product.setCost(countDto.getMinCost());
|
|
|
@@ -402,54 +402,86 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
product.setIsDrug(param.getIsDrug().toString());
|
|
|
product.setInstructionManual(param.getInstructionManual());
|
|
|
|
|
|
+ List<String> businessExpire = param.getBusinessExpire();
|
|
|
+ if (businessExpire != null && businessExpire.size() >= 2) {
|
|
|
+ product.setBusinessStart(parseLocalDate(businessExpire.get(0)));
|
|
|
+ product.setBusinessEnd(parseLocalDate(businessExpire.get(1)));
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> licenseExpire = param.getLicenseExpire();
|
|
|
+ if (licenseExpire != null && licenseExpire.size() >= 2) {
|
|
|
+ product.setLicenseStart(parseLocalDate(licenseExpire.get(0)));
|
|
|
+ product.setLicenseEnd(parseLocalDate(licenseExpire.get(1)));
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> certificateExpire = param.getCertificateExpire();
|
|
|
+ if (certificateExpire != null && certificateExpire.size() >= 2) {
|
|
|
+ product.setCertificateStart(parseLocalDate(certificateExpire.get(0)));
|
|
|
+ product.setCertificateEnd(parseLocalDate(certificateExpire.get(1)));
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> voucherExpire = param.getVoucherExpire();
|
|
|
+ if (voucherExpire != null && voucherExpire.size() >= 2) {
|
|
|
+ product.setVoucherStart(parseLocalDate(voucherExpire.get(0)));
|
|
|
+ product.setVoucherEnd(parseLocalDate(voucherExpire.get(1)));
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> gmpAuthExpire = param.getGmpAuthExpire();
|
|
|
+ if (gmpAuthExpire != null && gmpAuthExpire.size() >= 2) {
|
|
|
+ product.setGmpAuthStart(parseLocalDate(gmpAuthExpire.get(0)));
|
|
|
+ product.setGmpAuthEnd(parseLocalDate(gmpAuthExpire.get(1)));
|
|
|
+ }
|
|
|
+
|
|
|
//获取商品编码
|
|
|
- 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.setBusinessLink(param.getBusinessLink());
|
|
|
//校验店铺资质信息
|
|
|
//获取店铺
|
|
|
FsStoreScrm store = fsStoreScrmService.selectFsStoreByStoreId(product.getStoreId());
|
|
|
- if(store == null || 1 != store.getStatus()){
|
|
|
+ if (store == null || 1 != store.getStatus()) {
|
|
|
return R.error("店铺不存在或未启用");
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
//验证资质
|
|
|
- switch (product.getProductType()){
|
|
|
+ switch (product.getProductType()) {
|
|
|
case 1://非处方
|
|
|
break;
|
|
|
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("店铺药品资质为空或已过期,请完善后再添加");
|
|
|
}
|
|
|
break;
|
|
|
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("店铺食品资质为空或已过期,请完善后再添加");
|
|
|
}
|
|
|
break;
|
|
|
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("店铺器械资质为空或已过期,请完善后再添加");
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
|
return R.error("商品类型错误");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 根据经营范围校验商品类型
|
|
|
-// if (com.fs.common.utils.StringUtils.isNotEmpty(store.getSelectableProductTypes())) {
|
|
|
-// String productTypeName = getProductTypeName(product.getProductType());
|
|
|
-// if (com.fs.common.utils.StringUtils.isNotEmpty(productTypeName)) {
|
|
|
-// // 直接使用工具类方法校验
|
|
|
-// boolean isAllowed = BusinessScopeProductTypeUtil.isProductTypeAllowed(
|
|
|
-// store.getSelectableProductTypes(), productTypeName);
|
|
|
-// if (!isAllowed) {
|
|
|
-// return R.error("该商品类型[" + productTypeName + "]不在店铺经营范围允许的商品类型内,请联系管理员核实经营范围");
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
- }
|
|
|
+ if (com.fs.common.utils.StringUtils.isNotEmpty(store.getSelectableProductTypes())) {
|
|
|
+ String productTypeName = getProductTypeName(product.getCateId());
|
|
|
+ if (com.fs.common.utils.StringUtils.isNotEmpty(productTypeName)) {
|
|
|
+ // 直接使用工具类方法校验
|
|
|
+// boolean isAllowed = BusinessScopeProductTypeUtil.isProductTypeAllowed(store.getSelectableProductTypes(), productTypeName);
|
|
|
+ boolean isAllowed = validateShopBusinessScope(store.getBusinessScope(), productTypeName);
|
|
|
+ if (!isAllowed) {
|
|
|
+ return R.error("该商品类型[" + productTypeName + "]不在店铺经营范围允许的商品类型内,请联系管理员核实经营范围");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
if("纯正堂".equals(cloudHostProper.getCompanyName())){
|
|
|
product.setIsAudit("1");
|