Browse Source

Merge remote-tracking branch 'origin/dev_screen_data_2.0' into dev_temp

dev_shibei_match
zxc 5 years ago
parent
commit
15355a5b40
  1. 2
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/constant/ScreenConstant.java
  2. 12
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java
  3. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java
  4. 9
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java
  5. 70
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java
  6. 37
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml
  7. 26
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/CustomerBizOrgFormDTO.java
  8. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ShiBeiScreenCollController.java
  9. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java
  10. 40
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerBizOrgDao.java
  11. 52
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerBizOrgEntity.java
  12. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java
  13. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ShiBeiScreenCollService.java
  14. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java
  15. 82
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java
  16. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimCustomerPartymemberServiceImpl.java
  17. 1
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml
  18. 39
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerBizOrgDao.xml

2
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/constant/ScreenConstant.java

@ -16,6 +16,8 @@ public interface ScreenConstant {
String COMMA = ",";
String COLON = ":";
String MONTH_ID = "month";
String YEAR_ID = "year";

12
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java

@ -33,6 +33,18 @@ public class AgencyController {
return new Result<TreeResultDTO>().ok(agencyService.tree(customerId));
}
/**
* @Description 智慧社区的tree
* @Param customerId
* @Param bizType
* @author zxc
* @date 2020/10/21 2:49 下午
*/
@PostMapping("treebytype")
public Result<TreeResultDTO> treeByType(@RequestHeader("CustomerId") String customerId,@RequestParam("bizType")String bizType){
return new Result<TreeResultDTO>().ok(agencyService.treeByType(customerId,bizType));
}
/**
* @Description 2组织区域查询
* @param compartmentFormDTO

4
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java

@ -40,6 +40,8 @@ public interface ScreenCustomerAgencyDao {
*/
TreeResultDTO selectRootAgencyId(@Param("customerId")String customerId);
TreeResultDTO selectRootAgencyIdByBizType(@Param("customerId")String customerId,@Param("bizType")String bizType);
/**
* @Description 查询下级机关的 名称和id
* @param subAgencyPids
@ -48,6 +50,8 @@ public interface ScreenCustomerAgencyDao {
*/
List<TreeResultDTO> selectSubAgencyList(@Param("subAgencyPids") String subAgencyPids);
List<TreeResultDTO> selectSubAgencyListByBizType(@Param("subAgencyPids") String subAgencyPids);
/**
* @Description 查询当前机关的区域信息
* @param agencyId

9
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java

@ -20,6 +20,15 @@ public interface AgencyService {
*/
TreeResultDTO tree(String customerId);
/**
* @Description 智慧社区的tree
* @Param customerId
* @Param bizType
* @author zxc
* @date 2020/10/21 2:49 下午
*/
TreeResultDTO treeByType(String customerId,String bizType);
/**
* @Description 2组织区域查询
* @param compartmentFormDTO

70
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java

@ -66,6 +66,36 @@ public class AgencyServiceImpl implements AgencyService {
return rootAgency;
}
/**
* @Description 智慧社区的tree
* @Param customerId
* @Param bizType
* @author zxc
* @date 2020/10/21 2:49 下午
*/
@Override
public TreeResultDTO treeByType(String customerId, String bizType) {
TreeResultDTO rootAgency = null;
try {
rootAgency = screenCustomerAgencyDao.selectRootAgencyIdByBizType(customerId,bizType);
if (null == rootAgency) {
return new TreeResultDTO();
}
} catch (TooManyResultsException e) {
throw new RenException("根组织结构数据有误");
}
List<Double> centerMark = this.getCenterMark(rootAgency.getCenterMarkA());
rootAgency.setCenterMark(centerMark.size() == NumConstant.ZERO ? new ArrayList<>() : centerMark);
if (rootAgency.getLevel().equals(ScreenConstant.COMMUNITY)) {
List<TreeResultDTO> treeResultDTOS = screenCustomerGridDao.selectGridInfo(rootAgency.getValue());
rootAgency.setChildren(treeResultDTOS);
} else {
List<TreeResultDTO> departmentList = this.getDepartmentListByBiz(("".equals(rootAgency.getPids()) || rootAgency.getPids().equals(NumConstant.ZERO_STR)) ? rootAgency.getValue() : rootAgency.getPids().concat(",").concat(rootAgency.getValue()));
rootAgency.setChildren(departmentList);
}
return rootAgency;
}
/**
* @Description 处理centerMark
* @param centerMark
@ -105,7 +135,45 @@ public class AgencyServiceImpl implements AgencyService {
});
sub.setChildren(treeResultDTOS);
}else {
List<TreeResultDTO> subAgency = getDepartmentList(sub.getPids() + "," + sub.getValue());
List<TreeResultDTO> subAgency = new ArrayList<>();
if (sub.getPids().contains(ScreenConstant.COMMA)){
subAgency = getDepartmentList(sub.getPids() + ScreenConstant.COMMA + sub.getValue());
}else {
subAgency = getDepartmentList(sub.getPids() + ScreenConstant.COLON + sub.getValue());
}
sub.setChildren(subAgency);
}
});
}
return subAgencyList;
}
/**
* @Description 智慧社区的tree
* @Param subAgencyPids
* @author zxc
* @date 2020/10/21 2:49 下午
*/
public List<TreeResultDTO> getDepartmentListByBiz(String subAgencyPids) {
List<TreeResultDTO> subAgencyList = screenCustomerAgencyDao.selectSubAgencyListByBizType(subAgencyPids);
if (subAgencyList.size() > NumConstant.ZERO) {
subAgencyList.forEach(sub -> {
List<Double> centerMark = this.getCenterMark(sub.getCenterMarkA());
sub.setCenterMark(centerMark.size() == NumConstant.ZERO ? new ArrayList<>() : centerMark);
if (sub.getLevel().equals(ScreenConstant.COMMUNITY)){
List<TreeResultDTO> treeResultDTOS = screenCustomerGridDao.selectGridInfo(sub.getValue());
treeResultDTOS.forEach(tree -> {
List<Double> centerMarkTree = this.getCenterMark(tree.getCenterMarkA());
tree.setCenterMark(centerMarkTree.size() == NumConstant.ZERO ? new ArrayList<>() : centerMarkTree);
});
sub.setChildren(treeResultDTOS);
}else {
List<TreeResultDTO> subAgency = new ArrayList<>();
if (sub.getPids().contains(ScreenConstant.COMMA)){
subAgency = getDepartmentListByBiz(sub.getPids() + ScreenConstant.COMMA + sub.getValue());
}else {
subAgency = getDepartmentListByBiz(sub.getPids() + ScreenConstant.COLON + sub.getValue());
}
sub.setChildren(subAgency);
}
});

37
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml

@ -114,4 +114,41 @@
AND agency_id = #{agencyId}
</select>
<select id="selectRootAgencyIdByBizType" resultType="com.epmet.evaluationindex.screen.dto.result.TreeResultDTO">
SELECT
ca.agency_name AS label,
cbo.ORG_ID AS value,
ca.pids AS pids,
IFNULL(ca.center_mark,'') AS centerMarkA,
ca.level AS level
FROM
screen_customer_agency ca
LEFT JOIN screen_customer_biz_org cbo ON cbo.ORG_ID = ca.AGENCY_ID
WHERE
ca.del_flag = 0
AND cbo.DEL_FLAG = 0
AND ca.pid = '0'
AND cbo.customer_id = #{customerId}
AND cbo.BIZ_TYPE = #{bizType}
</select>
<select id="selectSubAgencyListByBizType" resultType="com.epmet.evaluationindex.screen.dto.result.TreeResultDTO">
SELECT
cbo.ORG_ID AS value,
ca.agency_name AS label,
ca.pids AS pids,
IFNULL(ca.center_mark,'') AS centerMarkA,
ca.level AS level
FROM
screen_customer_biz_org cbo
LEFT JOIN screen_customer_agency ca ON ca.AGENCY_ID = cbo.ORG_ID
WHERE
ca.del_flag = '0'
AND cbo.DEL_FLAG = 0
AND cbo.biz_type = "community"
AND ca.pids = #{subAgencyPids}
ORDER BY
ca.created_time DESC
</select>
</mapper>

26
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/CustomerBizOrgFormDTO.java

@ -0,0 +1,26 @@
package com.epmet.dto.indexcollect.form;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
/**
* 客户业务组织关系 入参
*/
@Data
public class CustomerBizOrgFormDTO implements Serializable {
/**
* 当为true时后台将删除本月数据
*/
@NotEmpty(message = "客户Id不能为空")
private String customerId;
/**
* 业务类型智慧社区 community
*/
@NotEmpty(message = "业务类型不能为空")
private String bizType;
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ShiBeiScreenCollController.java

@ -1,6 +1,7 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.indexcollect.form.CustomerBizOrgFormDTO;
import com.epmet.dto.screencoll.form.*;
import com.epmet.service.evaluationindex.screen.ShiBeiScreenCollService;
import org.springframework.beans.factory.annotation.Autowired;
@ -261,4 +262,12 @@ public class ShiBeiScreenCollController {
shiBeiScreenCollService.insertPublicPartiTotalData(formDTO, customerId);
return new Result();
}
/**
* 初始化客户业务组织类型
**/
@PostMapping("initbizorg")
public Result initBizOrg(@RequestBody CustomerBizOrgFormDTO formDTO) {
return new Result().ok(shiBeiScreenCollService.initBizOrg(formDTO));
}
}

7
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java

@ -23,6 +23,7 @@ import com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO;
import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO;
import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO;
import com.epmet.dto.extract.result.OrgNameResultDTO;
import com.epmet.dto.indexcollect.form.CustomerBizOrgFormDTO;
import com.epmet.dto.screen.result.TreeResultDTO;
import com.epmet.dto.screencoll.form.CustomerAgencyFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity;
@ -165,13 +166,15 @@ public interface ScreenCustomerAgencyDao extends BaseDao<ScreenCustomerAgencyEnt
*/
List<ScreenPartyLinkMassesDataFormDTO> selectAllAgencyIdToPartyLinkMessage(@Param("customerId") String customerId,@Param("monthId") String monthId);
List<ScreenPartyBranchDataFormDTO> selectAllAgencyIdToOrganize(@Param("customerId") String customerId,@Param("monthId") String monthId);
List<ScreenPartyBranchDataFormDTO> selectAllAgencyIdToOrganize(@Param("customerId") String customerId, @Param("monthId") String monthId);
/**
* @Description 查询org名称机关
* @param agencyIds
* @Description 查询org名称机关
* @author zxc
* @date 2020/9/24 1:27 下午
*/
List<OrgNameResultDTO> selectOrgNameAgency(@Param("agencyIds") List<String> agencyIds);
Boolean initBizOrg(CustomerBizOrgFormDTO formDTO);
}

40
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerBizOrgDao.java

@ -0,0 +1,40 @@
/**
* 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.evaluationindex.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.indexcollect.form.CustomerBizOrgFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerBizOrgEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 组织机构信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-18
*/
@Mapper
public interface ScreenCustomerBizOrgDao extends BaseDao<ScreenCustomerBizOrgEntity> {
int deleteByBizType(CustomerBizOrgFormDTO formDTO);
int batchInsert(@Param("list") List<ScreenCustomerBizOrgEntity> list);
}

52
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerBizOrgEntity.java

@ -0,0 +1,52 @@
/**
* 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.evaluationindex.screen;
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-08-21
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("screen_customer_biz_org")
public class ScreenCustomerBizOrgEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* 组织id
*/
private String orgId;
/**
* 业务类型 community:智慧社区
*/
private String bizType;
}

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java

@ -21,6 +21,7 @@ package com.epmet.service.evaluationindex.screen;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dto.extract.form.*;
import com.epmet.dto.extract.result.GridInfoResultDTO;
import com.epmet.dto.indexcollect.form.CustomerBizOrgFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity;
import com.epmet.entity.org.CustomerGridEntity;
@ -75,10 +76,20 @@ public interface ScreenCustomerGridService extends BaseService<ScreenCustomerGri
List<PartyAbilityGridMonthlyFormDTO> selectAllGridInfoToParty(String customerId);
/**
* @Description 查询全部网格信息
* @param customerId
* @Description 查询全部网格信息
* @author zxc
* @date 2020/9/18 10:47 上午
*/
List<GovernAbilityGridMonthlyFormDTO> selectAllGridInfo(String customerId);
/**
* desc: 初始化客户的业务组织关系
*
* @param formDTO
* @return java.lang.Boolean
* @author LiuJanJun
* @date 2020/10/21 2:33 下午
*/
Boolean initBizOrg(CustomerBizOrgFormDTO formDTO);
}

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ShiBeiScreenCollService.java

@ -1,8 +1,7 @@
package com.epmet.service.evaluationindex.screen;
import com.epmet.dto.indexcollect.form.CustomerBizOrgFormDTO;
import com.epmet.dto.screencoll.form.*;
import java.util.List;
/**
* 大屏数据采集api
*
@ -231,4 +230,14 @@ public interface ShiBeiScreenCollService {
* @Date 09:44 2020-08-25
**/
void insertPublicPartiTotalData(PublicPartiTotalDataListFormDTO formDTO, String customerId);
/**
* desc: 初始化客户业务组织关系表
*
* @param formDTO
* @return java.lang.Integer
* @author LiuJanJun
* @date 2020/10/21 2:38 下午
*/
Integer initBizOrg(CustomerBizOrgFormDTO formDTO);
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java

@ -26,10 +26,10 @@ import com.epmet.constant.OrgSourceTypeConstant;
import com.epmet.dao.evaluationindex.screen.ScreenCustomerGridDao;
import com.epmet.dto.extract.form.*;
import com.epmet.dto.extract.result.GridInfoResultDTO;
import com.epmet.dto.indexcollect.form.CustomerBizOrgFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity;
import com.epmet.entity.org.CustomerGridEntity;
import com.epmet.service.evaluationindex.screen.ScreenCustomerGridService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -150,8 +150,8 @@ public class ScreenCustomerGridServiceImpl extends BaseServiceImpl<ScreenCustome
}
/**
* @Description 查询全部网格信息
* @param customerId
* @Description 查询全部网格信息
* @author zxc
* @date 2020/9/18 10:47 上午
*/
@ -159,4 +159,9 @@ public class ScreenCustomerGridServiceImpl extends BaseServiceImpl<ScreenCustome
public List<GovernAbilityGridMonthlyFormDTO> selectAllGridInfo(String customerId) {
return screenCustomerGridDao.selectAllGridInfo(customerId);
}
@Override
public Boolean initBizOrg(CustomerBizOrgFormDTO formDTO) {
return null;
}
}

82
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java

@ -17,17 +17,20 @@
package com.epmet.service.evaluationindex.screen.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.constant.CompareConstant;
import com.epmet.constant.DataSourceConstant;
import com.epmet.constant.IndexCalConstant;
import com.epmet.dao.evaluationindex.screen.*;
import com.epmet.dto.indexcollect.form.CustomerBizOrgFormDTO;
import com.epmet.dto.screencoll.form.*;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerBizOrgEntity;
import com.epmet.entity.evaluationindex.screen.ScreenEventImgDataEntity;
import com.epmet.entity.evaluationindex.screen.ScreenUserJoinEntity;
import com.epmet.service.evaluationindex.screen.ShiBeiScreenCollService;
@ -40,7 +43,6 @@ import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
@ -54,9 +56,9 @@ import java.util.stream.Collectors;
@DataSource(DataSourceConstant.EVALUATION_INDEX)
public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
@Autowired
private ScreenPartyUserRankDataDao screenPartyUserRankDataDao;
@Autowired
@Autowired
private ScreenPartyUserRankDataDao screenPartyUserRankDataDao;
@Autowired
private ScreenPartyLinkMassesDataDao screenPartyLinkMassesDataDao;
@Autowired
private ScreenPartyBranchDataDao screenPartyBranchDataDao;
@ -81,6 +83,8 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
@Autowired
private ScreenCustomerAgencyDao screenCustomerAgencyDao;
@Autowired
private ScreenCustomerBizOrgDao screenCustomerBizOrgDao;
@Autowired
private ScreenUserTotalDataDao screenUserTotalDataDao;
@Autowired
private ScreenUserJoinDao screenUserJoinDao;
@ -94,7 +98,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
@Override
@Transactional(rollbackFor = Exception.class)
public void insertPartyUserRankData(PartyUserRankDataListFormDTO formDTO,String customerId) {
public void insertPartyUserRankData(PartyUserRankDataListFormDTO formDTO, String customerId) {
if (formDTO.getIsFirst()) {
int deleteNum;
do {
@ -187,7 +191,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
if (null != formDTO.getDataList().get(i).getImgDataList() && formDTO.getDataList().get(i).getImgDataList().size() > NumConstant.ZERO) {
// 根据原始事件ID,物理删除 - 事件数据图片数据
events[i] = formDTO.getDataList().get(i).getEventId();
for (int j = NumConstant.ZERO; j < formDTO.getDataList().get(i).getImgDataList().size(); j++){
for (int j = NumConstant.ZERO; j < formDTO.getDataList().get(i).getImgDataList().size(); j++) {
// 新增 中央区-事件数据图片数据 表
ScreenEventImgDataEntity imgDataEntity = new ScreenEventImgDataEntity();
imgDataEntity.setEventId(formDTO.getDataList().get(i).getImgDataList().get(j).getEventId());
@ -198,7 +202,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
}
}
}
if (isImgUrl){
if (isImgUrl) {
screenEventImgDataDao.delEventImgDataByEvent(events);
screenEventImgDataDao.batchInsertEventImgData(eventImgDataList);
}
@ -210,11 +214,11 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
@Override
@Transactional(rollbackFor = Exception.class)
public void insertDifficultyData(DifficultyDataFormDTO formDTO, String customerId) {
if(formDTO.getIsFirst()){
if (formDTO.getIsFirst()) {
//直接删除当前客户下所有的数据
screenDifficultyDataDao.deleteDifficultyData(customerId);
}
if (null != formDTO && !CollectionUtils.isEmpty(formDTO.getDataList())){
if (null != formDTO && !CollectionUtils.isEmpty(formDTO.getDataList())) {
screenDifficultyDataDao.batchInsertDifficultyData(formDTO.getDataList(), customerId);
}
}
@ -309,9 +313,9 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
}
if (!CollectionUtils.isEmpty(formDTO.getDataList())) {
List<CustomerAgencyFormDTO> pidIsZeroList = formDTO.getDataList().stream().filter(d -> d.getPid().equals(NumConstant.ZERO_STR) || "".equals(d.getPid())).collect(Collectors.toList());
if (pidIsZeroList.size()>NumConstant.ONE){
if (pidIsZeroList.size() > NumConstant.ONE) {
Object o = JSONObject.toJSON(pidIsZeroList);
throw new RenException("多个pid为【0】的数据:"+o.toString());
throw new RenException("多个pid为【0】的数据:" + o.toString());
}
screenCustomerAgencyDao.batchInsertCustomerAgency(formDTO.getDataList(), customerId);
}
@ -343,9 +347,9 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
} while (deleteNum != NumConstant.ZERO);
}
if (!CollectionUtils.isEmpty(formDTO.getDataList())) {
if (formDTO.getDataList().size() > NumConstant.ZERO){
if (formDTO.getDataList().size() > NumConstant.ZERO) {
String[] orgIds = new String[formDTO.getDataList().size()];
for (int i = NumConstant.ZERO; i < formDTO.getDataList().size(); i++){
for (int i = NumConstant.ZERO; i < formDTO.getDataList().size(); i++) {
orgIds[i] = formDTO.getDataList().get(i).getOrgId();
}
@ -360,11 +364,11 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
// 定义本月待添加数据的集合
List<ScreenUserJoinEntity> curMonthJoinEntityList = new ArrayList<>();
// 增加率计算
if (null != lastMonthJoinList && lastMonthJoinList.size() > NumConstant.ZERO){
if (null != lastMonthJoinList && lastMonthJoinList.size() > NumConstant.ZERO) {
// 存在上个月的数据 (本月-上月)/上月 *100
for (int i = NumConstant.ZERO; i < formDTO.getDataList().size(); i++){
for (int j = NumConstant.ZERO; j < lastMonthJoinList.size(); j++){
if (formDTO.getDataList().get(i).getOrgId().equals(lastMonthJoinList.get(j).getOrgId())){
for (int i = NumConstant.ZERO; i < formDTO.getDataList().size(); i++) {
for (int j = NumConstant.ZERO; j < lastMonthJoinList.size(); j++) {
if (formDTO.getDataList().get(i).getOrgId().equals(lastMonthJoinList.get(j).getOrgId())) {
ScreenUserJoinEntity entity = ConvertUtils.sourceToTarget(formDTO.getDataList().get(i), ScreenUserJoinEntity.class);
entity.setJoinTotalUpRate(this.calculateGrowthRateNumber(lastMonthJoinList.get(i).getJoinTotal(), formDTO.getDataList().get(j).getJoinTotal()));
entity.setJoinTotalUpFlag(this.calculateGrowthRateFlag(lastMonthJoinList.get(i).getJoinTotal(), formDTO.getDataList().get(j).getJoinTotal()));
@ -380,8 +384,8 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
// 计算增长率后的 待新增数据
BigDecimal zero = new BigDecimal(NumConstant.ZERO);
// 不存在上个月的数据
for (int i = NumConstant.ZERO; i < formDTO.getDataList().size(); i++){
ScreenUserJoinEntity entity = ConvertUtils.sourceToTarget(formDTO.getDataList().get(i), ScreenUserJoinEntity.class);
for (int i = NumConstant.ZERO; i < formDTO.getDataList().size(); i++) {
ScreenUserJoinEntity entity = ConvertUtils.sourceToTarget(formDTO.getDataList().get(i), ScreenUserJoinEntity.class);
entity.setJoinTotalUpRate(zero);
entity.setJoinTotalUpFlag("");
entity.setAvgIssueUpRate(zero);
@ -396,14 +400,37 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
}
}
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
@Override
@Transactional(rollbackFor = Exception.class)
public Integer initBizOrg(CustomerBizOrgFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
List<ScreenCustomerAgencyEntity> entityList = screenCustomerAgencyDao.selectListAgencyInfo(formDTO.getCustomerId());
List<ScreenCustomerBizOrgEntity> list = new ArrayList<>();
if (CollectionUtils.isEmpty(entityList)) {
return 0;
}
entityList.forEach(o -> {
ScreenCustomerBizOrgEntity entity = new ScreenCustomerBizOrgEntity();
entity.setCustomerId(o.getCustomerId());
entity.setOrgId(o.getAgencyId());
entity.setBizType(formDTO.getBizType());
list.add(entity);
});
screenCustomerBizOrgDao.deleteByBizType(formDTO);
return screenCustomerBizOrgDao.batchInsert(list);
}
/**
* 获取当前日期的前一个月的日期
*
* @param
* @return java.lang.String[]
* @Author zhangyong
* @Date 15:33 2020-08-21
**/
private String[] lastMonthDate(){
private String[] lastMonthDate() {
String[] date = new String[NumConstant.TWO];
//Java获取当前日期的前一个月的日期
Calendar calendar = Calendar.getInstance();
@ -411,8 +438,9 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH) + NumConstant.ONE;
date[NumConstant.ZERO] = String.valueOf(year);
date[NumConstant.ONE] = String.valueOf(month);;
if (NumConstant.TEN >= month){
date[NumConstant.ONE] = String.valueOf(month);
;
if (NumConstant.TEN >= month) {
date[NumConstant.ONE] = NumConstant.ZERO_STR + month;
}
return date;
@ -421,8 +449,8 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
/**
* 计算 本月数值 相较于 上月数值的增长率
*
* @param old 上月数值
* @param now 本月数值
* @param old 上月数值
* @param now 本月数值
* @return java.math.BigDecimal
* @Author zhangyong
* @Date 15:38 2020-08-21
@ -459,8 +487,8 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
/**
* 计算 本月数值 相较于 上月数值的增长率 得出标识
*
* @param old 上月数值
* @param now 本月数值
* @param old 上月数值
* @param now 本月数值
* @return java.util.String
* @Author zhangyong
* @Date 15:38 2020-08-21

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimCustomerPartymemberServiceImpl.java

@ -144,7 +144,11 @@ public class DimCustomerPartymemberServiceImpl extends BaseServiceImpl<DimCustom
throw new RenException(StatsConstant.CUSTOMER_INFO_NULL);
}
if ((StringUtils.isBlank(customerIdAndDateIdFormDTO.getStartDate()) && StringUtils.isBlank(customerIdAndDateIdFormDTO.getEndDate()))){
dateIds.add(DimIdGenerator.getDateDimId(DateUtils.addDateDays(new Date(), -1)));
if (StringUtils.isNotBlank(customerIdAndDateIdFormDTO.getDateId())){
dateIds.add(customerIdAndDateIdFormDTO.getDateId());
}else {
dateIds.add(DimIdGenerator.getDateDimId(DateUtils.addDateDays(new Date(), -1)));
}
}else {
dateIds = DateUtils.getDaysBetween(customerIdAndDateIdFormDTO.getStartDate(), customerIdAndDateIdFormDTO.getEndDate());
}

1
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml

@ -80,6 +80,7 @@
<select id="selectListAgencyInfo" parameterType="map" resultType="com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity">
SELECT
CUSTOMER_ID,
AGENCY_ID agencyId,
AGENCY_NAME agencyName,
PIDS pids

39
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerBizOrgDao.xml

@ -0,0 +1,39 @@
<?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.evaluationindex.screen.ScreenCustomerBizOrgDao">
<delete id="deleteByBizType">
delete from screen_customer_biz_org
where CUSTOMER_ID = #{customerId}
and BIZ_TYPE = #{bizType,jdbcType=VARCHAR}
</delete>
<insert id="batchInsert">
insert into screen_customer_biz_org
(
ID,
CUSTOMER_ID,
ORG_ID,
BIZ_TYPE,
DEL_FLAG,
REVISION,
CREATED_BY,
CREATED_TIME,
UPDATED_BY,
UPDATED_TIME
) values
<foreach collection="list" item="item" separator=",">
(
(SELECT REPLACE(UUID(), '-', '') AS id),
#{item.customerId},
#{item.orgId},
#{item.bizType},
0,
0,
'APP_USER',
now(),
'APP_USER',
now()
)
</foreach>
</insert>
</mapper>
Loading…
Cancel
Save