huanghongfa
2021-05-07 2cd6667778d28f6bf3aaa25ac8deed35201b77ef
创建订单返回订单
11个文件已修改
2个文件已添加
187 ■■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/NeighborApi.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngPopulationServeExcelListen.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngRealCompanyExcelListen.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/partybuilding/ComPbMemberExcelVO.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/partybuilding/PartyBuildingService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/ListUtils.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityPartyBuildingApi.java 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/api/PartyBuildIngApi.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/dao/ComPbMemberDAO.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/ComPbMemberService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/ComPbMemberServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/dao/UserDao.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/NeighborApi.java
@@ -6,6 +6,7 @@
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleAppVO;
import com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleDetailAppVO;
import com.panzhihua.common.model.vos.neighbor.ComActNeighborCommentReplyAppVO;
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.utlis.StringUtils;
import io.swagger.annotations.Api;
@@ -151,7 +152,7 @@
        return communityService.neighborAddBrowseByApp(addBrowseAppDTO);
    }
    @ApiOperation(value = "分页查询评论下所有回复")
    @ApiOperation(value = "分页查询评论下所有回复",response = ComActNeighborCommentReplyAppVO.class)
    @PostMapping("comment/reply")
    public R neighborCommentReplyByApp(@RequestBody ComActNeighborCommentReplyAppDTO commentReplyAppDTO) {
        Long userId = this.getLoginUserInfo().getUserId();
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngPopulationServeExcelListen.java
@@ -16,6 +16,7 @@
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.utlis.AgeUtils;
import com.panzhihua.common.utlis.IdCardUtil;
import com.panzhihua.common.utlis.ListUtils;
import com.panzhihua.common.utlis.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
@@ -24,6 +25,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * @description: 实有人口导入监听
@@ -183,6 +185,7 @@
                        vo.getUserTagStr().add(headData.get(i).substring(0,headData.get(i).indexOf("(")));
                    }
                }
                voList.add(vo);
                index++;
            }
@@ -195,7 +198,9 @@
//            }else{
//                throw new ServiceException("500", JSON.toJSONString(populationImportErrorVOList));
//            }
            R r = communityService.listSavePopulationServeExcelVO(voList, communityId);
            //根据list中的IdCard城市来去重
            List<ComMngPopulationServeExcelVO> newVoList = voList.stream().filter(ListUtils.distinctByKey(ComMngPopulationServeExcelVO::getCardNo)).collect(Collectors.toList());
            R r = communityService.listSavePopulationServeExcelVO(newVoList, communityId);
            if (!R.isOk(r)) {
                String errMsg = r.getMsg();
                List<ComMngPopulationImportErrorVO> errorList = JSON.parseArray(errMsg,ComMngPopulationImportErrorVO.class);
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngRealCompanyExcelListen.java
@@ -6,12 +6,15 @@
import com.panzhihua.common.exceptions.ServiceException;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.ComMngCarExcelVO;
import com.panzhihua.common.model.vos.community.ComMngPopulationServeExcelVO;
import com.panzhihua.common.model.vos.community.ComMngRealCompanyExcelVO;
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.utlis.ListUtils;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
 * @description: 实有单位导入监听
@@ -40,7 +43,9 @@
        // 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM
        if(list.size() >= BATCH_COUNT){
            log.info("excel导入数据【{}】", JSONObject.toJSONString(list));
            R r = this.communityService.listSaveMngRealCompanyExcelVO(list,this.communityId);
            // 根据list中的creditCode来去重
            List<ComMngRealCompanyExcelVO> newVoList = list.stream().filter(ListUtils.distinctByKey(ComMngRealCompanyExcelVO::getCreditCode)).collect(Collectors.toList());
            R r = this.communityService.listSaveMngRealCompanyExcelVO(newVoList,this.communityId);
            if (!R.isOk(r)) {
                throw new ServiceException(r.getMsg());
            }
@@ -52,7 +57,9 @@
    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
        log.info("excel导入数据【{}】", JSONObject.toJSONString(list));
        R r = this.communityService.listSaveMngRealCompanyExcelVO(list,this.communityId);//确保最后遗留的数据保存在数据库中
        // 根据list中的creditCode来去重
        List<ComMngRealCompanyExcelVO> newVoList = list.stream().filter(ListUtils.distinctByKey(ComMngRealCompanyExcelVO::getCreditCode)).collect(Collectors.toList());
        R r = this.communityService.listSaveMngRealCompanyExcelVO(newVoList,this.communityId);//确保最后遗留的数据保存在数据库中
        if (!R.isOk(r)) {
            throw new ServiceException(r.getMsg());
        }
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/partybuilding/ComPbMemberExcelVO.java
New file
@@ -0,0 +1,33 @@
package com.panzhihua.common.model.vos.partybuilding;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.util.Date;
/**
 * @description: 党员信息导出
 * @author: lyq
 * @date: 2021/5/6 17:48
 */
@Data
public class ComPbMemberExcelVO {
    @ExcelProperty(value = "党员姓名" ,index = 0)
    private String comName;
    @ExcelProperty(value = "身份证号" ,index = 1)
    private String idCard;
    @ExcelProperty(value = "所属党组织" ,index = 2)
    private String orgName;
    @ExcelProperty(value = "入党日期" ,index = 3)
    private Date joinTime;
    @ExcelProperty(value = "转正日期" ,index = 4)
    private Date employmentTime;
    @ExcelProperty(value = "所属社区" ,index = 5)
    private String communityName;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/partybuilding/PartyBuildingService.java
@@ -399,4 +399,12 @@
     */
    @PostMapping("/partybuildIng/deleteprepartybuildingmember")
    R deleteprepartybuildingmember(@RequestParam("id") Long id);
    /**
     * 导出党员信息
     * @param organizationVO    请求参数
     * @return  党员信息列表
     */
    @PostMapping("/partybuildIng/exportPbMember")
    R exportPbMember(@RequestBody PagePartyOrganizationVO organizationVO);
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/ListUtils.java
New file
@@ -0,0 +1,14 @@
package com.panzhihua.common.utlis;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.function.Predicate;
public class ListUtils {
    public static <T> Predicate<T> distinctByKey(Function<? super T, Object> keyExtractor) {
        Map<Object, Boolean> seen = new ConcurrentHashMap<>();
        return t -> seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null;
    }
}
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityPartyBuildingApi.java
@@ -1,16 +1,22 @@
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.alibaba.fastjson.JSONObject;
import com.jcraft.jsch.SftpException;
import com.panzhihua.common.constants.FtpConstants;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.interfaces.OperLog;
import com.panzhihua.common.model.dtos.community.ExportRealCompanyExcelDTO;
import com.panzhihua.common.model.dtos.partybuilding.ComPbServiceTeamDTO;
import com.panzhihua.common.model.dtos.partybuilding.PageComPbServiceTeamDTO;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.ComActMessageVO;
import com.panzhihua.common.model.vos.community.ComMngRealCompanyExcelVO;
import com.panzhihua.common.model.vos.community.ResetComActMessageVO;
import com.panzhihua.common.model.vos.partybuilding.*;
import com.panzhihua.common.model.vos.user.RoleVO;
@@ -20,6 +26,7 @@
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.common.utlis.SFTPUtil;
import com.panzhihua.common.validated.AddGroup;
import com.panzhihua.community_backstage.excel.CustomSheetWriteHandler;
import com.panzhihua.community_backstage.listen.PartyBuildingMemberExcelListen;
import com.panzhihua.community_backstage.model.dto.PartyBuildingMemberDTO;
import io.swagger.annotations.Api;
@@ -35,6 +42,8 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
@@ -60,7 +69,9 @@
    @Resource
    private UserService userService;
    @Value("${excel.url}")
    private String excelUrl = "http://panzhihua.nhys.cdnhxx.com/web/%E7%A4%BE%E5%8C%BA%E5%85%9A%E5%91%98%E6%95%B0%E6%8D%AE%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.xlsx";
    private String excelUrl = "http://panzhihua.nhys.cdnhxx.com/web/";
    @Value("${excel.userurl}")
    private String userurl;
    // FTP 登录用户名
    @Value("${ftp.username}")
    private String userName;
@@ -560,4 +571,58 @@
        return partyBuildingService.deleteprepartybuildingmember(id);
    }
    @ApiOperation(value = "党员信息导出Excel")
    @PostMapping("/member/export")
    public R exportPbMember(@RequestBody PagePartyOrganizationVO organizationVO) {
        organizationVO.setCommunityId(this.getCommunityId());
        String url = userurl;
        String name = "党员信息数据.xlsx";
        String ftpUrl = "/mnt/data/web/excel/";
//        用户搜索了就下载搜索的用户否则下载所有用户
        R r = partyBuildingService.exportPbMember(organizationVO);
        if (R.isOk(r)) {
            List<ComPbMemberExcelVO> eexcelUserDTOS = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), ComPbMemberExcelVO.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, ComPbMemberExcelVO.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).registerWriteHandler(new CustomSheetWriteHandler()).build();
                        WriteSheet writeSheet = EasyExcel.writerSheet("党员信息数据导出").build();
                        excelWriter.write(eexcelUserDTOS, 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(url + name);
            } catch (Exception e) {
                e.printStackTrace();
                log.error("文件传输失败【{}】", e.getMessage());
                return R.fail();
            }
        }
        return R.fail("未查询到用户");
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/api/PartyBuildIngApi.java
@@ -546,4 +546,14 @@
    public R deleteprepartybuildingmember(@RequestParam("id")Long id){
        return R.ok(comPbMemberService.removeById(id));
    }
    /**
     * 导出党员信息
     * @param organizationVO    请求参数
     * @return  党员信息列表
     */
    @PostMapping("exportPbMember")
    public R exportPbMember(@RequestBody PagePartyOrganizationVO organizationVO){
        return comPbMemberService.exportPbMember(organizationVO);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/dao/ComPbMemberDAO.java
@@ -3,6 +3,7 @@
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.vos.partybuilding.ComPbMemberExcelVO;
import com.panzhihua.common.model.vos.partybuilding.PagePartyBuildingMemberVO;
import com.panzhihua.common.model.vos.partybuilding.PagePartyOrganizationVO;
import com.panzhihua.common.model.vos.partybuilding.PartyBuildingMemberVO;
@@ -156,4 +157,22 @@
            " order by m.join_time desc "+
            "</script>")
    IPage<PartyBuildingMemberVO> pagePartyBuildingMembersVO(Page page, @Param("pagePartyBuildingMemberVO") PagePartyBuildingMemberVO pagePartyBuildingMemberVO);
    @Select("<script> " +
            "select cpm.name as comName,cpm.id_card,cpm.join_time,cpm.employment_time,ca.`name` as communityName,cpo.name as orgName from com_pb_member as cpm " +
            " left join com_act as ca on ca.community_id = cpm.community_id " +
            " left join com_pb_org as cpo on cpo.id = cpm.org_id " +
            " LEFT JOIN sys_user u ON cpm.id_card = u.id_card " +
            " where cpm.community_id = #{organizationVO.communityId} " +
            "<if test='organizationVO.orgName != null'>" +
            " and cpo.name LIKE CONCAT('%',#{organizationVO.orgName},'%') "+
            " </if> " +
            "<if test='organizationVO.account != null and organizationVO.account != &quot;&quot;'>" +
            " and u.phone like concat (#{organizationVO.account},'%')"+
            " </if> " +
            "<if test='organizationVO.name != null and organizationVO.name != &quot;&quot;'>" +
            " and cpm.name like concat (#{organizationVO.name},'%')"+
            " </if> " +
            "</script>")
    List<ComPbMemberExcelVO> exportPbMember(@Param("organizationVO") PagePartyOrganizationVO organizationVO);
}
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/ComPbMemberService.java
@@ -133,4 +133,11 @@
     * @return 编辑结果
     */
    R updatePartyBuildingMembers(PartyBuildingMemberVO partyBuildingMemberVO);
    /**
     * 导出党员信息
     * @param organizationVO    请求参数
     * @return  党员信息列表
     */
    R exportPbMember(PagePartyOrganizationVO organizationVO);
}
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/ComPbMemberServiceImpl.java
@@ -507,4 +507,9 @@
        return R.fail();
    }
    @Override
    public R exportPbMember(PagePartyOrganizationVO organizationVO){
        return R.ok(comPbMemberDAO.exportPbMember(organizationVO));
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/dao/UserDao.java
@@ -229,7 +229,7 @@
    @Select("SELECT \n" +
            "COUNT(DISTINCT u.user_id)allUser,\n" +
            "(select COUNT(m.id) from com_mng_volunteer_mng m where m.community_id=#{communityId} and m.`state`=2)volunteerUser,\n" +
            "COUNT(DISTINCT case when u.is_partymember=1 then u.user_id else null end )partymemberUser,\n" +
            " (select count(id) from com_pb_member cpm where cpm.audit_result = 1 and cpm.community_id = #{communityId}) partymemberUser,\n" +
            "COUNT(h.id)house\n" +
            "FROM\n" +
            "sys_user u\n" +
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
@@ -1377,6 +1377,7 @@
    @Override
    public R indexDataCommunityBackstage(Long communityId) {
        IndexDataVO indexDataVO = userDao.indexDataCommunityBackstage(communityId);
        //查询后台党员数量
        return R.ok(indexDataVO);
    }