Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@ -57,6 +57,8 @@ public class BizBidSharedRecordController {
|
||||
BizBidSharedRecord bizBidSharedRecord = new BizBidSharedRecord();
|
||||
bizBidSharedRecord.setId(PropertyUtils.getSnowflakeId());
|
||||
bizBidSharedRecord.setRecordId(bizBidShared.getId());
|
||||
bizBidSharedRecord.setRecordOrgId(cacheUser.getDeptId());
|
||||
bizBidSharedRecord.setRecordOrgName(cacheUser.getDeptName());
|
||||
bizBidSharedRecord.setRecordAccount(cacheUser.getLoginName());
|
||||
bizBidSharedRecord.setRecordName(cacheUser.getFullName());
|
||||
bizBidSharedRecord.setRecordRole(cacheUser.getCurrentRoleCode());
|
||||
|
@ -52,10 +52,22 @@ public class BizBidSharedRecord extends BaseEntity implements Serializable {
|
||||
|
||||
private String recordRole;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty(value = "机构Id")
|
||||
private String recordOrgId;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty(value = "机构名称")
|
||||
private String recordOrgName;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty(value = "下载人名称")
|
||||
private String recordName;
|
||||
|
||||
/**
|
||||
|
@ -53,10 +53,22 @@ public class BizBidSharedRecordVO extends BasePageRequest implements Serializabl
|
||||
|
||||
private String recordRole;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty(value = "机构Id")
|
||||
private String recordOrgId;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty(value = "机构名称")
|
||||
private String recordOrgName;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty(value = "下载人名称")
|
||||
private String recordName;
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,8 @@
|
||||
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;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizmessage.vo.DescribeSiteMsgDetailVO;
|
||||
@ -13,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
@ -34,7 +37,7 @@ public class BizMessageConsumerController {
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("消息概要清单.")
|
||||
@GetMapping("describeSiteMsg")
|
||||
@PostMapping("describeSiteMsg")
|
||||
@ResponseStatus(code = HttpStatus.OK)
|
||||
public IBizMessagePage<DescribeSiteMsgVO> describeSiteMsg(
|
||||
@ApiParam(value = "分页参数", required = false) @RequestBody(required = false) PageDTO page) {
|
||||
@ -56,9 +59,39 @@ public class BizMessageConsumerController {
|
||||
DescribeSiteMsgDetailVO vo = new DescribeSiteMsgDetailVO();
|
||||
vo.setMsgId(source.getId());
|
||||
BeanUtils.copyProperties(source, vo);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 信息类别查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("信息类别查询")
|
||||
@PostMapping("selectMsgListByType")
|
||||
@ResponseStatus(code = HttpStatus.OK)
|
||||
public List<BizMessageVo> selectMsgListByType(@RequestBody(required = false) BizMessageVo vo) {
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -5,4 +5,5 @@ import com.chinaunicom.mall.ebtp.extend.bizmessage.entity.BizMessageAuthorize;
|
||||
|
||||
public interface BizMessageAuthorizeMapper extends BaseMapper<BizMessageAuthorize> {
|
||||
|
||||
|
||||
}
|
||||
|
@ -3,10 +3,22 @@ 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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface BizMessageMapper extends BaseMapper<BizMessage> {
|
||||
|
||||
IPage<BizMessage> findMessage(@Param("param") IPage<BizMessage> page, @Param("userId") String userId);
|
||||
|
||||
IPage<BizMessageVo> findMessageVo(@Param("param") IPage<BizMessageVo> page, @Param("userId") String userId);
|
||||
|
||||
Boolean updateState(@Param("userId") String userId,@Param("messageId") String messageId);
|
||||
|
||||
List<BizMessageVo> findMessageVoList(BizMessageVo vo);
|
||||
|
||||
List<BizMessageAuthorize> findAuthorizeList(BizMessageAuthorize vo);
|
||||
|
||||
}
|
||||
|
@ -3,19 +3,81 @@
|
||||
<mapper namespace="com.chinaunicom.mall.ebtp.extend.bizmessage.dao.BizMessageMapper">
|
||||
|
||||
<select id="findMessage" resultType="com.chinaunicom.mall.ebtp.extend.bizmessage.entity.BizMessage">
|
||||
SELECT *
|
||||
FROM biz_message
|
||||
WHERE authorize = 0
|
||||
SELECT biz_message.*
|
||||
FROM biz_message WHERE authorize = 0
|
||||
|
||||
<if test="userId!=null and userId!=''">
|
||||
UNION ALL
|
||||
|
||||
SELECT a.*
|
||||
FROM ( SELECT * FROM biz_message WHERE authorize = 1) a
|
||||
FROM ( SELECT biz_message.* FROM biz_message
|
||||
WHERE authorize = 1) a
|
||||
INNER JOIN
|
||||
( SELECT * FROM biz_message_authorize WHERE user_id = #{userId}) b ON a.id = b.message_id
|
||||
</if>
|
||||
ORDER BY createtime DESC
|
||||
</select>
|
||||
|
||||
<select id="findMessageVo" resultType="com.chinaunicom.mall.ebtp.extend.bizmessage.entity.BizMessageVo">
|
||||
SELECT biz_message.*,biz_message_template.type as templatetype,'1' as authorizestate
|
||||
FROM biz_message
|
||||
left join biz_message_template on biz_message.templatecode = biz_message_template.code
|
||||
WHERE authorize = 0
|
||||
<if test="userId!=null and userId!=''">
|
||||
UNION ALL
|
||||
SELECT a.*,IFNULL(b.state,1) as authorizestate
|
||||
FROM ( SELECT biz_message.*,biz_message_template.type as templatetype
|
||||
FROM biz_message
|
||||
left join biz_message_template on biz_message.templatecode = biz_message_template.code
|
||||
WHERE authorize = 1) a
|
||||
INNER JOIN
|
||||
( SELECT * FROM biz_message_authorize WHERE user_id = #{userId}) b ON a.id = b.message_id
|
||||
</if>
|
||||
ORDER BY createtime DESC
|
||||
</select>
|
||||
|
||||
<update id="updateState" parameterType="java.lang.String">
|
||||
update biz_message_authorize set state = 1
|
||||
where message_id=#{messageId}
|
||||
and user_id =#{userId}
|
||||
</update>
|
||||
|
||||
<select id="findMessageVoList" resultType="com.chinaunicom.mall.ebtp.extend.bizmessage.entity.BizMessageVo" parameterType="com.chinaunicom.mall.ebtp.extend.bizmessage.entity.BizMessageVo">
|
||||
|
||||
SELECT
|
||||
biz_message.*,
|
||||
biz_message_authorize.state as authorizestate,
|
||||
biz_message_template.type AS templatetype
|
||||
FROM
|
||||
biz_message
|
||||
LEFT JOIN biz_message_template ON biz_message.templatecode = biz_message_template.CODE
|
||||
inner join biz_message_authorize on biz_message.id = biz_message_authorize.message_id
|
||||
WHERE
|
||||
authorize = 1 and user_id = #{userId}
|
||||
<if test="authorizestate!=null and authorizestate!=''">
|
||||
and biz_message_authorize.state = #{authorizestate}
|
||||
</if>
|
||||
<if test="templatetype!=null and templatetype!=''">
|
||||
and biz_message_template.type = #{templatetype}
|
||||
</if>
|
||||
ORDER BY createtime DESC
|
||||
</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>
|
@ -41,4 +41,8 @@ public class BizMessageRawDTO {
|
||||
@ApiModelProperty(required = true, value = "授权用户列表")
|
||||
private List<String> users;
|
||||
|
||||
@ApiModelProperty(required = true, value = "业务参数json")
|
||||
@NotNull(message = "业务参数json")
|
||||
private Map<String, Object> servicecode;
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizmessage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
|
||||
@ -16,6 +17,8 @@ public class BizMessage {
|
||||
private String url;
|
||||
private String params;
|
||||
private Timestamp createtime;
|
||||
private String servicecode;
|
||||
private String templatecode;
|
||||
|
||||
/* 该值为1则标识开启授权控制,只有授权列表( biz_message_authorize )内的用户可见 */
|
||||
private Integer authorize;
|
||||
|
@ -11,5 +11,6 @@ public class BizMessageAuthorize {
|
||||
|
||||
private String userId;
|
||||
private String messageId;
|
||||
private String state;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,14 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizmessage.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BizMessageVo extends BizMessage{
|
||||
|
||||
private String authorizestate;
|
||||
private String templatetype;
|
||||
private String userId;
|
||||
private Long datanum;
|
||||
private Integer size;
|
||||
|
||||
}
|
@ -2,13 +2,27 @@ 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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface BizMessageConsumerService {
|
||||
|
||||
IBizMessagePage<DescribeSiteMsgVO> listOutline(PageDTO page);
|
||||
|
||||
BizMessage getDetailById(String id);
|
||||
|
||||
Boolean updateState(String id);
|
||||
|
||||
List<BizMessageVo> selectMsgListByType(BizMessageVo vo);
|
||||
|
||||
/**
|
||||
* 查询读取状态
|
||||
* @param authorize
|
||||
* @return
|
||||
*/
|
||||
BizMessageAuthorize getAuthorize(BizMessageAuthorize authorize);
|
||||
}
|
||||
|
@ -6,6 +6,8 @@ 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;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizmessage.service.BizMessageConsumerService;
|
||||
@ -14,6 +16,8 @@ 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;
|
||||
|
||||
@ -39,7 +43,7 @@ public class BizMessageConsumerServiceImpl implements BizMessageConsumerService
|
||||
public IBizMessagePage<DescribeSiteMsgVO> listOutline(PageDTO page) {
|
||||
page = createPageCondition(page);
|
||||
|
||||
IPage<BizMessage> pageEntity = mapper.findMessage(new Page<BizMessage>(page.getPageNo(), page.getPageSize()),
|
||||
IPage<BizMessageVo> pageEntity = mapper.findMessageVo(new Page<BizMessageVo>(page.getPageNo(), page.getPageSize()),
|
||||
service.getCacheUser().getUserId());
|
||||
|
||||
// DAT -> VO 转换
|
||||
@ -48,8 +52,10 @@ public class BizMessageConsumerServiceImpl implements BizMessageConsumerService
|
||||
result.setRecords(pageEntity.getRecords().stream().map(source -> {
|
||||
DescribeSiteMsgVO vo = new DescribeSiteMsgVO();
|
||||
vo.setMsgId(source.getId());
|
||||
vo.setServicecode(source.getServicecode());
|
||||
vo.setAuthorizestate(source.getAuthorizestate());
|
||||
vo.setTemplatetype(source.getTemplatetype());
|
||||
BeanUtils.copyProperties(source, vo);
|
||||
|
||||
return vo;
|
||||
}).collect(Collectors.toList()));
|
||||
|
||||
@ -64,7 +70,20 @@ public class BizMessageConsumerServiceImpl implements BizMessageConsumerService
|
||||
*/
|
||||
@Override
|
||||
public BizMessage getDetailById(String id) {
|
||||
return mapper.selectById(id);
|
||||
BizMessage message = mapper.selectById(id);
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 消息详情 已读修改
|
||||
*
|
||||
* @param messageId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateState(String messageId){
|
||||
String userId = service.getCacheUser().getUserId();
|
||||
return mapper.updateState(userId,messageId);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -81,4 +100,45 @@ public class BizMessageConsumerServiceImpl implements BizMessageConsumerService
|
||||
}).orElseGet(PageDTO::new);
|
||||
}
|
||||
|
||||
/**
|
||||
* 消息概要列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<BizMessageVo> selectMsgListByType(BizMessageVo vo) {
|
||||
vo.setSize(vo.getSize()!=null?vo.getSize():5);
|
||||
vo.setUserId(service.getCacheUser().getUserId());
|
||||
if(vo.getAuthorizestate()==null||"".equals(vo.getAuthorizestate())){
|
||||
vo.setAuthorizestate("0");
|
||||
}
|
||||
|
||||
List<BizMessageVo> list = mapper.findMessageVoList(vo);
|
||||
|
||||
List<BizMessageVo> rList = new ArrayList<>();
|
||||
|
||||
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 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();
|
||||
}
|
||||
}
|
||||
|
@ -85,13 +85,15 @@ public class BizMessageProducerServiceImpl implements BizMessageProducerService
|
||||
bizmessage.setContent(fill(dao.getBody(), messageRaw.getBody()));
|
||||
bizmessage.setUrl(fill(dao.getRouter(), messageRaw.getExtra()));
|
||||
bizmessage.setParams(toJson(messageRaw.getExtra()));
|
||||
bizmessage.setServicecode(toJson(messageRaw.getServicecode()));
|
||||
bizmessage.setTemplatecode(dao.getCode());
|
||||
|
||||
Optional.ofNullable(messageRaw.getUsers()).ifPresent(users -> {
|
||||
log.debug("if user list {} is not emtpy, then grant current message to them.", users);
|
||||
bizmessage.setAuthorize(Math.min(1, users.size()));
|
||||
|
||||
log.debug("grant message [{}] to users", messageId);
|
||||
users.forEach(userid -> authorizeMapper.insert(new BizMessageAuthorize(userid, messageId)));
|
||||
users.forEach(userid -> authorizeMapper.insert(new BizMessageAuthorize(userid, messageId,"0")));
|
||||
});
|
||||
|
||||
return bizmessage;
|
||||
|
@ -26,4 +26,6 @@ public class DescribeSiteMsgDetailVO {
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Timestamp createtime;
|
||||
|
||||
private String authorizestate;
|
||||
private String servicecode;
|
||||
}
|
||||
|
@ -16,6 +16,9 @@ public class DescribeSiteMsgVO {
|
||||
private String msgId;
|
||||
private String title;
|
||||
private String category;
|
||||
private String servicecode;
|
||||
private String authorizestate;
|
||||
private String templatetype;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Timestamp createtime;
|
||||
|
||||
|
@ -29,6 +29,7 @@ import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -71,7 +72,7 @@ public class BidOpenRecordImpl implements ExportService {
|
||||
|
||||
OpenRecordExportData data = new OpenRecordExportData();
|
||||
data.setProjName(proj.getProjectName())
|
||||
.setProjNum(proj.getProjectBizNum())
|
||||
.setProjNum(Optional.ofNullable(proj.getAgencyCompanyProjectNum()).orElse(proj.getEbpProjectNumber()))
|
||||
.setBidNum(section.getBidSectBizNum());
|
||||
|
||||
ExportTableData tableData = new ExportTableData();
|
||||
|
@ -4,6 +4,7 @@ import com.chinaunicom.mall.ebtp.common.poiExport.constant.ExportConstant;
|
||||
import com.chinaunicom.mall.ebtp.common.poiExport.entity.ExcelTable;
|
||||
import com.chinaunicom.mall.ebtp.common.poiExport.entity.ExcelTd;
|
||||
import com.chinaunicom.mall.ebtp.common.poiExport.entity.ExcelTr;
|
||||
import com.chinaunicom.mall.ebtp.common.util.JsonUtils;
|
||||
import com.chinaunicom.mall.ebtp.extend.export.bean.CbpsExportData;
|
||||
import com.chinaunicom.mall.ebtp.extend.export.bean.ExportParam;
|
||||
import com.chinaunicom.mall.ebtp.extend.export.service.ExportService;
|
||||
@ -15,6 +16,7 @@ import com.chinaunicom.mall.ebtp.extend.feign.entity.rsms.BidEvalEarlyJudgesSumm
|
||||
import com.chinaunicom.mall.ebtp.extend.feign.entity.rsms.ReviewConfigCategoryDTO;
|
||||
import com.chinaunicom.mall.ebtp.extend.feign.entity.rsms.ReviewConfigDetailDTO;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -23,6 +25,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
/**
|
||||
@ -31,6 +34,7 @@ import java.util.Map;
|
||||
* @author fqj
|
||||
*/
|
||||
@Service("cbps")
|
||||
@Slf4j
|
||||
public class CbpsExportServiceImpl implements ExportService {
|
||||
|
||||
@Autowired
|
||||
@ -47,21 +51,22 @@ public class CbpsExportServiceImpl implements ExportService {
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public void doExport(ExportParam param, HttpServletRequest request, HttpServletResponse response) {
|
||||
log.info("初步评审表,ExportParam = {}", JsonUtils.objectToJson(param));
|
||||
//导出的表格名称
|
||||
String dictName = commonFeignService.exportDictName(param.getId(), "初步评审表");
|
||||
|
||||
//查询包
|
||||
ProjectSectionVO section = commonFeignService.projectGetSectionById(param.getSectionId());
|
||||
|
||||
log.info("初步评审表 {},查询包信息 {}", param.getAssessRoomId(), JsonUtils.objectToJson(section));
|
||||
//查询项目
|
||||
ProjectRecordVO proj = commonFeignService.projectGetProjById(section.getProjectId());
|
||||
|
||||
log.info("初步评审表 {},查询项目信息 = {}", param.getAssessRoomId(), JsonUtils.objectToJson(proj));
|
||||
//供应商信息
|
||||
List<BizSupplierRegister> suppliers = commonFeignService.tenderGetSupplierRegisterByRoomId(param.getAssessRoomId());
|
||||
|
||||
log.info("初步评审表 {},查询供应商信息 = {}", param.getAssessRoomId(), JsonUtils.objectToJson(suppliers));
|
||||
//初审评分信息
|
||||
List<ReviewConfigCategoryDTO> earlySummary = commonFeignService.rsmsFindScoreEarlySummary(param);
|
||||
|
||||
log.info("初步评审表 {},查询评分信息 = {}", param.getAssessRoomId(), JsonUtils.objectToJson(earlySummary));
|
||||
ExcelTable table = new ExcelTable(dictName);
|
||||
table.setFileName(dictName);
|
||||
|
||||
@ -74,7 +79,7 @@ public class CbpsExportServiceImpl implements ExportService {
|
||||
table.add(new ExcelTr().setExcelTdList(list));
|
||||
|
||||
list = new ArrayList<>();
|
||||
list.add(new ExcelTd().setTdValue("招标编号:" + proj.getProjectBizNum()).setCellStyleKey("noBorderLeft12").setIsRowMerge(true).setRowMergeNum(suppliers.size() + 3));
|
||||
list.add(new ExcelTd().setTdValue("招标编号:" + Optional.ofNullable(proj.getAgencyCompanyProjectNum()).orElse(proj.getEbpProjectNumber())).setCellStyleKey("noBorderLeft12").setIsRowMerge(true).setRowMergeNum(suppliers.size() + 3));
|
||||
table.add(new ExcelTr().setExcelTdList(list));
|
||||
|
||||
list = new ArrayList<>();
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.export.service.impl;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.util.JsonUtils;
|
||||
import com.chinaunicom.mall.ebtp.extend.export.bean.ExportParam;
|
||||
import com.chinaunicom.mall.ebtp.extend.export.service.ExportService;
|
||||
import com.chinaunicom.mall.ebtp.extend.export.service.common.ExportCommonFeignService;
|
||||
@ -10,6 +11,7 @@ import com.chinaunicom.mall.ebtp.extend.feign.entity.rsms.BidEvalDetailJudgesSum
|
||||
import com.chinaunicom.mall.ebtp.extend.feign.entity.rsms.BidEvalDetailSummaryVO;
|
||||
import com.chinaunicom.mall.ebtp.extend.feign.entity.rsms.JuryPrintVO;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.xssf.streaming.SXSSFCell;
|
||||
@ -24,16 +26,14 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/**
|
||||
* 打分汇总
|
||||
*/
|
||||
@Service("dfhz")
|
||||
@Slf4j
|
||||
public class DfhzExportServiceImpl implements ExportService {
|
||||
|
||||
|
||||
@ -50,24 +50,25 @@ public class DfhzExportServiceImpl implements ExportService {
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public void doExport(ExportParam param, HttpServletRequest request, HttpServletResponse response) {
|
||||
log.info("打分汇总表,ExportParam = {}", JsonUtils.objectToJson(param));
|
||||
//导出的表格名称
|
||||
String dictName = commonFeignService.exportDictName(param.getId(), "打分汇总表");
|
||||
|
||||
//查询包
|
||||
ProjectSectionVO section = commonFeignService.projectGetSectionById(param.getSectionId());
|
||||
|
||||
log.info("打分汇总表 {},查询包信息 {}", param.getAssessRoomId(), JsonUtils.objectToJson(section));
|
||||
//查询项目
|
||||
ProjectRecordVO proj = commonFeignService.projectGetProjById(section.getProjectId());
|
||||
|
||||
log.info("打分汇总表 {},查询项目信息 = {}", param.getAssessRoomId(), JsonUtils.objectToJson(proj));
|
||||
//供应商信息
|
||||
List<BizSupplierRegister> suppliers = commonFeignService.tenderGetSupplierRegisterByRoomId(param.getAssessRoomId());
|
||||
|
||||
log.info("打分汇总表 {},查询供应商信息 = {}", param.getAssessRoomId(), JsonUtils.objectToJson(suppliers));
|
||||
//评委
|
||||
List<JuryPrintVO> memberAll = commonFeignService.rsmsQueryReportPrintByRoomId(param.getAssessRoomId());
|
||||
|
||||
log.info("打分汇总表 {},查询评委信息 = {}", param.getAssessRoomId(), JsonUtils.objectToJson(memberAll));
|
||||
//所有类型打分数据源
|
||||
Map<String, List<BidEvalDetailSummaryVO>> detailList = commonFeignService.exportScoreSummary(param);
|
||||
|
||||
log.info("打分汇总表 {},查询所有类型打分数据源 = {}", param.getAssessRoomId(), JsonUtils.objectToJson(detailList));
|
||||
// 创建工作簿
|
||||
SXSSFWorkbook wb = new SXSSFWorkbook();
|
||||
//表格样式
|
||||
@ -110,7 +111,7 @@ public class DfhzExportServiceImpl implements ExportService {
|
||||
SXSSFCell projectNumCell0 = projectNumRow.createCell(0);
|
||||
projectNumCell0.setCellValue("项目编号:");
|
||||
SXSSFCell projectNumCell1 = projectNumRow.createCell(1);
|
||||
projectNumCell1.setCellValue(proj.getProjectBizNum());
|
||||
projectNumCell1.setCellValue(Optional.ofNullable(proj.getAgencyCompanyProjectNum()).orElse(proj.getEbpProjectNumber()));
|
||||
//列头
|
||||
List<String> titles0 = new ArrayList<>();
|
||||
titles0.add("投标人名称");
|
||||
@ -170,11 +171,16 @@ public class DfhzExportServiceImpl implements ExportService {
|
||||
this.createCell(row, cellIndex, cellStyle, "-");
|
||||
|
||||
} else {
|
||||
BidEvalDetailSummaryVO detailSummary = detailScore.stream().filter(f -> f.getSupplierRegisterId().equals(vo.getCompanyName())).findFirst().orElseGet(BidEvalDetailSummaryVO::new);
|
||||
BidEvalDetailSummaryVO detailSummary = detailScore.stream().filter(f -> f.getSupplierRegisterId().equals(vo.getId())).findFirst().orElseGet(BidEvalDetailSummaryVO::new);
|
||||
Map<String, BidEvalDetailJudgesSummaryVO> memberScoreMap = detailSummary.getScoreMap();
|
||||
for (JuryPrintVO memberVO : memberAll) {
|
||||
BigDecimal score = memberScoreMap.get(memberVO.getUserId()).getScore();
|
||||
this.createCell(row, cellIndex++, cellStyle, score == null ? "" : String.valueOf(score));
|
||||
if (memberScoreMap != null && memberScoreMap.containsKey(memberVO.getUserId())) {
|
||||
BigDecimal score = memberScoreMap.get(memberVO.getUserId()).getScore();
|
||||
this.createCell(row, cellIndex++, cellStyle, score == null ? "" : String.valueOf(score));
|
||||
} else {
|
||||
this.createCell(row, cellIndex++, cellStyle, "");
|
||||
}
|
||||
|
||||
}
|
||||
this.createCell(row, cellIndex, cellStyle, detailSummary.getFinalScore() == null ? "" : String.valueOf(detailSummary.getFinalScore()));
|
||||
}
|
||||
@ -264,8 +270,8 @@ public class DfhzExportServiceImpl implements ExportService {
|
||||
row = this.createRow(sheet, rowIndex);
|
||||
c = row.createCell(titles0.size() - 3);
|
||||
c.setCellValue("日期:");
|
||||
c = row.createCell(titles0.size() - 2);
|
||||
c.setCellValue(new SimpleDateFormat("yyyy年MM月dd日").format(new Date()));
|
||||
// c = row.createCell(titles0.size() - 2);
|
||||
// c.setCellValue(new SimpleDateFormat("yyyy年MM月dd日").format(new Date()));
|
||||
|
||||
//合并表头
|
||||
CellRangeAddress region = new CellRangeAddress(0, 0, 0, titles0.size() - 1);
|
||||
|
@ -4,6 +4,7 @@ import com.chinaunicom.mall.ebtp.common.poiExport.constant.ExportConstant;
|
||||
import com.chinaunicom.mall.ebtp.common.poiExport.entity.ExcelTable;
|
||||
import com.chinaunicom.mall.ebtp.common.poiExport.entity.ExcelTd;
|
||||
import com.chinaunicom.mall.ebtp.common.poiExport.entity.ExcelTr;
|
||||
import com.chinaunicom.mall.ebtp.common.util.JsonUtils;
|
||||
import com.chinaunicom.mall.ebtp.extend.export.bean.ExportParam;
|
||||
import com.chinaunicom.mall.ebtp.extend.export.bean.JgdfExportData;
|
||||
import com.chinaunicom.mall.ebtp.extend.export.service.ExportService;
|
||||
@ -14,16 +15,14 @@ import com.chinaunicom.mall.ebtp.extend.feign.entity.ProjectSectionVO;
|
||||
import com.chinaunicom.mall.ebtp.extend.feign.entity.TfileContentData;
|
||||
import com.chinaunicom.mall.ebtp.extend.feign.entity.rsms.SupplierRegisterPriceScoreVO;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -32,6 +31,7 @@ import java.util.stream.Collectors;
|
||||
* 价格打分
|
||||
*/
|
||||
@Service("jgdf")
|
||||
@Slf4j
|
||||
public class JgdfExportServiceImpl implements ExportService {
|
||||
|
||||
|
||||
@ -49,24 +49,27 @@ public class JgdfExportServiceImpl implements ExportService {
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public void doExport(ExportParam param, HttpServletRequest request, HttpServletResponse response) {
|
||||
log.info("价格打分表,ExportParam = {}", JsonUtils.objectToJson(param));
|
||||
//导出的表格名称
|
||||
String dictName = commonFeignService.exportDictName(param.getId(), "价格打分表");
|
||||
|
||||
//查询包
|
||||
ProjectSectionVO section = commonFeignService.projectGetSectionById(param.getSectionId());
|
||||
|
||||
log.info("价格打分表 {},查询包信息 {}", param.getAssessRoomId(), JsonUtils.objectToJson(section));
|
||||
//查询项目
|
||||
ProjectRecordVO proj = commonFeignService.projectGetProjById(section.getProjectId());
|
||||
|
||||
log.info("价格打分表 {},查询项目信息 = {}", param.getAssessRoomId(), JsonUtils.objectToJson(proj));
|
||||
//供应商信息
|
||||
List<BizSupplierRegister> suppliers = commonFeignService.tenderGetSupplierRegisterByRoomId(param.getAssessRoomId());
|
||||
|
||||
log.info("价格打分表 {},查询供应商信息 = {}", param.getAssessRoomId(), JsonUtils.objectToJson(suppliers));
|
||||
//查询报价信息
|
||||
List<TfileContentData> prices = commonFeignService.respsGetQuoteByRoomIdAndTurnSort(param);
|
||||
log.info("价格打分表 {},查询报价信息 = {}", param.getAssessRoomId(), JsonUtils.objectToJson(prices));
|
||||
Map<String, TfileContentData> priceMap = prices.stream().collect(Collectors.toMap(TfileContentData::getTendererId, Function.identity(), (o1, o2) -> o1));
|
||||
|
||||
//报价评分
|
||||
List<SupplierRegisterPriceScoreVO> priceScores = commonFeignService.exportPrice(param);
|
||||
log.info("价格打分表 {},查询报价评分 = {}", param.getAssessRoomId(), JsonUtils.objectToJson(priceScores));
|
||||
Map<String, SupplierRegisterPriceScoreVO> priceScoreMap = priceScores.stream().collect(Collectors.toMap(SupplierRegisterPriceScoreVO::getSupplierRegisterId, Function.identity(), (o1, o2) -> o1));
|
||||
|
||||
ExcelTable table = new ExcelTable(dictName);
|
||||
@ -81,7 +84,7 @@ public class JgdfExportServiceImpl implements ExportService {
|
||||
table.add(new ExcelTr().setExcelTdList(list));
|
||||
|
||||
list = new ArrayList<>();
|
||||
list.add(new ExcelTd().setTdValue("招标编号:" + proj.getProjectBizNum()).setCellStyleKey("noBorderLeft12").setIsRowMerge(true).setRowMergeNum(7));
|
||||
list.add(new ExcelTd().setTdValue("招标编号:" + Optional.ofNullable(proj.getAgencyCompanyProjectNum()).orElse(proj.getEbpProjectNumber())).setCellStyleKey("noBorderLeft12").setIsRowMerge(true).setRowMergeNum(7));
|
||||
table.add(new ExcelTr().setExcelTdList(list));
|
||||
|
||||
list = new ArrayList<>();
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.export.service.impl;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.util.JsonUtils;
|
||||
import com.chinaunicom.mall.ebtp.extend.export.bean.ExportParam;
|
||||
import com.chinaunicom.mall.ebtp.extend.export.service.ExportService;
|
||||
import com.chinaunicom.mall.ebtp.extend.export.service.common.ExportCommonFeignService;
|
||||
@ -9,6 +10,7 @@ import com.chinaunicom.mall.ebtp.extend.feign.entity.rsms.JuryPrintVO;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -26,6 +28,7 @@ import java.util.Map;
|
||||
* 评标委员会签字表
|
||||
*/
|
||||
@Service("judgesSign")
|
||||
@Slf4j
|
||||
public class JudgesSignImpl implements ExportService {
|
||||
|
||||
@Autowired
|
||||
@ -44,11 +47,13 @@ public class JudgesSignImpl implements ExportService {
|
||||
*/
|
||||
@Override
|
||||
public void doExport(ExportParam param, HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
log.info("评标委员会签字表,ExportParam = {}", JsonUtils.objectToJson(param));
|
||||
//项目和招标名称数据
|
||||
ProjectSectionVO section = commonFeignService.projectGetSectionById(param.getSectionId());
|
||||
log.info("评标委员会签字表 {},查询项目信息 = {}", param.getAssessRoomId(), JsonUtils.objectToJson(section));
|
||||
//专家人员数据
|
||||
List<JuryPrintVO> list = commonFeignService.rsmsQueryReportPrintByRoomId(param.getAssessRoomId());
|
||||
log.info("评标委员会签字表 {},查询专家人员数据 = {}", param.getAssessRoomId(), JsonUtils.objectToJson(list));
|
||||
ArrayList<Map<String, Object>> maps = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.export.service.impl;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.util.JsonUtils;
|
||||
import com.chinaunicom.mall.ebtp.extend.export.bean.ExportParam;
|
||||
import com.chinaunicom.mall.ebtp.extend.export.service.ExportService;
|
||||
import com.chinaunicom.mall.ebtp.extend.export.service.common.ExportCommonFeignService;
|
||||
@ -9,6 +10,7 @@ import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -24,6 +26,7 @@ import java.util.*;
|
||||
* 评审专家签到表
|
||||
*/
|
||||
@Service("judgesSignIn")
|
||||
@Slf4j
|
||||
public class JudgesSignInImpl implements ExportService {
|
||||
@Autowired
|
||||
private TemplateFileService templateFileService;
|
||||
@ -40,9 +43,10 @@ public class JudgesSignInImpl implements ExportService {
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public void doExport(ExportParam param, HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
log.info("评审专家签到表,ExportParam = {}", JsonUtils.objectToJson(param));
|
||||
//专家人员数据
|
||||
List<JuryPrintVO> list = commonFeignService.rsmsQueryReportPrintByRoomId(param.getAssessRoomId());
|
||||
log.info("评标委员会签字表 {},查询专家人员数据 = {}", param.getAssessRoomId(), JsonUtils.objectToJson(list));
|
||||
ArrayList<Map<String, Object>> maps = new ArrayList<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.export.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.chinaunicom.mall.ebtp.common.util.JsonUtils;
|
||||
import com.chinaunicom.mall.ebtp.extend.export.bean.ExportParam;
|
||||
import com.chinaunicom.mall.ebtp.extend.export.service.ExportService;
|
||||
import com.chinaunicom.mall.ebtp.extend.export.service.common.ExportCommonFeignService;
|
||||
@ -13,6 +14,7 @@ import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -33,6 +35,7 @@ import java.util.stream.Collectors;
|
||||
* 评审报告
|
||||
*/
|
||||
@Service("reviewReport")
|
||||
@Slf4j
|
||||
public class ReviewReportImpl implements ExportService {
|
||||
|
||||
@Autowired
|
||||
@ -52,10 +55,10 @@ public class ReviewReportImpl implements ExportService {
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public void doExport(ExportParam param, HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
log.info("评审报告,ExportParam = {}", JsonUtils.objectToJson(param));
|
||||
// 项目信息
|
||||
ProjectRecordVO project = commonFeignService.projectGetProjById(param.getProjectId());
|
||||
|
||||
log.info("评审报告 {},查询项目信息 = {}", param.getAssessRoomId(), JsonUtils.objectToJson(project));
|
||||
|
||||
String zbfs = "";
|
||||
switch (project.getBidMethodDict()) {
|
||||
@ -86,7 +89,7 @@ public class ReviewReportImpl implements ExportService {
|
||||
|
||||
//供应商信息
|
||||
List<BizSupplierRegister> registerList = commonFeignService.tenderGetSupplierRegisterByRoomId(param.getAssessRoomId());
|
||||
|
||||
log.info("初步评审表 {},查询供应商信息 = {}", param.getAssessRoomId(), JsonUtils.objectToJson(registerList));
|
||||
//表一
|
||||
List<Map<String, Object>> list1 = new ArrayList<>();
|
||||
for (int i = 0; i < registerList.size(); i++) {
|
||||
@ -101,6 +104,7 @@ public class ReviewReportImpl implements ExportService {
|
||||
|
||||
//表二 专家人员数据
|
||||
List<JuryPrintVO> memberList = commonFeignService.rsmsQueryReportPrintByRoomId(param.getAssessRoomId());
|
||||
log.info("评审报告 {},查询专家人员信息 = {}", param.getAssessRoomId(), JsonUtils.objectToJson(memberList));
|
||||
ArrayList<Map<String, Object>> list2 = new ArrayList<>();
|
||||
String pbwyhzz = null;
|
||||
for (int i = 0; i < memberList.size(); i++) {
|
||||
@ -132,6 +136,7 @@ public class ReviewReportImpl implements ExportService {
|
||||
|
||||
//评审结果表数据
|
||||
List<ResultDetailVO> resultDetails = commonFeignService.rsmsQueryReviewDetailByRoomId(param.getAssessRoomId());
|
||||
log.info("评审报告 {},查询评审结果表数据 = {}", param.getAssessRoomId(), JsonUtils.objectToJson(resultDetails));
|
||||
Map<String, ResultDetailVO> detailVOMap = resultDetails.stream().collect(Collectors.toMap(ResultDetailVO::getCompanyId, Function.identity(), (o1, o2) -> o1));
|
||||
for (int i = 0; i < registerList.size(); i++) {
|
||||
BizSupplierRegister register = registerList.get(i);
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.export.service.impl;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.util.JsonUtils;
|
||||
import com.chinaunicom.mall.ebtp.extend.export.bean.ExportParam;
|
||||
import com.chinaunicom.mall.ebtp.extend.export.service.ExportService;
|
||||
import com.chinaunicom.mall.ebtp.extend.export.service.common.ExportCommonFeignService;
|
||||
@ -10,6 +11,7 @@ import com.chinaunicom.mall.ebtp.extend.feign.entity.rsms.JuryPrintVO;
|
||||
import com.chinaunicom.mall.ebtp.extend.feign.entity.rsms.ReviewConfigCategoryDTO;
|
||||
import com.chinaunicom.mall.ebtp.extend.feign.entity.rsms.ReviewConfigDetailDTO;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||
@ -33,6 +35,7 @@ import java.util.stream.Collectors;
|
||||
* 专家个人打分表/评委打分表
|
||||
*/
|
||||
@Service("zjgr")
|
||||
@Slf4j
|
||||
public class ZjgrExportServiceImpl implements ExportService {
|
||||
|
||||
@Autowired
|
||||
@ -48,20 +51,21 @@ public class ZjgrExportServiceImpl implements ExportService {
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public void doExport(ExportParam param, HttpServletRequest request, HttpServletResponse response) {
|
||||
log.info("专家个人打分表,ExportParam = {}", JsonUtils.objectToJson(param));
|
||||
//查询项目名称
|
||||
ProjectSectionVO section = commonFeignService.projectGetSectionById(param.getSectionId());
|
||||
|
||||
log.info("专家个人打分表 {},查询项目信息 = {}", param.getAssessRoomId(), JsonUtils.objectToJson(section));
|
||||
//供应商信息
|
||||
List<BizSupplierRegister> suppliers = commonFeignService.tenderGetSupplierRegisterByRoomId(param.getAssessRoomId());
|
||||
|
||||
log.info("专家个人打分表 {},查询供应商信息 = {}", param.getAssessRoomId(), JsonUtils.objectToJson(suppliers));
|
||||
//评委
|
||||
List<JuryPrintVO> members = commonFeignService.rsmsQueryReportPrintByRoomId(param.getAssessRoomId());
|
||||
|
||||
log.info("专家个人打分表 {},查询评委信息 = {}", param.getAssessRoomId(), JsonUtils.objectToJson(members));
|
||||
param.setUserList(members.stream().map(JuryPrintVO::getUserId).collect(Collectors.toList()));
|
||||
|
||||
//打分数据
|
||||
Map<String, List<ReviewConfigCategoryDTO>> map = commonFeignService.exportDetail(param);
|
||||
|
||||
log.info("专家个人打分表 {},查询打分数据 = {}", param.getAssessRoomId(), JsonUtils.objectToJson(map));
|
||||
//列头
|
||||
StringBuilder titles0 = new StringBuilder("分类,类别名称,标准说明,分值");
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -9,7 +9,9 @@ import com.chinaunicom.mall.ebtp.extend.timeService.tsa.SystemTime;
|
||||
import com.chinaunicom.mall.ebtp.extend.timeService.tsa.TtsAgent;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -17,15 +19,19 @@ import java.util.Date;
|
||||
import java.util.Properties;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class TimeServiceConstant {
|
||||
|
||||
public static TSAClient client;
|
||||
|
||||
public TimeServiceConstant() {
|
||||
try {
|
||||
@Value("${spring.redis.sentinel.master}")
|
||||
private String redis;
|
||||
|
||||
static {
|
||||
try{
|
||||
Properties prop = new Properties();
|
||||
ClassPathResource classPathResource = new ClassPathResource("cssconfig.properties");
|
||||
InputStream inputStream = classPathResource.getInputStream();
|
||||
InputStream inputStream =classPathResource.getInputStream();
|
||||
prop.load(inputStream);
|
||||
inputStream.close();
|
||||
|
||||
@ -33,60 +39,67 @@ public class TimeServiceConstant {
|
||||
TSAClientFactory factory = TSAClientFactory.newInstance(prop);
|
||||
// 获得TSAClient
|
||||
client = (TSAClient) factory.getTSAClient();
|
||||
} catch (Exception e) {
|
||||
}catch (Exception e){
|
||||
log.error("读取配置文件或连接时间戳服务器异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请时间戳
|
||||
*
|
||||
* @param data 待申请时间戳的原文
|
||||
* @return 时间戳加密原文
|
||||
*/
|
||||
public String signTimeStamp(String data) {
|
||||
try {
|
||||
data = data != null && !"".equals(data) ? data : "system";
|
||||
public String signTimeStamp(String data){
|
||||
if(redis.equals("eshop-redis-sim")){
|
||||
return "";
|
||||
}
|
||||
try{
|
||||
|
||||
data = data!=null&&!"".equals(data)?data:"system";
|
||||
//第三步:申请时间戳,向时间戳服务器发起申请时间戳请求,返回时间戳结果
|
||||
TSASignedResult result = client.signTimeStamp("SHA1", data.getBytes("UTF-8"));
|
||||
//第四步:获取时间戳数据,tsaData为时间戳数据,验证时间戳时使用,如果不是实时验证,需要将时间戳数据保存在应用服务器
|
||||
byte[] tsaData = result.getSignedData();
|
||||
log.info("tsaData -->" + tsaData);
|
||||
log.info("tsaData -->"+tsaData);
|
||||
String timestamp = Base64.encodeBase64String(tsaData);
|
||||
log.info("timestamp -->" + timestamp);
|
||||
log.info("timestamp -->"+timestamp);
|
||||
return timestamp;
|
||||
} catch (Exception e) {
|
||||
}catch (Exception e){
|
||||
log.error("申请时间戳异常", e);
|
||||
}
|
||||
return null;
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析时间戳
|
||||
*
|
||||
* @param timestamp 时间戳加密原文
|
||||
* @return 时间戳对象
|
||||
*/
|
||||
public TtsAgent.TtsParseResult verifyTimeStamp2(String timestamp) {
|
||||
try {
|
||||
log.info("timestamp -->" + timestamp);
|
||||
public TtsAgent.TtsParseResult verifyTimeStamp2(String timestamp){
|
||||
String systemtime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
TtsAgent.TtsParseResult ttsParseResult = new TtsAgent.TtsParseResult(systemtime,"","");
|
||||
if(redis.equals("eshop-redis-sim")){
|
||||
return ttsParseResult;
|
||||
}
|
||||
try{
|
||||
|
||||
log.info("timestamp -->"+timestamp);
|
||||
TSAVerifyResult verifyResult = this.verifyTimeStamp(timestamp);
|
||||
String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(verifyResult.getSignedTime());
|
||||
TtsAgent.TtsParseResult ttsParseResult = new TtsAgent.TtsParseResult(time, HelperUtil.bytesToHexString(verifyResult.getData()),
|
||||
ttsParseResult = new TtsAgent.TtsParseResult(time, HelperUtil.bytesToHexString(verifyResult.getData()),
|
||||
verifyResult.getSignerSubject());
|
||||
return ttsParseResult;
|
||||
} catch (Exception e) {
|
||||
}catch (Exception e){
|
||||
log.error("解析时间戳", e);
|
||||
}
|
||||
return null;
|
||||
return ttsParseResult;
|
||||
}
|
||||
|
||||
private TSAVerifyResult verifyTimeStamp(String timestamp) {
|
||||
try {
|
||||
log.info("timestamp -->" + timestamp);
|
||||
private TSAVerifyResult verifyTimeStamp(String timestamp){
|
||||
|
||||
try{
|
||||
|
||||
log.info("timestamp -->"+timestamp);
|
||||
TSAVerifyResult verifyResult = client.verifyTimeStamp(Base64.decodeBase64(timestamp));
|
||||
return verifyResult;
|
||||
} catch (Exception e) {
|
||||
}catch (Exception e){
|
||||
log.error("解析时间戳", e);
|
||||
}
|
||||
return null;
|
||||
@ -94,92 +107,118 @@ public class TimeServiceConstant {
|
||||
|
||||
/**
|
||||
* 获取时间戳
|
||||
*
|
||||
* @param data 待申请时间戳的原文
|
||||
* @return 时间戳对象
|
||||
*/
|
||||
public TtsAgent.TtsParseResult getServiceTimeObj(String data) {
|
||||
try {
|
||||
String timestamp = this.signTimeStamp(data);
|
||||
TtsAgent.TtsParseResult ttsParseResult = this.verifyTimeStamp2(timestamp);
|
||||
public TtsAgent.TtsParseResult getServiceTimeObj(String data){
|
||||
String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
TtsAgent.TtsParseResult ttsParseResult = new TtsAgent.TtsParseResult(time,"","");
|
||||
if(redis.equals("eshop-redis-sim")){
|
||||
return ttsParseResult;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
try{
|
||||
|
||||
String timestamp = this.signTimeStamp(data);
|
||||
ttsParseResult = this.verifyTimeStamp2(timestamp);
|
||||
}catch (Exception e){
|
||||
log.error("获取时间戳异常", e);
|
||||
}
|
||||
return null;
|
||||
return ttsParseResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 直接获取获取时间戳 时间1
|
||||
*
|
||||
* @param data 待申请时间戳的原文
|
||||
* @return 时间
|
||||
*/
|
||||
public String getServiceTime(String data) {
|
||||
try {
|
||||
public String getServiceTime(String data){
|
||||
log.info("------------------redis-"+redis);
|
||||
String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
if(redis.equals("eshop-redis-sim")){
|
||||
return time;
|
||||
}
|
||||
try{
|
||||
|
||||
String timestamp = this.signTimeStamp(data);
|
||||
TSAVerifyResult verifyResult = this.verifyTimeStamp(timestamp);
|
||||
String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(verifyResult.getSignedTime());
|
||||
|
||||
return time;
|
||||
} catch (Exception e) {
|
||||
time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(verifyResult.getSignedTime());
|
||||
}catch (Exception e){
|
||||
log.error("获取时间戳异常", e);
|
||||
}
|
||||
return null;
|
||||
return time;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 直接获取获取时间戳 时间1
|
||||
*
|
||||
* @param data 待申请时间戳的原文
|
||||
* @return date时间
|
||||
*/
|
||||
public Date getServiceDate(String data) {
|
||||
try {
|
||||
public Date getServiceDate(String data){
|
||||
if(redis.equals("eshop-redis-sim")){
|
||||
return new Date();
|
||||
}
|
||||
try{
|
||||
|
||||
String timestamp = this.signTimeStamp(data);
|
||||
TSAVerifyResult verifyResult = this.verifyTimeStamp(timestamp);
|
||||
Date date = verifyResult.getSignedTime();
|
||||
return date;
|
||||
} catch (Exception e) {
|
||||
}catch (Exception e){
|
||||
log.error("获取时间戳异常", e);
|
||||
}
|
||||
return null;
|
||||
return new Date();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取年月日时分秒分割存储对象
|
||||
*
|
||||
* @param data 待申请时间戳的原文
|
||||
* @return SystemTime
|
||||
*/
|
||||
public SystemTime getServiceSystemTime(String data) {
|
||||
try {
|
||||
String timestamp = this.signTimeStamp(data);
|
||||
TSAVerifyResult verifyResult = this.verifyTimeStamp(timestamp);
|
||||
Date date = verifyResult.getSignedTime();
|
||||
SystemTime systemTime = new SystemTime()
|
||||
.setYear(date.getYear() + 1900)
|
||||
.setMonth(date.getMonth() + 1)
|
||||
public SystemTime getServiceSystemTime(String data){
|
||||
Date date = new Date();
|
||||
if(redis.equals("eshop-redis-sim")){
|
||||
return new SystemTime()
|
||||
.setYear(date.getYear()+1900)
|
||||
.setMonth(date.getMonth()+1)
|
||||
.setDate(date.getDate())
|
||||
.setHour(date.getHours())
|
||||
.setMinute(date.getMinutes())
|
||||
.setSecond(date.getSeconds())
|
||||
.setTimestamp(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date));
|
||||
return systemTime;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
try{
|
||||
|
||||
String timestamp = this.signTimeStamp(data);
|
||||
TSAVerifyResult verifyResult = this.verifyTimeStamp(timestamp);
|
||||
date = verifyResult.getSignedTime();
|
||||
|
||||
}catch (Exception e){
|
||||
log.error("获取时间戳异常", e);
|
||||
}
|
||||
return null;
|
||||
SystemTime systemTime = new SystemTime()
|
||||
.setYear(date.getYear()+1900)
|
||||
.setMonth(date.getMonth()+1)
|
||||
.setDate(date.getDate())
|
||||
.setHour(date.getHours())
|
||||
.setMinute(date.getMinutes())
|
||||
.setSecond(date.getSeconds())
|
||||
.setTimestamp(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date));
|
||||
return systemTime;
|
||||
}
|
||||
|
||||
public static void main(String arge[]) {
|
||||
Date date = new Date();
|
||||
System.out.println("-----------" + (date.getYear() + 1900));
|
||||
System.out.println("-----------" + (date.getMonth() + 1));
|
||||
System.out.println("-----------" + date.getDate());
|
||||
System.out.println("-----------" + date.getHours());
|
||||
System.out.println("-----------" + date.getMinutes());
|
||||
System.out.println("-----------" + date.getSeconds());
|
||||
public static void main(String arge[]){
|
||||
try{
|
||||
|
||||
Date date = new Date();
|
||||
System.out.println("-----------"+(date.getYear()+1900));
|
||||
System.out.println("-----------"+(date.getMonth()+1));
|
||||
System.out.println("-----------"+date.getDate());
|
||||
System.out.println("-----------"+date.getHours());
|
||||
System.out.println("-----------"+date.getMinutes());
|
||||
System.out.println("-----------"+date.getSeconds());
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,14 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.timeService.controller;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
||||
import com.chinaunicom.mall.ebtp.extend.export.service.ExportServiceFactory;
|
||||
import com.chinaunicom.mall.ebtp.extend.timeService.TimeServiceConstant;
|
||||
import com.chinaunicom.mall.ebtp.extend.timeService.tsa.SystemTime;
|
||||
import com.chinaunicom.mall.ebtp.extend.timeService.tsa.TtsAgent;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -20,6 +22,8 @@ import java.util.Date;
|
||||
@RequestMapping("/v1/timeService")
|
||||
public class TimeServiceController {
|
||||
|
||||
@Autowired
|
||||
private TimeServiceConstant timeServiceConstant;
|
||||
/**
|
||||
* 申请时间戳
|
||||
*
|
||||
@ -29,8 +33,8 @@ public class TimeServiceController {
|
||||
@ApiOperation("申请时间戳")
|
||||
@GetMapping(value = "/signTimeStamp")
|
||||
public BaseResponse<String> signTimeStamp(@ApiParam(value = "待申请时间戳的原文", required = false) @RequestParam(name = "data", required = false) String data) {
|
||||
TimeServiceConstant constant = new TimeServiceConstant();
|
||||
return BaseResponse.success(constant.signTimeStamp(data));
|
||||
//TimeServiceConstant constant = new TimeServiceConstant();
|
||||
return BaseResponse.success(timeServiceConstant.signTimeStamp(data));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -42,8 +46,8 @@ public class TimeServiceController {
|
||||
@ApiOperation("解析时间戳加密原文")
|
||||
@PostMapping(value = "/verifyTimeStamp")
|
||||
public BaseResponse<TtsAgent.TtsParseResult> verifyTimeStamp(@ApiParam(value = "时间戳加密原文", required = true) @RequestBody String timestamp) {
|
||||
TimeServiceConstant constant = new TimeServiceConstant();
|
||||
return BaseResponse.success(constant.verifyTimeStamp2(timestamp));
|
||||
//TimeServiceConstant constant = new TimeServiceConstant();
|
||||
return BaseResponse.success(timeServiceConstant.verifyTimeStamp2(timestamp));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -55,8 +59,8 @@ public class TimeServiceController {
|
||||
@ApiOperation("直接获取时间戳对象(内涵日期)")
|
||||
@PostMapping(value = "/getServiceTimeObj")
|
||||
public BaseResponse<TtsAgent.TtsParseResult> getServiceTimeObj(@ApiParam(value = "待申请时间戳的原文", required = false) @RequestParam(name = "data", required = false) String data) {
|
||||
TimeServiceConstant constant = new TimeServiceConstant();
|
||||
return BaseResponse.success(constant.getServiceTimeObj(data));
|
||||
//TimeServiceConstant constant = new TimeServiceConstant();
|
||||
return BaseResponse.success(timeServiceConstant.getServiceTimeObj(data));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -68,8 +72,8 @@ public class TimeServiceController {
|
||||
@ApiOperation("直接获取日期字符串")
|
||||
@GetMapping(value = "/getServiceTime")
|
||||
public BaseResponse<String> getServiceTime(@ApiParam(value = "待申请时间戳的原文", required = false) @RequestParam(name = "data", required = false) String data) {
|
||||
TimeServiceConstant constant = new TimeServiceConstant();
|
||||
return BaseResponse.success(constant.getServiceTime(data));
|
||||
//TimeServiceConstant constant = new TimeServiceConstant();
|
||||
return BaseResponse.success(timeServiceConstant.getServiceTime(data));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -81,8 +85,8 @@ public class TimeServiceController {
|
||||
@ApiOperation("获取日期对象SystemTime")
|
||||
@GetMapping(value = "/getServiceSystemTime")
|
||||
public BaseResponse<SystemTime> getServiceSystemTime(@ApiParam(value = "待申请时间戳的原文", required = false) @RequestParam(name = "data", required = false) String data) {
|
||||
TimeServiceConstant constant = new TimeServiceConstant();
|
||||
return BaseResponse.success(constant.getServiceSystemTime(data));
|
||||
//TimeServiceConstant constant = new TimeServiceConstant();
|
||||
return BaseResponse.success(timeServiceConstant.getServiceSystemTime(data));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -96,9 +100,9 @@ public class TimeServiceController {
|
||||
public BaseResponse<SystemTime> getDescOpenRoomTime(@RequestParam(name = "openTime", required = true) String openTime) {
|
||||
try {
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
TimeServiceConstant constant = new TimeServiceConstant();
|
||||
//TimeServiceConstant constant = new TimeServiceConstant();
|
||||
|
||||
Date now = constant.getServiceDate("getDescOpenRoomTime");
|
||||
Date now = timeServiceConstant.getServiceDate("getDescOpenRoomTime");
|
||||
;//当前时间
|
||||
Date date = df.parse(openTime);//过去
|
||||
long l = date.getTime() - now.getTime();
|
||||
|
@ -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