101captain
2022-05-19 f0f925ca104354dccbe8645275ec2c5afa1d7817
花城E+bug更新
3个文件已修改
18 ■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngVillageServeExcelListen.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/VillageApi.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVillageServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngVillageServeExcelListen.java
@@ -11,7 +11,9 @@
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.ComMngVillageServeExcelVO;
import com.panzhihua.common.model.vos.user.CommunityUserInfoVO;
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.common.utlis.Snowflake;
import lombok.extern.slf4j.Slf4j;
@@ -26,10 +28,12 @@
    private static final int BATCH_COUNT = 100;
    private CommunityService communityService;
    private LoginUserInfoVO loginUserInfo;
    private UserService userService;
    private List<ComMngVillageServeExcelVO> list = new ArrayList<>();
    public ComMngVillageServeExcelListen(CommunityService communityService, LoginUserInfoVO loginUserInfo) {
    public ComMngVillageServeExcelListen(CommunityService communityService, LoginUserInfoVO loginUserInfo, UserService userService) {
        this.communityService = communityService;
        this.loginUserInfo = loginUserInfo;
        this.userService=userService;
    }
    @Override
@@ -40,7 +44,11 @@
        catch (Exception e){
            throw new ServiceException("门牌号只能为纯数字");
        }
        comMngVillageServeExcelVO.setAddress("四川省-攀枝花市-"+loginUserInfo.getAreaName()+comMngVillageServeExcelVO.getAlley()+"+"+comMngVillageServeExcelVO.getHouseNum());
        R r1=userService.detailUser(loginUserInfo.getUserId());
        if(R.isOk(r1)){
            LoginUserInfoVO loginUserInfoVO=JSONObject.parseObject(JSONObject.toJSONString(r1.getData()), LoginUserInfoVO.class);
            comMngVillageServeExcelVO.setAddress("四川省-攀枝花市-"+loginUserInfoVO.getAreaName()+comMngVillageServeExcelVO.getAlley()+"+"+comMngVillageServeExcelVO.getHouseNum());
        }
        list.add(comMngVillageServeExcelVO);
        // 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM
        if (list.size() >= BATCH_COUNT) {
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/VillageApi.java
@@ -9,6 +9,7 @@
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.common.utlis.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
@@ -44,6 +45,8 @@
    private String excelConvenientUrl;
    @Resource
    private CommunityService communityService;
    @Resource
    private UserService userService;
    @ApiOperation(value = "分页查询小区", response = ComMngVillageVO.class)
    @PostMapping("pagevillage")
@@ -106,7 +109,7 @@
            inputStream = file.getInputStream();
            LoginUserInfoVO loginUserInfo = this.getLoginUserInfo();
            ComMngVillageServeExcelListen comMngVillageServeExcelListen =
                new ComMngVillageServeExcelListen(communityService, loginUserInfo);
                new ComMngVillageServeExcelListen(communityService, loginUserInfo,userService);
            EasyExcel.read(inputStream, ComMngVillageServeExcelVO.class, comMngVillageServeExcelListen).sheet()
                .doRead();
        } catch (IOException e) {
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVillageServiceImpl.java
@@ -218,6 +218,7 @@
            path.append(vo.getAlley()).append(">").append(vo.getHouseNum()).append(">").append(vo.getGroupAt());
            comMngVillageDO.setPath(path.toString());
            comMngVillageDO.setUpdateAt(new Date());
            comMngVillageDO.setName(comMngVillageDO.getGroupAt());
            comMngVillageDOS.add(comMngVillageDO);
        });
        this.saveBatch(comMngVillageDOS);