Null
2021-03-18 849ee6b0cb34f3c2e400d596da7384ce57721eb0
车辆导入
2个文件已修改
24 ■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommonDataApi.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngCarServiceImpl.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommonDataApi.java
@@ -4,6 +4,7 @@
import com.jcraft.jsch.SftpException;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.listen.ComCvtServeExcelListen;
import com.panzhihua.common.listen.ComMngCarExcelListen;
import com.panzhihua.common.model.dtos.community.ComMngCarSaveDTO;
import com.panzhihua.common.model.dtos.community.PageComMngCarDTO;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
@@ -94,7 +95,7 @@
        InputStream inputStream = null;
        try {
            inputStream = file.getInputStream();
            EasyExcel.read(inputStream, ComMngCarExcelVO.class, new ComCvtServeExcelListen(communityService,this.getCommunityId())).sheet().doRead();
            EasyExcel.read(inputStream, ComMngCarExcelVO.class, new ComMngCarExcelListen(communityService,this.getCommunityId())).sheet().doRead();
        } catch (IOException e) {
            e.printStackTrace();
            log.error("导入模板失败【{}】", e.getMessage());
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngCarServiceImpl.java
@@ -24,9 +24,7 @@
import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
/**
 * @description:
@@ -42,6 +40,7 @@
    private ComMngStructAreaDAO comMngStructAreaDAO;
    @Resource
    private UserService userService;
    @Override
    public R addComMngCarApplet(ComMngCarAppletDTO comCvtBusinessDTO) {
@@ -140,13 +139,27 @@
    @Override
    public R listSaveMngCarExcelVO(List<ComMngCarExcelVO> list, Long communityId) {
        //获取社区下所有的小区
        List<ComMngStructAreaDO> comMngStructAreaDOs = comMngStructAreaDAO.selectList(new QueryWrapper<ComMngStructAreaDO>().lambda().eq(ComMngStructAreaDO::getCommunityId,communityId));
        Map<String,ComMngStructAreaDO> areaMap = new HashMap<>(comMngStructAreaDOs.size());
        comMngStructAreaDOs.forEach(comMngStructAreaDO->{
            areaMap.put(comMngStructAreaDO.getAreaName(),comMngStructAreaDO);
        });
        List<ComMngCarDO> comMngCarDOS = new ArrayList<>();
        list.forEach(vo->{
            int count = comMngCarDAO.selectCount(new QueryWrapper<ComMngCarDO>()
                    .lambda().eq(ComMngCarDO::getPlateNum, vo.getPlateNum()).and(wrapper->wrapper.eq(ComMngCarDO::getSource,2)));
            if(count==0){
            if(count==0 && areaMap.containsKey(vo.getAreaName())){
                ComMngCarDO comMngCarDO = new ComMngCarDO();
                BeanUtils.copyProperties(vo,comMngCarDO);
                comMngCarDO.setCommunityId(communityId);
                comMngCarDO.setAreaId(areaMap.get(vo.getAreaName()).getId());
                R<SysUserVO> sysUserVOR = userService.getSysUserVOByPhone(vo.getMobile());
                if(R.isOk(sysUserVOR)){
                    SysUserVO sysUserVO = JSONObject.parseObject(JSONObject.toJSONString(sysUserVOR.getData()),SysUserVO.class);
                    comMngCarDO.setUserId(sysUserVO.getUserId());
                }
                comMngCarDO.setSource(2);
                comMngCarDOS.add(comMngCarDO);
            }
        });