Merge branch 'uat' into 'sim'
Uat See merge request eshop/biz_service_ebtp_extend!59
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
FROM harbor.dcos.guangzhou.unicom.local/eshop/jdk8_springboot_agent:v1.6
|
||||
ENV LC_ALL=zh_CN.utf8
|
||||
ENV LANG=zh_CN.utf8
|
||||
ENV LANGUAGE=zh_CN.utf8
|
||||
RUN localedef -c -f UTF-8 -i zh_CN zh_CN.utf8
|
||||
#ENV LC_ALL=zh_CN.utf8
|
||||
#ENV LANG=zh_CN.utf8
|
||||
#ENV LANGUAGE=zh_CN.utf8
|
||||
#RUN localedef -c -f UTF-8 -i zh_CN zh_CN.utf8
|
||||
ADD /target/biz_service_ebtp_extend-0.0.1.jar /biz_service_ebtp_extend-0.0.1.jar
|
||||
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-javaagent:/skywalking/agent/skywalking-agent.jar","-jar", "/biz_service_ebtp_extend-0.0.1.jar"]
|
||||
|
@ -39,6 +39,10 @@ spec:
|
||||
- name: log
|
||||
hostPath:
|
||||
path: /var/lib/docker/log/349553515466-test/default-group/all #开发环境
|
||||
- name: storage
|
||||
persistentVolumeClaim:
|
||||
claimName: file-pvc
|
||||
readOnly: false
|
||||
# 必选,Pod中容器列表
|
||||
containers:
|
||||
- name: biz-service-ebtp-extend
|
||||
@ -47,6 +51,8 @@ spec:
|
||||
volumeMounts:
|
||||
- name: log
|
||||
mountPath: /log
|
||||
- name: storage
|
||||
mountPath: /storage
|
||||
# 需要暴露的端口库号列表
|
||||
ports:
|
||||
- containerPort: 18018
|
||||
|
@ -39,6 +39,10 @@ spec:
|
||||
- name: log
|
||||
hostPath:
|
||||
path: /var/lib/docker/log/349553515466-prod/default-group/30days
|
||||
- name: storage
|
||||
persistentVolumeClaim:
|
||||
claimName: file-pvc
|
||||
readOnly: false
|
||||
affinity:
|
||||
podAntiAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
@ -57,6 +61,8 @@ spec:
|
||||
volumeMounts:
|
||||
- name: log
|
||||
mountPath: /log
|
||||
- name: storage
|
||||
mountPath: /storage
|
||||
ports:
|
||||
- containerPort: 18018
|
||||
livenessProbe:
|
||||
|
@ -39,6 +39,10 @@ spec:
|
||||
- name: log
|
||||
hostPath:
|
||||
path: /var/lib/docker/log/349553515466-preprod/default-group/all #开发环境
|
||||
- name: storage
|
||||
persistentVolumeClaim:
|
||||
claimName: file-pvc
|
||||
readOnly: false
|
||||
affinity:
|
||||
podAntiAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
@ -57,6 +61,8 @@ spec:
|
||||
volumeMounts:
|
||||
- name: log
|
||||
mountPath: /log
|
||||
- name: storage
|
||||
mountPath: /storage
|
||||
ports:
|
||||
- containerPort: 18018
|
||||
resources:
|
||||
|
@ -40,7 +40,10 @@ spec:
|
||||
- name: log
|
||||
hostPath:
|
||||
path: /var/lib/docker/log/349553515466-uat/default-group/all #开发环境
|
||||
|
||||
- name: storage
|
||||
persistentVolumeClaim:
|
||||
claimName: file-pvc
|
||||
readOnly: false
|
||||
# 必选,Pod中容器列表
|
||||
containers:
|
||||
- name: biz-service-ebtp-extend
|
||||
@ -49,6 +52,8 @@ spec:
|
||||
volumeMounts:
|
||||
- name: log
|
||||
mountPath: /log
|
||||
- name: storage
|
||||
mountPath: /storage
|
||||
# 需要暴露的端口库号列表
|
||||
ports:
|
||||
- containerPort: 18018
|
||||
|
BIN
lib/aspose-words-16.8.0-javadoc.jar
Normal file
BIN
lib/aspose-words-16.8.0-javadoc.jar
Normal file
Binary file not shown.
BIN
lib/aspose-words-16.8.0-jdk16.jar
Normal file
BIN
lib/aspose-words-16.8.0-jdk16.jar
Normal file
Binary file not shown.
31
pom.xml
31
pom.xml
@ -54,13 +54,13 @@
|
||||
<artifactId>poi</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
@ -71,6 +71,7 @@
|
||||
<artifactId>commons-httpclient</artifactId>
|
||||
<version>3.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jit.vstk</groupId>
|
||||
<artifactId>jit-vstk</artifactId>
|
||||
@ -78,6 +79,21 @@
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/jit-vstk-jdk15-2.0.50-20150603.060911-1.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>aspose.javadoc</groupId>
|
||||
<artifactId>aspose.javadoc</artifactId>
|
||||
<version>16.8.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/aspose-words-16.8.0-javadoc.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>aspose.jdk16</groupId>
|
||||
<artifactId>aspose.jdk16</artifactId>
|
||||
<version>16.8.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/aspose-words-16.8.0-jdk16.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity-tools</artifactId>
|
||||
@ -89,7 +105,11 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>e-iceblue</groupId>
|
||||
<artifactId>spire.doc.free</artifactId>
|
||||
<version>3.9.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<repositories>
|
||||
@ -105,6 +125,11 @@
|
||||
<updatePolicy>always</updatePolicy>
|
||||
</snapshots>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>com.e-iceblue</id>
|
||||
<url>http://repo.e-iceblue.cn/repository/maven-public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<build>
|
||||
|
@ -0,0 +1,38 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.feign.client;
|
||||
|
||||
/**
|
||||
* 风险管控接口调用
|
||||
* @author daixc
|
||||
* @date 2021/08/18
|
||||
*/
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
||||
import com.chinaunicom.mall.ebtp.extend.feign.client.factory.RiskManageRegulationServiceFallbackFactory;
|
||||
import com.chinaunicom.mall.ebtp.extend.riskmanage.entity.RiskManageRegulation;
|
||||
import com.chinaunicom.mall.ebtp.extend.riskmanage.entity.RiskManageRegulationGroupApply;
|
||||
import com.chinaunicom.mall.ebtp.extend.feign.entity.risk.RiskManageRegulationGroupOuterVO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(value = "${mconfig.feign.name.strategy-center}",path = "/outer/v1.0/riskManageRegulation",
|
||||
fallbackFactory = RiskManageRegulationServiceFallbackFactory.class)
|
||||
public interface RiskManageRegulationService {
|
||||
|
||||
/**
|
||||
* 查询规则模型列表接口
|
||||
* @param riskManageRegulation 风险管控规则模型
|
||||
* @return 返回结果
|
||||
*/
|
||||
@PostMapping({"/findRegulationParams"})
|
||||
BaseResponse<List<RiskManageRegulationGroupOuterVO>> findRegulationParams(@RequestBody RiskManageRegulation riskManageRegulation);
|
||||
|
||||
/**
|
||||
* 执行风控规则
|
||||
* @param regulationGroupApply 风控规则对象
|
||||
* @return 返回结果
|
||||
*/
|
||||
@PostMapping({"/applyRegulation"})
|
||||
BaseResponse<Object> applyRegulation(@RequestBody RiskManageRegulationGroupApply regulationGroupApply);
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.feign.client.factory;
|
||||
|
||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
||||
import com.chinaunicom.mall.ebtp.extend.feign.client.RiskManageRegulationService;
|
||||
import com.chinaunicom.mall.ebtp.extend.feign.entity.risk.RiskManageRegulationGroupOuterVO;
|
||||
import com.chinaunicom.mall.ebtp.extend.riskmanage.entity.RiskManageRegulation;
|
||||
import com.chinaunicom.mall.ebtp.extend.riskmanage.entity.RiskManageRegulationGroupApply;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class RiskManageRegulationServiceFallbackFactory implements FallbackFactory<RiskManageRegulationService> {
|
||||
@Override
|
||||
public RiskManageRegulationService create(Throwable throwable) {
|
||||
log.error(ExceptionUtil.stacktraceToString(throwable));
|
||||
return new RiskManageRegulationService() {
|
||||
@Override
|
||||
public BaseResponse<List<RiskManageRegulationGroupOuterVO>> findRegulationParams(RiskManageRegulation riskManageRegulation) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseResponse<Object> applyRegulation(RiskManageRegulationGroupApply regulationGroupApply) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.feign.entity.risk;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 风险管控规则接口返回对象
|
||||
* @author daixc
|
||||
* @date 2021/08/18
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("风险管控规则接口返回对象")
|
||||
public class RiskManageRegulationGroupOuterVO implements Serializable {
|
||||
|
||||
@ApiModelProperty("规则主键")
|
||||
private String regulationGroupId;
|
||||
@ApiModelProperty("规则集合编号")
|
||||
private String regulationGroupCode;
|
||||
@ApiModelProperty("规则名称")
|
||||
private String regulationGroupName;
|
||||
@ApiModelProperty("模型主键")
|
||||
private String regulationId;
|
||||
@ApiModelProperty("规则所需的字段标识")
|
||||
private String regulationField;
|
||||
@ApiModelProperty("产品范围类型")
|
||||
private String regulationProductRangeType;
|
||||
@ApiModelProperty("风险识别条件所需的字段标识")
|
||||
private String regulationConditionField;
|
||||
@ApiModelProperty("识别条件")
|
||||
private String regulationCondition;
|
||||
@ApiModelProperty("是否需要上传竞争合理性文件:Y:是 N:否")
|
||||
private String regulationPromotionUploadFiles;
|
||||
@ApiModelProperty("返回参数集")
|
||||
private List<Map<String, Object>> regulations;
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.feign.utils;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
||||
import com.chinaunicom.mall.ebtp.extend.feign.entity.risk.RiskManageRegulationGroupOuterVO;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 风险管控处理辅助类
|
||||
* @author daixc
|
||||
* @date 2021/08/18
|
||||
*/
|
||||
public class CallRegulationUtil {
|
||||
|
||||
public static List<RiskManageRegulationGroupOuterVO> getCallRegulationMap(Map<String,Object> param, BaseResponse<List<RiskManageRegulationGroupOuterVO>> regulationParams, String orgId) throws NoSuchFieldException, IllegalAccessException {
|
||||
List<RiskManageRegulationGroupOuterVO> regulationParamsList = regulationParams.getData();
|
||||
Iterator var4 = regulationParamsList.iterator();
|
||||
|
||||
while(var4.hasNext()) {
|
||||
RiskManageRegulationGroupOuterVO groupOuterVo = (RiskManageRegulationGroupOuterVO)var4.next();
|
||||
List<Map<String, Object>> regulationList = groupOuterVo.getRegulations();
|
||||
List<Map<String, Object>> parameterList = new ArrayList();
|
||||
Iterator var8 = regulationList.iterator();
|
||||
|
||||
while(var8.hasNext()) {
|
||||
Map<String, Object> map = (Map)var8.next();
|
||||
Map<String, Object> regulationObj = (Map)map.get("parameters");
|
||||
Map<String, Object> regulationMap = new HashMap();
|
||||
Map<String, Object> value = new HashMap();
|
||||
if (regulationObj.get("fields") != null) {
|
||||
Iterator var13 = ((List)regulationObj.get("fields")).iterator();
|
||||
|
||||
while(var13.hasNext()) {
|
||||
Object field = var13.next();
|
||||
// Class cls = param.getClass();
|
||||
// Field f = cls.getDeclaredField(field.toString());
|
||||
// f.setAccessible(true);
|
||||
// Object object = f.get(param);
|
||||
// value.put(field.toString(), object);
|
||||
value.put(field.toString(), param.get(field));
|
||||
}
|
||||
|
||||
regulationMap.put("fields", value);
|
||||
}
|
||||
|
||||
List<String> productList = (List)regulationObj.get("products");
|
||||
if (CollUtil.isNotEmpty(productList) && productList.get(0) != null) {
|
||||
value = new HashMap();
|
||||
Iterator var21 = productList.iterator();
|
||||
|
||||
while(var21.hasNext()) {
|
||||
String field = (String)var21.next();
|
||||
// Class cls = param.getClass();
|
||||
// Field f = cls.getDeclaredField(field);
|
||||
// f.setAccessible(true);
|
||||
// Object object = f.get(param);
|
||||
value.put(field, param.get(field));
|
||||
}
|
||||
|
||||
regulationMap.put("products", value);
|
||||
}
|
||||
|
||||
List<String> conditionFields = (List)regulationObj.get("conditionFields");
|
||||
if (!conditionFields.isEmpty() && !"".equals(conditionFields.get(0))) {
|
||||
value = new HashMap();
|
||||
Iterator var24 = conditionFields.iterator();
|
||||
|
||||
while(var24.hasNext()) {
|
||||
String field = (String)var24.next();
|
||||
// Class cls = param.getClass();
|
||||
// Field f = cls.getDeclaredField(field);
|
||||
// f.setAccessible(true);
|
||||
// Object object = f.get(param);
|
||||
// value.put(field, object);
|
||||
value.put(field, param.get(field));
|
||||
}
|
||||
|
||||
regulationMap.put("conditionFields", value);
|
||||
}
|
||||
|
||||
regulationMap.put("orgOu", orgId);
|
||||
Map<String, Object> params = new HashMap();
|
||||
params.put("regulationId", map.get("regulationId"));
|
||||
params.put("parameters", regulationMap);
|
||||
params.put("uploadFiles", map.get("uploadFiles"));
|
||||
parameterList.add(params);
|
||||
}
|
||||
groupOuterVo.setRegulations(parameterList);
|
||||
}
|
||||
return regulationParamsList;
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.riskmanage.controller;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
||||
import com.chinaunicom.mall.ebtp.extend.feign.client.RiskManageRegulationService;
|
||||
import com.chinaunicom.mall.ebtp.extend.feign.entity.risk.RiskManageRegulationGroupOuterVO;
|
||||
import com.chinaunicom.mall.ebtp.extend.riskmanage.entity.RiskManageRegulation;
|
||||
import com.chinaunicom.mall.ebtp.extend.riskmanage.entity.RiskManageRegulationGroupApply;
|
||||
import com.chinaunicom.mall.ebtp.extend.riskmanage.entity.RiskManageRegulationVO;
|
||||
import com.chinaunicom.mall.ebtp.extend.riskmanage.service.IRiskManageService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author daixc
|
||||
* @date daixc
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@Api(tags = "风险管控")
|
||||
@RequestMapping("/v1/risk")
|
||||
public class RiskManageController {
|
||||
|
||||
@Resource
|
||||
private RiskManageRegulationService regulationService;
|
||||
|
||||
@Resource
|
||||
private IRiskManageService riskManageService;
|
||||
|
||||
/**
|
||||
* 查询规则模型列表接口
|
||||
* @param riskManageRegulation 风险管控规则模型
|
||||
* @return 返回结果
|
||||
*/
|
||||
@PostMapping({"/findRegulationParams"})
|
||||
public BaseResponse<List<RiskManageRegulationGroupOuterVO>> findRegulationParams(@RequestBody RiskManageRegulation riskManageRegulation){
|
||||
return regulationService.findRegulationParams(riskManageRegulation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行风控规则
|
||||
* @param regulationGroupApply 风控规则对象
|
||||
* @return 返回结果
|
||||
*/
|
||||
@PostMapping({"/applyRegulation"})
|
||||
public BaseResponse<Object> applyRegulation(@RequestBody RiskManageRegulationGroupApply regulationGroupApply){
|
||||
return regulationService.applyRegulation(regulationGroupApply);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询规则模型列表接口
|
||||
* @param riskManageRegulation 风险管控规则模型
|
||||
* @return 返回结果
|
||||
*/
|
||||
@PostMapping({"/findApplyRegulation"})
|
||||
public BaseResponse<Object> findApplyRegulation(@RequestBody RiskManageRegulationVO riskManageRegulation){
|
||||
return BaseResponse.success(riskManageService.findApplyRegulation(riskManageRegulation));
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.riskmanage.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 风险管控规则模型
|
||||
* @author daixc
|
||||
* @date 2021/08/18
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("RiskManageRegulation规则模型对象")
|
||||
public class RiskManageRegulation implements Serializable {
|
||||
|
||||
@ApiModelProperty("主键")
|
||||
private String regulationGroupModuleId;
|
||||
|
||||
@ApiModelProperty("规则集合主键")
|
||||
private String regulationGroupId;
|
||||
|
||||
@ApiModelProperty("规则集合编号")
|
||||
private String regulationGroupCode;
|
||||
|
||||
@ApiModelProperty("调用模块类别名称")
|
||||
private String callCategoryName;
|
||||
|
||||
@ApiModelProperty("调用模块类别编号")
|
||||
private String callCategory;
|
||||
|
||||
@ApiModelProperty("风险调用模块名称")
|
||||
private String callModuleName;
|
||||
|
||||
@ApiModelProperty("风险调用模块")
|
||||
private String callModuleCode;
|
||||
|
||||
@ApiModelProperty("调用节点(多个用英文逗号隔开)")
|
||||
private String callPointName;
|
||||
|
||||
@ApiModelProperty("调用节点编号(多个用英文逗号隔开)")
|
||||
private String callPointCode;
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.riskmanage.entity;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.extend.feign.entity.risk.RiskManageRegulationGroupOuterVO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 风控规则
|
||||
* @author daixc
|
||||
* @date 2021/08/18
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("风控规则对象")
|
||||
public class RiskManageRegulationGroupApply implements Serializable {
|
||||
|
||||
@ApiModelProperty("业务id")
|
||||
private String businessId;
|
||||
|
||||
@ApiModelProperty("调用模块类别编号")
|
||||
private String callCategoryCode;
|
||||
|
||||
@ApiModelProperty("调用模块类别名称")
|
||||
private String callCategoryName;
|
||||
|
||||
@ApiModelProperty("风险调用模块编号")
|
||||
private String callModuleCode;
|
||||
|
||||
@ApiModelProperty("风险调用模块名称")
|
||||
private String callModuleName;
|
||||
|
||||
@ApiModelProperty("调用节点编号")
|
||||
private String callPointCode;
|
||||
|
||||
@ApiModelProperty("调用节点名称")
|
||||
private String callPointName;
|
||||
|
||||
@ApiModelProperty("应用规则所需的参数")
|
||||
private List<RiskManageRegulationGroupOuterVO> outerVoList;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.riskmanage.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 风险管控规则模型
|
||||
* @author daixc
|
||||
* @date 2021/08/18
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("执行接口请求对象")
|
||||
public class RiskManageRegulationVO {
|
||||
|
||||
@ApiModelProperty("请求参数对象")
|
||||
private Map<String,Object> params;
|
||||
|
||||
@ApiModelProperty("规则模型对象")
|
||||
private RiskManageRegulation riskManageRegulation;
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.riskmanage.service;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.extend.riskmanage.entity.RiskManageRegulationVO;
|
||||
|
||||
/**
|
||||
* 风控接口
|
||||
* @author daixc
|
||||
* @date 2021/08/19
|
||||
*/
|
||||
public interface IRiskManageService {
|
||||
|
||||
/**
|
||||
* 分控中心校验是否通过
|
||||
* @param riskManageRegulation 访问实体
|
||||
* @return 返回结果
|
||||
*/
|
||||
Object findApplyRegulation(RiskManageRegulationVO riskManageRegulation);
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.riskmanage.service.impl;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseCacheUser;
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
||||
import com.chinaunicom.mall.ebtp.common.base.service.IBaseCacheUserService;
|
||||
import com.chinaunicom.mall.ebtp.extend.feign.client.RiskManageRegulationService;
|
||||
import com.chinaunicom.mall.ebtp.extend.feign.entity.risk.RiskManageRegulationGroupOuterVO;
|
||||
import com.chinaunicom.mall.ebtp.extend.feign.utils.CallRegulationUtil;
|
||||
import com.chinaunicom.mall.ebtp.extend.riskmanage.entity.RiskManageRegulation;
|
||||
import com.chinaunicom.mall.ebtp.extend.riskmanage.entity.RiskManageRegulationGroupApply;
|
||||
import com.chinaunicom.mall.ebtp.extend.riskmanage.entity.RiskManageRegulationVO;
|
||||
import com.chinaunicom.mall.ebtp.extend.riskmanage.service.IRiskManageService;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 风险管控接口实现
|
||||
* @author daixc
|
||||
* @date 2021/08/19
|
||||
*/
|
||||
@Service
|
||||
public class RiskManageServiceImpl implements IRiskManageService {
|
||||
|
||||
@Resource
|
||||
private RiskManageRegulationService regulationService;
|
||||
|
||||
@Resource
|
||||
private IBaseCacheUserService cacheUserService;
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public Object findApplyRegulation(RiskManageRegulationVO riskManageRegulation) {
|
||||
|
||||
Map<String,Object> params = riskManageRegulation.getParams();
|
||||
RiskManageRegulation regulation = riskManageRegulation.getRiskManageRegulation();
|
||||
|
||||
//查询模型信息
|
||||
BaseResponse<List<RiskManageRegulationGroupOuterVO>> regulationParams = regulationService.findRegulationParams(regulation);
|
||||
|
||||
RiskManageRegulationGroupApply regulationGroupApply = new RiskManageRegulationGroupApply();
|
||||
regulationGroupApply.setBusinessId(params.get("id").toString());
|
||||
//模块分类
|
||||
regulationGroupApply.setCallCategoryCode(regulation.getCallCategory());
|
||||
regulationGroupApply.setCallCategoryName(regulation.getCallCategoryName());
|
||||
//调用模块
|
||||
regulationGroupApply.setCallModuleCode(regulation.getCallModuleCode());
|
||||
regulationGroupApply.setCallModuleName(regulation.getCallModuleName());
|
||||
//调用节点
|
||||
regulationGroupApply.setCallPointCode(regulation.getCallPointCode());
|
||||
regulationGroupApply.setCallPointName(regulation.getCallPointName());
|
||||
|
||||
BaseCacheUser cacheUser = cacheUserService.getCacheUser();
|
||||
regulationGroupApply.setOuterVoList(CallRegulationUtil.getCallRegulationMap(params,regulationParams,cacheUser.getOrganizationId()));
|
||||
|
||||
//校验信息
|
||||
return regulationService.applyRegulation(regulationGroupApply);
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.signature.controller;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
||||
import com.chinaunicom.mall.ebtp.extend.signature.entity.ExpertSignature;
|
||||
import com.chinaunicom.mall.ebtp.extend.signature.service.ExpertSignatureService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
||||
@RestController
|
||||
@Api(tags = "")
|
||||
@RequestMapping("/v1/signature")
|
||||
public class ExpertSignatureController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ExpertSignatureService expertSignatureService;
|
||||
|
||||
/**
|
||||
* 追加专家签名
|
||||
*
|
||||
* @param signature
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@PreAuthorize("hasAnyAuthority('ebtp-purchase','ebtp-agency-project-manager')")
|
||||
@PostMapping(value = "")
|
||||
public BaseResponse<String> export(@RequestBody ExpertSignature signature, HttpServletRequest request, HttpServletResponse response) {
|
||||
return BaseResponse.success(expertSignatureService.addSignature(signature));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.signature.entity;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ExpertInfo {
|
||||
|
||||
private String expertId;
|
||||
|
||||
private String expertSign;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.signature.entity;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ExpertSignature {
|
||||
|
||||
private String assessRoomId;
|
||||
|
||||
private String bid;
|
||||
|
||||
private List<ExpertInfo> experts;
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.signature.service;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.extend.signature.entity.ExpertSignature;
|
||||
|
||||
public interface ExpertSignatureService {
|
||||
|
||||
|
||||
/**
|
||||
* 追加专家签名
|
||||
*
|
||||
* @param signature
|
||||
* @return
|
||||
*/
|
||||
String addSignature(ExpertSignature signature);
|
||||
}
|
@ -0,0 +1,229 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.signature.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import com.aspose.words.FontSettings;
|
||||
import com.aspose.words.License;
|
||||
import com.aspose.words.SaveFormat;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.api.AttachmentClient;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.model.AttachmentDetail;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.model.AttachmentEntity;
|
||||
import com.chinaunicom.mall.ebtp.common.util.JsonUtils;
|
||||
import com.chinaunicom.mall.ebtp.common.util.PropertyUtils;
|
||||
import com.chinaunicom.mall.ebtp.extend.export.service.templateFile.TemplateFileService;
|
||||
import com.chinaunicom.mall.ebtp.extend.signature.entity.ExpertSignature;
|
||||
import com.chinaunicom.mall.ebtp.extend.signature.service.ExpertSignatureService;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.data.PictureRenderData;
|
||||
import com.spire.doc.Document;
|
||||
import com.spire.doc.DocumentObject;
|
||||
import com.spire.doc.FileFormat;
|
||||
import com.spire.doc.Section;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import sun.misc.BASE64Decoder;
|
||||
|
||||
import java.io.*;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ExpertSignatureServiceImpl implements ExpertSignatureService {
|
||||
|
||||
@Autowired
|
||||
private AttachmentClient attachmentClient;
|
||||
|
||||
@Autowired
|
||||
private TemplateFileService templateFileService;
|
||||
|
||||
@Value("${mconfig.file.upload-address}")
|
||||
private String uploadAddress;
|
||||
|
||||
@Value("${mconfig.file.font-address}")
|
||||
private String fontAddress;
|
||||
|
||||
|
||||
private String getUploadAddress(String assessRoomId) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
||||
return uploadAddress + File.separator + sdf.format(System.currentTimeMillis()) + File.separator + assessRoomId + File.separator;
|
||||
}
|
||||
|
||||
/**
|
||||
* 追加专家签名
|
||||
*
|
||||
* @param signature
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String addSignature(ExpertSignature signature) {
|
||||
//获取临时存储地址
|
||||
String path = this.getUploadAddress(signature.getAssessRoomId());
|
||||
//获取专家签名文件
|
||||
InputStream expertSign = getExpertSign(signature, path);
|
||||
//获取bid的word文件
|
||||
AttachmentDetail attachmentDetail = attachmentClient.findByBusinessId(Collections.singletonList(signature.getBid())).orElse(new AttachmentDetail());
|
||||
AttachmentEntity entity = attachmentDetail.get(signature.getBid()).stream().findAny()
|
||||
.orElseGet(() -> attachmentClient.findByObjectId(signature.getBid()).orElseThrow(() -> new RuntimeException("文档查询失败")));
|
||||
log.info("----------AttachmentEntity --------: " + JsonUtils.objectToJson(entity));
|
||||
byte[] bytes = attachmentClient.downloadFileByObjectId(entity.getId()).orElseThrow(() -> new RuntimeException("文档下载失败"));
|
||||
log.info("----------AttachmentEntity --------: " + bytes.length);
|
||||
InputStream word = new ByteArrayInputStream(bytes);
|
||||
|
||||
//合并word 转为pdf
|
||||
byte[] pdf = null;
|
||||
try {
|
||||
pdf = mergeWord(word, expertSign, path);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
//上传pdf到文档中心
|
||||
String pdfId = PropertyUtils.getSnowflakeId();
|
||||
String filename = entity.getFilename();
|
||||
filename = filename.substring(0, filename.lastIndexOf(".")) + ".pdf";
|
||||
attachmentClient.upload(pdfId, filename, pdf);
|
||||
return pdfId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 合并word
|
||||
*
|
||||
* @param source
|
||||
* @param addObj
|
||||
* @param path
|
||||
* @throws IOException
|
||||
*/
|
||||
private byte[] mergeWord(InputStream source, InputStream addObj, String path) throws IOException {
|
||||
Document d1 = new Document(source);
|
||||
Document d2 = new Document(addObj);
|
||||
|
||||
//获取文档1的最后一节
|
||||
Section lastsec = d1.getLastSection();
|
||||
|
||||
//遍历文档2的所有段落内容,添加到文档1
|
||||
for (Section section : (Iterable<Section>) d2.getSections()) {
|
||||
for (DocumentObject obj : (Iterable<DocumentObject>) section.getBody().getChildObjects()
|
||||
) {
|
||||
lastsec.getBody().getChildObjects().add(obj.deepClone());
|
||||
}
|
||||
}
|
||||
|
||||
//保存合并后的文档
|
||||
d1.saveToFile(path + "merged.docx", FileFormat.Docx_2010);
|
||||
|
||||
//转为pdf
|
||||
long l = System.currentTimeMillis();
|
||||
if (!getLicense()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
File f = new File(path + "merged.pdf");
|
||||
FileOutputStream fos = new FileOutputStream(f);
|
||||
FontSettings.getDefaultInstance().setFontsFolder(fontAddress, true);
|
||||
try {
|
||||
com.aspose.words.Document doc = new com.aspose.words.Document(path + "merged.docx");
|
||||
doc.save(fos, SaveFormat.PDF);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
source.close();
|
||||
addObj.close();
|
||||
fos.flush();
|
||||
fos.close();
|
||||
}
|
||||
|
||||
long l1 = System.currentTimeMillis();
|
||||
log.info(" ======= " + (l1 - l) + " ======= ");
|
||||
|
||||
return IOUtils.toByteArray(new FileInputStream(f));
|
||||
}
|
||||
|
||||
private boolean getLicense() {
|
||||
boolean result = false;
|
||||
InputStream is = ExpertSignatureServiceImpl.class.getClassLoader().getResourceAsStream("/license/aspose-license.xml");
|
||||
License license = new License();
|
||||
try {
|
||||
license.setLicense(is);
|
||||
result = true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private FileInputStream getExpertSign(ExpertSignature signature, final String path) {
|
||||
String imgPath = mkdir(path + "/imgs/");
|
||||
List<PictureRenderData> pics = new ArrayList<>();
|
||||
signature.getExperts().forEach(l -> {
|
||||
if (l.getExpertSign().contains("data:image/png;base64,")) {
|
||||
l.setExpertSign(l.getExpertSign().replace("data:image/png;base64,", ""));
|
||||
}
|
||||
String img = imgPath + l.getExpertId() + ".png";
|
||||
|
||||
base64ToImage(l.getExpertSign(), img);
|
||||
pics.add(new PictureRenderData(130, 100, img));
|
||||
});
|
||||
|
||||
//获取签名模版
|
||||
InputStream file = templateFileService.getExportTemplet("expertSignature");
|
||||
|
||||
//生成签名word
|
||||
Map<String, Object> all = new HashMap<String, Object>() {{
|
||||
put("imgs", pics);
|
||||
}};
|
||||
XWPFTemplate template = XWPFTemplate.compile(file).render(all);
|
||||
FileInputStream fis = null;
|
||||
try {
|
||||
String docPath = path + "expertSignature.docx";
|
||||
|
||||
template.writeToFile(docPath);
|
||||
fis = new FileInputStream(new File(docPath));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return fis;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* base64字符串转换成图片
|
||||
*
|
||||
* @param imgStr base64字符串
|
||||
* @param imgFilePath 图片存放路径
|
||||
*/
|
||||
private void base64ToImage(String imgStr, String imgFilePath) {
|
||||
if (StringUtils.isEmpty(imgStr)) {
|
||||
return;
|
||||
}
|
||||
BASE64Decoder decoder = new BASE64Decoder();
|
||||
try {
|
||||
// Base64解码
|
||||
byte[] b = decoder.decodeBuffer(imgStr);
|
||||
for (int i = 0; i < b.length; ++i) {
|
||||
if (b[i] < 0) {// 调整异常数据
|
||||
b[i] += 256;
|
||||
}
|
||||
}
|
||||
OutputStream out = new FileOutputStream(imgFilePath);
|
||||
out.write(b);
|
||||
out.flush();
|
||||
out.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String mkdir(String path) {
|
||||
if (!FileUtil.exist(path)) {
|
||||
FileUtil.mkdir(path);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
}
|
@ -172,9 +172,14 @@ mconfig:
|
||||
tender: biz-service-ebtp-tender #投标服务
|
||||
documentcenter: core-service-document-center #文档中心
|
||||
usercenter: core-service-usercenter-public #用户中心
|
||||
file:
|
||||
font-address: /storage/fonts/
|
||||
upload-address: /storage/reviewReport/
|
||||
document:
|
||||
clientHttpUrl: http://10.242.31.158:8100/auth/oauth/token?grant_type=client_credentials&client_id=bVS46ElU&client_secret=58ea04ba02475c8da2321cc99849d2a10f15b749
|
||||
|
||||
|
||||
|
||||
# 用户暴露给 prometheus 的健康数据
|
||||
management:
|
||||
endpoints:
|
||||
|
@ -3,18 +3,18 @@ server:
|
||||
servlet:
|
||||
context-path: /
|
||||
|
||||
# 对应 apollo 配置中心的应用名
|
||||
app:
|
||||
id: biz-service-ebtp-extend
|
||||
|
||||
# Apollo 配置信息
|
||||
apollo:
|
||||
meta: http://10.242.37.148:6001/
|
||||
bootstrap:
|
||||
namespace: application
|
||||
enabled: true
|
||||
eagerLoad:
|
||||
enabled: true
|
||||
## 对应 apollo 配置中心的应用名
|
||||
#app:
|
||||
# id: biz-service-ebtp-extend
|
||||
#
|
||||
## Apollo 配置信息
|
||||
#apollo:
|
||||
# meta: http://10.242.37.148:6001/
|
||||
# bootstrap:
|
||||
# namespace: application
|
||||
# enabled: true
|
||||
# eagerLoad:
|
||||
# enabled: true
|
||||
|
||||
seata:
|
||||
service:
|
||||
@ -164,7 +164,9 @@ mconfig:
|
||||
tender: biz-service-ebtp-tender #投标服务
|
||||
documentcenter: core-service-document-center #文档中心
|
||||
usercenter: core-service-usercenter-public #用户中心
|
||||
|
||||
file:
|
||||
font-address: /storage/fonts/
|
||||
upload-address: /storage/reviewReport/
|
||||
|
||||
document:
|
||||
clientHttpUrl: http://10.242.31.158:8100/auth/oauth/token?grant_type=client_credentials&client_id=bVS46ElU&client_secret=58ea04ba02475c8da2321cc99849d2a10f15b749
|
||||
|
@ -167,6 +167,9 @@ mconfig:
|
||||
tender: biz-service-ebtp-tender #投标服务
|
||||
documentcenter: core-service-document-center #文档中心
|
||||
usercenter: core-service-usercenter-public #用户中心
|
||||
file:
|
||||
font-address: /storage/fonts/
|
||||
upload-address: /storage/reviewReport/
|
||||
document:
|
||||
clientHttpUrl: http://10.238.25.112:8100/auth/oauth/token?grant_type=client_credentials&client_id=bVS46ElU&client_secret=58ea04ba02475c8da2321cc99849d2a10f15b749
|
||||
|
||||
|
@ -167,6 +167,9 @@ mconfig:
|
||||
tender: biz-service-ebtp-tender #投标服务
|
||||
documentcenter: core-service-document-center #文档中心
|
||||
usercenter: core-service-usercenter-public #用户中心
|
||||
file:
|
||||
font-address: /storage/fonts/
|
||||
upload-address: /storage/reviewReport/
|
||||
document:
|
||||
clientHttpUrl: http://10.242.31.158:8100/auth/oauth/token?grant_type=client_credentials&client_id=bVS46ElU&client_secret=58ea04ba02475c8da2321cc99849d2a10f15b749
|
||||
|
||||
|
16
src/main/resources/license/aspose-license.xml
Normal file
16
src/main/resources/license/aspose-license.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<License>
|
||||
<Data>
|
||||
<Products>
|
||||
<Product>Aspose.Total for Java</Product>
|
||||
<Product>Aspose.Words for Java</Product>
|
||||
</Products>
|
||||
<EditionType>Enterprise</EditionType>
|
||||
<SubscriptionExpiry>20991231</SubscriptionExpiry>
|
||||
<LicenseExpiry>20991231</LicenseExpiry>
|
||||
<SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber>
|
||||
</Data>
|
||||
<Signature>
|
||||
sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=
|
||||
</Signature>
|
||||
</License>
|
Reference in New Issue
Block a user