|
@@ -1,7 +1,9 @@
|
|
|
package cn.cslg.pas.service.impl;
|
|
|
|
|
|
import cn.cslg.pas.common.model.dto.PatentMarketDataDTO;
|
|
|
+import cn.cslg.pas.common.model.vo.PatentNoTrendVO;
|
|
|
import cn.cslg.pas.common.model.vo.PatentTrendVO;
|
|
|
+import cn.cslg.pas.common.model.vo.PermissionRecordTrendVO;
|
|
|
import cn.cslg.pas.common.model.vo.ProductMarketDataTrendVO;
|
|
|
import cn.cslg.pas.mapper.PatentMarketDataMapper;
|
|
|
import cn.cslg.pas.service.IPatentMarketDataService;
|
|
@@ -27,26 +29,71 @@ public class PatentMarketDataServiceImpl implements IPatentMarketDataService {
|
|
|
|
|
|
@Override
|
|
|
public List<PatentTrendVO> showTrend(PatentMarketDataDTO dto) {
|
|
|
- //存储专利号以及各专利号对应的营销数据
|
|
|
+ //存储专利号,以及专利号查询出来的信息
|
|
|
List<PatentTrendVO> trendVOS = new ArrayList<>();
|
|
|
- //存储产品id查询到的营销数据
|
|
|
- List<ProductMarketDataTrendVO> saleVOS = new ArrayList<>();
|
|
|
+ //存储专利号查询出来的所有信息
|
|
|
+ List<PatentNoTrendVO> saleVOS = new ArrayList<>();
|
|
|
+ //存储根据专利号查询出来的营销数据部分的信息
|
|
|
+ List<ProductMarketDataTrendVO> pmdVOS = new ArrayList<>();
|
|
|
+ //存储根据专利号查询出来的许可记录部分的信息
|
|
|
+ List<PermissionRecordTrendVO> prVOS = new ArrayList<>();
|
|
|
//判断专利号集合内是否有内容,没有的话直接返回null
|
|
|
if(dto.getPatentNoList() == null && dto.getPatentNoList().size() == 0) {
|
|
|
return null;
|
|
|
}
|
|
|
if (dto.getTimeUnit() == 2) {//按照年份返回营销数据
|
|
|
- saleVOS = patentMarketDataMapper.patentQueryByYear(dto.getPatentNoList(), dto.getSaleArea());
|
|
|
+ pmdVOS = patentMarketDataMapper.patentQueryByYear(dto.getPatentNoList(), dto.getSaleArea());
|
|
|
+ prVOS = patentMarketDataMapper.PRDataQueryByYear(dto.getPatentNoList());
|
|
|
} else if (dto.getTimeUnit() == 1) {//按照季度返回营销数据
|
|
|
- saleVOS = patentMarketDataMapper.patentQueryBySeason(dto.getPatentNoList(), dto.getSaleArea());
|
|
|
+ pmdVOS = patentMarketDataMapper.patentQueryBySeason(dto.getPatentNoList(), dto.getSaleArea());
|
|
|
+ prVOS = patentMarketDataMapper.PRDataQueryBySeason(dto.getPatentNoList());
|
|
|
} else if (dto.getTimeUnit() == null || dto.getTimeUnit() == 0) {//按照月份返回营销数据
|
|
|
- saleVOS = patentMarketDataMapper.patentQueryByMonth(dto.getPatentNoList(), dto.getSaleArea());
|
|
|
+ pmdVOS = patentMarketDataMapper.patentQueryByMonth(dto.getPatentNoList(), dto.getSaleArea());
|
|
|
+ prVOS = patentMarketDataMapper.PRDataQueryByMonth(dto.getPatentNoList());
|
|
|
}
|
|
|
+
|
|
|
+ //遍历查询到的许可历史费用
|
|
|
+ for (PermissionRecordTrendVO prVO : prVOS) {
|
|
|
+ //new一个要返回的类
|
|
|
+ PatentNoTrendVO temVO = new PatentNoTrendVO();
|
|
|
+ //将prVOS的数据插入到空的retList中
|
|
|
+ temVO.setMarketDate(prVO.getMarketDate());
|
|
|
+ temVO.setLicenseFee(prVO.getLicenseFee());
|
|
|
+ saleVOS.add(temVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ //遍历专利营销数据费用
|
|
|
+ for(ProductMarketDataTrendVO pmdVO:pmdVOS){
|
|
|
+ //设置一个标志
|
|
|
+ boolean isExistInReturnList = false;
|
|
|
+ //遍历返回的retList
|
|
|
+ for(PatentNoTrendVO ptVO:saleVOS){
|
|
|
+ if(ptVO.getMarketDate().equals(pmdVO.getMarketDate())){
|
|
|
+ //如果找到了pmdVO中和retList中相同的时间
|
|
|
+ isExistInReturnList = true;
|
|
|
+ //将专利营销数据费用赋值给要返回的retList
|
|
|
+ ptVO.setSaleTotalMoney(pmdVO.getSaleTotalMoney());
|
|
|
+ ptVO.setCustomLicenseMoney(pmdVO.getCustomLicenseMoney());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //如果没有找到
|
|
|
+ if(!isExistInReturnList){
|
|
|
+ PatentNoTrendVO temVO = new PatentNoTrendVO();
|
|
|
+ temVO.setMarketDate(pmdVO.getMarketDate());
|
|
|
+ temVO.setSaleTotalMoney(pmdVO.getSaleTotalMoney());
|
|
|
+ temVO.setCustomLicenseMoney(pmdVO.getCustomLicenseMoney());
|
|
|
+ saleVOS.add(temVO);
|
|
|
+ }else{
|
|
|
+ isExistInReturnList = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
PatentTrendVO trendVO = new PatentTrendVO();
|
|
|
trendVO.setPatentNoList(dto.getPatentNoList());
|
|
|
trendVO.setSaleVOS(saleVOS);
|
|
|
trendVOS.add(trendVO);
|
|
|
return trendVOS;
|
|
|
}
|
|
|
-
|
|
|
}
|