|
|
@ -17,23 +17,24 @@ |
|
|
|
|
|
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.HttpClientManager; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.dao.CustomerFunctionDetailDao; |
|
|
|
import com.epmet.dao.FunctionCustomizedDao; |
|
|
|
import com.epmet.dto.CustomerFunctionDetailDTO; |
|
|
|
import com.epmet.dto.CustomizedDTO; |
|
|
|
import com.epmet.dto.FunctionCustomizedDTO; |
|
|
|
import com.epmet.dto.form.CommonFunctionIdFormDTO; |
|
|
|
import com.epmet.dto.form.FunctionCustomizedListFormDTO; |
|
|
|
import com.epmet.dto.form.SaveFunctionCustomizedFormDTO; |
|
|
|
import com.epmet.dto.form.UpdateCustomizedFormDTO; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.result.FunctionCustomizedDetailResultDTO; |
|
|
|
import com.epmet.dto.result.FunctionCustomizedListResultDTO; |
|
|
|
import com.epmet.entity.CustomerFunctionDetailEntity; |
|
|
@ -52,6 +53,7 @@ import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* 定制功能 |
|
|
@ -194,12 +196,12 @@ public class FunctionCustomizedServiceImpl extends BaseServiceImpl<FunctionCusto |
|
|
|
|| !formDTO.getFromApp().equals(customizedDTO.getFromApp()) ){ |
|
|
|
// 4.1 如果修改的内容是其他字段,则返回语句
|
|
|
|
tipCustomizedInfoUserId.append(customizedId.get(i).getId() + ","); |
|
|
|
} else if (!formDTO.getCustomizedName().equals(customizedDTO.getCustomizedName()) |
|
|
|
} else if (!formDTO.getFunctionName().equals(customizedDTO.getCustomizedName()) |
|
|
|
|| !formDTO.getIconLargeImg().equals(customizedDTO.getIconLargeImg()) |
|
|
|
|| !formDTO.getIconSmallImg().equals(customizedDTO.getIconSmallImg())){ |
|
|
|
// 4.2 如果修改的内容只是:功能名称和大小图标,, 需要批量更新客户数据
|
|
|
|
CustomerFunctionDetailEntity customer = new CustomerFunctionDetailEntity(); |
|
|
|
customer.setFunctionName(formDTO.getCustomizedName()); |
|
|
|
customer.setFunctionName(formDTO.getFunctionName()); |
|
|
|
customer.setIconLargeImg(formDTO.getIconLargeImg()); |
|
|
|
customer.setIconSmallImg(formDTO.getIconSmallImg()); |
|
|
|
customer.setId(customizedId.get(i).getId()); |
|
|
@ -231,11 +233,60 @@ public class FunctionCustomizedServiceImpl extends BaseServiceImpl<FunctionCusto |
|
|
|
int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); |
|
|
|
formDTO.setPageNo(pageIndex); |
|
|
|
FunctionCustomizedListResultDTO resultDTO = new FunctionCustomizedListResultDTO(); |
|
|
|
resultDTO.setListDTOS(baseDao.selectListFunctionCustomizedList(formDTO)); |
|
|
|
resultDTO.setList(baseDao.selectListFunctionCustomizedList(formDTO)); |
|
|
|
resultDTO.setTotal(baseDao.countTotalFunctionCustomizedList(formDTO)); |
|
|
|
return new Result<FunctionCustomizedListResultDTO>().ok(resultDTO); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void customerDomain(CustomerDomainFormDTO formDTO) { |
|
|
|
//获取业务域名
|
|
|
|
List<FunctionCustomizedDTO> list = baseDao.selectDomains(formDTO.getCustomerId()); |
|
|
|
List<String> workDomains = new ArrayList<>(); |
|
|
|
List<String> resiDomains = new ArrayList<>(); |
|
|
|
if (null != list) { |
|
|
|
for(FunctionCustomizedDTO dto : list) { |
|
|
|
if (StringUtils.isNotBlank(dto.getDomainName())) { |
|
|
|
String[] domainNames = dto.getDomainName().split(";"); |
|
|
|
if (("resi").equals(dto.getFromApp())) { |
|
|
|
resiDomains.addAll(Arrays.asList(domainNames)); |
|
|
|
} else { |
|
|
|
workDomains.addAll(Arrays.asList(domainNames)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
String domainUrl = "https://epmet-cloud.elinkservice.cn/api/third/setting/setwebviewdomain"; |
|
|
|
if(resiDomains.size() > NumConstant.ZERO) { |
|
|
|
resiDomains = resiDomains.stream().distinct().collect(Collectors.toList()); |
|
|
|
WebviewDomainFormDTO domainFormDTO = new WebviewDomainFormDTO(); |
|
|
|
domainFormDTO.setCustomerId(formDTO.getCustomerId()); |
|
|
|
domainFormDTO.setClientType("resi"); |
|
|
|
domainFormDTO.setWebViewDomain(resiDomains); |
|
|
|
String domainData = HttpClientManager.getInstance().sendPostByJSON(domainUrl, JSON.toJSONString(domainFormDTO)).getData(); |
|
|
|
JSONObject domainObject = JSON.parseObject(domainData); |
|
|
|
Result domainResult = ConvertUtils.mapToEntity(domainObject, Result.class); |
|
|
|
if (!domainResult.success()) { |
|
|
|
throw new RenException(domainResult.getCode(), domainResult.getInternalMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if(workDomains.size() > NumConstant.ZERO) { |
|
|
|
workDomains = workDomains.stream().distinct().collect(Collectors.toList()); |
|
|
|
WebviewDomainFormDTO domainFormDTO = new WebviewDomainFormDTO(); |
|
|
|
domainFormDTO.setCustomerId(formDTO.getCustomerId()); |
|
|
|
domainFormDTO.setClientType("work"); |
|
|
|
domainFormDTO.setWebViewDomain(workDomains); |
|
|
|
String domainData = HttpClientManager.getInstance().sendPostByJSON(domainUrl, JSON.toJSONString(domainFormDTO)).getData(); |
|
|
|
JSONObject domainObject = JSON.parseObject(domainData); |
|
|
|
Result domainResult = ConvertUtils.mapToEntity(domainObject, Result.class); |
|
|
|
if (!domainResult.success()) { |
|
|
|
throw new RenException(domainResult.getCode(), domainResult.getInternalMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 保存数据到 功能表 |
|
|
|
* @param formDTO |
|
|
@ -265,7 +316,7 @@ public class FunctionCustomizedServiceImpl extends BaseServiceImpl<FunctionCusto |
|
|
|
private void upFunction(UpdateCustomizedFormDTO formDTO, Integer flag){ |
|
|
|
FunctionEntity entity = new FunctionEntity(); |
|
|
|
entity.setId(formDTO.getFunctionId()); |
|
|
|
entity.setFunctionName(formDTO.getCustomizedName()); |
|
|
|
entity.setFunctionName(formDTO.getFunctionName()); |
|
|
|
entity.setFunctionIcon(formDTO.getIconLargeImg()); |
|
|
|
if (NumConstant.ONE == flag){ |
|
|
|
entity.setShoppingStatus(Integer.valueOf(formDTO.getShoppingStatus())); |
|
|
@ -303,7 +354,7 @@ public class FunctionCustomizedServiceImpl extends BaseServiceImpl<FunctionCusto |
|
|
|
// 2.修改 定制功能表, 修改的字段范围,是:功能名称和大小图标
|
|
|
|
FunctionCustomizedEntity entity = new FunctionCustomizedEntity(); |
|
|
|
entity.setFunctionId(formDTO.getFunctionId()); |
|
|
|
entity.setCustomizedName(formDTO.getCustomizedName()); |
|
|
|
entity.setCustomizedName(formDTO.getFunctionName()); |
|
|
|
entity.setIconLargeImg(formDTO.getIconLargeImg()); |
|
|
|
entity.setIconSmallImg(formDTO.getIconSmallImg()); |
|
|
|
baseDao.updateFunctionCustomized(entity); |
|
|
|