Merge branch 'uat' into 'dev'

Uat

See merge request eshop/biz_service_ebtp_extend!58
This commit is contained in:
付庆吉
2021-08-23 15:33:37 +08:00
22 changed files with 562 additions and 43 deletions

View File

@ -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"]

View File

@ -1,6 +1,7 @@
package com.chinaunicom.mall.ebtp.extend.bizmessage.controller;
import com.chinaunicom.mall.ebtp.extend.bizmessage.dto.PageDTO;
import com.chinaunicom.mall.ebtp.extend.bizmessage.entity.BizMessageAuthorize;
import com.chinaunicom.mall.ebtp.extend.bizmessage.entity.BizMessageVo;
import com.chinaunicom.mall.ebtp.extend.bizmessage.mybatis.IBizMessagePage;
import com.chinaunicom.mall.ebtp.extend.bizmessage.service.BizMessageConsumerService;
@ -58,9 +59,11 @@ public class BizMessageConsumerController {
DescribeSiteMsgDetailVO vo = new DescribeSiteMsgDetailVO();
vo.setMsgId(source.getId());
BeanUtils.copyProperties(source, vo);
//已读
this.service.updateState(source.getId());
BizMessageAuthorize authorize = new BizMessageAuthorize();
authorize.setMessageId(source.getId());
authorize = this.service.getAuthorize(authorize);
vo.setAuthorizestate(authorize.getState());
vo.setServicecode(source.getServicecode());
return vo;
}).orElseGet(DescribeSiteMsgDetailVO::new);
}
@ -77,4 +80,18 @@ public class BizMessageConsumerController {
return service.selectMsgListByType(vo);
}
/**
* 信息已阅
*
* @return
*/
@ApiOperation("信息已阅")
@GetMapping("selectMsgRead/{id}")
@ResponseStatus(code = HttpStatus.OK)
public Boolean selectMsgRead( @ApiParam(value = "待查询的消息id", required = true) @PathVariable("id") String id) {
//已读
this.service.updateState(id);
return true;
}
}

View File

@ -3,6 +3,7 @@ package com.chinaunicom.mall.ebtp.extend.bizmessage.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.chinaunicom.mall.ebtp.extend.bizmessage.entity.BizMessage;
import com.chinaunicom.mall.ebtp.extend.bizmessage.entity.BizMessageAuthorize;
import com.chinaunicom.mall.ebtp.extend.bizmessage.entity.BizMessageVo;
import org.apache.ibatis.annotations.Param;
@ -16,6 +17,8 @@ public interface BizMessageMapper extends BaseMapper<BizMessage> {
Boolean updateState(@Param("userId") String userId,@Param("messageId") String messageId);
IPage<BizMessageVo> findMessageVoList(@Param("param") IPage<BizMessageVo> page,BizMessageVo vo);
List<BizMessageVo> findMessageVoList(BizMessageVo vo);
List<BizMessageAuthorize> findAuthorizeList(BizMessageAuthorize vo);
}

View File

@ -61,7 +61,23 @@
and biz_message_template.type = #{templatetype}
</if>
ORDER BY createtime DESC
LIMIT #{size}
</select>
<select id="findAuthorizeList" resultType="com.chinaunicom.mall.ebtp.extend.bizmessage.entity.BizMessageAuthorize" parameterType="com.chinaunicom.mall.ebtp.extend.bizmessage.entity.BizMessageAuthorize">
SELECT
*
FROM
biz_message_authorize
WHERE 1 = 1
<if test="userId!=null and userId!=''">
and user_id = #{userId}
</if>
<if test="messageId!=null and messageId!=''">
and message_id = #{messageId}
</if>
<if test="state!=null and state!=''">
and state = #{state}
</if>
</select>
</mapper>

View File

@ -2,6 +2,7 @@ package com.chinaunicom.mall.ebtp.extend.bizmessage.service;
import com.chinaunicom.mall.ebtp.extend.bizmessage.dto.PageDTO;
import com.chinaunicom.mall.ebtp.extend.bizmessage.entity.BizMessage;
import com.chinaunicom.mall.ebtp.extend.bizmessage.entity.BizMessageAuthorize;
import com.chinaunicom.mall.ebtp.extend.bizmessage.entity.BizMessageVo;
import com.chinaunicom.mall.ebtp.extend.bizmessage.mybatis.IBizMessagePage;
import com.chinaunicom.mall.ebtp.extend.bizmessage.vo.DescribeSiteMsgVO;
@ -17,4 +18,11 @@ public interface BizMessageConsumerService {
Boolean updateState(String id);
List<BizMessageVo> selectMsgListByType(BizMessageVo vo);
/**
* 查询读取状态
* @param authorize
* @return
*/
BizMessageAuthorize getAuthorize(BizMessageAuthorize authorize);
}

View File

@ -6,6 +6,7 @@ import com.chinaunicom.mall.ebtp.common.base.service.IBaseCacheUserService;
import com.chinaunicom.mall.ebtp.extend.bizmessage.dao.BizMessageMapper;
import com.chinaunicom.mall.ebtp.extend.bizmessage.dto.PageDTO;
import com.chinaunicom.mall.ebtp.extend.bizmessage.entity.BizMessage;
import com.chinaunicom.mall.ebtp.extend.bizmessage.entity.BizMessageAuthorize;
import com.chinaunicom.mall.ebtp.extend.bizmessage.entity.BizMessageVo;
import com.chinaunicom.mall.ebtp.extend.bizmessage.mybatis.BizMessagePage;
import com.chinaunicom.mall.ebtp.extend.bizmessage.mybatis.IBizMessagePage;
@ -15,6 +16,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@ -68,7 +70,8 @@ public class BizMessageConsumerServiceImpl implements BizMessageConsumerService
*/
@Override
public BizMessage getDetailById(String id) {
return mapper.selectById(id);
BizMessage message = mapper.selectById(id);
return message;
}
/**
@ -109,17 +112,33 @@ public class BizMessageConsumerServiceImpl implements BizMessageConsumerService
if(vo.getAuthorizestate()==null||"".equals(vo.getAuthorizestate())){
vo.setAuthorizestate("0");
}
PageDTO page = new PageDTO();
page.setPageSize(vo.getSize());
IPage<BizMessageVo> pageEntity = mapper.findMessageVoList(new Page<BizMessageVo>(page.getPageNo(), page.getPageSize()),vo);
List<BizMessageVo> list = mapper.findMessageVoList(vo);
List<BizMessageVo> list = pageEntity.getRecords();
List<BizMessageVo> rList = new ArrayList<>();
list.forEach(l->{
l.setDatanum(pageEntity.getTotal());
});
for(int i = 0 ; i < list.size();i++){
if(i<vo.getSize()){
BizMessageVo message = list.get(i);
message.setDatanum(Long.valueOf(list.size()));
rList.add(message);
}
}
return list;
return rList;
}
/**
* 查询读取状态
* @param authorize
* @return
*/
@Override
public BizMessageAuthorize getAuthorize(BizMessageAuthorize authorize){
authorize.setUserId(service.getCacheUser().getUserId());
List<BizMessageAuthorize> authorizes = this.mapper.findAuthorizeList(authorize);
return authorizes!=null&&authorizes.size()>0?authorizes.get(0):new BizMessageAuthorize();
}
}

View File

@ -26,4 +26,6 @@ public class DescribeSiteMsgDetailVO {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Timestamp createtime;
private String authorizestate;
private String servicecode;
}

View File

@ -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);
}

View File

@ -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;
}
};
}
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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));
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -2,10 +2,13 @@ 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;
@ -26,10 +29,7 @@ import sun.misc.BASE64Decoder;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
@Slf4j
@Service
@ -44,6 +44,9 @@ public class ExpertSignatureServiceImpl implements ExpertSignatureService {
@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");
@ -63,9 +66,12 @@ public class ExpertSignatureServiceImpl implements ExpertSignatureService {
//获取专家签名文件
InputStream expertSign = getExpertSign(signature, path);
//获取bid的word文件
AttachmentEntity entity = attachmentClient.findByObjectId(signature.getBid()).orElse(new AttachmentEntity());
byte[] bytes = attachmentClient.downloadFileByObjectId(signature.getBid()).orElse(new byte[0]);
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
@ -78,7 +84,9 @@ public class ExpertSignatureServiceImpl implements ExpertSignatureService {
//上传pdf到文档中心
String pdfId = PropertyUtils.getSnowflakeId();
attachmentClient.upload(pdfId, entity.getFilename(), pdf);
String filename = entity.getFilename();
filename = filename.substring(0, filename.lastIndexOf(".")) + ".pdf";
attachmentClient.upload(pdfId, filename, pdf);
return pdfId;
}
@ -116,7 +124,7 @@ public class ExpertSignatureServiceImpl implements ExpertSignatureService {
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);
@ -138,22 +146,6 @@ public class ExpertSignatureServiceImpl implements ExpertSignatureService {
private boolean getLicense() {
boolean result = false;
InputStream is = ExpertSignatureServiceImpl.class.getClassLoader().getResourceAsStream("/license/aspose-license.xml");
// String licenseStr =
// "<License>\n" +
// " <Data>\n" +
// " <Products>\n" +
// " <Product>Aspose.Total for Java</Product>\n" +
// " <Product>Aspose.Words for Java</Product>\n" +
// " </Products>\n" +
// " <EditionType>Enterprise</EditionType>\n" +
// " <SubscriptionExpiry>20991231</SubscriptionExpiry>\n" +
// " <LicenseExpiry>20991231</LicenseExpiry>\n" +
// " <SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber>\n" +
// " </Data>\n" +
// " <Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature>\n" +
// "</License>";
// InputStream is = null;
// is = new ByteArrayInputStream(licenseStr.getBytes(StandardCharsets.UTF_8));
License license = new License();
try {
license.setLicense(is);

View File

@ -173,6 +173,7 @@ mconfig:
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

View File

@ -165,6 +165,7 @@ mconfig:
documentcenter: core-service-document-center #文档中心
usercenter: core-service-usercenter-public #用户中心
file:
font-address: /storage/fonts/
upload-address: /storage/reviewReport/
document:

View File

@ -168,6 +168,7 @@ mconfig:
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

View File

@ -168,6 +168,7 @@ mconfig:
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