Merge branch 'master' into 'pro'
Master See merge request eshop/biz_service_ebtp_extend!19
This commit is contained in:
@ -6,12 +6,15 @@ import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseEntity;
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BasePageRequest;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 实体类 BizBidNotice
|
||||
@ -65,5 +68,7 @@ public class BizBidNoticeVO extends BasePageRequest implements Serializable {
|
||||
@ApiModelProperty(value = "是否置顶")
|
||||
private String noticeTop;
|
||||
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createDate;
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package com.chinaunicom.mall.ebtp.extend.bizbidnotice.service.impl;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.chinaunicom.mall.ebtp.common.base.service.impl.BaseServiceImpl;
|
||||
@ -43,6 +42,9 @@ public class BizBidNoticeServiceImpl extends BaseServiceImpl<BizBidNoticeMapper,
|
||||
.like(StrUtil.isNotEmpty(bizBidNotice.getNoticeName()), BizBidNotice::getNoticeName, bizBidNotice.getNoticeName())
|
||||
.orderByAsc(BizBidNotice::getNoticeTop);
|
||||
|
||||
if (bizBidNotice.getCreateDate() != null) {
|
||||
wrapper.between(BizBidNotice::getCreateDate, bizBidNotice.getCreateDate(), bizBidNotice.getCreateDate().plusDays(1L));
|
||||
}
|
||||
IPage<BizBidNotice> page = this.page(new Page<>(bizBidNotice.getPageNo(), bizBidNotice.getPageSize()), wrapper);
|
||||
listRelease(page.getRecords());
|
||||
return page;
|
||||
|
@ -3,13 +3,16 @@ package com.chinaunicom.mall.ebtp.extend.bizbidshared.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BasePageRequest;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -66,4 +69,7 @@ public class BizBidSharedVO extends BasePageRequest implements Serializable {
|
||||
@ApiModelProperty(value = "共享文档备注")
|
||||
private String sharedRemarks;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createDate;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ 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.base.service.impl.BaseServiceImpl;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizbidnotice.entity.BizBidNotice;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizbidshared.dao.BizBidSharedMapper;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizbidshared.entity.BizBidShared;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizbidshared.entity.BizBidSharedVO;
|
||||
@ -40,6 +41,10 @@ public class BizBidSharedServiceImpl extends BaseServiceImpl<BizBidSharedMapper,
|
||||
.like(StrUtil.isNotEmpty(bizBidNotice.getSharedRole()), BizBidShared::getSharedRole, bizBidNotice.getSharedRole())
|
||||
.orderByDesc(BizBidShared::getCreateDate);
|
||||
|
||||
if (bizBidNotice.getCreateDate() != null) {
|
||||
wrapper.between(BizBidShared::getCreateDate, bizBidNotice.getCreateDate(), bizBidNotice.getCreateDate().plusDays(1L));
|
||||
}
|
||||
|
||||
Page<BizBidShared> page = this.page(new Page<>(bizBidNotice.getPageNo(), bizBidNotice.getPageSize()), wrapper);
|
||||
|
||||
List<String> collect = page.getRecords().stream().map(BizBidShared::getSharedFile).distinct().collect(Collectors.toList());
|
||||
|
@ -4,13 +4,16 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseEntity;
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BasePageRequest;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -70,6 +73,8 @@ public class BizBidSharedRecordVO extends BasePageRequest implements Serializabl
|
||||
@ApiModelProperty(value = "下载账号")
|
||||
private String recordAccount;
|
||||
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createDate;
|
||||
|
||||
}
|
||||
|
@ -35,7 +35,9 @@ public class BizBidSharedRecordServiceImpl extends BaseServiceImpl<BizBidSharedR
|
||||
.eq(StrUtil.isNotEmpty(recordVO.getRecordStaff()), BizBidSharedRecord::getRecordStaff, recordVO.getRecordStaff())
|
||||
.eq(StrUtil.isNotEmpty(recordVO.getRecordAccount()), BizBidSharedRecord::getRecordAccount, recordVO.getRecordAccount())
|
||||
.orderByDesc(BizBidSharedRecord::getCreateDate);
|
||||
|
||||
if (recordVO.getCreateDate() != null) {
|
||||
wrapper.between(BizBidSharedRecord::getCreateDate, recordVO.getCreateDate(), recordVO.getCreateDate().plusDays(1L));
|
||||
}
|
||||
return this.page(new Page<>(recordVO.getPageNo(), recordVO.getPageSize()), wrapper);
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,8 @@ public enum ExportExceptionEnum implements BusinessExceptionAssert {
|
||||
|
||||
FRAME_EXCEPTION_GET_PROJECT_INFO(2200001, "获取项目信息失败"),
|
||||
|
||||
FRAME_EXCEPTION_GET_DOCUMENT_CENTER(2200009, "!"),
|
||||
|
||||
;
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,39 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.feign.client;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.extend.feign.factory.FeignConfiguration;
|
||||
import com.chinaunicom.mall.ebtp.extend.feign.factory.DocumentCenterServiceFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* 连接山分的文档中心服务
|
||||
*
|
||||
* @author Ajaxfan
|
||||
*/
|
||||
|
||||
@FeignClient(value = "${mconfig.feign.name.documentcenter}",
|
||||
fallbackFactory = DocumentCenterServiceFallbackFactory.class,
|
||||
configuration = FeignConfiguration.class)
|
||||
public interface DocumentCenterService {
|
||||
|
||||
/**
|
||||
* 通过附件id查询明细
|
||||
*
|
||||
* @param fileId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = "v1.0/files/downloadFileAllStream")
|
||||
String getObjectDetail(@RequestParam("fileId") String fileId);
|
||||
|
||||
/**
|
||||
* 通过附件id查询明细
|
||||
*
|
||||
* @param fileId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = "v1.0/files/downloadStream")
|
||||
String getFileObjectDetail(@RequestParam("fileId") String fileId);
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.feign.factory;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.extend.feign.client.DocumentCenterService;
|
||||
import com.chinaunicom.mall.ebtp.extend.feign.fallback.DocumentCenterServiceFallbackImpl;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 断路器
|
||||
*
|
||||
* @author dino
|
||||
* @date 2020/11/26 9:39
|
||||
*/
|
||||
@Component
|
||||
public class DocumentCenterServiceFallbackFactory implements FallbackFactory<DocumentCenterService> {
|
||||
@Override
|
||||
public DocumentCenterService create(Throwable throwable) {
|
||||
DocumentCenterServiceFallbackImpl remoteProcessServiceFallback = new DocumentCenterServiceFallbackImpl();
|
||||
remoteProcessServiceFallback.setCause(throwable);
|
||||
return remoteProcessServiceFallback;
|
||||
}
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.feign.factory;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chinaunicom.mall.ebtp.extend.feign.utils.UrlConstants;
|
||||
import feign.RequestInterceptor;
|
||||
import feign.RequestTemplate;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
|
||||
@Slf4j
|
||||
@Configuration
|
||||
public class FeignConfiguration implements RequestInterceptor {
|
||||
|
||||
@Override
|
||||
public void apply(RequestTemplate requestTemplate) {
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
if(attributes!=null){
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
log.info("token=======requestTemplate.headers"+requestTemplate.headers());
|
||||
String access_token = request.getHeader("Authorization");
|
||||
log.info("token======="+access_token);
|
||||
if(access_token==null || StringUtils.isBlank(access_token)){
|
||||
access_token = getAccessToken();
|
||||
log.info("token=======access_token==="+access_token);
|
||||
requestTemplate.header(HttpHeaders.AUTHORIZATION, "Bearer "+access_token);
|
||||
}
|
||||
}else{
|
||||
String access_token = getAccessToken();
|
||||
log.info("token=======attributes==null==="+access_token);
|
||||
requestTemplate.header(HttpHeaders.AUTHORIZATION, "Bearer "+access_token);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getAccessToken () {
|
||||
StringBuffer strBf = new StringBuffer();
|
||||
try {
|
||||
URL realUrl = new URL(UrlConstants.clientHttpUrl);
|
||||
//将realUrl以 open方法返回的urlConnection 连接强转为HttpURLConnection连接 (标识一个url所引用的远程对象连接)
|
||||
HttpURLConnection connection = (HttpURLConnection) realUrl.openConnection();// 此时cnnection只是为一个连接对象,待连接中
|
||||
//设置连接输出流为true,默认false (post请求是以流的方式隐式的传递参数)
|
||||
connection.setDoOutput(true);
|
||||
//设置连接输入流为true
|
||||
connection.setDoInput(true);
|
||||
//设置请求方式为post
|
||||
connection.setRequestMethod("POST");
|
||||
//post请求缓存设为false
|
||||
connection.setUseCaches(false);
|
||||
//设置该HttpURLConnection实例是否自动执行重定向
|
||||
connection.setInstanceFollowRedirects(true);
|
||||
//设置请求头里面的各个属性 (以下为设置内容的类型,设置为经过urlEncoded编码过的from参数)
|
||||
connection.setRequestProperty("Content-Type", "application/json;charset=utf-8");
|
||||
//建立连接 (请求未开始,直到connection.getInputStream()方法调用时才发起,以上各个参数设置需在此方法之前进行)
|
||||
connection.connect();
|
||||
//创建输入输出流,用于往连接里面输出携带的参数,(输出内容为?后面的内容)
|
||||
DataOutputStream dataout = new DataOutputStream(connection.getOutputStream());
|
||||
// String query = data.toString();
|
||||
// //将参数输出到连接
|
||||
// dataout.write(query.getBytes("UTF-8"));
|
||||
// 输出完成后刷新并关闭流
|
||||
dataout.flush();
|
||||
dataout.close(); // 重要且易忽略步骤 (关闭流,切记!)
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
|
||||
String lines;
|
||||
while ((lines = reader.readLine()) != null) {
|
||||
lines = new String(lines.getBytes(), "utf-8");
|
||||
strBf.append(lines);
|
||||
}
|
||||
reader.close();
|
||||
connection.disconnect();
|
||||
log.info("toke返回数据:---------------------- "+strBf.toString());
|
||||
} catch (Exception e) {
|
||||
log.info("toke返回数据:---------------------- "+e.getMessage());
|
||||
}
|
||||
JSONObject json=JSONObject.parseObject(strBf.toString());
|
||||
if((boolean)json.get("success")){
|
||||
return ((JSONObject)json.get("data")).get("value").toString();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.feign.fallback;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.extend.feign.client.DocumentCenterService;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 熔断
|
||||
*
|
||||
* @author dino
|
||||
* @date 2020/11/26 9:39
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class DocumentCenterServiceFallbackImpl implements DocumentCenterService {
|
||||
|
||||
@Setter
|
||||
private Throwable cause;
|
||||
|
||||
@Override
|
||||
public String getObjectDetail(String fileId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFileObjectDetail(String fileId) {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.feign.utils;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "document")
|
||||
public class UrlConstants {
|
||||
public static String clientHttpUrl;
|
||||
|
||||
@Value("${document.clientHttpUrl}")
|
||||
public void setClientHttpUrl(String confPath) {
|
||||
clientHttpUrl = confPath;
|
||||
}
|
||||
|
||||
}
|
@ -1,14 +1,20 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.templatewarehouse.controller;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
||||
import com.chinaunicom.mall.ebtp.extend.templatewarehouse.entity.BizBidClientVersion;
|
||||
import com.chinaunicom.mall.ebtp.extend.templatewarehouse.entity.BizBidTemplateWarehouse;
|
||||
import com.chinaunicom.mall.ebtp.extend.templatewarehouse.sevice.BizBidClientVersionService;
|
||||
import com.chinaunicom.mall.ebtp.extend.templatewarehouse.sevice.BizBidTemplateWarehouseService;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
@RestController
|
||||
@Api(tags = "模板仓库")
|
||||
@ -16,6 +22,8 @@ import javax.annotation.Resource;
|
||||
public class TemplateWarehouseController {
|
||||
@Resource
|
||||
private BizBidTemplateWarehouseService templateWarehouseService;
|
||||
@Resource
|
||||
private BizBidClientVersionService bizBidClientVersionService;
|
||||
|
||||
/**
|
||||
* 通过模板类型查询模板数据
|
||||
@ -44,4 +52,31 @@ public class TemplateWarehouseController {
|
||||
Boolean result = templateWarehouseService.insertTemplate(templateWarehouse);
|
||||
return BaseResponse.success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得客户端配置文件相关信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("获得客户端配置文件文件id")
|
||||
@GetMapping("/client/file")
|
||||
public BaseResponse getClientFile() throws IOException {
|
||||
String type = "ipassConfigFile";
|
||||
BizBidTemplateWarehouse templateWarehouse = templateWarehouseService.getTemplateByType(type);
|
||||
bizBidClientVersionService.downloadFileByOId(templateWarehouse.getDocumentCenterId());
|
||||
return BaseResponse.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过版本号获得对应客户端文件id
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("通过版本号获得对应客户端文件id")
|
||||
@GetMapping("/client/{version}")
|
||||
public BaseResponse getClientByVersion(@ApiParam(value = "版本号", required = true) @PathVariable String version) throws IOException {
|
||||
bizBidClientVersionService.getClientByVersion(version);
|
||||
return BaseResponse.success();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.templatewarehouse.dao;
|
||||
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.base.dao.IBaseMapper;
|
||||
import com.chinaunicom.mall.ebtp.extend.templatewarehouse.entity.BizBidClientVersion;
|
||||
|
||||
public interface BizBidClientVersionMapper extends IBaseMapper<BizBidClientVersion> {
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.chinaunicom.mall.ebtp.extend.templatewarehouse.dao.BizBidClientVersionMapper">
|
||||
<resultMap id="BaseResultMap"
|
||||
type="com.chinaunicom.mall.ebtp.extend.templatewarehouse.entity.BizBidClientVersion">
|
||||
<result column="id" jdbcType="BIGINT" property="id"/>
|
||||
<result column="document_center_id" jdbcType="VARCHAR" property="documentCenterId"/>
|
||||
<result column="ipass_version" jdbcType="VARCHAR" property="ipassVersion"/>
|
||||
<result column="publish_date" jdbcType="TIMESTAMP" property="publishDate"/>
|
||||
<result column="remark" jdbcType="VARCHAR" property="remark"/>
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,70 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.templatewarehouse.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseEntity;
|
||||
import com.chinaunicom.mall.ebtp.common.config.CustomLocalDateTimeTypeHandler;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 实体类 BizBidClientVersion
|
||||
*
|
||||
* @auto.generated
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel
|
||||
@TableName(value = "biz_bid_client_version", autoResultMap = true)
|
||||
public class BizBidClientVersion implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 文档中心-文档ID
|
||||
*/
|
||||
@ApiModelProperty(value = "文档中心-文档ID")
|
||||
private String documentCenterId;
|
||||
|
||||
/**
|
||||
* ipass客户端版本号
|
||||
*/
|
||||
@ApiModelProperty(value = "ipass客户端版本号")
|
||||
private String ipassVersion;
|
||||
|
||||
@TableField(
|
||||
fill = FieldFill.INSERT,
|
||||
typeHandler = CustomLocalDateTimeTypeHandler.class
|
||||
)
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
@DateTimeFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
@ApiModelProperty("客户端发布时间")
|
||||
private LocalDateTime publishDate;
|
||||
|
||||
/**
|
||||
* ipass客户端版本号
|
||||
*/
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.templatewarehouse.sevice;
|
||||
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.base.service.IBaseService;
|
||||
import com.chinaunicom.mall.ebtp.extend.templatewarehouse.entity.BizBidClientVersion;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 对数据表 biz_bid_client_version 操作的 service
|
||||
* @author Auto create
|
||||
*
|
||||
*/
|
||||
public interface BizBidClientVersionService extends IBaseService<BizBidClientVersion>{
|
||||
|
||||
/**
|
||||
* 通过版本号获得对应客户端文件id
|
||||
* @param version
|
||||
* @return
|
||||
*/
|
||||
void getClientByVersion(String version) throws IOException;
|
||||
|
||||
void downloadFileByOId(String oId) throws IOException;
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.templatewarehouse.sevice.impl;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.convertor.ModelConvertor;
|
||||
import com.chinaunicom.mall.ebtp.common.util.JsonUtils;
|
||||
import com.chinaunicom.mall.ebtp.extend.export.enums.ExportExceptionEnum;
|
||||
import com.chinaunicom.mall.ebtp.extend.feign.client.DocumentCenterService;
|
||||
import com.chinaunicom.mall.ebtp.extend.templatewarehouse.entity.BizBidClientVersion;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.time.DateFormatUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.chinaunicom.mall.ebtp.extend.templatewarehouse.dao.BizBidClientVersionMapper;
|
||||
import com.chinaunicom.mall.ebtp.extend.templatewarehouse.sevice.BizBidClientVersionService;
|
||||
import com.chinaunicom.mall.ebtp.common.base.service.impl.BaseServiceImpl;
|
||||
import sun.nio.cs.ext.GBK;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.DateFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
/**
|
||||
* 对数据表 biz_bid_client_version 操作的 serviceImpl
|
||||
* @author Auto create
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class BizBidClientVersionServiceImpl extends BaseServiceImpl<BizBidClientVersionMapper, BizBidClientVersion> implements BizBidClientVersionService {
|
||||
|
||||
private final DocumentCenterService documentCenterService;
|
||||
|
||||
private final ModelConvertor modelConvertor;
|
||||
|
||||
@Resource
|
||||
private HttpServletResponse response;
|
||||
|
||||
@Override
|
||||
public void getClientByVersion(String version) throws IOException {
|
||||
QueryWrapper<BizBidClientVersion> query = new QueryWrapper<>(new BizBidClientVersion().setIpassVersion(version));
|
||||
BizBidClientVersion clientVersion = this.getOne(query);
|
||||
this.downloadClientByOId(clientVersion.getDocumentCenterId());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void downloadFileByOId(String objectId) throws IOException {
|
||||
log.info("文档中心文件下载传入数据:"+ JsonUtils.objectToJson(objectId));
|
||||
String objectInfo = documentCenterService.getObjectDetail(objectId);
|
||||
log.info("文档中心文件下载返回数据:"+ JsonUtils.objectToJson(objectInfo));
|
||||
Map map = (Map) JSON.parse(objectInfo);
|
||||
ExportExceptionEnum.FRAME_EXCEPTION_GET_DOCUMENT_CENTER.customValidName("文档获取失败", !(map.containsKey("message") && map.containsKey("success")) || "null".equals(objectInfo));
|
||||
ExportExceptionEnum.FRAME_EXCEPTION_GET_DOCUMENT_CENTER.customValidName("文档中心返回信息:" + map.get("message").toString(), !(boolean) map.get("success"));
|
||||
Optional<byte[]> optionalBytes = modelConvertor.toByteArray(objectInfo);
|
||||
// log.info("文档中心文件下载返回数据转为byte[]数据:"+ new String(optionalBytes.get()));
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
// response.setContentType("application/octet-stream;charset=utf-8");
|
||||
response.setHeader("Content-Disposition","attachment;filename="+ URLEncoder.encode("AutoUpdater.xml", "utf-8"));
|
||||
if(optionalBytes.isPresent()){
|
||||
outputStream.write(optionalBytes.get());
|
||||
}
|
||||
outputStream.flush();
|
||||
outputStream.close();
|
||||
}
|
||||
|
||||
public void downloadClientByOId(String objectId) throws IOException {
|
||||
log.info("文档中心s文件下载传入数据:"+ JsonUtils.objectToJson(objectId));
|
||||
String objectInfo = documentCenterService.getObjectDetail(objectId);
|
||||
log.info("文档中心s文件下载返回数据:"+ JsonUtils.objectToJson(objectInfo));
|
||||
Map map = (Map) JSON.parse(objectInfo);
|
||||
ExportExceptionEnum.FRAME_EXCEPTION_GET_DOCUMENT_CENTER.customValidName("文档获取失败", !(map.containsKey("message") && map.containsKey("success")) || "null".equals(objectInfo));
|
||||
ExportExceptionEnum.FRAME_EXCEPTION_GET_DOCUMENT_CENTER.customValidName("文档中心返回信息:" + map.get("message").toString(), !(boolean) map.get("success"));
|
||||
Optional<byte[]> optionalBytes = modelConvertor.toByteArray(objectInfo);
|
||||
// log.info("文档中心s文件下载返回数据转为byte[]数据:"+ optionalBytes.get());
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
// response.setContentType("application/octet-stream;charset=utf-8");
|
||||
response.setHeader("Content-Disposition","attachment;filename="+ URLEncoder.encode("ebtp-ca.zip", "utf-8"));
|
||||
if(optionalBytes.isPresent()){
|
||||
outputStream.write(optionalBytes.get());
|
||||
}
|
||||
outputStream.flush();
|
||||
outputStream.close();
|
||||
}
|
||||
|
||||
}
|
@ -116,7 +116,19 @@ mybatis-plus:
|
||||
db-config:
|
||||
# logic-delete-field: flag # 全局逻辑删除的实体字段名(since 3.3.0,配置后可以忽略不配置步骤2) @TableLogic
|
||||
logic-delete-value: deleted # 逻辑已删除值
|
||||
logic-not-delete-value: normal # 逻辑未删除值
|
||||
logic-not-delete-value: normal # 逻辑未删除
|
||||
|
||||
# --------------feign ------------
|
||||
feign:
|
||||
httpclient:
|
||||
enabled: false
|
||||
okhttp:
|
||||
enabled: true
|
||||
client:
|
||||
config:
|
||||
default:
|
||||
connect-timeout: 20000
|
||||
read-timeout: 20000
|
||||
|
||||
hystrix:
|
||||
command:
|
||||
@ -150,7 +162,12 @@ mconfig:
|
||||
resps: biz-service-ebtp-resps #应答结构化服务
|
||||
rsms: biz-service-ebtp-rsms #评审结构化服务
|
||||
tender: biz-service-ebtp-tender #投标服务
|
||||
|
||||
documentcenter: core-service-document-center #文档中心
|
||||
|
||||
|
||||
document:
|
||||
clientHttpUrl: http://10.242.31.158:8100/auth/oauth/token?grant_type=client_credentials&client_id=bVS46ElU&client_secret=58ea04ba02475c8da2321cc99849d2a10f15b749
|
||||
|
||||
# 用户暴露给 prometheus 的健康数据
|
||||
management:
|
||||
endpoints:
|
||||
|
@ -120,7 +120,20 @@ mybatis-plus:
|
||||
# logic-delete-field: flag # 全局逻辑删除的实体字段名(since 3.3.0,配置后可以忽略不配置步骤2) @TableLogic
|
||||
logic-delete-value: deleted # 逻辑已删除值
|
||||
logic-not-delete-value: normal # 逻辑未删除值
|
||||
|
||||
|
||||
|
||||
# --------------feign ------------
|
||||
feign:
|
||||
httpclient:
|
||||
enabled: false
|
||||
okhttp:
|
||||
enabled: true
|
||||
client:
|
||||
config:
|
||||
default:
|
||||
connect-timeout: 20000
|
||||
read-timeout: 20000
|
||||
|
||||
hystrix:
|
||||
command:
|
||||
default:
|
||||
@ -153,8 +166,13 @@ mconfig:
|
||||
resps: biz-service-ebtp-resps #应答结构化服务
|
||||
rsms: biz-service-ebtp-rsms #评审结构化服务
|
||||
tender: biz-service-ebtp-tender #投标服务
|
||||
|
||||
# 用户暴露给 prometheus 的健康数据
|
||||
documentcenter: core-service-document-center #文档中心
|
||||
|
||||
|
||||
document:
|
||||
clientHttpUrl: http://10.242.31.158:8100/auth/oauth/token?grant_type=client_credentials&client_id=bVS46ElU&client_secret=58ea04ba02475c8da2321cc99849d2a10f15b749
|
||||
|
||||
# 用户暴露给 prometheus 的健康数据
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
|
@ -125,7 +125,19 @@ mybatis-plus:
|
||||
# logic-delete-field: flag # 全局逻辑删除的实体字段名(since 3.3.0,配置后可以忽略不配置步骤2) @TableLogic
|
||||
logic-delete-value: deleted # 逻辑已删除值
|
||||
logic-not-delete-value: normal # 逻辑未删除值
|
||||
|
||||
|
||||
# --------------feign ------------
|
||||
feign:
|
||||
httpclient:
|
||||
enabled: false
|
||||
okhttp:
|
||||
enabled: true
|
||||
client:
|
||||
config:
|
||||
default:
|
||||
connect-timeout: 20000
|
||||
read-timeout: 20000
|
||||
|
||||
hystrix:
|
||||
command:
|
||||
default:
|
||||
@ -158,7 +170,11 @@ mconfig:
|
||||
resps: biz-service-ebtp-resps #应答结构化服务
|
||||
rsms: biz-service-ebtp-rsms #评审结构化服务
|
||||
tender: biz-service-ebtp-tender #投标服务
|
||||
|
||||
documentcenter: core-service-document-center #文档中心
|
||||
|
||||
document:
|
||||
clientHttpUrl: http://10.242.31.158:8100/auth/oauth/token?grant_type=client_credentials&client_id=bVS46ElU&client_secret=58ea04ba02475c8da2321cc99849d2a10f15b749
|
||||
|
||||
# 用户暴露给 prometheus 的健康数据
|
||||
management:
|
||||
endpoints:
|
||||
|
@ -123,7 +123,19 @@ mybatis-plus:
|
||||
# logic-delete-field: flag # 全局逻辑删除的实体字段名(since 3.3.0,配置后可以忽略不配置步骤2) @TableLogic
|
||||
logic-delete-value: deleted # 逻辑已删除值
|
||||
logic-not-delete-value: normal # 逻辑未删除值
|
||||
|
||||
|
||||
# --------------feign ------------
|
||||
feign:
|
||||
httpclient:
|
||||
enabled: false
|
||||
okhttp:
|
||||
enabled: true
|
||||
client:
|
||||
config:
|
||||
default:
|
||||
connect-timeout: 20000
|
||||
read-timeout: 20000
|
||||
|
||||
hystrix:
|
||||
command:
|
||||
default:
|
||||
@ -156,7 +168,11 @@ mconfig:
|
||||
resps: biz-service-ebtp-resps #应答结构化服务
|
||||
rsms: biz-service-ebtp-rsms #评审结构化服务
|
||||
tender: biz-service-ebtp-tender #投标服务
|
||||
|
||||
documentcenter: core-service-document-center #文档中心
|
||||
|
||||
document:
|
||||
clientHttpUrl: http://10.242.31.158:8100/auth/oauth/token?grant_type=client_credentials&client_id=bVS46ElU&client_secret=58ea04ba02475c8da2321cc99849d2a10f15b749
|
||||
|
||||
# 用户暴露给 prometheus 的健康数据
|
||||
management:
|
||||
endpoints:
|
||||
|
Reference in New Issue
Block a user