diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java index 3e2a78b716..68dedbd4a0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java @@ -1,7 +1,6 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; -import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.AgencySubDeptTreeDto; import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; @@ -105,6 +104,13 @@ public class DimController { } catch (Exception e) { logger.error("初始化按周维度失败:", e); } + //项目分类字典维度 初始化 每天晚上凌晨10分执行 + try { + statsDimService.customerInitProjectCategory(); + logger.info("初始化项目分类成功"); + } catch (Exception e) { + logger.error("初始化项目分类失败:", e); + } return new Result(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/IssueProjectCategoryDictDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/IssueProjectCategoryDictDao.java new file mode 100644 index 0000000000..9cc59cf996 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/IssueProjectCategoryDictDao.java @@ -0,0 +1,39 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.issue; + +import com.epmet.entity.issue.IssueProjectCategoryDictEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.Date; +import java.util.List; + +/** + * 议题项目分类字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Mapper +public interface IssueProjectCategoryDictDao { + + List listInsertCategoies(@Param("start") Date start, @Param("end") Date end); + + List listByUpdatedTime(@Param("start") Date start, @Param("end") Date end); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/CustomerProjectCategoryDictDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/CustomerProjectCategoryDictDao.java new file mode 100644 index 0000000000..fd0cdd6eb2 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/CustomerProjectCategoryDictDao.java @@ -0,0 +1,39 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.stats; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.stats.CustomerProjectCategoryDictEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 客户项目分类字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-19 + */ +@Mapper +public interface CustomerProjectCategoryDictDao extends BaseDao { + + CustomerProjectCategoryDictEntity getLatestProjectCategory(); + + CustomerProjectCategoryDictEntity getLatestUpdatedEntity(); + + CustomerProjectCategoryDictEntity selectByCustomerIdAndId(@Param("customerId") String customerId, @Param("categoryId") String categoryId); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactOrginProjectCategoryDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactOrginProjectCategoryDao.java new file mode 100644 index 0000000000..789dc926bb --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactOrginProjectCategoryDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.stats; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.stats.FactOrginProjectCategoryEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 项目所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-19 + */ +@Mapper +public interface FactOrginProjectCategoryDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/issue/IssueProjectCategoryDictEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/issue/IssueProjectCategoryDictEntity.java new file mode 100644 index 0000000000..67c82fee00 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/issue/IssueProjectCategoryDictEntity.java @@ -0,0 +1,83 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.issue; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 议题项目分类字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("issue_project_category_dict") +public class IssueProjectCategoryDictEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id, 产品默认default + */ + private String customerId; + + /** + * 上级分类ID 顶级此列存储0 + */ + private String pid; + + /** + * 所有上级分类ID,用逗号分开 + */ + private String pids; + + /** + * 上级分类编码 + */ + private String parentCategoryCode; + + /** + * 分类编码,分类编码+customer_id唯一 + */ + private String categoryCode; + + /** + * 分类名称 + */ + private String categoryName; + + /** + * 分类类别1,2,3,4.... + */ + private String categoryType; + + /** + * 排序 + */ + private Integer sort; + + /** + * 是否禁用(enable:启用 disable:禁用) + */ + private String isDisable; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/CustomerProjectCategoryDictEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/CustomerProjectCategoryDictEntity.java new file mode 100644 index 0000000000..82afefb88c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/CustomerProjectCategoryDictEntity.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.stats; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 客户项目分类字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-19 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("customer_project_category_dict") +public class CustomerProjectCategoryDictEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 外部客户:external;内部客户:internal + */ + private String customerType; + + /** + * 客户自己的分类编码 + */ + private String categoryCode; + + /** + * 客户自己的分类名称 + */ + private String categoryName; + + /** + * 父类分类编码,如果是一级分类,此列赋值为0 + */ + private String parentCategoryCode; + + /** + * 分类等级:1、2....;产品只有2级分类 + */ + private Integer level; + + /** + * 排序 + */ + private Integer sort; + + /** + * 是否禁用(enable:启用 disable:禁用) + */ + private String isDisable; + + /** + * 对应e世通中的分类编码,没有此列为空 + */ + private String epmetCategoryCode; + + /** + * 创建时间 + */ + private Date originCreatedTime; + /** + * 修改时间 + */ + private Date originUpdatedTime; + + private String categoryId; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactOrginProjectCategoryEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactOrginProjectCategoryEntity.java new file mode 100644 index 0000000000..294bdfd92e --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactOrginProjectCategoryEntity.java @@ -0,0 +1,63 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.stats; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 项目所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-19 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_orgin_project_category") +public class FactOrginProjectCategoryEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 项目id + */ + private String projectId; + + /** + * 分类编码 + */ + private String categoryCode; + + /** + * 所属父类分类编码 + */ + private String parentCategoryCode; + + /** + * 分类等级:1、2....;产品目前只有2级分类 + */ + private Integer level; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueProjectCategoryDictService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueProjectCategoryDictService.java new file mode 100644 index 0000000000..3067657abb --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueProjectCategoryDictService.java @@ -0,0 +1,37 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.Issue; + +import com.epmet.entity.issue.IssueProjectCategoryDictEntity; + +import java.util.Date; +import java.util.List; + +/** + * 议题项目分类字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ + +public interface IssueProjectCategoryDictService{ + + List listInsertCategoies(Date start, Date end); + + List listByUpdatedTime(Date start, Date end); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueProjectCategoryDictServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueProjectCategoryDictServiceImpl.java new file mode 100644 index 0000000000..98c18ec1fc --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueProjectCategoryDictServiceImpl.java @@ -0,0 +1,36 @@ +package com.epmet.service.Issue.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.issue.IssueProjectCategoryDictDao; +import com.epmet.entity.issue.IssueProjectCategoryDictEntity; +import com.epmet.service.Issue.IssueProjectCategoryDictService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2021/3/19 15:29 + */ +@Service +@DataSource(DataSourceConstant.GOV_ISSUE) +public class IssueProjectCategoryDictServiceImpl implements IssueProjectCategoryDictService { + @Autowired + private IssueProjectCategoryDictDao issueProjectCategoryDictDao; + + @Override + public List listInsertCategoies(Date start, Date end) { + return issueProjectCategoryDictDao.listInsertCategoies(start, end); + } + + @Override + public List listByUpdatedTime(Date start, Date end) { + return issueProjectCategoryDictDao.listByUpdatedTime(start, end); + } + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDimService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDimService.java index 1e2f05991b..0bdac4cb04 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDimService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDimService.java @@ -10,4 +10,6 @@ public interface StatsDimService { void initCustomerDim(); void initDepartmentDim(); + + void customerInitProjectCategory(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java index 6338145260..09db5e717d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java @@ -3,10 +3,12 @@ package com.epmet.service.impl; import com.epmet.constant.RobotConstant; import com.epmet.dto.org.result.CustomerAreaCodeResultDTO; import com.epmet.entity.crm.CustomerEntity; +import com.epmet.entity.issue.IssueProjectCategoryDictEntity; import com.epmet.entity.org.CustomerAgencyEntity; import com.epmet.entity.org.CustomerDepartmentEntity; import com.epmet.entity.org.CustomerGridEntity; import com.epmet.entity.stats.*; +import com.epmet.service.Issue.IssueProjectCategoryDictService; import com.epmet.service.StatsDimService; import com.epmet.service.crm.CustomerService; import com.epmet.service.org.CustomerAgencyService; @@ -52,6 +54,12 @@ public class StatsDimServiceImpl implements StatsDimService { @Autowired private DimDepartmentService dimDepartmentService; + @Autowired + private CustomerProjectCategoryDictService projectCategoryDictService; + + @Autowired + private IssueProjectCategoryDictService issueProjectCategoryDictService; + @Override public void initGridDim() { List newDimGrids = getNewDimGrids(); @@ -264,4 +272,47 @@ public class StatsDimServiceImpl implements StatsDimService { } return new ArrayList<>(); } + + /** + * @return void + * @author yinzuomei + * @description 初始化项目分类字典表 + * @Date 2021/3/19 15:44 + **/ + @Override + public void customerInitProjectCategory() { + Date now = new Date(); + List insertCategoies = listInsertCategoies(); + List updateCategoies = listUpdateCategoies(now); + projectCategoryDictService.initProjectCategory(insertCategoies,updateCategoies); + } + + /** + * @author yinzuomei + * @description 构造需要插入的分类字典 + * @Date 2021/3/19 15:52 + **/ + private List listInsertCategoies() { + CustomerProjectCategoryDictEntity lastInsertProjectCategory = projectCategoryDictService.getLatestProjectCategory(); + Date now = new Date(); + Date lastInitTime = null; + if (null != lastInsertProjectCategory) { + lastInitTime = lastInsertProjectCategory.getOriginCreatedTime(); + } + return issueProjectCategoryDictService.listInsertCategoies(lastInitTime, now); + } + + /** + * @param initTime + * @author yinzuomei + * @description + * @Date 2021/3/19 15:55 + **/ + private List listUpdateCategoies(Date initTime) { + CustomerProjectCategoryDictEntity lastUpdated = projectCategoryDictService.getLatestUpdatedEntity(); + if (lastUpdated != null) { + return issueProjectCategoryDictService.listByUpdatedTime(lastUpdated.getOriginUpdatedTime(), initTime); + } + return new ArrayList<>(); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/CustomerProjectCategoryDictService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/CustomerProjectCategoryDictService.java new file mode 100644 index 0000000000..36861d7b35 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/CustomerProjectCategoryDictService.java @@ -0,0 +1,45 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.stats; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.issue.IssueProjectCategoryDictEntity; +import com.epmet.entity.stats.CustomerProjectCategoryDictEntity; + +import java.util.List; + +/** + * 客户项目分类字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-19 + */ +public interface CustomerProjectCategoryDictService extends BaseService { + + void initProjectCategory(List insertCategoies, + List updateCategoies); + + /** + * @author yinzuomei + * @description 获取内部客户最近一次初始记录 + * @Date 2021/3/19 14:57 + **/ + CustomerProjectCategoryDictEntity getLatestProjectCategory(); + + CustomerProjectCategoryDictEntity getLatestUpdatedEntity(); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactOrginProjectCategoryService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactOrginProjectCategoryService.java new file mode 100644 index 0000000000..1d3a614ead --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactOrginProjectCategoryService.java @@ -0,0 +1,31 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.stats; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.stats.FactOrginProjectCategoryEntity; + +/** + * 项目所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-19 + */ +public interface FactOrginProjectCategoryService extends BaseService { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/CustomerProjectCategoryDictServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/CustomerProjectCategoryDictServiceImpl.java new file mode 100644 index 0000000000..e81c8568ed --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/CustomerProjectCategoryDictServiceImpl.java @@ -0,0 +1,97 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.stats.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.stats.CustomerProjectCategoryDictDao; +import com.epmet.entity.issue.IssueProjectCategoryDictEntity; +import com.epmet.entity.stats.CustomerProjectCategoryDictEntity; +import com.epmet.service.stats.CustomerProjectCategoryDictService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + * 客户项目分类字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-19 + */ +@Slf4j +@DataSource(DataSourceConstant.EVALUATION_INDEX) +@Service +public class CustomerProjectCategoryDictServiceImpl extends BaseServiceImpl implements CustomerProjectCategoryDictService { + + @DataSource(value = DataSourceConstant.EVALUATION_INDEX) + @Transactional(rollbackFor = Exception.class) + @Override + public void initProjectCategory(List insertCategoies, List updateCategoies) { + log.info(String.format("=============需要插入的条数=%s,更新的条数=%s",insertCategoies.size(),updateCategoies.size())); + insertCategoies.forEach(insertEntity -> { + CustomerProjectCategoryDictEntity entityInsert=new CustomerProjectCategoryDictEntity(); + entityInsert.setCustomerId(insertEntity.getCustomerId()); + entityInsert.setCustomerType("internal"); + entityInsert.setCategoryCode(insertEntity.getCategoryCode()); + entityInsert.setCategoryName(insertEntity.getCategoryName()); + entityInsert.setParentCategoryCode(insertEntity.getParentCategoryCode()); + entityInsert.setLevel(Integer.valueOf(insertEntity.getCategoryType())); + entityInsert.setSort(insertEntity.getSort()); + entityInsert.setIsDisable(insertEntity.getIsDisable()); + entityInsert.setOriginCreatedTime(insertEntity.getCreatedTime()); + entityInsert.setOriginUpdatedTime(insertEntity.getUpdatedTime()); + entityInsert.setCategoryId(insertEntity.getId()); + baseDao.insert(entityInsert); + }); + updateCategoies.forEach(updatedEntity -> { + CustomerProjectCategoryDictEntity entity=baseDao.selectByCustomerIdAndId(updatedEntity.getCustomerId(),updatedEntity.getId()); + if(null!=entity){ + entity.setCategoryCode(updatedEntity.getCategoryCode()); + entity.setCategoryName(updatedEntity.getCategoryName()); + entity.setParentCategoryCode(updatedEntity.getParentCategoryCode()); + entity.setLevel(Integer.valueOf(updatedEntity.getCategoryType())); + entity.setSort(updatedEntity.getSort()); + entity.setIsDisable(updatedEntity.getIsDisable()); + entity.setOriginCreatedTime(updatedEntity.getCreatedTime()); + entity.setOriginUpdatedTime(updatedEntity.getUpdatedTime()); + } + baseDao.updateById(entity); + }); + } + + /** + * @author yinzuomei + * @description 获取内部客户最近一次初始记录 + * @Date 2021/3/19 14:57 + **/ + @DataSource(value = DataSourceConstant.EVALUATION_INDEX) + @Override + public CustomerProjectCategoryDictEntity getLatestProjectCategory() { + return baseDao.getLatestProjectCategory(); + } + + @DataSource(value = DataSourceConstant.EVALUATION_INDEX) + @Override + public CustomerProjectCategoryDictEntity getLatestUpdatedEntity() { + return baseDao.getLatestUpdatedEntity(); + } + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactOrginProjectCategoryServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactOrginProjectCategoryServiceImpl.java new file mode 100644 index 0000000000..c2190ca008 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactOrginProjectCategoryServiceImpl.java @@ -0,0 +1,35 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.stats.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.dao.stats.FactOrginProjectCategoryDao; +import com.epmet.entity.stats.FactOrginProjectCategoryEntity; +import com.epmet.service.stats.FactOrginProjectCategoryService; +import org.springframework.stereotype.Service; + +/** + * 项目所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-19 + */ +@Service +public class FactOrginProjectCategoryServiceImpl extends BaseServiceImpl implements FactOrginProjectCategoryService { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/IssueProjectCategoryDictDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/IssueProjectCategoryDictDao.xml new file mode 100644 index 0000000000..a1207ecd06 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/IssueProjectCategoryDictDao.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/CustomerProjectCategoryDictDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/CustomerProjectCategoryDictDao.xml new file mode 100644 index 0000000000..63b47e4456 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/CustomerProjectCategoryDictDao.xml @@ -0,0 +1,41 @@ + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactOrginProjectCategoryDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactOrginProjectCategoryDao.xml new file mode 100644 index 0000000000..572c1dc091 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactOrginProjectCategoryDao.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file