jianjun 4 years ago
parent
commit
4583a0d6ac
  1. 29
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  2. 25
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/LineChartDTO.java
  3. 28
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/GroupActInfoDao.java
  4. 44
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java
  5. 43
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/GroupActInfoDao.xml

29
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java

@ -25,7 +25,6 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.CustomerAgencyConstant;
@ -1091,16 +1090,38 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
}
/**
* @param tokenDTO
* @Description 获取客户下组织树
* @Param tokenDTO
* @Param formDTO
* @Return {@link AgencyTreeResultDTO}
* @Author zhaoqifeng
* @Date 2021/9/8 15:21
*/
@Override
public AgencyTreeResultDTO getAgencyList(GetAgencyListFormDTO formDTO) {
return baseDao.getAllAgency(formDTO.getCustomerId());
AgencyTreeResultDTO agency = baseDao.getAllAgency(formDTO.getCustomerId());
if (CollectionUtils.isEmpty(agency.getSubAgencyList())) {
agency.setSubAgencyList(null);
} else {
setAgencyList(agency.getSubAgencyList());
}
return agency;
}
/**
* @Description 组织树最后一级没有数据的话设null
* @Param agencyList
* @Return
* @Author zhaoqifeng
* @Date 2021/9/18 14:33
*/
private void setAgencyList(List<AgencyTreeResultDTO> agencyList) {
for (AgencyTreeResultDTO dto : agencyList) {
if (CollectionUtils.isEmpty(dto.getSubAgencyList())) {
dto.setSubAgencyList(null);
} else {
setAgencyList(dto.getSubAgencyList());
}
}
}
}

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.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.form.OrganizationalLifeFormDTO;
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,
@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.resi.group.dto.act.GroupActIdDTO;
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.form.*;
import com.epmet.resi.group.dto.act.result.ActDetailByLinkResultDTO;
@ -886,7 +887,7 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl<GroupActInfoDao, Gr
* @author zxc
* @date 2021/9/3 2:57 下午
*/
@Override
/*@Override
public OrganizationalLifeResultDTO organizationalLife(OrganizationalLifeFormDTO formDTO) {
OrganizationalLifeResultDTO result = new OrganizationalLifeResultDTO();
if (StringUtils.isBlank(formDTO.getYearId())){
@ -939,6 +940,47 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl<GroupActInfoDao, Gr
}
result.setLineChart(lineChart);
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}
GROUP BY month
</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>
Loading…
Cancel
Save