Browse Source

增长率

master
zxc 4 years ago
parent
commit
67ee6c6560
  1. 16
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/GovernConstant.java
  2. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenUserJoinDao.java
  3. 83
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java
  4. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserJoinService.java
  5. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserJoinServiceImpl.java
  6. 10
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserJoinDao.xml

16
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/GovernConstant.java

@ -0,0 +1,16 @@
package com.epmet.constant;
/**
* @Author zxc
* @DateTime 2021/7/9 3:24 下午
* @DESC
*/
public interface GovernConstant {
/**
* 增长incr下降decr 相等 eq
*/
String INCR = "incr";
String DECR = "decr";
String EQ = "eq";
}

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

@ -83,4 +83,14 @@ public interface ScreenUserJoinDao extends BaseDao<ScreenUserJoinEntity> {
* @Date 10:52 2020-08-18
**/
void batchInsertUserJoin(@Param("list") List<ScreenUserJoinEntity> list, @Param("customerId")String customerId);
/**
* @Description 根据月份查询screenUserJoin
* @Param customerId
* @Param monthId
* @Param flag agency grid
* @author zxc
* @date 2021/7/9 3:13 下午
*/
List<ScreenUserJoinEntity> selectScreenUserJoin(@Param("customerId")String customerId, @Param("monthId")String monthId, @Param("flag")String flag);
}

83
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.GovernConstant;
import com.epmet.constant.OrgTypeConstant;
import com.epmet.constant.ProjectConstant;
import com.epmet.dto.extract.form.ExtractScreenFormDTO;
@ -407,7 +408,8 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService {
entity.setAvgJoin(realJoinCount.divide(avgFz, NumConstant.FOUR, BigDecimal.ROUND_HALF_UP));
}
}
screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values()),OrgTypeConstant.GRID);
ArrayList<ScreenUserJoinEntity> dispose = dispose(formDTO, insertMap, OrgTypeConstant.GRID);
screenUserJoinService.deleteAndInsertBatch(formDTO, dispose,OrgTypeConstant.GRID);
}
/**
@ -492,7 +494,84 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService {
}
});
}
screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values()),OrgTypeConstant.AGENCY);
ArrayList<ScreenUserJoinEntity> dispose = dispose(formDTO, insertMap, OrgTypeConstant.AGENCY);
screenUserJoinService.deleteAndInsertBatch(formDTO, dispose,OrgTypeConstant.AGENCY);
}
public ArrayList<ScreenUserJoinEntity> dispose(ExtractScreenFormDTO formDTO,Map<String, ScreenUserJoinEntity> insertMap,String flag) {
String beforeNMonthByMonth = DateUtils.getBeforeNMonthByMonth(NumConstant.ONE, formDTO.getMonthId());
List<ScreenUserJoinEntity> screenUserJoinEntities = screenUserJoinService.selectScreenUserJoin(formDTO.getCustomerId(), beforeNMonthByMonth, flag);
ArrayList<ScreenUserJoinEntity> insertList = new ArrayList<>(insertMap.values());
if (CollectionUtils.isEmpty(screenUserJoinEntities)) {
insertList.forEach(l -> {
// 总的参与次数较上月增长率
if (l.getJoinTotal().equals(NumConstant.ZERO)) {
l.setJoinTotalUpFlag(GovernConstant.EQ);
l.setJoinTotalUpRate(NumConstant.ZERO_DECIMAL);
} else if (l.getJoinTotal() > NumConstant.ZERO) {
l.setJoinTotalUpFlag(GovernConstant.INCR);
l.setJoinTotalUpRate(NumConstant.ONE_HUNDRED_DECIMAL);
}
// 人均议题较上月增长率
if (l.getAvgIssue().equals(NumConstant.ZERO_DECIMAL)) {
l.setAvgIssueUpFlag(GovernConstant.EQ);
l.setAvgIssueUpRate(NumConstant.ZERO_DECIMAL);
} else {
l.setAvgIssueUpFlag(GovernConstant.INCR);
l.setAvgIssueUpRate(NumConstant.ONE_HUNDRED_DECIMAL);
}
// 平均参与度较上月增长率
if (l.getAvgJoin().equals(NumConstant.ZERO_DECIMAL)) {
l.setAgvgJoinUpFlag(GovernConstant.EQ);
l.setAgvgJoinUpRate(NumConstant.ZERO_DECIMAL);
} else {
l.setAgvgJoinUpFlag(GovernConstant.INCR);
l.setAgvgJoinUpRate(NumConstant.ONE_HUNDRED_DECIMAL);
}
});
} else {
insertList.forEach(l -> {
screenUserJoinEntities.forEach(s -> {
if (l.getOrgId().equals(s.getOrgId())) {
// 总的参与次数较上月增长率
if (l.getJoinTotal() > s.getJoinTotal()) {
l.setJoinTotalUpFlag(GovernConstant.INCR);
l.setJoinTotalUpRate(new BigDecimal(((l.getJoinTotal() - s.getJoinTotal()) / s.getJoinTotal()) * NumConstant.ONE_HUNDRED).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP));
} else if (l.getJoinTotal() < s.getJoinTotal()) {
l.setJoinTotalUpFlag(GovernConstant.DECR);
l.setJoinTotalUpRate(new BigDecimal(((l.getJoinTotal() - s.getJoinTotal()) / s.getJoinTotal()) * NumConstant.ONE_HUNDRED).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP));
} else {
l.setJoinTotalUpFlag(GovernConstant.EQ);
l.setJoinTotalUpRate(NumConstant.ZERO_DECIMAL);
}
// 人均议题较上月增长率
Integer re = l.getAvgIssue().compareTo(s.getAvgIssue());
if (re.equals(NumConstant.ONE)) {
l.setAvgIssueUpFlag(GovernConstant.INCR);
l.setAvgIssueUpRate(l.getAvgIssue().subtract(s.getAvgIssue()).divide(s.getAvgIssue()).multiply(NumConstant.ONE_HUNDRED_DECIMAL).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP));
} else if (re.equals(NumConstant.ONE_NEG)) {
l.setAvgIssueUpFlag(GovernConstant.DECR);
l.setAvgIssueUpRate(l.getAvgIssue().subtract(s.getAvgIssue()).divide(s.getAvgIssue()).multiply(NumConstant.ONE_HUNDRED_DECIMAL).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP));
} else {
l.setAvgIssueUpFlag(GovernConstant.EQ);
l.setAvgIssueUpRate(NumConstant.ZERO_DECIMAL);
}
// 平均参与度较上月增长率
Integer avgJoinRe = l.getAvgJoin().compareTo(s.getAvgJoin());
if (avgJoinRe.equals(NumConstant.ONE)) {
l.setAgvgJoinUpFlag(GovernConstant.INCR);
l.setAgvgJoinUpRate(l.getAvgJoin().subtract(s.getAvgJoin()).divide(s.getAvgJoin()).multiply(NumConstant.ONE_HUNDRED_DECIMAL).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP));
} else if (avgJoinRe.equals(NumConstant.ONE_NEG)) {
l.setAvgIssueUpFlag(GovernConstant.DECR);
l.setAgvgJoinUpRate(l.getAvgJoin().subtract(s.getAvgJoin()).divide(s.getAvgJoin()).multiply(NumConstant.ONE_HUNDRED_DECIMAL).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP));
} else {
l.setAvgIssueUpFlag(GovernConstant.EQ);
l.setAgvgJoinUpRate(NumConstant.ZERO_DECIMAL);
}
}
});
});
}
return insertList;
}
}

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserJoinService.java

@ -42,4 +42,14 @@ public interface ScreenUserJoinService extends BaseService<ScreenUserJoinEntity>
* @date 2020/9/27 4:40 下午
*/
Boolean deleteAndInsertBatch(ExtractScreenFormDTO formDTO, List<ScreenUserJoinEntity> list,String delFlag);
/**
* @Description 根据月份查询screenUserJoin
* @Param customerId
* @Param monthId
* @Param flag agency grid
* @author zxc
* @date 2021/7/9 3:13 下午
*/
List<ScreenUserJoinEntity> selectScreenUserJoin(String customerId,String monthId,String flag);
}

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

@ -124,6 +124,19 @@ public class ScreenUserJoinServiceImpl extends BaseServiceImpl<ScreenUserJoinDao
return true;
}
/**
* @Description 根据月份查询screenUserJoin
* @Param customerId
* @Param monthId
* @Param flag agency grid
* @author zxc
* @date 2021/7/9 3:13 下午
*/
@Override
public List<ScreenUserJoinEntity> selectScreenUserJoin(String customerId, String monthId, String flag) {
return baseDao.selectScreenUserJoin(customerId, monthId, flag);
}
/**
* 计算 本月数值 相较于 上月数值的增长率

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

@ -100,4 +100,14 @@
</foreach>
</insert>
<!-- 根据月份查询screenUserJoin -->
<select id="selectScreenUserJoin" resultType="com.epmet.entity.evaluationindex.screen.ScreenUserJoinEntity">
SELECT * FROM screen_user_join
WHERE DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
AND ORG_TYPE = #{flag}
AND MONTH_ID = #{monthId}
</select>
</mapper>

Loading…
Cancel
Save