Browse Source

Merge remote-tracking branch 'origin/dev'

dev_shibei_match
zxc 4 years ago
parent
commit
849e3cdae1
  1. 25
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/LineChartDTO.java
  2. 28
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/GroupActInfoDao.java
  3. 44
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java
  4. 43
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/GroupActInfoDao.xml

25
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/LineChartDTO.java

@ -0,0 +1,25 @@
package com.epmet.resi.group.dto.act;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/9/18 9:37 上午
* @DESC
*/
@Data
public class LineChartDTO implements Serializable {
private static final long serialVersionUID = -8479227864670104465L;
private Integer value;
private String month;
public LineChartDTO() {
this.value = NumConstant.ZERO;
}
}

28
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/GroupActInfoDao.java

@ -19,6 +19,7 @@ package com.epmet.modules.act.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.modules.act.entity.GroupActInfoEntity; import com.epmet.modules.act.entity.GroupActInfoEntity;
import com.epmet.resi.group.dto.act.LineChartDTO;
import com.epmet.resi.group.dto.act.OrganizationalLifeLineChartDTO; import com.epmet.resi.group.dto.act.OrganizationalLifeLineChartDTO;
import com.epmet.resi.group.dto.act.form.OrganizationalLifeFormDTO; import com.epmet.resi.group.dto.act.form.OrganizationalLifeFormDTO;
import com.epmet.resi.group.dto.act.result.OrganizationalLifeResultDTO; import com.epmet.resi.group.dto.act.result.OrganizationalLifeResultDTO;
@ -67,4 +68,31 @@ public interface GroupActInfoDao extends BaseDao<GroupActInfoEntity> {
List<OrganizationalLifeLineChartDTO> selectLineChart(@Param("groupIds") List<String> groupId,@Param("leaderFlag")Boolean leaderFlag, List<OrganizationalLifeLineChartDTO> selectLineChart(@Param("groupIds") List<String> groupId,@Param("leaderFlag")Boolean leaderFlag,
@Param("yearId")String yearId); @Param("yearId")String yearId);
/**
* @Description 查询我创建的活动
* @Param userId
* @Param yearId
* @author zxc
* @date 2021/9/18 9:23 上午
*/
List<LineChartDTO> selectMyCreateActTypeMonth(@Param("userId")String userId,@Param("yearId")String yearId);
/**
* @Description 查询应参与的活动
* @Param userId
* @Param yearId
* @author zxc
* @date 2021/9/18 9:25 上午
*/
List<LineChartDTO> selectShouldJoinActTypeMonth(@Param("userId")String userId,@Param("yearId")String yearId);
/**
* @Description 查询活动签到次数
* @Param userId
* @Param yearId
* @author zxc
* @date 2021/9/18 9:27 上午
*/
List<LineChartDTO> selectSignInTypeMonth(@Param("userId")String userId,@Param("yearId")String yearId);
} }

44
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java

@ -59,6 +59,7 @@ import com.epmet.modules.invitation.service.InvitationRecordService;
import com.epmet.modules.member.service.ResiGroupMemberService; import com.epmet.modules.member.service.ResiGroupMemberService;
import com.epmet.resi.group.dto.act.GroupActIdDTO; import com.epmet.resi.group.dto.act.GroupActIdDTO;
import com.epmet.resi.group.dto.act.GroupActInfoDTO; import com.epmet.resi.group.dto.act.GroupActInfoDTO;
import com.epmet.resi.group.dto.act.LineChartDTO;
import com.epmet.resi.group.dto.act.OrganizationalLifeLineChartDTO; import com.epmet.resi.group.dto.act.OrganizationalLifeLineChartDTO;
import com.epmet.resi.group.dto.act.form.*; import com.epmet.resi.group.dto.act.form.*;
import com.epmet.resi.group.dto.act.result.ActDetailByLinkResultDTO; import com.epmet.resi.group.dto.act.result.ActDetailByLinkResultDTO;
@ -886,7 +887,7 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl<GroupActInfoDao, Gr
* @author zxc * @author zxc
* @date 2021/9/3 2:57 下午 * @date 2021/9/3 2:57 下午
*/ */
@Override /*@Override
public OrganizationalLifeResultDTO organizationalLife(OrganizationalLifeFormDTO formDTO) { public OrganizationalLifeResultDTO organizationalLife(OrganizationalLifeFormDTO formDTO) {
OrganizationalLifeResultDTO result = new OrganizationalLifeResultDTO(); OrganizationalLifeResultDTO result = new OrganizationalLifeResultDTO();
if (StringUtils.isBlank(formDTO.getYearId())){ if (StringUtils.isBlank(formDTO.getYearId())){
@ -939,6 +940,47 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl<GroupActInfoDao, Gr
} }
result.setLineChart(lineChart); result.setLineChart(lineChart);
return result; return result;
}*/
@Override
public OrganizationalLifeResultDTO organizationalLife(OrganizationalLifeFormDTO formDTO) {
OrganizationalLifeResultDTO result = new OrganizationalLifeResultDTO();
if (StringUtils.isBlank(formDTO.getYearId())) {
formDTO.setYearId(String.valueOf(LocalDate.now().getYear()));
}
List<LineChartDTO> myActs = baseDao.selectMyCreateActTypeMonth(formDTO.getUserId(), formDTO.getYearId());
List<LineChartDTO> joinActs = baseDao.selectShouldJoinActTypeMonth(formDTO.getUserId(), formDTO.getYearId());
List<LineChartDTO> signInActs = baseDao.selectSignInTypeMonth(formDTO.getUserId(), formDTO.getYearId());
// 折线图组装
List<OrganizationalLifeLineChartDTO> lineChart = lineChart(formDTO.getYearId());
lineChart.forEach(l ->{
if (!CollectionUtils.isEmpty(myActs)){
myActs.forEach(m -> {
if (l.getMonth().equals(m.getMonth())){
l.setOrganizationalActCount(m.getValue());
}
});
}
if (!CollectionUtils.isEmpty(joinActs)){
joinActs.forEach(j -> {
if (l.getMonth().equals(j.getMonth())){
l.setShouldJoinActCount(j.getValue());
}
});
}
if (!CollectionUtils.isEmpty(signInActs)){
signInActs.forEach(s -> {
if (l.getMonth().equals(s.getMonth())){
l.setActSignCount(s.getValue());
}
});
}
});
result.setOrganizationalActCount(CollectionUtils.isEmpty(myActs) ? NumConstant.ZERO : myActs.stream().collect(Collectors.summingInt(LineChartDTO::getValue)));
result.setShouldJoinActCount(CollectionUtils.isEmpty(joinActs) ? NumConstant.ZERO : joinActs.stream().collect(Collectors.summingInt(LineChartDTO::getValue)));
result.setActSignCount(CollectionUtils.isEmpty(signInActs) ? NumConstant.ZERO : signInActs.stream().collect(Collectors.summingInt(LineChartDTO::getValue)));
result.setLineChart(lineChart);
return result;
} }
/** /**

43
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/GroupActInfoDao.xml

@ -64,4 +64,47 @@
AND DATE_FORMAT( CREATED_TIME, '%Y' ) = #{yearId} AND DATE_FORMAT( CREATED_TIME, '%Y' ) = #{yearId}
GROUP BY month GROUP BY month
</select> </select>
<!-- 查询我创建的活动 -->
<select id="selectMyCreateActTypeMonth" resultType="com.epmet.resi.group.dto.act.LineChartDTO">
SELECT
COUNT(ai.ID) AS value,
DATE_FORMAT(CREATED_TIME,'%Y-%m') AS month
FROM group_act_info ai
WHERE
ai.DEL_FLAG = '0'
AND ai.PUBLISH_USER_ID = #{userId}
AND DATE_FORMAT(CREATED_TIME,'%Y') = #{yearId}
GROUP BY month
</select>
<!-- 查询应参与的活动 -->
<select id="selectShouldJoinActTypeMonth" resultType="com.epmet.resi.group.dto.act.LineChartDTO">
SELECT
COUNT(DISTINCT GROUP_ACT_ID) AS value,
DATE_FORMAT(CREATED_TIME,'%Y-%m') AS month
FROM act_read_record
WHERE
DEL_FLAG = 0
AND SHOULD_BE_READ = 'yes'
AND USER_ID = #{userId}
AND DATE_FORMAT(CREATED_TIME,'%Y') = #{yearId}
GROUP BY month
</select>
<!-- 查询活动签到次数 -->
<select id="selectSignInTypeMonth" resultType="com.epmet.resi.group.dto.act.LineChartDTO">
SELECT
COUNT(ID) AS value,
DATE_FORMAT(CREATED_TIME,'%Y-%m') AS month
FROM act_sign_in_record
WHERE DEL_FLAG = '0'
AND GROUP_ACT_ID IN (SELECT DISTINCT GROUP_ACT_ID FROM act_read_record
WHERE DEL_FLAG = 0
AND SHOULD_BE_READ = 'yes'
AND USER_ID = #{userId}
AND DATE_FORMAT(CREATED_TIME,'%Y') = #{yearId}
)
GROUP BY month
</select>
</mapper> </mapper>
Loading…
Cancel
Save