|
|
@ -34,6 +34,7 @@ import com.epmet.dto.form.CommonFunctionIdFormDTO; |
|
|
|
import com.epmet.dto.form.SaveFunctionCustomizedFormDTO; |
|
|
|
import com.epmet.dto.form.UpdateCustomizedFormDTO; |
|
|
|
import com.epmet.dto.result.FunctionCustomizedDetailResultDTO; |
|
|
|
import com.epmet.entity.CustomerFunctionDetailEntity; |
|
|
|
import com.epmet.entity.FunctionCustomizedEntity; |
|
|
|
import com.epmet.entity.FunctionEntity; |
|
|
|
import com.epmet.redis.FunctionCustomizedRedis; |
|
|
@ -166,31 +167,26 @@ public class FunctionCustomizedServiceImpl extends BaseServiceImpl<FunctionCusto |
|
|
|
public Result updateCustomized(UpdateCustomizedFormDTO formDTO) { |
|
|
|
// 1.客户定制功能详情表 ,没查到就是没人在使用
|
|
|
|
List<CustomerFunctionDetailDTO> customizedId = customerFunctionDetailDao.selectCustomerIdByFunctionId(formDTO.getFunctionId()); |
|
|
|
FunctionCustomizedEntity entity = new FunctionCustomizedEntity(); |
|
|
|
FunctionCustomizedEntity entity = ConvertUtils.sourceToTarget(formDTO, FunctionCustomizedEntity.class); |
|
|
|
entity.setId(formDTO.getCustomizedId()); |
|
|
|
entity.setIconLargeImg(formDTO.getIconLargeImg()); |
|
|
|
entity.setIconSmallImg(formDTO.getIconSmallImg()); |
|
|
|
entity.setCustomizedName(formDTO.getCustomizedName()); |
|
|
|
if (customizedId != null && customizedId.size() > NumConstant.ZERO){ |
|
|
|
// 根据功能id,查询功能的详细信息
|
|
|
|
CustomizedDTO customizedDTO = baseDao.selectCustomized(formDTO.getFunctionId()); |
|
|
|
// 判断这个功能,用户使用的是默认的,还是自定义的
|
|
|
|
|
|
|
|
// 该集合,用户统一修改 客户定制功能详情表
|
|
|
|
List<String> upCustomizedInfoUserId = new ArrayList<>(); |
|
|
|
|
|
|
|
List<CustomerFunctionDetailEntity> upCustomizedInfo = new ArrayList<>(); |
|
|
|
// 统一提示 不能进行修改的客户id
|
|
|
|
StringBuilder tipCustomizedInfoUserId = new StringBuilder(); |
|
|
|
|
|
|
|
// 如果这个功能,被客户重新定义了,则不会修改
|
|
|
|
for (int i = 0; i < customizedId.size(); i++){ |
|
|
|
if (null != customizedDTO){ |
|
|
|
// 功能信息和客户信息:判断这个功能,用户使用的是默认的,还是自定义的
|
|
|
|
if (customizedDTO.getCustomizedName().equals(customizedId.get(i).getFunctionName()) |
|
|
|
&& customizedDTO.getIconLargeImg().equals(customizedId.get(i).getIconLargeImg()) |
|
|
|
&& customizedDTO.getIconSmallImg().equals(customizedId.get(i).getIconSmallImg()) |
|
|
|
&& customizedDTO.getDomainName().equals(customizedId.get(i).getDomainName()) |
|
|
|
&& customizedDTO.getTargetLink().equals(customizedId.get(i).getTargetLink()) ){ |
|
|
|
// 这个功能,客户使用的是默认的,则修改
|
|
|
|
// 这个功能,客户使用的是默认的,则判断本次修改的字段,如果是功能名称和大小图标,则批量更新客户数据,负责提示 不能修改
|
|
|
|
if (!formDTO.getShoppingStatus().equals(customizedDTO.getShoppingStatus()) |
|
|
|
|| !formDTO.getFunctionExplain().equals(customizedDTO.getFunctionExplain()) |
|
|
|
|| !formDTO.getTargetLink().equals(customizedDTO.getTargetLink()) |
|
|
@ -202,15 +198,20 @@ public class FunctionCustomizedServiceImpl extends BaseServiceImpl<FunctionCusto |
|
|
|
|| !formDTO.getIconLargeImg().equals(customizedDTO.getIconLargeImg()) |
|
|
|
|| !formDTO.getIconSmallImg().equals(customizedDTO.getIconSmallImg())){ |
|
|
|
// 如果修改的内容只是:功能名称和大小图标,, 需要批量更新客户数据
|
|
|
|
upCustomizedInfoUserId.add(customizedId.get(i).getId()); |
|
|
|
CustomerFunctionDetailEntity customer = new CustomerFunctionDetailEntity(); |
|
|
|
customer.setFunctionName(formDTO.getCustomizedName()); |
|
|
|
customer.setIconLargeImg(formDTO.getIconLargeImg()); |
|
|
|
customer.setIconSmallImg(formDTO.getIconSmallImg()); |
|
|
|
customer.setId(customizedId.get(i).getId()); |
|
|
|
upCustomizedInfo.add(customer); |
|
|
|
} |
|
|
|
} |
|
|
|
// 用户使用的是自定义的功能,则不予处理
|
|
|
|
} |
|
|
|
} |
|
|
|
// 1.修改 客户定制功能详情表
|
|
|
|
if (upCustomizedInfoUserId != null && upCustomizedInfoUserId.size() > NumConstant.ZERO){ |
|
|
|
String[] ueserIds = new String[upCustomizedInfoUserId.size()]; |
|
|
|
customerFunctionDetailService.delete(upCustomizedInfoUserId.toArray(ueserIds)); |
|
|
|
if (upCustomizedInfo != null && upCustomizedInfo.size() > NumConstant.ZERO){ |
|
|
|
customerFunctionDetailService.updateBatchById(upCustomizedInfo); |
|
|
|
} |
|
|
|
// 2.修改 功能表, 修改的字段范围,是:功能名称和大小图标
|
|
|
|
this.upFunction(formDTO); |
|
|
@ -226,12 +227,7 @@ public class FunctionCustomizedServiceImpl extends BaseServiceImpl<FunctionCusto |
|
|
|
// 没有客户正在使用该 功能
|
|
|
|
// 2.修改 功能表, 修改的字段范围,是所有入参字段
|
|
|
|
this.upFunction(formDTO); |
|
|
|
|
|
|
|
// 3.修改 定制功能表, 修改的字段范围,是所有入参字段
|
|
|
|
entity.setFunctionId(formDTO.getFunctionId()); |
|
|
|
entity.setTargetLink(formDTO.getTargetLink()); |
|
|
|
entity.setDomainName(formDTO.getDomainName()); |
|
|
|
entity.setFromApp(formDTO.getFromApp()); |
|
|
|
baseDao.updateById(entity); |
|
|
|
} |
|
|
|
return new Result(); |
|
|
|