党员活动接口

This commit is contained in:
517612449@qq.com
2022-06-22 17:37:05 +08:00
parent 527f87ae56
commit 4bc7401094
15 changed files with 308 additions and 38 deletions

View File

@ -2,18 +2,16 @@ package com.chinaunicom.mall.ebtp.extend.partyMemberEvent.controller;
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventMockData;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventStyle;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service.EventMockDataService;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service.EventStyleService;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.*;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@RestController
@Api(tags = "党员活动接口")
@ -24,6 +22,14 @@ public class PartyMemberEventController {
private EventMockDataService eventMockDataService;
@Resource
private EventStyleService eventStyleService;
@Resource
private EventPartyBranchService eventPartyBranchService;
@Resource
private EventSubjectService eventSubjectService;
@Resource
private EventContactService eventContactService;
@Resource
private EventContactSuggestionService eventContactSuggestionService;
@ApiOperation("右侧专业线数据")
@ -35,6 +41,69 @@ public class PartyMemberEventController {
@ApiOperation("活动风采轮播列表")
@GetMapping("/eventStyle/banner")
public BaseResponse<List<EventStyle>> getEventStyleBanner() {
return BaseResponse.success(eventStyleService.getEventStyleBanner());
return BaseResponse.success(eventStyleService.getEventStyle("banner"));
}
@ApiOperation("活动风采列表")
@GetMapping("/eventStyle/list")
public BaseResponse<List<EventStyle>> getEventStyleList() {
return BaseResponse.success(eventStyleService.getEventStyle("list"));
}
@ApiOperation("活动宣言")
@GetMapping("/eventDeclaration/list")
public BaseResponse<List<String>> getEventDeclarationList() {
return BaseResponse.success(eventPartyBranchService.getEventDeclarationList());
}
@ApiOperation("活动课题列表")
@GetMapping("/eventSubject/list")
public BaseResponse<List<EventSubject>> getEventSubjectList() {
return BaseResponse.success(eventSubjectService.getEventSubjectList());
}
@ApiOperation("活动联系人列表-按公司分组")
@GetMapping("/eventContact/group")
public BaseResponse<Map<String, List<EventContact>>> getEventContactGroup() {
return BaseResponse.success(eventContactService.getEventContactGroup());
}
@ApiOperation("活动联系人列表")
@GetMapping("/eventContact/list")
public BaseResponse<List<EventContact>> getEventContactList() {
return BaseResponse.success(eventContactService.getEventContactList());
}
@ApiOperation("我要提意见")
@PostMapping("/submitSuggestion")
public BaseResponse<Boolean> submitSuggestion(@ApiParam(value = "对象数据", required = true) @RequestBody EventContactSuggestion suggestion) {
return BaseResponse.success(eventContactSuggestionService.submitSuggestion(suggestion));
}
@ApiOperation("党员数量、党支部数量")
@GetMapping("/partyBranchMember/count")
public BaseResponse<Map<String,Integer>> getPartyBranchMemberCount() {
return BaseResponse.success(eventPartyBranchService.getPartyBranchMemberCount());
}
@ApiOperation("党支部列表")
@GetMapping("/partyBranch/list")
public BaseResponse<List<EventPartyBranch>> getPartyBranchList() {
return BaseResponse.success(eventPartyBranchService.getPartyBranchList());
}
@ApiOperation("党支部下党员列表")
@GetMapping("/partyMember/list")
public BaseResponse<List<EventPartyBranch>> getPartyMemberList(@RequestParam(value = "belongBranch") String belongBranch) {
return BaseResponse.success(eventPartyBranchService.getPartyMemberList(belongBranch));
}
@ApiOperation("党员列表模糊查询")
@GetMapping("/partyMember/paramQuery")
public BaseResponse<List<EventPartyBranch>> getPartyMemberListByParam(@RequestParam(value = "belongBranch") String belongBranch, @RequestParam(value = "param") String param) {
return BaseResponse.success(eventPartyBranchService.getPartyMemberListByParam(belongBranch, param));
}
}

View File

@ -11,8 +11,6 @@
<result column="milestone_target" jdbcType="VARCHAR" property="milestoneTarget"/>
<result column="sort" jdbcType="INTEGER" property="sort"/>
<result column="status" jdbcType="VARCHAR" property="status"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="send_time" jdbcType="TIMESTAMP" property="sendTime"/>
</resultMap>

View File

@ -155,4 +155,10 @@ public class EventPartyBranch implements Serializable {
private String status;
/**
* 党员数量
*/
@TableField(exist = false)
@ApiModelProperty(value = "党员数量")
private Integer count;
}

View File

@ -11,6 +11,7 @@ import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.List;
/**
* 实体类 EventSubject
@ -133,5 +134,24 @@ public class EventSubject implements Serializable {
@ApiModelProperty(value = "需要集团公司提供的供应链平台开发及运营支撑资源(若有)")
private String supportResources;
/**
* 团队牵头人信息
*/
@TableField(exist = false)
@ApiModelProperty(value = "团队牵头人信息")
private EventContact teamLeaderInfo;
/**
* 相关人员信息
*/
@TableField(exist = false)
@ApiModelProperty(value = "相关人员信息")
private List<EventContact> teamMenberInfo;
/**
* 项目推进计划及成果目标
*/
@TableField(exist = false)
@ApiModelProperty(value = "项目推进计划及成果目标")
private List<EventSubjectTime> subjectTimeList;
}

View File

@ -70,23 +70,6 @@ public class EventSubjectTime implements Serializable {
@ApiModelProperty(value = "页面显示状态 0-隐藏 1-显示")
private String status;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@TableField(typeHandler = CustomLocalDateTimeTypeHandler.class)
private java.time.LocalDateTime createTime;
/**
* 发布时间
*/
@ApiModelProperty(value = "发布时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@TableField(typeHandler = CustomLocalDateTimeTypeHandler.class)
private java.time.LocalDateTime sendTime;
}

View File

@ -3,6 +3,9 @@ package com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventContact;
import java.util.List;
import java.util.Map;
/**
* 对数据表 event_contact 操作的 service
* @author Auto create
@ -12,4 +15,8 @@ public interface EventContactService extends IService<EventContact>{
Map<String, List<EventContact>> getEventContactGroup();
List<EventContact> getEventContactList();
}

View File

@ -11,5 +11,6 @@ import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventContactSugg
public interface EventContactSuggestionService extends IService<EventContactSuggestion>{
Boolean submitSuggestion(EventContactSuggestion suggestion);
}

View File

@ -3,6 +3,9 @@ package com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventPartyBranch;
import java.util.List;
import java.util.Map;
/**
* 对数据表 event_party_branch 操作的 service
* @author Auto create
@ -11,5 +14,14 @@ import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventPartyBranch
public interface EventPartyBranchService extends IService<EventPartyBranch>{
List<String> getEventDeclarationList();
Map<String,Integer> getPartyBranchMemberCount();
List<EventPartyBranch> getPartyBranchList();
List<EventPartyBranch> getPartyMemberList(String belongBranch);
List<EventPartyBranch> getPartyMemberListByParam(String belongBranch, String param);
}

View File

@ -13,5 +13,5 @@ import java.util.List;
public interface EventStyleService extends IService<EventStyle>{
List<EventStyle> getEventStyleBanner();
List<EventStyle> getEventStyle(String type);
}

View File

@ -3,6 +3,8 @@ package com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventSubject;
import java.util.List;
/**
* 对数据表 event_subject 操作的 service
* @author Auto create
@ -11,5 +13,5 @@ import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventSubject;
public interface EventSubjectService extends IService<EventSubject>{
List<EventSubject> getEventSubjectList();
}

View File

@ -1,11 +1,18 @@
package com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.dao.EventContactMapper;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventContact;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service.EventContactService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 对数据表 event_contact 操作的 serviceImpl
* @author Auto create
@ -15,4 +22,19 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
public class EventContactServiceImpl extends ServiceImpl<EventContactMapper, EventContact> implements EventContactService {
@Override
public Map<String, List<EventContact>> getEventContactGroup() {
LambdaQueryWrapper<EventContact> query = Wrappers.lambdaQuery();
query.eq(EventContact::getStatus, "1");
return this.list(query).stream().collect(Collectors.groupingBy(EventContact::getContactUnit));
}
@Override
public List<EventContact> getEventContactList() {
LambdaQueryWrapper<EventContact> query = Wrappers.lambdaQuery();
query.eq(EventContact::getStatus, "1");
return this.list(query);
}
}

View File

@ -1,11 +1,18 @@
package com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service.impl;
import com.chinaunicom.mall.ebtp.common.base.entity.BaseCacheUser;
import com.chinaunicom.mall.ebtp.common.base.service.IBaseCacheUserService;
import com.chinaunicom.mall.ebtp.common.util.PropertyUtils;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.dao.EventContactSuggestionMapper;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventContactSuggestion;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service.EventContactSuggestionService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import javax.annotation.Resource;
import java.time.LocalDateTime;
/**
* 对数据表 event_contact_suggestion 操作的 serviceImpl
* @author Auto create
@ -14,5 +21,17 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service
public class EventContactSuggestionServiceImpl extends ServiceImpl<EventContactSuggestionMapper, EventContactSuggestion> implements EventContactSuggestionService {
@Resource
private IBaseCacheUserService iBaseCacheUserService;
@Override
public Boolean submitSuggestion(EventContactSuggestion suggestion) {
BaseCacheUser cacheUser = iBaseCacheUserService.getCacheUser();
suggestion.setId(PropertyUtils.getSnowflakeId());
suggestion.setSuggestionSponsor(cacheUser.getFullName());
suggestion.setSuggestionSponsorId(cacheUser.getUserId());
suggestion.setSuggestionSponsorUnit(cacheUser.getOrganizationId());
suggestion.setCreateTime(LocalDateTime.now());
return this.save(suggestion);
}
}

View File

@ -1,11 +1,17 @@
package com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.dao.EventPartyBranchMapper;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventPartyBranch;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service.EventPartyBranchService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.*;
import java.util.stream.Collectors;
/**
* 对数据表 event_party_branch 操作的 serviceImpl
* @author Auto create
@ -15,4 +21,70 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
public class EventPartyBranchServiceImpl extends ServiceImpl<EventPartyBranchMapper, EventPartyBranch> implements EventPartyBranchService {
@Override
public List<String> getEventDeclarationList() {
LambdaQueryWrapper<EventPartyBranch> query = Wrappers.lambdaQuery();
query.eq(EventPartyBranch::getType, "2").eq(EventPartyBranch::getStatus, "1").isNotNull(EventPartyBranch::getEventDeclaration);
List<EventPartyBranch> list = this.list();
if (list.isEmpty()) {
return new ArrayList<>();
}
List<String> returnList = new ArrayList<>();
list.forEach(f -> returnList.add(f.getContactName() + ":" + f.getEventDeclaration()));
return returnList;
}
@Override
public Map<String, Integer> getPartyBranchMemberCount() {
Map<String, Integer> map = new HashMap<>(2);
LambdaQueryWrapper<EventPartyBranch> queryBranch = Wrappers.lambdaQuery();
queryBranch.eq(EventPartyBranch::getType, "1").eq(EventPartyBranch::getStatus, "1");
int branchCount = this.count(queryBranch);
LambdaQueryWrapper<EventPartyBranch> queryMember = Wrappers.lambdaQuery();
queryMember.eq(EventPartyBranch::getType, "2").eq(EventPartyBranch::getStatus, "1");
int memberCount = this.count(queryMember);
map.put("branch", branchCount);
map.put("member", memberCount);
return map;
}
@Override
public List<EventPartyBranch> getPartyBranchList() {
LambdaQueryWrapper<EventPartyBranch> queryBranch = Wrappers.lambdaQuery();
queryBranch.eq(EventPartyBranch::getType, "1").eq(EventPartyBranch::getStatus, "1");
List<EventPartyBranch> list = this.list(queryBranch);
LambdaQueryWrapper<EventPartyBranch> queryMember = Wrappers.lambdaQuery();
queryMember.eq(EventPartyBranch::getType, "2").eq(EventPartyBranch::getStatus, "1");
List<EventPartyBranch> memberList = this.list(queryMember);
Map<String, List<EventPartyBranch>> listMap = memberList.stream().collect(Collectors.groupingBy(EventPartyBranch::getBelongBranch));
list.forEach(f -> f.setCount(listMap.get(f.getBelongBranch()).size()));
return list.stream().sorted(Comparator.comparing(EventPartyBranch::getCount).reversed()).collect(Collectors.toList());
}
@Override
public List<EventPartyBranch> getPartyMemberList(String belongBranch) {
LambdaQueryWrapper<EventPartyBranch> queryMember = Wrappers.lambdaQuery();
queryMember.eq(EventPartyBranch::getType, "2").eq(EventPartyBranch::getStatus, "1").eq(EventPartyBranch::getBelongBranch, belongBranch);
return this.list(queryMember);
}
@Override
public List<EventPartyBranch> getPartyMemberListByParam(String belongBranch, String param) {
LambdaQueryWrapper<EventPartyBranch> queryMember = Wrappers.lambdaQuery();
queryMember.eq(EventPartyBranch::getType, "2")
.eq(EventPartyBranch::getStatus, "1")
.eq(EventPartyBranch::getBelongBranch, belongBranch)
.like(EventPartyBranch::getContactName,param)
.like(EventPartyBranch::getContactMobiphone,param)
.like(EventPartyBranch::getContactEmail,param);
return this.list(queryMember);
}
}

View File

@ -22,9 +22,14 @@ public class EventStyleServiceImpl extends ServiceImpl<EventStyleMapper, EventSt
@Override
public List<EventStyle> getEventStyleBanner() {
public List<EventStyle> getEventStyle(String type) {
LambdaQueryWrapper<EventStyle> query = Wrappers.lambdaQuery();
if ("banner".equals(type)) {
query.eq(EventStyle::getBanner, "1").eq(EventStyle::getStatus, "1").orderByAsc(EventStyle::getSort);
return this.list(query);
} else {
query.eq(EventStyle::getBanner, "0").eq(EventStyle::getStatus, "1").orderByAsc(EventStyle::getSort);
return this.list(query);
}
}
}

View File

@ -1,11 +1,26 @@
package com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service.impl;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.dao.EventSubjectMapper;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventSubject;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service.EventSubjectService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.dao.EventSubjectMapper;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventContact;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventSubject;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventSubjectTime;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service.EventContactService;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service.EventSubjectService;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service.EventSubjectTimeService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* 对数据表 event_subject 操作的 serviceImpl
* @author Auto create
@ -14,5 +29,44 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service
public class EventSubjectServiceImpl extends ServiceImpl<EventSubjectMapper, EventSubject> implements EventSubjectService {
@Resource
private EventSubjectTimeService eventSubjectTimeService;
@Resource
private EventContactService contactService;
@Override
public List<EventSubject> getEventSubjectList() {
LambdaQueryWrapper<EventSubject> query = Wrappers.lambdaQuery();
query.eq(EventSubject::getStatus, "1");
List<EventSubject> list = this.list(query);
List<String> subjectIdList = list.stream().map(EventSubject::getId).collect(Collectors.toList());
List<String> teamLeaderIdList = list.stream().map(EventSubject::getTeamLeader).distinct().collect(Collectors.toList());
List<String> teamMemberIdList = new ArrayList<>();
list.forEach(f -> teamMemberIdList.addAll(Stream.of(f.getTeamMenber().split(",")).collect(Collectors.toList())));
LambdaQueryWrapper<EventSubjectTime> querySubjectTime = Wrappers.lambdaQuery();
querySubjectTime.eq(EventSubjectTime::getStatus, "1").in(EventSubjectTime::getSubjectId, subjectIdList);
List<EventSubjectTime> subjectTimeList = eventSubjectTimeService.list(querySubjectTime);
Map<String, List<EventSubjectTime>> timeMap = subjectTimeList.stream().collect(Collectors.groupingBy(EventSubjectTime::getSubjectId));
List<EventContact> eventContacts = contactService.listByIds(teamLeaderIdList);
Map<String, EventContact> leaderMap = eventContacts.stream().collect(Collectors.toMap(EventContact::getId, Function.identity()));
LambdaQueryWrapper<EventContact> contactLambdaQuery = new LambdaQueryWrapper<>();
contactLambdaQuery.eq(EventContact::getStatus, "1").in(EventContact::getId, teamMemberIdList.stream().distinct().collect(Collectors.toList()));
List<EventContact> eventContactList = contactService.list(contactLambdaQuery);
Map<String, EventContact> eventContactMap = eventContactList.stream().collect(Collectors.toMap(EventContact::getId, Function.identity()));
list.forEach(f -> {
List<EventContact> contactList = new ArrayList<>();
List<String> collect = Stream.of(f.getTeamMenber().split(",")).collect(Collectors.toList());
collect.forEach(c -> contactList.add(eventContactMap.get(c)));
f.setTeamMenberInfo(contactList);
f.setSubjectTimeList(timeMap.get(f.getId()));
f.setTeamLeaderInfo(leaderMap.get(f.getTeamLeader()));
});
return list;
}
}