21 changed files with 500 additions and 5 deletions
@ -0,0 +1,33 @@ |
|||||
|
package com.elink.esua.epdc.dto.category; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author songyunpeng |
||||
|
* @Description |
||||
|
* @create 2021-01-07 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CategoryCodeTree implements Serializable { |
||||
|
|
||||
|
/** |
||||
|
* 部门区域编码 |
||||
|
*/ |
||||
|
private String categoryCode; |
||||
|
|
||||
|
/** |
||||
|
* 部门区域编码 |
||||
|
*/ |
||||
|
private String categoryName; |
||||
|
|
||||
|
/** |
||||
|
* 下一级 |
||||
|
*/ |
||||
|
private List<CategoryCodeTree> children; |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,57 @@ |
|||||
|
package com.elink.esua.epdc.dto.category; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @author songyunpeng |
||||
|
* @Description |
||||
|
* @create 2021-01-07 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CategoryCodeUpload implements Serializable { |
||||
|
|
||||
|
/** |
||||
|
* 客户内自己的分类编码 |
||||
|
*/ |
||||
|
private String categoryCode; |
||||
|
|
||||
|
/** |
||||
|
* 客户内自己的分类名称 |
||||
|
*/ |
||||
|
private String categoryName; |
||||
|
/** |
||||
|
* 父类分类编码,如果是一级分类,此列赋值为0 |
||||
|
*/ |
||||
|
private String parentCategoryCode; |
||||
|
/** |
||||
|
* 分类等级:1、2....;对应关系:领域:1,大类 :2,小类:3 ,细分类:4 具体问题:5 |
||||
|
*/ |
||||
|
private String level; |
||||
|
/** |
||||
|
* 排序 |
||||
|
*/ |
||||
|
private String sort; |
||||
|
/** |
||||
|
* 当前分类对应产品内的分类编码,如果对应不上,此列传空 |
||||
|
*/ |
||||
|
private String epmetCategoryCode; |
||||
|
/** |
||||
|
* 原始创建时间yyyy-MM-dd HH:mm:ss |
||||
|
*/ |
||||
|
private String originCreatedTime; |
||||
|
|
||||
|
/** |
||||
|
* 原始更新时间yyyy-MM-dd HH:mm:ss |
||||
|
*/ |
||||
|
private String orginUpdatedTime; |
||||
|
/** |
||||
|
* 分类字典表主键 |
||||
|
*/ |
||||
|
private String categoryId; |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,18 @@ |
|||||
|
package com.elink.esua.epdc.dto.category; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 部门节点 |
||||
|
* |
||||
|
* @author work@yujt.net.cn |
||||
|
* @date 2019/11/27 10:03 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class EpmetCategoryCodeOption<T> { |
||||
|
|
||||
|
private List<T> options; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
package com.elink.esua.epdc.dto.screen.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Author:liuchuang |
||||
|
* @Date:2020/9/10 14:51 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ScreenDataDTO implements Serializable { |
||||
|
private static final long serialVersionUID = 8161588041384645877L; |
||||
|
|
||||
|
/** |
||||
|
* 当为true时后台将先删除当前维度的数据,后新增 |
||||
|
*/ |
||||
|
private Boolean isFirst; |
||||
|
|
||||
|
/** |
||||
|
* 上报数据 |
||||
|
*/ |
||||
|
private Object dataList; |
||||
|
} |
||||
@ -0,0 +1,49 @@ |
|||||
|
package com.elink.esua.epdc.modules.category; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.category.EpmetCategoryCodeOption; |
||||
|
import com.elink.esua.epdc.modules.category.service.CategoryAnalysisService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
/** |
||||
|
* @Description 相关 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2020/2/10 16:06 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("category") |
||||
|
public class CategoryAnalysisController { |
||||
|
|
||||
|
@Autowired |
||||
|
private CategoryAnalysisService categoryAnalysisService; |
||||
|
|
||||
|
/** |
||||
|
* @Description 获取分类编码 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2021/1/7 |
||||
|
* @Param [] |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result |
||||
|
**/ |
||||
|
@GetMapping("getCategoryCode") |
||||
|
public Result<EpmetCategoryCodeOption> getCategoryCode(){ |
||||
|
EpmetCategoryCodeOption deptCodeOption = categoryAnalysisService.getCategoryCode(); |
||||
|
return new Result().ok(deptCodeOption); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Description 分类编码上报 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2021/1/7 |
||||
|
* @Param [] |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result |
||||
|
**/ |
||||
|
@PostMapping("uploadCategoryCode") |
||||
|
public Result uploadCategoryCode(){ |
||||
|
return categoryAnalysisService.uploadCategoryCode(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,43 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.category.dao; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
||||
|
import com.elink.esua.epdc.dto.category.CategoryCodeUpload; |
||||
|
import com.elink.esua.epdc.dto.issue.result.IssueResultDTO; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @Description 分类相关 |
||||
|
* @Author yinzuomei |
||||
|
* @Date 2020/2/10 16:06 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface CategoryAnalysisDao extends BaseDao<IssueResultDTO> { |
||||
|
/** |
||||
|
* @Description 查询分类编码 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2021/3/23 |
||||
|
* @Param [] |
||||
|
* @return java.util.List<com.elink.esua.epdc.dto.category.CategoryCodeUpload> |
||||
|
**/ |
||||
|
List<CategoryCodeUpload> selectCategoryCode(); |
||||
|
} |
||||
@ -0,0 +1,29 @@ |
|||||
|
package com.elink.esua.epdc.modules.category.service; |
||||
|
|
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.category.EpmetCategoryCodeOption; |
||||
|
|
||||
|
/** |
||||
|
* @Description 相关 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2020/2/10 16:06 |
||||
|
*/ |
||||
|
public interface CategoryAnalysisService { |
||||
|
/** |
||||
|
* @Description 获取分类编码 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2021/1/7 |
||||
|
* @Param [] |
||||
|
* @return java.lang.String |
||||
|
**/ |
||||
|
EpmetCategoryCodeOption getCategoryCode(); |
||||
|
/** |
||||
|
* @Description 项目分类字典上报 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2021/3/23 |
||||
|
* @Param [categoryCodeUpload] |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result |
||||
|
**/ |
||||
|
Result uploadCategoryCode(); |
||||
|
} |
||||
@ -0,0 +1,62 @@ |
|||||
|
package com.elink.esua.epdc.modules.category.service.impl; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSON; |
||||
|
import com.alibaba.fastjson.JSONArray; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.elink.esua.epdc.commons.tools.constant.EpmetConstant; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.datasources.DataSourceNames; |
||||
|
import com.elink.esua.epdc.datasources.annotation.DataSource; |
||||
|
import com.elink.esua.epdc.dto.category.CategoryCodeTree; |
||||
|
import com.elink.esua.epdc.dto.category.CategoryCodeUpload; |
||||
|
import com.elink.esua.epdc.dto.category.EpmetCategoryCodeOption; |
||||
|
import com.elink.esua.epdc.dto.issue.result.IssueResultDTO; |
||||
|
import com.elink.esua.epdc.modules.category.dao.CategoryAnalysisDao; |
||||
|
import com.elink.esua.epdc.modules.category.service.CategoryAnalysisService; |
||||
|
import com.elink.esua.epdc.utils.EpmetUtils; |
||||
|
import com.elink.esua.epdc.utils.ScreenDataUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Description admin相关 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2020/2/10 16:06 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class CategoryAnalysisServiceImpl extends BaseServiceImpl<CategoryAnalysisDao, IssueResultDTO> implements CategoryAnalysisService { |
||||
|
|
||||
|
@Autowired |
||||
|
private EpmetUtils epmetUtils; |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public EpmetCategoryCodeOption getCategoryCode() { |
||||
|
String dataResult = epmetUtils.httpPost(EpmetConstant.EPMET_SCREEN_COLL_CATEGORY_CODE,null); |
||||
|
JSONObject jsonObject = JSONObject.parseObject(dataResult); |
||||
|
Result categoryCodeTreeResult = JSON.toJavaObject(jsonObject, Result.class ); |
||||
|
if(categoryCodeTreeResult!=null && categoryCodeTreeResult.getData()!=null){ |
||||
|
List<CategoryCodeTree> categoryCodeTreeList = JSONArray.parseArray(JSONObject.toJSONString(categoryCodeTreeResult.getData()), CategoryCodeTree.class); |
||||
|
EpmetCategoryCodeOption epmetCategoryCodeOption = new EpmetCategoryCodeOption(); |
||||
|
epmetCategoryCodeOption.setOptions(categoryCodeTreeList); |
||||
|
return epmetCategoryCodeOption; |
||||
|
} |
||||
|
return new EpmetCategoryCodeOption(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@DataSource(name = DataSourceNames.FOURTH) |
||||
|
public Result uploadCategoryCode() { |
||||
|
// 数据统计
|
||||
|
List<CategoryCodeUpload> data = baseDao.selectCategoryCode(); |
||||
|
// 数据格式化
|
||||
|
String dataJson = ScreenDataUtils.getScreenDateJson(data,true); |
||||
|
// 数据上报
|
||||
|
epmetUtils.httpPost(EpmetConstant.EPMET_SCREEN_COLL_CATEGORY_CODE_UPLOAD, dataJson); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,28 @@ |
|||||
|
<?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.elink.esua.epdc.modules.category.dao.CategoryAnalysisDao"> |
||||
|
|
||||
|
|
||||
|
<select id="selectCategoryCode" resultType="com.elink.esua.epdc.dto.category.CategoryCodeUpload"> |
||||
|
select |
||||
|
t1.ID as categoryId, |
||||
|
t1.CATEGORY_NAME, |
||||
|
t1.CATEGORY_CODE, |
||||
|
ifnull((select t2.category_code from epdc_category t2 where t1.pid = t2.id and t2.del_flag = '0' and t2.enable_flag = '1'),0) as parentCategoryCode, |
||||
|
CASE t1.category_type |
||||
|
WHEN 0 THEN '1' |
||||
|
WHEN 1 THEN '2' |
||||
|
WHEN 2 THEN '3' |
||||
|
WHEN 3 THEN '4' |
||||
|
WHEN 4 THEN '5' |
||||
|
ELSE '' |
||||
|
END AS level, |
||||
|
t1.SORT, |
||||
|
t1.CREATE_DATE as originCreatedTime, |
||||
|
t1.UPDATE_DATE as orginUpdatedTime, |
||||
|
t1.EPMET_CATEGORY_CODE |
||||
|
from epdc_category t1 |
||||
|
where t1.del_flag ='0' and t1.enable_flag = '1' |
||||
|
</select> |
||||
|
</mapper> |
||||
@ -0,0 +1,30 @@ |
|||||
|
package com.elink.esua.epdc.modules.feign; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.category.EpmetCategoryCodeOption; |
||||
|
import com.elink.esua.epdc.modules.feign.fallback.AnalysisFeignClientFallback; |
||||
|
import org.springframework.cloud.openfeign.FeignClient; |
||||
|
import org.springframework.http.MediaType; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
|
||||
|
/** |
||||
|
* 数据分析模块调用 |
||||
|
* |
||||
|
* @Author:liuchuang |
||||
|
* @Date:2020/9/9 15:41 |
||||
|
*/ |
||||
|
@FeignClient(name = ServiceConstant.EPDC_ANALYSIS_SERVER, fallback = AnalysisFeignClientFallback.class) |
||||
|
public interface AnalysisFeignClient { |
||||
|
|
||||
|
/** |
||||
|
* @Description 组织机构编码获取 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2021/1/7 |
||||
|
* @Param [] |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result |
||||
|
**/ |
||||
|
@GetMapping(value = "analysis/category/getCategoryCode", consumes = MediaType.APPLICATION_JSON_VALUE) |
||||
|
Result<EpmetCategoryCodeOption> getCategoryCode(); |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
package com.elink.esua.epdc.modules.feign.fallback; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.ModuleUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.category.EpmetCategoryCodeOption; |
||||
|
import com.elink.esua.epdc.modules.feign.AnalysisFeignClient; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* @Author:songyunpeg |
||||
|
* @Date:2020/9/9 15:42 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class AnalysisFeignClientFallback implements AnalysisFeignClient { |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public Result<EpmetCategoryCodeOption> getCategoryCode() { |
||||
|
return ModuleUtils.feignConError(ServiceConstant.EPDC_ANALYSIS_SERVER, "getCategoryCode"); |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue