Browse Source

Merge remote-tracking branch 'origin/dev_public_join' into dev

dev_shibei_match
yinzuomei 4 years ago
parent
commit
bc9bcf4308
  1. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenUserJoinDao.java
  2. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserJoinServiceImpl.java
  3. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java
  4. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserJoinDao.xml

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenUserJoinDao.java

@ -37,7 +37,6 @@ public interface ScreenUserJoinDao extends BaseDao<ScreenUserJoinEntity> {
* 11基层治理-公众参与 * 11基层治理-公众参与
* 0) 查询上月的基础数据可用来计算本月的增长率 * 0) 查询上月的基础数据可用来计算本月的增长率
* @param customerId * @param customerId
* @param yearId
* @param monthId * @param monthId
* @param orgIds 组织Id集合 * @param orgIds 组织Id集合
* @return java.util.List<com.epmet.entity.screen.ScreenUserJoinEntity> * @return java.util.List<com.epmet.entity.screen.ScreenUserJoinEntity>
@ -45,7 +44,6 @@ public interface ScreenUserJoinDao extends BaseDao<ScreenUserJoinEntity> {
* @Date 14:46 2020-08-21 * @Date 14:46 2020-08-21
**/ **/
List<ScreenUserJoinEntity> selectLastMonthScreenUserJoinList(@Param("customerId") String customerId, List<ScreenUserJoinEntity> selectLastMonthScreenUserJoinList(@Param("customerId") String customerId,
@Param("yearId") String yearId,
@Param("monthId") String monthId, @Param("monthId") String monthId,
@Param("orgIds") String[] orgIds); @Param("orgIds") String[] orgIds);

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

@ -72,7 +72,6 @@ public class ScreenUserJoinServiceImpl extends BaseServiceImpl<ScreenUserJoinDao
DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(DateUtils.addDateMonths(DateUtils.stringToDate(formDTO.getMonthId(), DateUtils.DATE_PATTERN_YYYYMM), -1)); DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(DateUtils.addDateMonths(DateUtils.stringToDate(formDTO.getMonthId(), DateUtils.DATE_PATTERN_YYYYMM), -1));
// 获取上个月的基本数据 // 获取上个月的基本数据
List<ScreenUserJoinEntity> lastMonthJoinList = baseDao.selectLastMonthScreenUserJoinList(formDTO.getCustomerId(), List<ScreenUserJoinEntity> lastMonthJoinList = baseDao.selectLastMonthScreenUserJoinList(formDTO.getCustomerId(),
dimIdBean.getYearId(),
dimIdBean.getMonthId(), dimIdBean.getMonthId(),
orgIds); orgIds);

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

@ -22,6 +22,7 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.constant.CompareConstant; import com.epmet.constant.CompareConstant;
import com.epmet.constant.DataSourceConstant; import com.epmet.constant.DataSourceConstant;
@ -35,6 +36,7 @@ import com.epmet.entity.evaluationindex.screen.ScreenEventImgDataEntity;
import com.epmet.entity.evaluationindex.screen.ScreenUserJoinEntity; import com.epmet.entity.evaluationindex.screen.ScreenUserJoinEntity;
import com.epmet.service.evaluationindex.screen.ScreenEventImgDataService; import com.epmet.service.evaluationindex.screen.ScreenEventImgDataService;
import com.epmet.service.evaluationindex.screen.ShiBeiScreenCollService; import com.epmet.service.evaluationindex.screen.ShiBeiScreenCollService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.ListUtils; import org.apache.commons.collections4.ListUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -54,6 +56,7 @@ import java.util.stream.Collectors;
* @author generator generator@elink-cn.com * @author generator generator@elink-cn.com
* @since v1.0.0 2020-05-11 * @since v1.0.0 2020-05-11
*/ */
@Slf4j
@Service @Service
@DataSource(DataSourceConstant.EVALUATION_INDEX) @DataSource(DataSourceConstant.EVALUATION_INDEX)
public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService { public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
@ -374,18 +377,19 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
orgIds[i] = formDTO.getDataList().get(i).getOrgId(); orgIds[i] = formDTO.getDataList().get(i).getOrgId();
} }
String[] lastMonth = this.lastMonthDate(); /*String[] lastMonth = this.lastMonthDate();
// 获取上个月的基本数据 // 获取上个月的基本数据
String moneth = lastMonth[NumConstant.ZERO] + lastMonth[NumConstant.ONE]; String moneth = lastMonth[NumConstant.ZERO] + lastMonth[NumConstant.ONE];*/
String monthId= DateUtils.getBeforeNMonthByMonth(1,formDTO.getMonthId());
List<ScreenUserJoinEntity> lastMonthJoinList = screenUserJoinDao.selectLastMonthScreenUserJoinList(customerId, List<ScreenUserJoinEntity> lastMonthJoinList = screenUserJoinDao.selectLastMonthScreenUserJoinList(customerId,
lastMonth[NumConstant.ZERO], monthId,
moneth,
orgIds); orgIds);
// 定义本月待添加数据的集合 // 定义本月待添加数据的集合
List<ScreenUserJoinEntity> curMonthJoinEntityList = new ArrayList<>(); List<ScreenUserJoinEntity> curMonthJoinEntityList = new ArrayList<>();
// 增加率计算 // 增加率计算
if (null != lastMonthJoinList && lastMonthJoinList.size() > NumConstant.ZERO) { if (null != lastMonthJoinList && lastMonthJoinList.size() > NumConstant.ZERO) {
log.info("当前传入的monthId="+formDTO.getMonthId()+";数据集合长度="+formDTO.getDataList()+";当前monthId的上月已有数据集合长度="+lastMonthJoinList.size());
// 存在上个月的数据 (本月-上月)/上月 *100 // 存在上个月的数据 (本月-上月)/上月 *100
for (int i = NumConstant.ZERO; i < formDTO.getDataList().size(); i++) { for (int i = NumConstant.ZERO; i < formDTO.getDataList().size(); i++) {
for (int j = NumConstant.ZERO; j < lastMonthJoinList.size(); j++) { for (int j = NumConstant.ZERO; j < lastMonthJoinList.size(); j++) {
@ -402,6 +406,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
} }
} }
} else { } else {
log.info("当前传入的monthId="+formDTO.getMonthId()+";数据集合长度="+formDTO.getDataList()+";当前monthId上月不存在数据。");
// 计算增长率后的 待新增数据 // 计算增长率后的 待新增数据
BigDecimal zero = new BigDecimal(NumConstant.ZERO); BigDecimal zero = new BigDecimal(NumConstant.ZERO);
// 不存在上个月的数据 // 不存在上个月的数据

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserJoinDao.xml

@ -13,7 +13,7 @@
AVG_ISSUE avgIssue, AVG_ISSUE avgIssue,
AVG_JOIN avgJoin AVG_JOIN avgJoin
from screen_user_join from screen_user_join
where CUSTOMER_ID = #{customerId} AND YEAR_ID = #{yearId} AND MONTH_ID = #{monthId} where CUSTOMER_ID = #{customerId} AND MONTH_ID = #{monthId}
AND ORG_ID IN AND ORG_ID IN
<foreach item="item" collection="orgIds" open="(" separator="," close=")"> <foreach item="item" collection="orgIds" open="(" separator="," close=")">
#{item} #{item}

Loading…
Cancel
Save