Browse Source

项目分类字典抽取到指标库

dev_shibei_match
yinzuomei 4 years ago
parent
commit
0d55115691
  1. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java
  2. 39
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/IssueProjectCategoryDictDao.java
  3. 39
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/CustomerProjectCategoryDictDao.java
  4. 33
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactOrginProjectCategoryDao.java
  5. 83
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/issue/IssueProjectCategoryDictEntity.java
  6. 95
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/CustomerProjectCategoryDictEntity.java
  7. 63
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactOrginProjectCategoryEntity.java
  8. 37
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueProjectCategoryDictService.java
  9. 36
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueProjectCategoryDictServiceImpl.java
  10. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDimService.java
  11. 51
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java
  12. 45
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/CustomerProjectCategoryDictService.java
  13. 31
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactOrginProjectCategoryService.java
  14. 97
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/CustomerProjectCategoryDictServiceImpl.java
  15. 35
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactOrginProjectCategoryServiceImpl.java
  16. 44
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/IssueProjectCategoryDictDao.xml
  17. 41
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/CustomerProjectCategoryDictDao.xml
  18. 8
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactOrginProjectCategoryDao.xml

8
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();
}

39
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
* <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.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<IssueProjectCategoryDictEntity> listInsertCategoies(@Param("start") Date start, @Param("end") Date end);
List<IssueProjectCategoryDictEntity> listByUpdatedTime(@Param("start") Date start, @Param("end") Date end);
}

39
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
* <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.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> {
CustomerProjectCategoryDictEntity getLatestProjectCategory();
CustomerProjectCategoryDictEntity getLatestUpdatedEntity();
CustomerProjectCategoryDictEntity selectByCustomerIdAndId(@Param("customerId") String customerId, @Param("categoryId") String categoryId);
}

33
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
* <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.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<FactOrginProjectCategoryEntity> {
}

83
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
* <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.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;
}

95
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
* <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.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;
/**
* 分类等级12....产品只有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;
}

63
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
* <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.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;
/**
* 分类等级12....产品目前只有2级分类
*/
private Integer level;
}

37
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
* <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.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<IssueProjectCategoryDictEntity> listInsertCategoies(Date start, Date end);
List<IssueProjectCategoryDictEntity> listByUpdatedTime(Date start, Date end);
}

36
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<IssueProjectCategoryDictEntity> listInsertCategoies(Date start, Date end) {
return issueProjectCategoryDictDao.listInsertCategoies(start, end);
}
@Override
public List<IssueProjectCategoryDictEntity> listByUpdatedTime(Date start, Date end) {
return issueProjectCategoryDictDao.listByUpdatedTime(start, end);
}
}

2
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();
}

51
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<DimGridEntity> 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<IssueProjectCategoryDictEntity> insertCategoies = listInsertCategoies();
List<IssueProjectCategoryDictEntity> updateCategoies = listUpdateCategoies(now);
projectCategoryDictService.initProjectCategory(insertCategoies,updateCategoies);
}
/**
* @author yinzuomei
* @description 构造需要插入的分类字典
* @Date 2021/3/19 15:52
**/
private List<IssueProjectCategoryDictEntity> 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<IssueProjectCategoryDictEntity> listUpdateCategoies(Date initTime) {
CustomerProjectCategoryDictEntity lastUpdated = projectCategoryDictService.getLatestUpdatedEntity();
if (lastUpdated != null) {
return issueProjectCategoryDictService.listByUpdatedTime(lastUpdated.getOriginUpdatedTime(), initTime);
}
return new ArrayList<>();
}
}

45
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
* <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.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<CustomerProjectCategoryDictEntity> {
void initProjectCategory(List<IssueProjectCategoryDictEntity> insertCategoies,
List<IssueProjectCategoryDictEntity> updateCategoies);
/**
* @author yinzuomei
* @description 获取内部客户最近一次初始记录
* @Date 2021/3/19 14:57
**/
CustomerProjectCategoryDictEntity getLatestProjectCategory();
CustomerProjectCategoryDictEntity getLatestUpdatedEntity();
}

31
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
* <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.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<FactOrginProjectCategoryEntity> {
}

97
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
* <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.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<CustomerProjectCategoryDictDao, CustomerProjectCategoryDictEntity> implements CustomerProjectCategoryDictService {
@DataSource(value = DataSourceConstant.EVALUATION_INDEX)
@Transactional(rollbackFor = Exception.class)
@Override
public void initProjectCategory(List<IssueProjectCategoryDictEntity> insertCategoies, List<IssueProjectCategoryDictEntity> 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();
}
}

35
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
* <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.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<FactOrginProjectCategoryDao, FactOrginProjectCategoryEntity> implements FactOrginProjectCategoryService {
}

44
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/IssueProjectCategoryDictDao.xml

@ -0,0 +1,44 @@
<?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.epmet.dao.issue.IssueProjectCategoryDictDao">
<!-- 构造需要插入的分类字典数据 -->
<select id="listInsertCategoies" parameterType="map" resultType="com.epmet.entity.issue.IssueProjectCategoryDictEntity">
SELECT
*
FROM
issue_project_category_dict
<where>
DEL_FLAG = 0
and CUSTOMER_ID !='default'
<if test="start != null">
AND CREATED_TIME &gt; #{start}
</if>
<if test="end != null">
AND CREATED_TIME &lt; #{end}
</if>
</where>
ORDER BY CREATED_TIME ASC
</select>
<!-- 构造需要更新的分类字典数据 -->
<select id="listByUpdatedTime" parameterType="map" resultType="com.epmet.entity.issue.IssueProjectCategoryDictEntity">
SELECT
*
FROM
issue_project_category_dict
<where>
DEL_FLAG = 0
and CUSTOMER_ID !='default'
<if test="start != null">
AND UPDATED_TIME &gt; #{start}
</if>
<if test="end != null">
AND UPDATED_TIME &lt; #{end}
</if>
</where>
ORDER BY UPDATED_TIME ASC
</select>
</mapper>

41
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/CustomerProjectCategoryDictDao.xml

@ -0,0 +1,41 @@
<?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.epmet.dao.stats.CustomerProjectCategoryDictDao">
<select id="getLatestProjectCategory" resultType="com.epmet.entity.stats.CustomerProjectCategoryDictEntity">
SELECT
*
FROM
customer_project_category_dict m
WHERE
m.DEL_FLAG = '0'
AND m.CUSTOMER_TYPE = 'internal'
ORDER BY
m.ORIGIN_CREATED_TIME DESC
LIMIT 1
</select>
<select id="getLatestUpdatedEntity" resultType="com.epmet.entity.stats.CustomerProjectCategoryDictEntity">
SELECT
*
FROM
customer_project_category_dict m
WHERE
m.DEL_FLAG = '0'
AND m.CUSTOMER_TYPE = 'internal'
ORDER BY
m.ORIGIN_UPDATED_TIME DESC
LIMIT 1
</select>
<select id="selectByCustomerIdAndId" parameterType="map" resultType="com.epmet.entity.stats.CustomerProjectCategoryDictEntity">
SELECT
*
FROM
customer_project_category_dict m
WHERE
m.DEL_FLAG = '0'
and m.customer_id=#{customerId}
and m.CATEGORY_ID=#{categoryId}
</select>
</mapper>

8
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactOrginProjectCategoryDao.xml

@ -0,0 +1,8 @@
<?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.epmet.dao.stats.FactOrginProjectCategoryDao">
</mapper>
Loading…
Cancel
Save