|
|
@ -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; |
|
|
|
|
|
|
|
/** |
|
|
|
* 定制功能 |
|
|
@ -236,6 +238,55 @@ public class FunctionCustomizedServiceImpl extends BaseServiceImpl<FunctionCusto |
|
|
|
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/code/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 |
|
|
|