Commit 67da3bb6 by 陶光胜

Merge branch 'developer' of http://115.159.76.241/base_platform_enterprise/gic-store into developer

parents fa0be0af 39b344b4
......@@ -37,7 +37,6 @@ public class StoreFieldSelectDTO implements Serializable {
/**
* 属性code
*/
@NotBlank(message = "属性值code不能为空", groups = {SaveStoreFieldSelectValid.class, EditStoreFieldSelectValid.class})
private String storeFieldSelectCode;
/**
......
......@@ -197,20 +197,28 @@ public class StoreApiServiceImpl implements StoreApiService {
sb.append("门店名称").append("【").append(oldStore.getStoreName()).append("】")
.append("变更为【").append(newStore.getStoreName()).append("】");
}
if (!CollectionUtils.isEqualCollection(oldStore.getPhotoList(), newStore.getPhotoList())) {
sb.append("门店照片变更");
if (CollectionUtils.isNotEmpty(oldStore.getPhotoList()) && CollectionUtils.isNotEmpty(newStore.getPhotoList())) {
if (!CollectionUtils.isEqualCollection(oldStore.getPhotoList(), newStore.getPhotoList())) {
sb.append("门店照片变更");
}
}
if (newStore.getStoreType() != null && !newStore.getStoreType().equals(oldStore.getStoreType())) {
ServiceResponse<StoreDictDTO> oldStoreType = this.storeDictApiService.getStoreDict("storeType", oldStore.getStoreType().toString());
sb.append("门店类型");
if (oldStore.getStoreType() != null) {
ServiceResponse<StoreDictDTO> oldStoreType = this.storeDictApiService.getStoreDict("storeType", oldStore.getStoreType().toString());
sb.append("【").append(oldStoreType.getResult().getKey()).append("】");
}
ServiceResponse<StoreDictDTO> newStoreType = this.storeDictApiService.getStoreDict("storeType", newStore.getStoreType().toString());
sb.append("门店类型").append("【").append(oldStoreType.getResult().getKey()).append("】")
.append("变更为【").append(newStoreType.getResult().getKey()).append("】");
sb.append("变更为【").append(newStoreType.getResult().getKey()).append("】");
}
if (newStore.getErpStatus() != null && !newStore.getErpStatus().equals(oldStore.getErpStatus())) {
ServiceResponse<StoreDictDTO> oldStoreStatus = this.storeDictApiService.getStoreDict("storeStatus", oldStore.getErpStatus().toString());
sb.append("门店状态");
if (oldStore.getErpStatus() != null) {
ServiceResponse<StoreDictDTO> oldStoreStatus = this.storeDictApiService.getStoreDict("storeStatus", oldStore.getErpStatus().toString());
sb.append("【").append(oldStoreStatus.getResult().getKey()).append("】");
}
ServiceResponse<StoreDictDTO> newStoreStatus = this.storeDictApiService.getStoreDict("storeStatus", newStore.getErpStatus().toString());
sb.append("门店状态").append("【").append(oldStoreStatus.getResult().getKey()).append("】")
.append("变更为【").append(newStoreStatus.getResult().getKey()).append("】");
sb.append("变更为【").append(newStoreStatus.getResult().getKey()).append("】");
}
if (StringUtils.isNotBlank(newStore.getConactsPhone()) && !StringUtils.equals(newStore.getConactsPhone(), oldStore.getConactsPhone())) {
sb.append("门店电话").append("【").append(oldStore.getConactsPhone()).append("】")
......
......@@ -50,10 +50,10 @@ public class StoreBrandApiServiceImpl implements StoreBrandApiService {
@Override
public ServiceResponse<Integer> saveOrUpdateStoreBrand(StoreBrandDTO storeBrandDTO) {
Integer storeBrandId;
int brandCodeCount = storeBrandService.countByStoreBrandCode(storeBrandDTO.getEnterpriseId(), storeBrandDTO.getStoreBrandCode(), storeBrandDTO.getStoreBrandId());
if (brandCodeCount > 0) {
return ServiceResponse.failure(ErrorCode.DATA_EXISTS.getCode(), "品牌code已存在");
}
// int brandCodeCount = storeBrandService.countByStoreBrandCode(storeBrandDTO.getEnterpriseId(), storeBrandDTO.getStoreBrandCode(), storeBrandDTO.getStoreBrandId());
// if (brandCodeCount > 0) {
// return ServiceResponse.failure(ErrorCode.DATA_EXISTS.getCode(), "品牌code已存在");
// }
int storeBrandName = storeBrandService.countByStoreBrandName(storeBrandDTO.getEnterpriseId(), storeBrandDTO.getStoreBrandName(), storeBrandDTO.getStoreBrandId());
if (storeBrandName > 0) {
return ServiceResponse.failure(ErrorCode.DATA_EXISTS.getCode(), "品牌名称已存在");
......
......@@ -17,6 +17,7 @@ import com.gic.store.service.StoreFieldSelectService;
import com.gic.store.service.StoreFieldService;
import com.gic.store.utils.valid.ValidUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -45,9 +46,12 @@ public class StoreFieldSelectApiServiceImpl implements StoreFieldSelectApiServic
return paramValid;
}
if (storeFieldSelectService.isRepeatCode(storeFieldSelectDTO.getStoreFieldId(), null,
storeFieldSelectDTO.getStoreFieldSelectCode())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "属性值code不能重复");
boolean isCodeNotNull = StringUtils.isBlank(storeFieldSelectDTO.getStoreFieldSelectCode());
if (isCodeNotNull) {
if (storeFieldSelectService.isRepeatCode(storeFieldSelectDTO.getStoreFieldId(), null,
storeFieldSelectDTO.getStoreFieldSelectCode())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "属性值code不能重复");
}
}
if (storeFieldSelectService.isRepeatName(storeFieldSelectDTO.getStoreFieldId(), null,
......@@ -135,9 +139,12 @@ public class StoreFieldSelectApiServiceImpl implements StoreFieldSelectApiServic
return paramValid;
}
if (storeFieldSelectService.isRepeatCode(storeFieldSelectDTO.getStoreFieldId(),
storeFieldSelectDTO.getStoreFieldSelectId(), storeFieldSelectDTO.getStoreFieldSelectCode())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "属性值code不能重复");
boolean isCodeNotNull = StringUtils.isBlank(storeFieldSelectDTO.getStoreFieldSelectCode());
if (isCodeNotNull) {
if (storeFieldSelectService.isRepeatCode(storeFieldSelectDTO.getStoreFieldId(),
storeFieldSelectDTO.getStoreFieldSelectId(), storeFieldSelectDTO.getStoreFieldSelectCode())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "属性值code不能重复");
}
}
if (storeFieldSelectService.isRepeatName(storeFieldSelectDTO.getStoreFieldId(),
......
package com.gic.store.utils.field;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.List;
/**
......@@ -46,7 +49,7 @@ public class FieldBase {
}
public String validate(String value){
if (getIsMust() && (value == null || "".equals(value))) {
if (getIsMust() && (StringUtils.isNotBlank(value))) {
return "不能为空";
}else {
return null;
......@@ -58,7 +61,7 @@ public class FieldBase {
if (msg != null) {
return msg;
}
if (value != null && !"".equals(value)) {
if (StringUtils.isNotBlank(value) && CollectionUtils.isNotEmpty(nameList)) {
String[] values = value.split(",");
for (String val : values) {
boolean exist = false;
......
package com.gic.store.utils.field;
import com.gic.store.constant.StoreFieldTextEnum;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.HashMap;
......@@ -60,7 +61,7 @@ public class TextField extends FieldBase {
if (msg != null) {
return msg;
}
if (value == null || "".equals(value)) {
if (StringUtils.isBlank(value)) {
return null;
}
......
......@@ -123,6 +123,13 @@ public class StoreImportController {
if (file.getSize() > 0) {
String fileName = file.getOriginalFilename();
String uuId = request.getParameter("uuId");
//获取配置信息,是否门店替换code
String repeatStoreCodeConfig = request.getParameter("repeatStoreCodeConfig");
if (StringUtils.isBlank(repeatStoreCodeConfig)) {
repeatStoreCodeConfig = "0";
}
//如果门店code重复,是否替换更新
boolean isReplace = "1".equals(repeatStoreCodeConfig);
if (fileName.endsWith("xlsx") || fileName.endsWith("xls")) {
try {
Workbook workbook = ExcelUtils.getWorkbookFromUpload(file.getInputStream(), fileName);
......@@ -141,7 +148,7 @@ public class StoreImportController {
storeImportApiService.delStoreTmp(enterpriseId);
//批量插入数据到门店临时表,用于队列导入到门店表
for (Map<Integer, String> row : data) {
StoreTmpDTO bean = this.validateData(row, enterpriseId, storeRegion.getRegionId());
StoreTmpDTO bean = this.validateData(row, enterpriseId, storeRegion.getRegionId(), isReplace);
bean.setRegionId(storeRegion.getRegionId());
bean.setRegionName(storeRegion.getRegionName());
try {
......@@ -159,13 +166,6 @@ public class StoreImportController {
// userId
Integer userId = UserDetailUtils.getUserDetail().getUserInfo().getUserId();
// 开队列
//获取配置信息
String repeatStoreCodeConfig = request.getParameter("repeatStoreCodeConfig");
if (StringUtils.isBlank(repeatStoreCodeConfig)) {
repeatStoreCodeConfig = "0";
}
//如果门店code重复,是否替换更新
boolean isReplace = "1".equals(repeatStoreCodeConfig);
String r = storeImportApiService.importDataToStore(enterpriseId, userId.toString(), uuId, isReplace).getResult();
if (StringUtils.isNotBlank(r)) {
logger.warn("队列错误, {}", r);
......@@ -300,7 +300,7 @@ public class StoreImportController {
}
}
private StoreTmpDTO validateData(Map<Integer, String> row, Integer enterpriseId, Integer regionId) {
private StoreTmpDTO validateData(Map<Integer, String> row, Integer enterpriseId, Integer regionId, boolean isNeedReplaceStoreCode) {
boolean validate = true;
StoreTmpDTO bean = new StoreTmpDTO();
bean.setEnterpriseId(enterpriseId);
......@@ -320,7 +320,7 @@ public class StoreImportController {
validate = false;
}
}
if (validate) {
if (!isNeedReplaceStoreCode && validate) {
// 验证门店code唯一
if (storeImportApiService.validateStoreName(enterpriseId, storeName).getResult()) {
bean.setErrorMessage("门店名称已经存在");
......@@ -343,7 +343,7 @@ public class StoreImportController {
validate = false;
}
}
if (validate) {
if (!isNeedReplaceStoreCode && validate) {
// 验证门店code唯一
if (storeImportApiService.validateStoreCode(enterpriseId, regionId, storeCode).getResult()) {
bean.setErrorMessage("门店编码重复");
......@@ -480,9 +480,9 @@ public class StoreImportController {
bean.setLatitude(row.get(13));
// 自定义属性
//todo 自定义属性验证
ServiceResponse<List<StoreFieldDTO>> fieldServiceResponse = storeFieldApiService.listStoreFieldByRegionId(regionId);
List<StoreFieldDTO> fieldList = fieldServiceResponse.getResult();
logger.info("门店域的ID:{}, 自定义字段数据:{}", regionId, JSON.toJSONString(fieldList));
if (CollectionUtils.isNotEmpty(fieldList)) {
List<StoreExtendDTO> extendDTOList = new ArrayList<>();
for (int i = 0; i < fieldList.size(); i++) {
......
......@@ -34,7 +34,7 @@ public class StoreBrandQO implements Serializable {
/**
* 品牌code
*/
@NotNull(message = "品牌code不能为空", groups = {SaveValidView.class})
// @NotNull(message = "品牌code不能为空", groups = {SaveValidView.class})
private String storeBrandCode;
/**
......
......@@ -54,7 +54,6 @@ public class StoreFieldSelectQO implements Serializable{
/**
* 属性code
*/
@NotBlank(message = "属性值code不能为空", groups = {SaveValidView.class, EditValidView.class})
private String storeFieldSelectCode;
/**
......
......@@ -132,6 +132,9 @@ public class ExcelUtils {
}
}
cell.setCellStyle(style); // 设置单元格样式
if (j != 0) {
cell.setCellType(XSSFCell.CELL_TYPE_STRING);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment