New file |
| | |
| | | package com.panzhihua.applets.api; |
| | | |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.model.dtos.community.cluster.PageClusterMemberDto; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.cluster.PageClusterMemberVo; |
| | | import com.panzhihua.common.model.vos.community.cluster.PageClusterVo; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * title: 群团组织接口类 |
| | | * projectName 成都呐喊信息技术有限公司-智慧社区项目 |
| | | * description: 群团组织接口类 |
| | | * |
| | | * @author lyq |
| | | * @date 2021/9/23 16:12 |
| | | */ |
| | | @Slf4j |
| | | @Api(tags = {"群团组织"}) |
| | | @RestController |
| | | @RequestMapping("/cluster/") |
| | | public class ClusterApi extends BaseController { |
| | | |
| | | @Resource |
| | | private CommunityService communityService; |
| | | |
| | | @ApiOperation(value = "群团组织成员分页查询",response = PageClusterMemberVo.class) |
| | | @PostMapping("/member/page") |
| | | public R pageMemberClusterApplets(@RequestBody PageClusterMemberDto pageClusterMemberDto) { |
| | | pageClusterMemberDto.setCommunityId(this.getCommunityId()); |
| | | return communityService.pageClusterMemberApplets(pageClusterMemberDto); |
| | | } |
| | | |
| | | @ApiOperation(value = "群团组织列表",response = PageClusterVo.class) |
| | | @GetMapping("list") |
| | | public R listClusterApplets() { |
| | | return communityService.listClusterApplets(this.getCommunityId()); |
| | | } |
| | | } |
| | |
| | | |
| | | public static final String PENSION_RECORD_ERROR_LIST = "PENSION_RECORD_ERROR_LIST_"; |
| | | |
| | | public static final String CLUSTER_MEMBER_ERROR_LIST = "CLUSTER_MEMBER_ERROR_LIST_"; |
| | | |
| | | public static final String CLUSTER_MEMBER_DEFAULT_IMAGE_URL = "https://www.psciio.com/files/4822602b68af48bcbbea7842aa463227/a6a7882b3fd24d60ac6809fef42d879d.png"; |
| | | |
| | | /** |
| | | * 高德地图获取天气url |
| | | */ |
| | |
| | | * 常量 |
| | | */ |
| | | public static final Integer ONE_HUNDRED = 100; |
| | | /** |
| | | * 字典表民族系统配置码key |
| | | */ |
| | | public static final String NATION_DICT_KEY = "nation"; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.listen; |
| | | |
| | | import com.alibaba.excel.context.AnalysisContext; |
| | | import com.alibaba.excel.event.AnalysisEventListener; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.google.common.collect.Lists; |
| | | import com.panzhihua.common.constants.Constants; |
| | | import com.panzhihua.common.exceptions.ServiceException; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.cluster.admin.ComClusterMemberExcelErrorVO; |
| | | import com.panzhihua.common.model.vos.community.cluster.admin.ComClusterMemberExcelVO; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | import com.panzhihua.common.utlis.ListUtils; |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | | import org.springframework.data.redis.core.ValueOperations; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * title: 群团组织成员导入监听 |
| | | * @author : lyq |
| | | */ |
| | | @Slf4j |
| | | public class ComClusterMemberExcelListen extends AnalysisEventListener<Map<Integer, String>> { |
| | | /** |
| | | * 每隔5条存储数据库,实际使用中可以3000条,然后清理list ,方便内存回收 |
| | | */ |
| | | private static final int BATCH_COUNT = 3000; |
| | | private static int headSize = 0; |
| | | List<Map<Integer, String>> list = new ArrayList<Map<Integer, String>>(); |
| | | private CommunityService communityService; |
| | | private Long communityId; |
| | | private Long userId; |
| | | private Map<Integer, String> headData; |
| | | private StringRedisTemplate stringRedisTemplate; |
| | | |
| | | public ComClusterMemberExcelListen(CommunityService communityService, Long communityId, Long userId, |
| | | StringRedisTemplate stringRedisTemplate) { |
| | | this.communityService = communityService; |
| | | this.communityId = communityId; |
| | | this.userId = userId; |
| | | this.stringRedisTemplate = stringRedisTemplate; |
| | | } |
| | | |
| | | @Override |
| | | public void invoke(Map<Integer, String> data, AnalysisContext context) { |
| | | list.add(data); |
| | | if (list.size() >= BATCH_COUNT) { |
| | | saveData(); |
| | | list.clear(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 这里会一行行的返回头 |
| | | * |
| | | * @param headMap |
| | | * @param context |
| | | */ |
| | | @Override |
| | | public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) { |
| | | headSize = headMap.size(); |
| | | headData = headMap; |
| | | } |
| | | |
| | | @Override |
| | | public void doAfterAllAnalysed(AnalysisContext context) { |
| | | saveData(); |
| | | log.info("所有数据解析完成!"); |
| | | } |
| | | |
| | | /** |
| | | * 不是固定的列只能手动处理 |
| | | */ |
| | | private void saveData() { |
| | | log.info("表格总数据:" + list.size()); |
| | | if (list.size() == 0) { |
| | | throw new ServiceException("000", "导入数据为空!"); |
| | | } |
| | | ValueOperations<String, String> valueOperations = stringRedisTemplate.opsForValue(); |
| | | String key = Constants.CLUSTER_MEMBER_ERROR_LIST + communityId; |
| | | int index = 2; |
| | | try { |
| | | ArrayList<ComClusterMemberExcelVO> voList = Lists.newArrayList(); |
| | | ArrayList<ComClusterMemberExcelErrorVO> mistakes = Lists.newArrayList(); |
| | | for (Map<Integer, String> oneData : list) { |
| | | ComClusterMemberExcelVO vo = new ComClusterMemberExcelVO(); |
| | | |
| | | if (StringUtils.isEmpty(oneData.get(0))) { |
| | | index++; |
| | | mistakes.add(setErrorObject(oneData,"名字不可为空,请填写姓名")); |
| | | continue; |
| | | } |
| | | vo.setName(oneData.get(0)); |
| | | if (StringUtils.isEmpty(oneData.get(1))) { |
| | | index++; |
| | | mistakes.add(setErrorObject(oneData,"组织不可为空,请填写组织名称")); |
| | | continue; |
| | | } |
| | | vo.setClusterName(oneData.get(1)); |
| | | if (StringUtils.isEmpty(oneData.get(2))) { |
| | | index++; |
| | | mistakes.add(setErrorObject(oneData,"职务不可为空,请填写职务")); |
| | | continue; |
| | | } |
| | | vo.setJob(oneData.get(2)); |
| | | if (StringUtils.isEmpty(oneData.get(3))) { |
| | | index++; |
| | | mistakes.add(setErrorObject(oneData,"联系电话不可为空,请填写联系电话")); |
| | | continue; |
| | | } |
| | | vo.setPhone(oneData.get(3)); |
| | | if (StringUtils.isEmpty(oneData.get(4))) { |
| | | index++; |
| | | mistakes.add(setErrorObject(oneData,"民族不可为空,请填写民族")); |
| | | continue; |
| | | }else{ |
| | | if(!oneData.get(4).contains("族")){ |
| | | index++; |
| | | mistakes.add(setErrorObject(oneData,"填写的民族有误,请重新填写(民族格式:X族 如:汉族)")); |
| | | continue; |
| | | } |
| | | } |
| | | vo.setNation(oneData.get(4)); |
| | | if (StringUtils.isEmpty(oneData.get(5))) { |
| | | index++; |
| | | mistakes.add(setErrorObject(oneData,"住址不可为空,请填写住址")); |
| | | continue; |
| | | } |
| | | vo.setAddress(oneData.get(5)); |
| | | if (StringUtils.isEmpty(oneData.get(6))) { |
| | | index++; |
| | | mistakes.add(setErrorObject(oneData,"身份证号不可为空,请填写身份证号码")); |
| | | continue; |
| | | } |
| | | // 判断身份证号码位数 |
| | | if (oneData.get(6).length() != 18) { |
| | | index++; |
| | | mistakes.add(setErrorObject(oneData,"身份证号位数有误,请检查身份证号码是否正确")); |
| | | continue; |
| | | } |
| | | vo.setIdCard(oneData.get(1).toUpperCase()); |
| | | voList.add(vo); |
| | | index++; |
| | | } |
| | | List<ComClusterMemberExcelVO> newVoList = |
| | | voList.stream().filter(ListUtils.distinctByKey(ComClusterMemberExcelVO::getIdCard)) |
| | | .collect(Collectors.toList()); |
| | | R r = communityService.importClusterMember(newVoList, communityId, userId); |
| | | if (!R.isOk(r)) { |
| | | List<ComClusterMemberExcelErrorVO> list = |
| | | JSONArray.parseArray(JSONArray.toJSONString(r.getData()), ComClusterMemberExcelErrorVO.class); |
| | | mistakes.addAll(list); |
| | | valueOperations.set(key, JSONArray.toJSONString(mistakes), 1, TimeUnit.HOURS); |
| | | throw new ServiceException("500", key); |
| | | } else { |
| | | if (!mistakes.isEmpty()) { |
| | | valueOperations.set(key, JSONArray.toJSONString(mistakes), 1, TimeUnit.HOURS); |
| | | throw new ServiceException("500", key); |
| | | } |
| | | } |
| | | } catch (NumberFormatException e) { |
| | | e.printStackTrace(); |
| | | throw new ServiceException("500", "导入失败"); |
| | | } |
| | | } |
| | | |
| | | private void setError(Map<Integer, String> map, ComClusterMemberExcelErrorVO vo) { |
| | | vo.setName(map.get(0)); |
| | | vo.setClusterName(map.get(1)); |
| | | vo.setJob(map.get(2)); |
| | | vo.setPhone(map.get(3)); |
| | | vo.setNation(map.get(4)); |
| | | vo.setAddress(map.get(5)); |
| | | vo.setIdCard(map.get(6)); |
| | | } |
| | | |
| | | /** |
| | | * 组装错误信息 |
| | | * @param oneData 数据表格对象 |
| | | * @param error 错误信息 |
| | | * @return 错误对象 |
| | | */ |
| | | private ComClusterMemberExcelErrorVO setErrorObject(Map<Integer, String> oneData, String error){ |
| | | ComClusterMemberExcelErrorVO mistake = new ComClusterMemberExcelErrorVO(); |
| | | setError(oneData, mistake); |
| | | mistake.setError(error); |
| | | return mistake; |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.dtos.community.cluster; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author lyq |
| | | * 分页查询群团组织成员列表请求参数 |
| | | */ |
| | | @Data |
| | | @ApiModel("分页查询群团组织成员列表请求参数") |
| | | public class PageClusterMemberDto { |
| | | |
| | | @ApiModelProperty(value = "社区id",hidden = true) |
| | | private Long communityId; |
| | | |
| | | @ApiModelProperty(value = "分页-当前页数",example = "1") |
| | | private Long pageNum = 1L; |
| | | |
| | | @ApiModelProperty(value = "分页-每页记录数",example = "10") |
| | | private Long pageSize = 10L; |
| | | |
| | | @ApiModelProperty(value = "关键词") |
| | | private String keyWord; |
| | | |
| | | @ApiModelProperty(value = "群团组织id") |
| | | private Long clusterId; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.dtos.community.cluster.admin; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author lyq |
| | | * 分页查询群团组织成员列表请求参数 |
| | | */ |
| | | @Data |
| | | @ApiModel("分页查询群团组织列表请求参数") |
| | | public class AddClusterAdminDto { |
| | | |
| | | @ApiModelProperty(value = "社区id",hidden = true) |
| | | private Long communityId; |
| | | |
| | | @ApiModelProperty(value = "组织名") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "组织电话") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "组织地址") |
| | | private String address; |
| | | |
| | | @ApiModelProperty(value = "状态(1.启用 2.禁用)") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "组织logo") |
| | | private String logo; |
| | | |
| | | @ApiModelProperty(value = "经度") |
| | | private String lng; |
| | | |
| | | @ApiModelProperty(value = "纬度") |
| | | private String lat; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.dtos.community.cluster.admin; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author lyq |
| | | * 分页查询群团组织成员列表请求参数 |
| | | */ |
| | | @Data |
| | | @ApiModel("分页查询群团组织列表请求参数") |
| | | public class AddClusterMemberAdminDto { |
| | | |
| | | @ApiModelProperty(value = "社区id",hidden = true) |
| | | private Long communityId; |
| | | |
| | | @ApiModelProperty("群团组织成员名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("群团组织成员照片") |
| | | private String imageUrl; |
| | | |
| | | @ApiModelProperty("群团组织成员职务") |
| | | private String job; |
| | | |
| | | @ApiModelProperty("群团组织成员电话") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty("群团组织成员住址") |
| | | private String address; |
| | | |
| | | @ApiModelProperty("群团组织成员身份证号码") |
| | | private String idCard; |
| | | |
| | | @ApiModelProperty("所属群团组织id") |
| | | private Long clusterId; |
| | | |
| | | @ApiModelProperty("状态(1.启用 2禁用)") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("民族code") |
| | | private String nationCode; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.dtos.community.cluster.admin; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author lyq |
| | | * 分页查询群团组织成员列表请求参数 |
| | | */ |
| | | @Data |
| | | @ApiModel("分页查询群团组织列表请求参数") |
| | | public class EditClusterAdminDto { |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "组织名") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "组织电话") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "组织地址") |
| | | private String address; |
| | | |
| | | @ApiModelProperty(value = "状态(1.启用 2.禁用)") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "组织logo") |
| | | private String logo; |
| | | |
| | | @ApiModelProperty(value = "社区id",hidden = true) |
| | | private Long communityId; |
| | | |
| | | @ApiModelProperty(value = "经度") |
| | | private String lng; |
| | | |
| | | @ApiModelProperty(value = "纬度") |
| | | private String lat; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.dtos.community.cluster.admin; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author lyq |
| | | * 分页查询群团组织成员列表请求参数 |
| | | */ |
| | | @Data |
| | | @ApiModel("分页查询群团组织列表请求参数") |
| | | public class EditClusterMemberAdminDto { |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "社区id",hidden = true) |
| | | private Long communityId; |
| | | |
| | | @ApiModelProperty("群团组织成员名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("群团组织成员照片") |
| | | private String imageUrl; |
| | | |
| | | @ApiModelProperty("群团组织成员职务") |
| | | private String job; |
| | | |
| | | @ApiModelProperty("群团组织成员电话") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty("群团组织成员住址") |
| | | private String address; |
| | | |
| | | @ApiModelProperty("群团组织成员身份证号码") |
| | | private String idCard; |
| | | |
| | | @ApiModelProperty("所属群团组织id") |
| | | private Long clusterId; |
| | | |
| | | @ApiModelProperty("状态(1.启用 2禁用)") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("民族code") |
| | | private String nationCode; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.dtos.community.cluster.admin; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author lyq |
| | | * 分页查询群团组织成员列表请求参数 |
| | | */ |
| | | @Data |
| | | @ApiModel("分页查询群团组织列表请求参数") |
| | | public class PageClusterAdminDto { |
| | | |
| | | @ApiModelProperty(value = "社区id",hidden = true) |
| | | private Long communityId; |
| | | |
| | | @ApiModelProperty(value = "分页-当前页数",example = "1") |
| | | private Long pageNum = 1L; |
| | | |
| | | @ApiModelProperty(value = "分页-每页记录数",example = "10") |
| | | private Long pageSize = 10L; |
| | | |
| | | @ApiModelProperty(value = "关键词") |
| | | private String keyWord; |
| | | |
| | | @ApiModelProperty(value = "状态(1.启用 2.禁用)") |
| | | private Integer status; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.dtos.community.cluster.admin; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author lyq |
| | | * 分页查询群团组织成员列表请求参数 |
| | | */ |
| | | @Data |
| | | @ApiModel("分页查询群团组织成员列表请求参数") |
| | | public class PageClusterMemberAdminDto { |
| | | |
| | | @ApiModelProperty(value = "社区id",hidden = true) |
| | | private Long communityId; |
| | | |
| | | @ApiModelProperty(value = "分页-当前页数",example = "1") |
| | | private Long pageNum = 1L; |
| | | |
| | | @ApiModelProperty(value = "分页-每页记录数",example = "10") |
| | | private Long pageSize = 10L; |
| | | |
| | | @ApiModelProperty(value = "关键词") |
| | | private String keyWord; |
| | | |
| | | @ApiModelProperty(value = "状态(1.启用 2.禁用)") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "群团组织id") |
| | | private Long clusterId; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community.cluster; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author lyq |
| | | * 分页查询群团组织成员返回参数 |
| | | */ |
| | | @Data |
| | | @ApiModel("分页查询群团组织成员返回参数") |
| | | public class PageClusterMemberVo { |
| | | |
| | | @ApiModelProperty("主键id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("群团组织成员名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("群团组织成员照片") |
| | | private String imageUrl; |
| | | |
| | | @ApiModelProperty("群团组织成员职务") |
| | | private String job; |
| | | |
| | | @ApiModelProperty("群团组织成员电话") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty("群团组织成员住址") |
| | | private String address; |
| | | |
| | | @ApiModelProperty("群团组织成员身份证号码") |
| | | private String idCard; |
| | | |
| | | @ApiModelProperty("所属群团组织id") |
| | | private Long clusterId; |
| | | |
| | | @ApiModelProperty("所属群团组织名称") |
| | | private String clusterName; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community.cluster; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author lyq |
| | | * 分页查询群团组织成员返回参数 |
| | | */ |
| | | @Data |
| | | @ApiModel("分页查询群团组织成员返回参数") |
| | | public class PageClusterVo { |
| | | |
| | | @ApiModelProperty("主键id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("群团组织成员名称") |
| | | private String name; |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community.cluster.admin; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author lyq |
| | | * 群团组织详情返回参数 |
| | | */ |
| | | @Data |
| | | @ApiModel("群团组织详情返回参数") |
| | | public class ClusterDetailAdminVo { |
| | | |
| | | @ApiModelProperty("主键id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("群团组织成员名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("群团组织成员logo") |
| | | private String logo; |
| | | |
| | | @ApiModelProperty("群团组织成员电话") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty("群团组织成员地址") |
| | | private String address; |
| | | |
| | | @ApiModelProperty("状态(1.启用 2.禁用)") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("经度") |
| | | private String lng; |
| | | |
| | | @ApiModelProperty("维度") |
| | | private String lat; |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community.cluster.admin; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author lyq |
| | | * 查询系统民族列表返回参数 |
| | | */ |
| | | @Data |
| | | @ApiModel("查询系统民族列表返回参数") |
| | | public class ClusterMemberNationVo { |
| | | |
| | | @ApiModelProperty("民族code") |
| | | private String nationCode; |
| | | |
| | | @ApiModelProperty("民族名称") |
| | | private String nationName; |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community.cluster.admin; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @description: 批量导入群团组织成员 |
| | | * @author : lyq |
| | | */ |
| | | @Data |
| | | public class ComClusterMemberExcelErrorVO implements Serializable { |
| | | |
| | | @ExcelProperty(value = "姓名", index = 0) |
| | | private String name; |
| | | |
| | | @ExcelProperty(value = "组织名称", index = 1) |
| | | private String clusterName; |
| | | |
| | | @ExcelProperty(value = "职务", index = 2) |
| | | private String job; |
| | | |
| | | @ExcelProperty(value = "联系电话", index = 3) |
| | | private String phone; |
| | | |
| | | @ExcelProperty(value = "民族", index = 4) |
| | | private String nation; |
| | | |
| | | @ExcelProperty(value = "住址", index = 5) |
| | | private String address; |
| | | |
| | | @ExcelProperty(value = "身份证号码", index = 6) |
| | | private String idCard; |
| | | |
| | | @ExcelProperty(value = "错误信息", index = 7) |
| | | private String error; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community.cluster.admin; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author lyq |
| | | * title 群团组织导出对象 |
| | | */ |
| | | @Data |
| | | public class ComClusterMemberExcelExportAdminVO { |
| | | |
| | | @ExcelProperty(value = "姓名" ,index = 0) |
| | | private String name; |
| | | @ExcelProperty(value = "所属组织" ,index = 1) |
| | | private String clusterName; |
| | | @ExcelProperty(value = "职务" ,index = 2) |
| | | private String job; |
| | | @ExcelProperty(value = "联系电话" ,index = 3) |
| | | private String phone; |
| | | @ExcelProperty(value = "状态" ,index = 4) |
| | | private String status; |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community.cluster.admin; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @description: 批量导入群团组织成员 |
| | | * @author : lyq |
| | | */ |
| | | @Data |
| | | public class ComClusterMemberExcelVO implements Serializable { |
| | | |
| | | @ExcelProperty(value = "姓名", index = 0) |
| | | private String name; |
| | | |
| | | @ExcelProperty(value = "组织名称", index = 1) |
| | | private String clusterName; |
| | | |
| | | @ExcelProperty(value = "职务", index = 2) |
| | | private String job; |
| | | |
| | | @ExcelProperty(value = "联系电话", index = 3) |
| | | private String phone; |
| | | |
| | | @ExcelProperty(value = "民族", index = 4) |
| | | private String nation; |
| | | |
| | | @ExcelProperty(value = "住址", index = 5) |
| | | private String address; |
| | | |
| | | @ExcelProperty(value = "身份证号码", index = 6) |
| | | private String idCard; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community.cluster.admin; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author lyq |
| | | * 分页查询群团组织成员返回参数 |
| | | */ |
| | | @Data |
| | | @ApiModel("分页查询群团组织返回参数") |
| | | public class PageClusterAdminVo { |
| | | |
| | | @ApiModelProperty("主键id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("群团组织名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("群团组织logo") |
| | | private String logo; |
| | | |
| | | @ApiModelProperty("群团组织电话") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty("群团组织地址") |
| | | private String address; |
| | | |
| | | @ApiModelProperty("状态(1.启用 2.禁用)") |
| | | private Integer status; |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community.cluster.admin; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author lyq |
| | | * 分页查询群团组织成员返回参数 |
| | | */ |
| | | @Data |
| | | @ApiModel("分页查询群团组织成员返回参数") |
| | | public class PageClusterMemberAdminVo { |
| | | |
| | | @ApiModelProperty("主键id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("群团组织成员名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("群团组织成员照片") |
| | | private String imageUrl; |
| | | |
| | | @ApiModelProperty("群团组织成员职务") |
| | | private String job; |
| | | |
| | | @ApiModelProperty("群团组织成员电话") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty("群团组织成员住址") |
| | | private String address; |
| | | |
| | | @ApiModelProperty("群团组织成员身份证号码") |
| | | private String idCard; |
| | | |
| | | @ApiModelProperty("所属群团组织id") |
| | | private Long clusterId; |
| | | |
| | | @ApiModelProperty("所属群团组织名称") |
| | | private String clusterName; |
| | | |
| | | @ApiModelProperty("状态(1.启用 2禁用)") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("民族code") |
| | | private String nationCode; |
| | | |
| | | } |
| | |
| | | |
| | | import com.panzhihua.common.model.dtos.community.GetIdentityEidTokenDTO; |
| | | import com.panzhihua.common.model.dtos.community.*; |
| | | import com.panzhihua.common.model.dtos.community.cluster.PageClusterMemberDto; |
| | | import com.panzhihua.common.model.dtos.community.cluster.admin.*; |
| | | import com.panzhihua.common.model.dtos.property.CommonPage; |
| | | import com.panzhihua.common.model.dtos.community.discuss.ComActDiscussDetailDTO; |
| | | import com.panzhihua.common.model.dtos.community.discuss.ComActDiscussPublishResultDTO; |
| | |
| | | import com.panzhihua.common.model.dtos.community.elder.SignElderAuthStatisticDTO; |
| | | import com.panzhihua.common.model.dtos.neighbor.*; |
| | | import com.panzhihua.common.model.vos.community.*; |
| | | import com.panzhihua.common.model.vos.community.cluster.admin.ComClusterMemberExcelVO; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | |
| | | */ |
| | | @GetMapping("/comProperty/del") |
| | | R comPropertyDelete(@RequestParam("id") Long id); |
| | | |
| | | /** |
| | | * 群团组织成员列表-小程序分页查询 |
| | | * @param pageClusterMemberDto 请求参数 |
| | | * @return 群团组织成员列表 |
| | | */ |
| | | @PostMapping("/cluster/member/page/applets") |
| | | R pageClusterMemberApplets(@RequestBody PageClusterMemberDto pageClusterMemberDto); |
| | | |
| | | /** |
| | | * 群团组织列表-小程序查询社区群团组织列表 |
| | | * @param communityId 社区id |
| | | * @return 社区群团组织列表 |
| | | */ |
| | | @GetMapping("/cluster/list/applets") |
| | | R listClusterApplets(@RequestParam("communityId") Long communityId); |
| | | |
| | | /** |
| | | * 分页查询群团组织列表 |
| | | * @param pageClusterAdminDto 请求参数 |
| | | * @return 群团组织列表 |
| | | */ |
| | | @PostMapping("/cluster/page/admin") |
| | | R pageClusterAdmin(@RequestBody PageClusterAdminDto pageClusterAdminDto); |
| | | |
| | | /** |
| | | * 新增群团组织 |
| | | * @param addClusterAdminDto 请求参数 |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping("/cluster/add/admin") |
| | | R addClusterAdmin(@RequestBody AddClusterAdminDto addClusterAdminDto); |
| | | |
| | | /** |
| | | * 修改群团组织 |
| | | * @param editClusterAdminDto 请求参数 |
| | | * @return 修改结果 |
| | | */ |
| | | @PostMapping("/cluster/edit/admin") |
| | | R editClusterAdmin(@RequestBody EditClusterAdminDto editClusterAdminDto); |
| | | |
| | | /** |
| | | * 删除群团组织 |
| | | * @param id 组织id |
| | | * @return 删除结果 |
| | | */ |
| | | @GetMapping("/cluster/delete/admin") |
| | | R deleteClusterAdmin(@RequestParam("id") Long id); |
| | | |
| | | /** |
| | | * 群团组织详情 |
| | | * @param id 组织id |
| | | * @return 群团组织详情 |
| | | */ |
| | | @GetMapping("/cluster/detail/admin") |
| | | R detailClusterAdmin(@RequestParam("id") Long id); |
| | | |
| | | /** |
| | | * 分页查询群团组织成员列表 |
| | | * @param pageClusterMemberAdminDto 请求参数 |
| | | * @return 群团组织成员列表 |
| | | */ |
| | | @PostMapping("/cluster/member/page/admin") |
| | | R pageClusterMemberAdmin(@RequestBody PageClusterMemberAdminDto pageClusterMemberAdminDto); |
| | | |
| | | /** |
| | | * 新增群团组织成员 |
| | | * @param addClusterMemberAdminDto 请求参数 |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping("/cluster/member/add/admin") |
| | | R addClusterMemberAdmin(@RequestBody AddClusterMemberAdminDto addClusterMemberAdminDto); |
| | | |
| | | /** |
| | | * 编辑群团组织成员 |
| | | * @param editClusterMemberAdminDto 请求参数 |
| | | * @return 编辑结果 |
| | | */ |
| | | @PostMapping("/cluster/member/edit/admin") |
| | | R editClusterMemberAdmin(@RequestBody EditClusterMemberAdminDto editClusterMemberAdminDto); |
| | | |
| | | /** |
| | | * 删除群团组织成员 |
| | | * @param id 组织成员id |
| | | * @return 删除结果 |
| | | */ |
| | | @GetMapping("/cluster/member/delete/admin") |
| | | R deleteClusterMemberAdmin(@RequestParam("id") Long id); |
| | | |
| | | /** |
| | | * 群团组织成员详情 |
| | | * @param id 组织成员id |
| | | * @return 群团组织成员详情 |
| | | */ |
| | | @GetMapping("/cluster/member/detail/admin") |
| | | R detailClusterMemberAdmin(@RequestParam("id") Long id); |
| | | |
| | | /** |
| | | * 查询系统民族列表 |
| | | * @return 民族列表 |
| | | */ |
| | | @GetMapping("/cluster/member/nation/list/admin") |
| | | R memberNationListAdmin(); |
| | | |
| | | /** |
| | | * 群团组织成员导入 |
| | | * @param list 导入数据 |
| | | * @param communityId 社区id |
| | | * @param userId 操作用户id |
| | | * @return 导入结果 |
| | | */ |
| | | @PostMapping("/cluster/member/import/admin") |
| | | R importClusterMember(@RequestBody List<ComClusterMemberExcelVO> list, |
| | | @RequestParam(value = "communityId") Long communityId, @RequestParam(value = "userId") Long userId); |
| | | |
| | | /** |
| | | * 群团组织导出数据查询 |
| | | * @param pageClusterMemberAdminDto 请求参数 |
| | | * @return 导出数据结果集 |
| | | */ |
| | | @PostMapping("/cluster/member/export/admin") |
| | | R exportClusterMember(@RequestBody PageClusterMemberAdminDto pageClusterMemberAdminDto); |
| | | } |
New file |
| | |
| | | package com.panzhihua.community_backstage.api; |
| | | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.ExcelWriter; |
| | | import com.alibaba.excel.write.metadata.WriteSheet; |
| | | import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.listen.ComClusterMemberExcelListen; |
| | | import com.panzhihua.common.model.dtos.community.cluster.*; |
| | | import com.panzhihua.common.model.dtos.community.cluster.admin.*; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.cluster.*; |
| | | import com.panzhihua.common.model.vos.community.cluster.admin.*; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | import com.panzhihua.common.utlis.DateUtils; |
| | | import com.panzhihua.common.utlis.SFTPUtil; |
| | | import com.panzhihua.community_backstage.excel.CustomSheetWriteHandler; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | | import org.springframework.data.redis.core.ValueOperations; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * title: 群团组织接口类 |
| | | * projectName 成都呐喊信息技术有限公司-智慧社区项目 |
| | | * description: 群团组织接口类 |
| | | * |
| | | * @author lyq |
| | | * @date 2021/9/23 16:12 |
| | | */ |
| | | @Slf4j |
| | | @Api(tags = {"群团组织"}) |
| | | @RestController |
| | | @RequestMapping("/cluster/") |
| | | public class ClusterApi extends BaseController { |
| | | |
| | | @Resource |
| | | private CommunityService communityService; |
| | | // FTP 登录用户名 |
| | | @Value("${ftp.username}") |
| | | private String userName; |
| | | // FTP 登录密码 |
| | | @Value("${ftp.password}") |
| | | private String password; |
| | | // FTP 服务器地址IP地址 |
| | | @Value("${ftp.host}") |
| | | private String host; |
| | | // FTP 端口 |
| | | @Value("${ftp.port}") |
| | | private int port; |
| | | @Value("${ftp.url}") |
| | | private String url; |
| | | @Value("${excel.userurl}") |
| | | private String excelUrl; |
| | | @Resource |
| | | private StringRedisTemplate stringRedisTemplate; |
| | | |
| | | @ApiOperation(value = "群团组织列表",response = PageClusterVo.class) |
| | | @GetMapping("list") |
| | | public R listClusterApplets() { |
| | | return communityService.listClusterApplets(this.getCommunityId()); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询群团组织列表",response = PageClusterAdminVo.class) |
| | | @PostMapping("/page") |
| | | public R pageClusterAdmin(@RequestBody PageClusterAdminDto pageClusterAdminDto) { |
| | | pageClusterAdminDto.setCommunityId(this.getCommunityId()); |
| | | return communityService.pageClusterAdmin(pageClusterAdminDto); |
| | | } |
| | | |
| | | @ApiOperation(value = "新增群团组织") |
| | | @PostMapping("/add") |
| | | public R addClusterAdmin(@RequestBody AddClusterAdminDto addClusterAdminDto) { |
| | | addClusterAdminDto.setCommunityId(this.getCommunityId()); |
| | | return communityService.addClusterAdmin(addClusterAdminDto); |
| | | } |
| | | |
| | | @ApiOperation(value = "编辑群团组织") |
| | | @PostMapping("/edit") |
| | | public R editClusterAdmin(@RequestBody EditClusterAdminDto editClusterAdminDto) { |
| | | editClusterAdminDto.setCommunityId(this.getCommunityId()); |
| | | return communityService.editClusterAdmin(editClusterAdminDto); |
| | | } |
| | | |
| | | @ApiOperation(value = "删除群团组织") |
| | | @GetMapping("/delete") |
| | | public R deleteClusterAdmin(@RequestParam("id") Long id) { |
| | | return communityService.deleteClusterAdmin(id); |
| | | } |
| | | |
| | | @ApiOperation(value = "群团组织详情",response = ClusterDetailAdminVo.class) |
| | | @GetMapping("/detail") |
| | | public R detailClusterAdmin(@RequestParam("id") Long id) { |
| | | return communityService.detailClusterAdmin(id); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询群团组织成员列表",response = PageClusterMemberAdminVo.class) |
| | | @PostMapping("/member/page") |
| | | public R pageClusterMemberAdmin(@RequestBody PageClusterMemberAdminDto pageClusterMemberAdminDto) { |
| | | pageClusterMemberAdminDto.setCommunityId(this.getCommunityId()); |
| | | return communityService.pageClusterMemberAdmin(pageClusterMemberAdminDto); |
| | | } |
| | | |
| | | @ApiOperation(value = "新增群团组织成员") |
| | | @PostMapping("/member/add") |
| | | public R addClusterMemberAdmin(@RequestBody AddClusterMemberAdminDto addClusterMemberAdminDto) { |
| | | addClusterMemberAdminDto.setCommunityId(this.getCommunityId()); |
| | | return communityService.addClusterMemberAdmin(addClusterMemberAdminDto); |
| | | } |
| | | |
| | | @ApiOperation(value = "编辑群团组织成员") |
| | | @PostMapping("/member/edit") |
| | | public R editClusterMemberAdmin(@RequestBody EditClusterMemberAdminDto editClusterMemberAdminDto) { |
| | | return communityService.editClusterMemberAdmin(editClusterMemberAdminDto); |
| | | } |
| | | |
| | | @ApiOperation(value = "删除群团组织成员") |
| | | @GetMapping("/member/delete") |
| | | public R deleteClusterMemberAdmin(@RequestParam("id") Long id) { |
| | | return communityService.deleteClusterMemberAdmin(id); |
| | | } |
| | | |
| | | @ApiOperation(value = "群团组织成员详情",response = PageClusterMemberAdminVo.class) |
| | | @GetMapping("/member/detail") |
| | | public R detailClusterMemberAdmin(@RequestParam("id") Long id) { |
| | | return communityService.detailClusterMemberAdmin(id); |
| | | } |
| | | |
| | | @ApiOperation(value = "群团组织民族列表",response = PageClusterVo.class) |
| | | @GetMapping("/member/nation/list") |
| | | public R memberNationListAdmin() { |
| | | return communityService.memberNationListAdmin(); |
| | | } |
| | | |
| | | @ApiOperation(value = "群团组织成员导入模板下载") |
| | | @GetMapping("/member/import/download") |
| | | public R clusterMemberDownload(){ |
| | | return R.ok(this.excelUrl + "群团组织成员导入模板.xlsx"); |
| | | } |
| | | |
| | | @ApiOperation(value = "群团组织成员导入") |
| | | @PostMapping(value = "/member/import", consumes = "multipart/*", headers = "content-type=multipart/form-date") |
| | | public R importClusterMember(@RequestParam MultipartFile file, HttpServletRequest request) { |
| | | // 获取文件名 |
| | | String fileName = file.getOriginalFilename(); |
| | | log.info("传入文件名字【{}】", fileName); |
| | | InputStream inputStream = null; |
| | | try { |
| | | inputStream = file.getInputStream(); |
| | | ComClusterMemberExcelListen clusterMemberExcelListen = new ComClusterMemberExcelListen( |
| | | communityService, this.getCommunityId(), this.getUserId(), stringRedisTemplate); |
| | | EasyExcel.read(inputStream, null, clusterMemberExcelListen).sheet().doRead(); |
| | | } catch (IOException e) { |
| | | log.error("导入模板失败【{}】", e.getMessage()); |
| | | e.printStackTrace(); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "下载导入失败群团组织成员数据") |
| | | @PostMapping("/member/download/error") |
| | | public R downloadErrorClusterMember(@RequestParam(value = "key") String key) { |
| | | List<ComClusterMemberExcelErrorVO> list = new ArrayList<>(); |
| | | Boolean isExits = stringRedisTemplate.hasKey(key); |
| | | ValueOperations<String, String> valueOperations = stringRedisTemplate.opsForValue(); |
| | | if (isExits) { |
| | | String json = valueOperations.get(key); |
| | | list = JSONArray.parseArray(json, ComClusterMemberExcelErrorVO.class); |
| | | } |
| | | String ftpUrl = "/mnt/data/web/excel/"; |
| | | String nowDate = DateUtils.getCurrentDateString(); |
| | | String name = "群团组织成员导入错误数据" + nowDate + ".xlsx"; |
| | | try { |
| | | SFTPUtil sftp = new SFTPUtil(userName, password, host, port); |
| | | sftp.login(); |
| | | boolean existDir = sftp.isExistDir(ftpUrl + name); |
| | | if (!existDir) { |
| | | String property = System.getProperty("user.dir"); |
| | | String fileName = property + File.separator + name; |
| | | // 这里 需要指定写用哪个class去写 |
| | | ExcelWriter excelWriter = null; |
| | | InputStream inputStream = null; |
| | | try { |
| | | excelWriter = EasyExcel.write(fileName, ComClusterMemberExcelErrorVO.class) |
| | | .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
| | | .registerWriteHandler(new CustomSheetWriteHandler()).build(); |
| | | WriteSheet writeSheet = EasyExcel.writerSheet("群团组织成员导入错误数据").build(); |
| | | excelWriter.write(list, writeSheet); |
| | | excelWriter.finish(); |
| | | File file = new File(fileName); |
| | | inputStream = new FileInputStream(file); |
| | | sftp.uploadMore(ftpUrl, name, inputStream); |
| | | sftp.logout(); |
| | | inputStream.close(); |
| | | String absolutePath = file.getAbsolutePath(); |
| | | boolean delete = file.delete(); |
| | | log.info("删除excel【{}】结果【{}】", absolutePath, delete); |
| | | } finally { |
| | | // 千万别忘记finish 会帮忙关闭流 |
| | | if (inputStream != null) { |
| | | inputStream.close(); |
| | | } |
| | | if (excelWriter != null) { |
| | | excelWriter.finish(); |
| | | } |
| | | } |
| | | } |
| | | return R.ok(excelUrl + name); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("文件传输失败【{}】", e.getMessage()); |
| | | return R.fail(); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "群团组织成员数据导出") |
| | | @PostMapping("/member/export") |
| | | public R exportClusterMember(@RequestBody PageClusterMemberAdminDto pageClusterMemberAdminDto) { |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | if (loginUserInfo == null) { |
| | | return R.fail("请先登录"); |
| | | } |
| | | pageClusterMemberAdminDto.setCommunityId(loginUserInfo.getCommunityId()); |
| | | String name = "群团组织成员导出数据.xlsx"; |
| | | String ftpUrl = "/mnt/data/web/excel/"; |
| | | R r = communityService.exportClusterMember(pageClusterMemberAdminDto); |
| | | if (R.isOk(r)) { |
| | | List<ComClusterMemberExcelExportAdminVO> resultList = JSONArray.parseArray( |
| | | JSONArray.toJSONString(r.getData()), ComClusterMemberExcelExportAdminVO.class); |
| | | try { |
| | | SFTPUtil sftp = new SFTPUtil(userName, password, host, port); |
| | | sftp.login(); |
| | | boolean existDir = sftp.isExistDir(ftpUrl + name); |
| | | if (!existDir) { |
| | | String property = System.getProperty("user.dir"); |
| | | String fileName = property + File.separator + name; |
| | | // 这里 需要指定写用哪个class去写 |
| | | ExcelWriter excelWriter = null; |
| | | InputStream inputStream = null; |
| | | try { |
| | | excelWriter = EasyExcel.write(fileName, ComClusterMemberExcelExportAdminVO.class) |
| | | .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
| | | .registerWriteHandler(new CustomSheetWriteHandler()).build(); |
| | | WriteSheet writeSheet = EasyExcel.writerSheet("群团组织成员导出数据").build(); |
| | | excelWriter.write(resultList, writeSheet); |
| | | excelWriter.finish(); |
| | | File file = new File(fileName); |
| | | inputStream = new FileInputStream(file); |
| | | sftp.uploadMore(ftpUrl, name, inputStream); |
| | | sftp.logout(); |
| | | inputStream.close(); |
| | | String absolutePath = file.getAbsolutePath(); |
| | | boolean delete = file.delete(); |
| | | log.info("删除excel【{}】结果【{}】", absolutePath, delete); |
| | | } finally { |
| | | // 千万别忘记finish 会帮忙关闭流 |
| | | if (inputStream != null) { |
| | | inputStream.close(); |
| | | } |
| | | if (excelWriter != null) { |
| | | excelWriter.finish(); |
| | | } |
| | | } |
| | | } |
| | | return R.ok(excelUrl + name); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("文件传输失败【{}】", e.getMessage()); |
| | | return R.fail(); |
| | | } |
| | | } |
| | | return r; |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.api; |
| | | |
| | | import com.panzhihua.common.model.dtos.community.cluster.*; |
| | | import com.panzhihua.common.model.dtos.community.cluster.admin.*; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.cluster.admin.ComClusterMemberExcelVO; |
| | | import com.panzhihua.service_community.service.ComClusterOrganizationMemberService; |
| | | import com.panzhihua.service_community.service.ComClusterOrganizationService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * title: 群团组织接口类 |
| | | * projectName 成都呐喊信息技术有限公司-智慧社区项目 |
| | | * description: 群团组织接口类 |
| | | * |
| | | * @author lyq |
| | | * @date 2021/9/23 16:12 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/cluster/") |
| | | public class ClusterApi { |
| | | |
| | | @Resource |
| | | private ComClusterOrganizationMemberService comClusterOrganizationMemberService; |
| | | @Resource |
| | | private ComClusterOrganizationService comClusterOrganizationService; |
| | | |
| | | /** |
| | | * 群团组织成员列表-小程序分页查询 |
| | | * @param pageClusterMemberDto 请求参数 |
| | | * @return 群团组织成员列表 |
| | | */ |
| | | @PostMapping("/member/page/applets") |
| | | public R pageClusterMemberApplets(@RequestBody PageClusterMemberDto pageClusterMemberDto) { |
| | | return comClusterOrganizationMemberService.pageClusterMemberApplets(pageClusterMemberDto); |
| | | } |
| | | |
| | | /** |
| | | * 群团组织列表-小程序查询社区群团组织列表 |
| | | * @param communityId 社区id |
| | | * @return 社区群团组织列表 |
| | | */ |
| | | @GetMapping("/list/applets") |
| | | public R listClusterApplets(@RequestParam("communityId") Long communityId) { |
| | | return comClusterOrganizationService.listClusterApplets(communityId); |
| | | } |
| | | |
| | | /** |
| | | * 分页查询群团组织列表 |
| | | * @param pageClusterAdminDto 请求参数 |
| | | * @return 群团组织列表 |
| | | */ |
| | | @PostMapping("/page/admin") |
| | | public R pageClusterAdmin(@RequestBody PageClusterAdminDto pageClusterAdminDto) { |
| | | return comClusterOrganizationService.pageClusterAdmin(pageClusterAdminDto); |
| | | } |
| | | |
| | | /** |
| | | * 新增群团组织 |
| | | * @param addClusterAdminDto 请求参数 |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping("/add/admin") |
| | | public R addClusterAdmin(@RequestBody AddClusterAdminDto addClusterAdminDto) { |
| | | return comClusterOrganizationService.addClusterAdmin(addClusterAdminDto); |
| | | } |
| | | |
| | | /** |
| | | * 修改群团组织 |
| | | * @param editClusterAdminDto 请求参数 |
| | | * @return 修改结果 |
| | | */ |
| | | @PostMapping("/edit/admin") |
| | | public R editClusterAdmin(@RequestBody EditClusterAdminDto editClusterAdminDto) { |
| | | return comClusterOrganizationService.editClusterAdmin(editClusterAdminDto); |
| | | } |
| | | |
| | | /** |
| | | * 删除群团组织 |
| | | * @param id 组织id |
| | | * @return 删除结果 |
| | | */ |
| | | @GetMapping("/delete/admin") |
| | | public R deleteClusterAdmin(@RequestParam("id") Long id) { |
| | | return comClusterOrganizationService.deleteClusterAdmin(id); |
| | | } |
| | | |
| | | /** |
| | | * 群团组织详情 |
| | | * @param id 组织id |
| | | * @return 群团组织详情 |
| | | */ |
| | | @GetMapping("/detail/admin") |
| | | public R detailClusterAdmin(@RequestParam("id") Long id) { |
| | | return comClusterOrganizationService.detailClusterAdmin(id); |
| | | } |
| | | |
| | | /** |
| | | * 分页查询群团组织成员列表 |
| | | * @param pageClusterMemberAdminDto 请求参数 |
| | | * @return 群团组织成员列表 |
| | | */ |
| | | @PostMapping("/member/page/admin") |
| | | public R pageClusterMemberAdmin(@RequestBody PageClusterMemberAdminDto pageClusterMemberAdminDto) { |
| | | return comClusterOrganizationMemberService.pageClusterMemberAdmin(pageClusterMemberAdminDto); |
| | | } |
| | | |
| | | /** |
| | | * 新增群团组织成员 |
| | | * @param addClusterMemberAdminDto 请求参数 |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping("/member/add/admin") |
| | | public R addClusterMemberAdmin(@RequestBody AddClusterMemberAdminDto addClusterMemberAdminDto) { |
| | | return comClusterOrganizationMemberService.addClusterMemberAdmin(addClusterMemberAdminDto); |
| | | } |
| | | |
| | | /** |
| | | * 编辑群团组织成员 |
| | | * @param editClusterMemberAdminDto 请求参数 |
| | | * @return 编辑结果 |
| | | */ |
| | | @PostMapping("/member/edit/admin") |
| | | public R editClusterMemberAdmin(@RequestBody EditClusterMemberAdminDto editClusterMemberAdminDto) { |
| | | return comClusterOrganizationMemberService.editClusterMemberAdmin(editClusterMemberAdminDto); |
| | | } |
| | | |
| | | /** |
| | | * 删除群团组织成员 |
| | | * @param id 组织成员id |
| | | * @return 删除结果 |
| | | */ |
| | | @GetMapping("/member/delete/admin") |
| | | public R deleteClusterMemberAdmin(@RequestParam("id") Long id) { |
| | | return comClusterOrganizationMemberService.deleteClusterMemberAdmin(id); |
| | | } |
| | | |
| | | /** |
| | | * 群团组织成员详情 |
| | | * @param id 组织成员id |
| | | * @return 群团组织成员详情 |
| | | */ |
| | | @GetMapping("/member/detail/admin") |
| | | public R detailClusterMemberAdmin(@RequestParam("id") Long id) { |
| | | return comClusterOrganizationMemberService.detailClusterMemberAdmin(id); |
| | | } |
| | | |
| | | /** |
| | | * 查询系统民族列表 |
| | | * @return 民族列表 |
| | | */ |
| | | @GetMapping("/member/nation/list/admin") |
| | | public R memberNationListAdmin(){ |
| | | return comClusterOrganizationMemberService.memberNationListAdmin(); |
| | | } |
| | | |
| | | /** |
| | | * 群团组织成员导入 |
| | | * @param list 导入数据 |
| | | * @param communityId 社区id |
| | | * @param userId 操作用户id |
| | | * @return 导入结果 |
| | | */ |
| | | @PostMapping("/member/import/admin") |
| | | public R importClusterMember(@RequestBody List<ComClusterMemberExcelVO> list, |
| | | @RequestParam(value = "communityId") Long communityId, @RequestParam(value = "userId") Long userId){ |
| | | return comClusterOrganizationMemberService.importClusterMember(list,communityId,userId); |
| | | } |
| | | |
| | | /** |
| | | * 群团组织导出数据查询 |
| | | * @param pageClusterMemberAdminDto 请求参数 |
| | | * @return 导出数据结果集 |
| | | */ |
| | | @PostMapping("/member/export/admin") |
| | | public R exportClusterMember(@RequestBody PageClusterMemberAdminDto pageClusterMemberAdminDto){ |
| | | return comClusterOrganizationMemberService.exportClusterMember(pageClusterMemberAdminDto); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.model.dtos.community.cluster.admin.PageClusterAdminDto; |
| | | import com.panzhihua.common.model.vos.community.cluster.PageClusterVo; |
| | | import com.panzhihua.common.model.vos.community.cluster.admin.PageClusterAdminVo; |
| | | import com.panzhihua.service_community.model.dos.ComClusterOrganizationDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author lyq |
| | | * @date 2021-09-23 16:44:06 |
| | | * describe 群团组织表mapper类 |
| | | */ |
| | | @Mapper |
| | | public interface ComClusterOrganizationMapper extends BaseMapper<ComClusterOrganizationDO> { |
| | | |
| | | /** |
| | | * 群团组织列表-小程序查询社区群团组织列表 |
| | | * @param communityId 社区id |
| | | * @return 社区群团组织列表 |
| | | */ |
| | | List<PageClusterVo> listClusterApplets(@Param("communityId") Long communityId); |
| | | |
| | | /** |
| | | * 分页查询群团组织列表 |
| | | * @param pageClusterAdminDto 请求参数 |
| | | * @return 群团组织列表 |
| | | */ |
| | | IPage<PageClusterAdminVo> pageClusterAdmin(Page page,@Param("pageClusterAdminDto") PageClusterAdminDto pageClusterAdminDto); |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.model.dtos.community.cluster.PageClusterMemberDto; |
| | | import com.panzhihua.common.model.dtos.community.cluster.admin.PageClusterMemberAdminDto; |
| | | import com.panzhihua.common.model.vos.community.cluster.PageClusterMemberVo; |
| | | import com.panzhihua.common.model.vos.community.cluster.PageClusterVo; |
| | | import com.panzhihua.common.model.vos.community.cluster.admin.ClusterMemberNationVo; |
| | | import com.panzhihua.common.model.vos.community.cluster.admin.ComClusterMemberExcelExportAdminVO; |
| | | import com.panzhihua.common.model.vos.community.cluster.admin.PageClusterMemberAdminVo; |
| | | import com.panzhihua.service_community.model.dos.ComClusterOrganizationMemberDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author lyq |
| | | * @date 2021-09-23 16:44:00 |
| | | * describe 群团组织成员表mapper类 |
| | | */ |
| | | @Mapper |
| | | public interface ComClusterOrganizationMemberMapper extends BaseMapper<ComClusterOrganizationMemberDO> { |
| | | |
| | | /** |
| | | * 群团组织成员列表-小程序分页查询 |
| | | * @param pageClusterMemberDto 请求参数 |
| | | * @return 群团组织成员列表 |
| | | */ |
| | | IPage<PageClusterMemberVo> pageClusterMemberApplets(Page page, @Param("pageClusterMemberDto") PageClusterMemberDto pageClusterMemberDto); |
| | | |
| | | /** |
| | | * 分页查询群团组织成员列表 |
| | | * @param pageClusterMemberAdminDto 请求参数 |
| | | * @return 群团组织成员列表 |
| | | */ |
| | | IPage<PageClusterMemberAdminVo> pageClusterMemberAdmin(Page page, @Param("pageClusterMemberAdminDto") PageClusterMemberAdminDto pageClusterMemberAdminDto); |
| | | |
| | | /** |
| | | * 查询系统民族列表 |
| | | * @param key 字典码Key |
| | | * @return 民族列表 |
| | | */ |
| | | List<ClusterMemberNationVo> memberNationListAdmin(@Param("key") String key); |
| | | |
| | | /** |
| | | * 查询民族code |
| | | * @param nationName 民族名称 |
| | | * @param key 民族字典码key |
| | | * @return 民族code |
| | | */ |
| | | Map<String,String> getNationCode(@Param("nationName") String nationName,@Param("key") String key); |
| | | |
| | | /** |
| | | * 群团组织导出数据查询 |
| | | * @param pageClusterMemberAdminDto 请求参数 |
| | | * @return 导出数据结果集 |
| | | */ |
| | | List<ComClusterMemberExcelExportAdminVO> exportClusterMember(@Param("pageClusterMemberAdminDto") PageClusterMemberAdminDto pageClusterMemberAdminDto); |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.model.dos; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | |
| | | /** |
| | | * @author lyq |
| | | * @date 2021-09-23 16:38:57 |
| | | * describe 群团组织表实体类 |
| | | */ |
| | | |
| | | @Data |
| | | @TableName("com_cluster_organization") |
| | | public class ComClusterOrganizationDO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键id |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 组织名称 |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * 联系电话 |
| | | */ |
| | | private String phone; |
| | | |
| | | /** |
| | | * 详细地址 |
| | | */ |
| | | private String address; |
| | | |
| | | /** |
| | | * 状态(1.启用 2.禁用) |
| | | */ |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 组织logo |
| | | */ |
| | | private String logo; |
| | | |
| | | /** |
| | | * 是否删除(1.是 2.否) |
| | | */ |
| | | private Integer isDel; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private Date createAt; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | private Date updateAt; |
| | | |
| | | /** |
| | | * 社区id |
| | | */ |
| | | private Long communityId; |
| | | |
| | | /** |
| | | * 经度 |
| | | */ |
| | | private String lng; |
| | | |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | private String lat; |
| | | |
| | | /** |
| | | * 是否枚举(1.是 2.否) |
| | | */ |
| | | public interface isOk{ |
| | | int yes = 1; |
| | | int no = 2; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "ComClusterOrganizationDO{" + |
| | | "id=" + id + |
| | | ", name=" + name + |
| | | ", phone=" + phone + |
| | | ", address=" + address + |
| | | ", status=" + status + |
| | | ", logo=" + logo + |
| | | ", isDel=" + isDel + |
| | | ", createAt=" + createAt + |
| | | ", updateAt=" + updateAt + |
| | | "}"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.model.dos; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | |
| | | /** |
| | | * @author lyq |
| | | * @date 2021-09-23 16:39:05 |
| | | * describe 群团组织成员表实体类 |
| | | */ |
| | | |
| | | @Data |
| | | @TableName("com_cluster_organization_member") |
| | | public class ComClusterOrganizationMemberDO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键id |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 所属组织id |
| | | */ |
| | | private Long clusterId; |
| | | |
| | | /** |
| | | * 组织成员姓名 |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * 组织成员电话 |
| | | */ |
| | | private String phone; |
| | | |
| | | /** |
| | | * 组织成员住址 |
| | | */ |
| | | private String address; |
| | | |
| | | /** |
| | | * 组织成员照片 |
| | | */ |
| | | private String imageUrl; |
| | | |
| | | /** |
| | | * 组织成员职务 |
| | | */ |
| | | private String job; |
| | | |
| | | /** |
| | | * 组织成员身份证号码 |
| | | */ |
| | | private String idCard; |
| | | |
| | | /** |
| | | * 民族编号(字典表中dict_value) |
| | | */ |
| | | private String nationCode; |
| | | |
| | | /** |
| | | * 状态(1.启用 2.禁用) |
| | | */ |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 是否删除(1.是 2.否) |
| | | */ |
| | | private Integer isDel; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private Date createAt; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | private Date updateAt; |
| | | |
| | | /** |
| | | * 社区id |
| | | */ |
| | | private Long communityId; |
| | | |
| | | /** |
| | | * 是否枚举(1.是 2.否) |
| | | */ |
| | | public interface isOk{ |
| | | int yes = 1; |
| | | int no = 2; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "ComClusterOrganizationMemberDO{" + |
| | | "id=" + id + |
| | | ", clusterId=" + clusterId + |
| | | ", name=" + name + |
| | | ", phone=" + phone + |
| | | ", address=" + address + |
| | | ", imageUrl=" + imageUrl + |
| | | ", job=" + job + |
| | | ", idCard=" + idCard + |
| | | ", nationCode=" + nationCode + |
| | | ", status=" + status + |
| | | ", isDel=" + isDel + |
| | | ", createAt=" + createAt + |
| | | ", updateAt=" + updateAt + |
| | | "}"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.panzhihua.common.model.dtos.community.cluster.PageClusterMemberDto; |
| | | import com.panzhihua.common.model.dtos.community.cluster.admin.AddClusterMemberAdminDto; |
| | | import com.panzhihua.common.model.dtos.community.cluster.admin.EditClusterMemberAdminDto; |
| | | import com.panzhihua.common.model.dtos.community.cluster.admin.PageClusterMemberAdminDto; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.cluster.admin.ComClusterMemberExcelVO; |
| | | import com.panzhihua.service_community.model.dos.ComClusterOrganizationMemberDO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author lyq |
| | | * @date 2021-09-23 16:44:00 |
| | | * describe 群团组织成员表服务类 |
| | | */ |
| | | public interface ComClusterOrganizationMemberService extends IService<ComClusterOrganizationMemberDO> { |
| | | |
| | | /** |
| | | * 群团组织成员列表-小程序分页查询 |
| | | * |
| | | * @param pageClusterMemberDto 请求参数 |
| | | * @return 群团组织成员列表 |
| | | */ |
| | | R pageClusterMemberApplets(PageClusterMemberDto pageClusterMemberDto); |
| | | |
| | | /** |
| | | * 分页查询群团组织成员列表 |
| | | * |
| | | * @param pageClusterMemberAdminDto 请求参数 |
| | | * @return 群团组织成员列表 |
| | | */ |
| | | R pageClusterMemberAdmin(PageClusterMemberAdminDto pageClusterMemberAdminDto); |
| | | |
| | | /** |
| | | * 新增群团组织成员 |
| | | * |
| | | * @param addClusterMemberAdminDto 请求参数 |
| | | * @return 新增结果 |
| | | */ |
| | | R addClusterMemberAdmin(AddClusterMemberAdminDto addClusterMemberAdminDto); |
| | | |
| | | /** |
| | | * 编辑群团组织成员 |
| | | * |
| | | * @param editClusterMemberAdminDto 请求参数 |
| | | * @return 编辑结果 |
| | | */ |
| | | R editClusterMemberAdmin(EditClusterMemberAdminDto editClusterMemberAdminDto); |
| | | |
| | | /** |
| | | * 删除群团组织成员 |
| | | * |
| | | * @param id 组织成员id |
| | | * @return 删除结果 |
| | | */ |
| | | R deleteClusterMemberAdmin(Long id); |
| | | |
| | | /** |
| | | * 群团组织成员详情 |
| | | * |
| | | * @param id 组织成员id |
| | | * @return 群团组织成员详情 |
| | | */ |
| | | R detailClusterMemberAdmin(Long id); |
| | | |
| | | /** |
| | | * 查询系统民族列表 |
| | | * |
| | | * @return 民族列表 |
| | | */ |
| | | R memberNationListAdmin(); |
| | | |
| | | /** |
| | | * 群团组织成员导入 |
| | | * @param list 导入数据 |
| | | * @param communityId 社区id |
| | | * @param userId 操作用户id |
| | | * @return 导入结果 |
| | | */ |
| | | R importClusterMember(List<ComClusterMemberExcelVO> list, Long communityId, Long userId); |
| | | |
| | | /** |
| | | * 群团组织导出数据查询 |
| | | * @param pageClusterMemberAdminDto 请求参数 |
| | | * @return 导出数据结果集 |
| | | */ |
| | | R exportClusterMember(PageClusterMemberAdminDto pageClusterMemberAdminDto); |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.panzhihua.common.model.dtos.community.cluster.admin.AddClusterAdminDto; |
| | | import com.panzhihua.common.model.dtos.community.cluster.admin.EditClusterAdminDto; |
| | | import com.panzhihua.common.model.dtos.community.cluster.admin.PageClusterAdminDto; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.service_community.model.dos.ComClusterOrganizationDO; |
| | | |
| | | /** |
| | | * @author lyq |
| | | * @date 2021-09-23 16:44:06 |
| | | * describe 群团组织表服务类 |
| | | */ |
| | | public interface ComClusterOrganizationService extends IService<ComClusterOrganizationDO> { |
| | | |
| | | /** |
| | | * 群团组织列表-小程序查询社区群团组织列表 |
| | | * @param communityId 社区id |
| | | * @return 社区群团组织列表 |
| | | */ |
| | | R listClusterApplets(Long communityId); |
| | | |
| | | /** |
| | | * 分页查询群团组织列表 |
| | | * @param pageClusterAdminDto 请求参数 |
| | | * @return 群团组织列表 |
| | | */ |
| | | R pageClusterAdmin(PageClusterAdminDto pageClusterAdminDto); |
| | | |
| | | /** |
| | | * 新增群团组织 |
| | | * @param addClusterAdminDto 请求参数 |
| | | * @return 新增结果 |
| | | */ |
| | | R addClusterAdmin(AddClusterAdminDto addClusterAdminDto); |
| | | |
| | | /** |
| | | * 修改群团组织 |
| | | * @param editClusterAdminDto 请求参数 |
| | | * @return 修改结果 |
| | | */ |
| | | R editClusterAdmin(EditClusterAdminDto editClusterAdminDto); |
| | | |
| | | /** |
| | | * 删除群团组织 |
| | | * @param id 组织id |
| | | * @return 删除结果 |
| | | */ |
| | | R deleteClusterAdmin(Long id); |
| | | |
| | | /** |
| | | * 群团组织详情 |
| | | * @param id 组织id |
| | | * @return 群团组织详情 |
| | | */ |
| | | R detailClusterAdmin(Long id); |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.google.common.collect.Lists; |
| | | import com.panzhihua.common.constants.Constants; |
| | | import com.panzhihua.common.model.dtos.community.cluster.PageClusterMemberDto; |
| | | import com.panzhihua.common.model.dtos.community.cluster.admin.AddClusterMemberAdminDto; |
| | | import com.panzhihua.common.model.dtos.community.cluster.admin.EditClusterMemberAdminDto; |
| | | import com.panzhihua.common.model.dtos.community.cluster.admin.PageClusterMemberAdminDto; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.cluster.admin.ClusterMemberNationVo; |
| | | import com.panzhihua.common.model.vos.community.cluster.admin.ComClusterMemberExcelErrorVO; |
| | | import com.panzhihua.common.model.vos.community.cluster.admin.ComClusterMemberExcelVO; |
| | | import com.panzhihua.common.model.vos.community.cluster.admin.PageClusterMemberAdminVo; |
| | | import com.panzhihua.service_community.dao.ComClusterOrganizationMapper; |
| | | import com.panzhihua.service_community.dao.ComClusterOrganizationMemberMapper; |
| | | import com.panzhihua.service_community.model.dos.ComClusterOrganizationDO; |
| | | import com.panzhihua.service_community.model.dos.ComClusterOrganizationMemberDO; |
| | | import com.panzhihua.service_community.service.ComClusterOrganizationMemberService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author lyq |
| | | * @date 2021-09-23 16:44:00 |
| | | * describe 群团组织成员表服务实现类 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class ComClusterOrganizationMemberServiceImpl extends ServiceImpl<ComClusterOrganizationMemberMapper, ComClusterOrganizationMemberDO> implements ComClusterOrganizationMemberService { |
| | | |
| | | @Resource |
| | | private ComClusterOrganizationMapper comClusterOrganizationMapper; |
| | | |
| | | /** |
| | | * 群团组织成员列表-小程序分页查询 |
| | | * @param pageClusterMemberDto 请求参数 |
| | | * @return 群团组织成员列表 |
| | | */ |
| | | @Override |
| | | public R pageClusterMemberApplets(PageClusterMemberDto pageClusterMemberDto){ |
| | | return R.ok(this.baseMapper.pageClusterMemberApplets(new Page(pageClusterMemberDto.getPageNum(),pageClusterMemberDto.getPageSize()),pageClusterMemberDto)); |
| | | } |
| | | |
| | | /** |
| | | * 分页查询群团组织成员列表 |
| | | * @param pageClusterMemberAdminDto 请求参数 |
| | | * @return 群团组织成员列表 |
| | | */ |
| | | @Override |
| | | public R pageClusterMemberAdmin(PageClusterMemberAdminDto pageClusterMemberAdminDto){ |
| | | return R.ok(this.baseMapper.pageClusterMemberAdmin(new Page(pageClusterMemberAdminDto.getPageNum(),pageClusterMemberAdminDto.getPageSize()),pageClusterMemberAdminDto)); |
| | | } |
| | | |
| | | /** |
| | | * 新增群团组织成员 |
| | | * @param addClusterMemberAdminDto 请求参数 |
| | | * @return 新增结果 |
| | | */ |
| | | @Override |
| | | public R addClusterMemberAdmin(AddClusterMemberAdminDto addClusterMemberAdminDto){ |
| | | |
| | | ComClusterOrganizationMemberDO organizationMemberDO = this.baseMapper.selectOne(new QueryWrapper<ComClusterOrganizationMemberDO>() |
| | | .lambda().eq(ComClusterOrganizationMemberDO::getIdCard,addClusterMemberAdminDto.getIdCard()) |
| | | .eq(ComClusterOrganizationMemberDO::getIsDel,ComClusterOrganizationMemberDO.isOk.no) |
| | | .eq(ComClusterOrganizationMemberDO::getCommunityId,addClusterMemberAdminDto.getCommunityId())); |
| | | if(organizationMemberDO != null){ |
| | | return R.fail("该身份证号已存在,不可重复添加"); |
| | | } |
| | | organizationMemberDO = new ComClusterOrganizationMemberDO(); |
| | | BeanUtils.copyProperties(addClusterMemberAdminDto,organizationMemberDO); |
| | | organizationMemberDO.setCreateAt(new Date()); |
| | | if(this.baseMapper.insert(organizationMemberDO) > 0){ |
| | | return R.ok(); |
| | | } |
| | | return R.fail(); |
| | | } |
| | | |
| | | /** |
| | | * 编辑群团组织成员 |
| | | * @param editClusterMemberAdminDto 请求参数 |
| | | * @return 编辑结果 |
| | | */ |
| | | @Override |
| | | public R editClusterMemberAdmin(EditClusterMemberAdminDto editClusterMemberAdminDto){ |
| | | ComClusterOrganizationMemberDO organizationMemberDO = this.baseMapper.selectById(editClusterMemberAdminDto.getId()); |
| | | if(organizationMemberDO == null){ |
| | | return R.fail("该组织成员不存在"); |
| | | } |
| | | |
| | | Integer count = this.baseMapper.selectCount(new QueryWrapper<ComClusterOrganizationMemberDO>().lambda() |
| | | .eq(ComClusterOrganizationMemberDO::getCommunityId,editClusterMemberAdminDto.getCommunityId()) |
| | | .eq(ComClusterOrganizationMemberDO::getIdCard,editClusterMemberAdminDto.getIdCard()) |
| | | .eq(ComClusterOrganizationMemberDO::getIsDel,ComClusterOrganizationMemberDO.isOk.no) |
| | | .ne(ComClusterOrganizationMemberDO::getId,editClusterMemberAdminDto.getId())); |
| | | if(count > 0){ |
| | | return R.fail("该身份证号已存在,不可重复添加"); |
| | | } |
| | | BeanUtils.copyProperties(editClusterMemberAdminDto,organizationMemberDO); |
| | | organizationMemberDO.setUpdateAt(new Date()); |
| | | if(this.baseMapper.updateById(organizationMemberDO) > 0){ |
| | | return R.ok(); |
| | | } |
| | | return R.fail(); |
| | | } |
| | | |
| | | /** |
| | | * 删除群团组织成员 |
| | | * @param id 组织成员id |
| | | * @return 删除结果 |
| | | */ |
| | | @Override |
| | | public R deleteClusterMemberAdmin(Long id){ |
| | | ComClusterOrganizationMemberDO organizationMemberDO = new ComClusterOrganizationMemberDO(); |
| | | organizationMemberDO.setId(id); |
| | | organizationMemberDO.setIsDel(ComClusterOrganizationMemberDO.isOk.yes); |
| | | organizationMemberDO.setUpdateAt(new Date()); |
| | | if(this.baseMapper.updateById(organizationMemberDO) > 0){ |
| | | return R.ok(); |
| | | } |
| | | return R.fail(); |
| | | } |
| | | |
| | | /** |
| | | * 群团组织成员详情 |
| | | * @param id 组织成员id |
| | | * @return 群团组织成员详情 |
| | | */ |
| | | @Override |
| | | public R detailClusterMemberAdmin(Long id){ |
| | | ComClusterOrganizationMemberDO organizationMemberDO = this.baseMapper.selectById(id); |
| | | if(organizationMemberDO == null){ |
| | | return R.fail("该组织成员不存在"); |
| | | } |
| | | PageClusterMemberAdminVo memberAdminVo = new PageClusterMemberAdminVo(); |
| | | BeanUtils.copyProperties(organizationMemberDO,memberAdminVo); |
| | | return R.ok(memberAdminVo); |
| | | } |
| | | |
| | | /** |
| | | * 查询系统民族列表 |
| | | * @return 民族列表 |
| | | */ |
| | | @Override |
| | | public R memberNationListAdmin(){ |
| | | return R.ok(this.baseMapper.memberNationListAdmin(Constants.NATION_DICT_KEY)); |
| | | } |
| | | |
| | | /** |
| | | * 群团组织成员导入 |
| | | * @param memberExcelList 导入数据 |
| | | * @param communityId 社区id |
| | | * @param userId 操作用户id |
| | | * @return 导入结果 |
| | | */ |
| | | @Override |
| | | public R importClusterMember(List<ComClusterMemberExcelVO> memberExcelList, Long communityId, Long userId){ |
| | | |
| | | //需要新增的数据 |
| | | List<ComClusterOrganizationMemberDO> saveList = Lists.newArrayList(); |
| | | //错误数据 |
| | | ArrayList<ComClusterMemberExcelErrorVO> mistakes = Lists.newArrayList(); |
| | | //查询当前社区现有的所有群团组织成员列表 |
| | | List<ComClusterOrganizationMemberDO> memberList = this.baseMapper.selectList(new QueryWrapper<ComClusterOrganizationMemberDO>().lambda() |
| | | .eq(ComClusterOrganizationMemberDO::getCommunityId,communityId) |
| | | .eq(ComClusterOrganizationMemberDO::getIsDel,ComClusterOrganizationMemberDO.isOk.no)); |
| | | HashMap<String, Object> memberMap = new HashMap<>(); |
| | | memberList.forEach(member -> { |
| | | String key = member.getIdCard(); |
| | | memberMap.put(key, member); |
| | | }); |
| | | |
| | | //查询该社区现有的所有群团组织 |
| | | List<ComClusterOrganizationDO> clusterList = comClusterOrganizationMapper.selectList(new QueryWrapper<ComClusterOrganizationDO>().lambda() |
| | | .eq(ComClusterOrganizationDO::getCommunityId,communityId).eq(ComClusterOrganizationDO::getIsDel,ComClusterOrganizationDO.isOk.no)); |
| | | HashMap<String, Object> clusterMap = new HashMap<>(); |
| | | clusterList.forEach(cluster -> { |
| | | String key = cluster.getName(); |
| | | clusterMap.put(key, cluster); |
| | | }); |
| | | |
| | | List<ClusterMemberNationVo> nationList = this.baseMapper.memberNationListAdmin(Constants.NATION_DICT_KEY); |
| | | HashMap<String, Object> nationMap = new HashMap<>(); |
| | | nationList.forEach(nation -> { |
| | | String key = nation.getNationName(); |
| | | nationMap.put(key, nation.getNationCode()); |
| | | }); |
| | | Date nowDate = new Date(); |
| | | for (ComClusterMemberExcelVO memberExcel : memberExcelList) { |
| | | Long clusterId = 0L; |
| | | |
| | | String nationCode = ""; |
| | | |
| | | //判断成员是否已存在 |
| | | if(isOnly(memberExcel.getIdCard(),memberMap)){ |
| | | ComClusterMemberExcelErrorVO memberExcelErrorVO = new ComClusterMemberExcelErrorVO(); |
| | | BeanUtils.copyProperties(memberExcel,memberExcelErrorVO); |
| | | memberExcelErrorVO.setError("该成员已存在"); |
| | | mistakes.add(memberExcelErrorVO); |
| | | continue; |
| | | } |
| | | |
| | | //判断组织是否存在 |
| | | if(!isOnly(memberExcel.getClusterName(),clusterMap)){ |
| | | ComClusterMemberExcelErrorVO memberExcelErrorVO = new ComClusterMemberExcelErrorVO(); |
| | | BeanUtils.copyProperties(memberExcel,memberExcelErrorVO); |
| | | memberExcelErrorVO.setError("该组织在本社区不存在"); |
| | | mistakes.add(memberExcelErrorVO); |
| | | continue; |
| | | }else{ |
| | | ComClusterOrganizationDO clusterDO = (ComClusterOrganizationDO)clusterMap.get(memberExcel.getClusterName()); |
| | | clusterId = clusterDO.getId(); |
| | | } |
| | | |
| | | //判断民族是否存在 |
| | | if(!isOnly(memberExcel.getNation(),nationMap)){ |
| | | ComClusterMemberExcelErrorVO memberExcelErrorVO = new ComClusterMemberExcelErrorVO(); |
| | | BeanUtils.copyProperties(memberExcel,memberExcelErrorVO); |
| | | memberExcelErrorVO.setError("您填写的民族不存在"); |
| | | mistakes.add(memberExcelErrorVO); |
| | | continue; |
| | | }else{ |
| | | nationCode = nationMap.get(memberExcel.getNation()).toString(); |
| | | } |
| | | |
| | | ComClusterOrganizationMemberDO clusterMember = new ComClusterOrganizationMemberDO(); |
| | | BeanUtils.copyProperties(memberExcel,clusterMember); |
| | | clusterMember.setClusterId(clusterId); |
| | | clusterMember.setNationCode(nationCode); |
| | | clusterMember.setImageUrl(Constants.CLUSTER_MEMBER_DEFAULT_IMAGE_URL); |
| | | clusterMember.setCreateAt(nowDate); |
| | | saveList.add(clusterMember); |
| | | } |
| | | //执行导入 |
| | | if(saveList.size() > 0){ |
| | | this.saveBatch(saveList); |
| | | } |
| | | //有错误,返回错误数据 |
| | | if(mistakes.size() > 0){ |
| | | return R.fail(mistakes); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 判重方法 |
| | | * |
| | | * @param key |
| | | * 主键 |
| | | * @param hashMap |
| | | * 数据集 |
| | | * @return 存在即为false 不存在则为true |
| | | */ |
| | | private boolean isOnly(String key, HashMap<String, Object> hashMap) { |
| | | return ObjectUtils.isEmpty(hashMap.get(key)); |
| | | } |
| | | |
| | | /** |
| | | * 群团组织导出数据查询 |
| | | * @param pageClusterMemberAdminDto 请求参数 |
| | | * @return 导出数据结果集 |
| | | */ |
| | | @Override |
| | | public R exportClusterMember(PageClusterMemberAdminDto pageClusterMemberAdminDto){ |
| | | return R.ok(this.baseMapper.exportClusterMember(pageClusterMemberAdminDto)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.panzhihua.common.model.dtos.community.cluster.admin.AddClusterAdminDto; |
| | | import com.panzhihua.common.model.dtos.community.cluster.admin.EditClusterAdminDto; |
| | | import com.panzhihua.common.model.dtos.community.cluster.admin.PageClusterAdminDto; |
| | | import com.panzhihua.common.model.vos.community.cluster.admin.ClusterDetailAdminVo; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.service_community.dao.ComClusterOrganizationMapper; |
| | | import com.panzhihua.service_community.dao.ComClusterOrganizationMemberMapper; |
| | | import com.panzhihua.service_community.model.dos.ComClusterOrganizationDO; |
| | | import com.panzhihua.service_community.model.dos.ComClusterOrganizationMemberDO; |
| | | import com.panzhihua.service_community.service.ComClusterOrganizationService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author lyq |
| | | * @date 2021-09-23 16:44:06 |
| | | * describe 群团组织表服务实现类 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class ComClusterOrganizationServiceImpl extends ServiceImpl<ComClusterOrganizationMapper, ComClusterOrganizationDO> implements ComClusterOrganizationService { |
| | | |
| | | @Resource |
| | | private ComClusterOrganizationMemberMapper comClusterOrganizationMemberMapper; |
| | | |
| | | /** |
| | | * 群团组织列表-小程序查询社区群团组织列表 |
| | | * @param communityId 社区id |
| | | * @return 社区群团组织列表 |
| | | */ |
| | | @Override |
| | | public R listClusterApplets(Long communityId){ |
| | | return R.ok(this.baseMapper.listClusterApplets(communityId)); |
| | | } |
| | | |
| | | /** |
| | | * 分页查询群团组织列表 |
| | | * @param pageClusterAdminDto 请求参数 |
| | | * @return 群团组织列表 |
| | | */ |
| | | @Override |
| | | public R pageClusterAdmin(PageClusterAdminDto pageClusterAdminDto){ |
| | | return R.ok(this.baseMapper.pageClusterAdmin(new Page(pageClusterAdminDto.getPageNum(),pageClusterAdminDto.getPageSize()),pageClusterAdminDto)); |
| | | } |
| | | |
| | | /** |
| | | * 新增群团组织 |
| | | * @param addClusterAdminDto 请求参数 |
| | | * @return 新增结果 |
| | | */ |
| | | @Override |
| | | public R addClusterAdmin(AddClusterAdminDto addClusterAdminDto){ |
| | | |
| | | ComClusterOrganizationDO organizationDO = this.baseMapper.selectOne(new QueryWrapper<ComClusterOrganizationDO>().lambda() |
| | | .eq(ComClusterOrganizationDO::getCommunityId,addClusterAdminDto.getCommunityId()) |
| | | .eq(ComClusterOrganizationDO::getName,addClusterAdminDto.getName()) |
| | | .eq(ComClusterOrganizationDO::getIsDel,ComClusterOrganizationDO.isOk.no)); |
| | | if(organizationDO != null){ |
| | | return R.fail("该组织已存在,不可重复添加"); |
| | | } |
| | | organizationDO = new ComClusterOrganizationDO(); |
| | | BeanUtils.copyProperties(addClusterAdminDto,organizationDO); |
| | | organizationDO.setCreateAt(new Date()); |
| | | if(this.baseMapper.insert(organizationDO) > 0){ |
| | | return R.ok(); |
| | | } |
| | | return R.fail(); |
| | | } |
| | | |
| | | /** |
| | | * 修改群团组织 |
| | | * @param editClusterAdminDto 请求参数 |
| | | * @return 修改结果 |
| | | */ |
| | | @Override |
| | | public R editClusterAdmin(EditClusterAdminDto editClusterAdminDto){ |
| | | ComClusterOrganizationDO organizationDO = this.baseMapper.selectById(editClusterAdminDto.getId()); |
| | | if(organizationDO == null){ |
| | | return R.fail("该组织不存在"); |
| | | } |
| | | Integer count = this.baseMapper.selectCount(new QueryWrapper<ComClusterOrganizationDO>().lambda() |
| | | .eq(ComClusterOrganizationDO::getCommunityId,editClusterAdminDto.getCommunityId()) |
| | | .eq(ComClusterOrganizationDO::getName,editClusterAdminDto.getName()) |
| | | .eq(ComClusterOrganizationDO::getIsDel,ComClusterOrganizationDO.isOk.no) |
| | | .ne(ComClusterOrganizationDO::getId,editClusterAdminDto.getId())); |
| | | if(count > 0){ |
| | | return R.fail("该组织已存在"); |
| | | } |
| | | BeanUtils.copyProperties(editClusterAdminDto,organizationDO); |
| | | organizationDO.setUpdateAt(new Date()); |
| | | if(this.baseMapper.updateById(organizationDO) > 0){ |
| | | return R.ok(); |
| | | } |
| | | return R.fail(); |
| | | } |
| | | |
| | | /** |
| | | * 删除群团组织 |
| | | * @param id 组织id |
| | | * @return 删除结果 |
| | | */ |
| | | @Override |
| | | public R deleteClusterAdmin(Long id){ |
| | | Integer count = comClusterOrganizationMemberMapper.selectCount(new QueryWrapper<ComClusterOrganizationMemberDO>().lambda() |
| | | .eq(ComClusterOrganizationMemberDO::getClusterId,id) |
| | | .eq(ComClusterOrganizationMemberDO::getIsDel,ComClusterOrganizationMemberDO.isOk.no)); |
| | | if(count > 0){ |
| | | return R.fail("该组织下存在成员,不可删除"); |
| | | } |
| | | ComClusterOrganizationDO organizationDO = new ComClusterOrganizationDO(); |
| | | organizationDO.setId(id); |
| | | organizationDO.setIsDel(ComClusterOrganizationDO.isOk.yes); |
| | | organizationDO.setUpdateAt(new Date()); |
| | | if(this.baseMapper.updateById(organizationDO) > 0){ |
| | | return R.ok(); |
| | | } |
| | | return R.fail(); |
| | | } |
| | | |
| | | /** |
| | | * 群团组织详情 |
| | | * @param id 组织id |
| | | * @return 群团组织详情 |
| | | */ |
| | | @Override |
| | | public R detailClusterAdmin(Long id){ |
| | | ComClusterOrganizationDO organizationDO = this.baseMapper.selectById(id); |
| | | if(organizationDO == null){ |
| | | return R.fail("该组织不存在"); |
| | | } |
| | | ClusterDetailAdminVo detailAdminVo = new ClusterDetailAdminVo(); |
| | | BeanUtils.copyProperties(organizationDO,detailAdminVo); |
| | | return R.ok(detailAdminVo); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.panzhihua.service_community.dao.ComClusterOrganizationMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComClusterOrganizationDO"> |
| | | <id column="id" property="id" /> |
| | | <result column="name" property="name" /> |
| | | <result column="phone" property="phone" /> |
| | | <result column="address" property="address" /> |
| | | <result column="status" property="status" /> |
| | | <result column="logo" property="logo" /> |
| | | <result column="is_del" property="isDel" /> |
| | | <result column="create_at" property="createAt" /> |
| | | <result column="update_at" property="updateAt" /> |
| | | <result column="community_id" property="communityId" /> |
| | | <result column="lng" property="lng" /> |
| | | <result column="lat" property="lat" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, name, phone, address, status, logo, is_del, create_at, update_at,community_id, lng, lat |
| | | </sql> |
| | | |
| | | <select id="listClusterApplets" resultType="com.panzhihua.common.model.vos.community.cluster.PageClusterVo"> |
| | | select id,`name` from com_cluster_organization where status = 1 and is_del = 2 and community_id = #{communityId} order by create_at desc |
| | | </select> |
| | | |
| | | <select id="pageClusterAdmin" resultType="com.panzhihua.common.model.vos.community.cluster.admin.PageClusterAdminVo"> |
| | | SELECT |
| | | id, |
| | | `name`, |
| | | logo, |
| | | phone, |
| | | address, |
| | | `status` |
| | | FROM |
| | | com_cluster_organization |
| | | WHERE |
| | | is_del = 2 |
| | | <if test="pageClusterAdminDto.communityId != null"> |
| | | and community_id = #{pageClusterAdminDto.communityId} |
| | | </if> |
| | | <if test="pageClusterAdminDto.status != null"> |
| | | and status = #{pageClusterAdminDto.status} |
| | | </if> |
| | | <if test="pageClusterAdminDto.keyWord != null and pageClusterAdminDto.keyWord != """> |
| | | and ( |
| | | `name` like concat(#{pageClusterAdminDto.keyWord}, '%' ) or |
| | | phone like concat(#{pageClusterAdminDto.keyWord}, '%' ) |
| | | ) |
| | | </if> |
| | | ORDER BY |
| | | create_at DESC |
| | | </select> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.panzhihua.service_community.dao.ComClusterOrganizationMemberMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComClusterOrganizationMemberDO"> |
| | | <id column="id" property="id" /> |
| | | <result column="cluster_id" property="clusterId" /> |
| | | <result column="name" property="name" /> |
| | | <result column="phone" property="phone" /> |
| | | <result column="address" property="address" /> |
| | | <result column="image_url" property="imageUrl" /> |
| | | <result column="job" property="job" /> |
| | | <result column="id_card" property="idCard" /> |
| | | <result column="nation_code" property="nationCode" /> |
| | | <result column="status" property="status" /> |
| | | <result column="is_del" property="isDel" /> |
| | | <result column="create_at" property="createAt" /> |
| | | <result column="update_at" property="updateAt" /> |
| | | <result column="community_id" property="communityId" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, cluster_id, name, phone, address, image_url, job, id_card, nation_code, status, is_del, create_at, update_at, community_id |
| | | </sql> |
| | | |
| | | <select id="pageClusterMemberApplets" resultType="com.panzhihua.common.model.vos.community.cluster.PageClusterMemberVo"> |
| | | SELECT |
| | | ccom.id,ccom.`name`,ccom.cluster_id,cco.`name` as clusterName,ccom.phone,ccom.address,ccom.image_url,ccom.job,ccom.id_card |
| | | FROM |
| | | com_cluster_organization_member AS ccom |
| | | LEFT JOIN com_cluster_organization AS cco ON cco.id = ccom.cluster_id |
| | | <where> |
| | | ccom.status = 1 and ccom.is_del = 2 |
| | | <if test="pageClusterMemberDto.communityId != null"> |
| | | and ccom.community_id = #{pageClusterMemberDto.communityId} |
| | | </if> |
| | | <if test="pageClusterMemberDto.clusterId != null"> |
| | | and ccom.cluster_id = #{pageClusterMemberDto.clusterId} |
| | | </if> |
| | | <if test="pageClusterMemberDto.keyWord != null and pageClusterMemberDto.keyWord != """> |
| | | and ccom.`name` like concat(#{pageClusterMemberDto.keyWord}, '%' ) |
| | | </if> |
| | | </where> |
| | | order by ccom.create_at desc |
| | | </select> |
| | | |
| | | <select id="pageClusterMemberAdmin" resultType="com.panzhihua.common.model.vos.community.cluster.admin.PageClusterMemberAdminVo"> |
| | | SELECT |
| | | ccom.id, |
| | | ccom.`name`, |
| | | ccom.image_url, |
| | | cco.`name` AS clusterName, |
| | | ccom.job, |
| | | ccom.phone, |
| | | ccom.`status` |
| | | FROM |
| | | com_cluster_organization_member AS ccom |
| | | LEFT JOIN com_cluster_organization AS cco ON cco.id = ccom.cluster_id |
| | | WHERE |
| | | ccom.is_del = 2 |
| | | <if test="pageClusterMemberAdminDto.communityId != null"> |
| | | and ccom.community_id = #{pageClusterMemberAdminDto.communityId} |
| | | </if> |
| | | <if test="pageClusterMemberAdminDto.status != null"> |
| | | and ccom.`status` = #{pageClusterMemberAdminDto.status} |
| | | </if> |
| | | <if test="pageClusterMemberAdminDto.clusterId != null"> |
| | | and ccom.cluster_id = #{pageClusterMemberAdminDto.clusterId} |
| | | </if> |
| | | <if test="pageClusterMemberAdminDto.keyWord != null"> |
| | | and ( |
| | | ccom.`name` like concat(#{pageClusterMemberAdminDto.keyWord}, '%' ) or |
| | | ccom.phone like concat(#{pageClusterMemberAdminDto.keyWord}, '%' ) |
| | | ) |
| | | </if> |
| | | order by ccom.create_at desc |
| | | </select> |
| | | |
| | | <select id="memberNationListAdmin" resultType="com.panzhihua.common.model.vos.community.cluster.admin.ClusterMemberNationVo"> |
| | | SELECT |
| | | dict_value AS nationCode, |
| | | dict_item_name AS nationName |
| | | FROM |
| | | bc_dictionary_item |
| | | WHERE |
| | | dict_id = ( |
| | | SELECT |
| | | id |
| | | FROM |
| | | bc_dictionary |
| | | WHERE |
| | | `dict_key` = #{key}) |
| | | </select> |
| | | |
| | | <select id="getNationCode" resultType="Map"> |
| | | SELECT |
| | | dict_value |
| | | FROM |
| | | bc_dictionary_item |
| | | WHERE |
| | | dict_id = ( SELECT id FROM bc_dictionary WHERE dict_key =#{key} ) |
| | | AND dict_item_name = #{nationName} |
| | | </select> |
| | | |
| | | <select id="exportClusterMember" resultType="com.panzhihua.common.model.vos.community.cluster.admin.ComClusterMemberExcelExportAdminVO"> |
| | | SELECT |
| | | ccom.`name`, |
| | | cco.`name` AS clusterName, |
| | | ccom.job, |
| | | ccom.phone, |
| | | case ccom.`status` |
| | | when '1' then '启用' |
| | | when '2' then '禁用' |
| | | end |
| | | FROM |
| | | com_cluster_organization_member AS ccom |
| | | LEFT JOIN com_cluster_organization AS cco ON cco.id = ccom.cluster_id |
| | | WHERE |
| | | ccom.is_del = 2 |
| | | <if test="pageClusterMemberAdminDto.communityId != null"> |
| | | and ccom.community_id = #{pageClusterMemberAdminDto.communityId} |
| | | </if> |
| | | <if test="pageClusterMemberAdminDto.status != null"> |
| | | and ccom.`status` = #{pageClusterMemberAdminDto.status} |
| | | </if> |
| | | <if test="pageClusterMemberAdminDto.clusterId != null"> |
| | | and ccom.cluster_id = #{pageClusterMemberAdminDto.clusterId} |
| | | </if> |
| | | <if test="pageClusterMemberAdminDto.keyWord != null"> |
| | | and ( |
| | | ccom.`name` like concat(#{pageClusterMemberAdminDto.keyWord}, '%' ) or |
| | | ccom.phone like concat(#{pageClusterMemberAdminDto.keyWord}, '%' ) |
| | | ) |
| | | </if> |
| | | order by ccom.create_at desc |
| | | </select> |
| | | </mapper> |