From 2e64c232ab6b51b2cecf1ee96e1e9b709234f326 Mon Sep 17 00:00:00 2001 From: huanghongfa <huanghongfa123456> Date: 星期六, 21 八月 2021 16:35:14 +0800 Subject: [PATCH] 随手拍改版接口开发 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngCarServiceImpl.java | 47 +++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 39 insertions(+), 8 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngCarServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngCarServiceImpl.java index 17a626f..ea5703a 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngCarServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngCarServiceImpl.java @@ -7,20 +7,26 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.panzhihua.common.model.dtos.community.ComMngCarAppletDTO; import com.panzhihua.common.model.dtos.community.ComMngCarSaveDTO; +import com.panzhihua.common.model.dtos.community.ExportComMngCarExcelDTO; import com.panzhihua.common.model.dtos.community.PageComMngCarDTO; +import com.panzhihua.common.model.helper.AESUtil; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.ComMngCarExcelVO; import com.panzhihua.common.model.vos.community.ComMngCarVO; +import com.panzhihua.common.model.vos.community.ComMngRealCompanyExcelVO; import com.panzhihua.common.model.vos.user.SysUserVO; import com.panzhihua.common.service.user.UserService; import com.panzhihua.common.utlis.ParamRegularUtil; import com.panzhihua.service_community.dao.ComMngCarDAO; import com.panzhihua.service_community.dao.ComMngStructAreaDAO; +import com.panzhihua.service_community.dao.ComMngVillageDAO; import com.panzhihua.service_community.model.dos.ComCvtServeDO; import com.panzhihua.service_community.model.dos.ComMngCarDO; import com.panzhihua.service_community.model.dos.ComMngStructAreaDO; +import com.panzhihua.service_community.model.dos.ComMngVillageDO; import com.panzhihua.service_community.service.ComMngCarService; import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.util.ObjectUtils; @@ -40,7 +46,11 @@ @Resource private ComMngStructAreaDAO comMngStructAreaDAO; @Resource + private ComMngVillageDAO comMngVillageDAO; + @Resource private UserService userService; + @Value("${domain.aesKey:}") + private String aesKey; @Override @@ -96,22 +106,32 @@ if (!carResult) { return R.fail("车牌号有误!"); } - ComMngCarDO exist = comMngCarDAO.selectOne(new QueryWrapper<ComMngCarDO>() - .lambda().eq(ComMngCarDO::getPlateNum, comMngCarSaveDTO.getPlateNum())); - if (exist != null) { - return R.ok("车辆已存在"); + if (comMngCarSaveDTO.getId()==null) { + List<ComMngCarDO> existList = comMngCarDAO.selectList(new QueryWrapper<ComMngCarDO>() + .lambda().eq(ComMngCarDO::getPlateNum, comMngCarSaveDTO.getPlateNum())); + if (!existList.isEmpty()) { + return R.ok("车辆已存在"); + } } - ComMngStructAreaDO comMngStructAreaDO = comMngStructAreaDAO.selectById(comMngCarSaveDTO.getAreaId()); - if (ObjectUtils.isEmpty(comMngStructAreaDO)) { + ComMngVillageDO comMngVillageDO = comMngVillageDAO.selectById(comMngCarSaveDTO.getAreaId()); + if (ObjectUtils.isEmpty(comMngVillageDO)) { return R.fail("小区不存在"); } if (ObjectUtils.isEmpty(comMngCarSaveDTO.getMobile())) { return R.fail("车主手机号码不能为空"); } + if (ObjectUtils.isEmpty(comMngCarSaveDTO.getCardNo())) { + return R.fail("车主身份证号码不能为空"); + } ComMngCarDO comMngCarDO = new ComMngCarDO(); BeanUtils.copyProperties(comMngCarSaveDTO, comMngCarDO); - comMngCarDO.setAreaName(comMngStructAreaDO.getAreaName()); - comMngCarDO.setCommunityId(comMngStructAreaDO.getCommunityId()); + comMngCarDO.setAreaName(comMngVillageDO.getGroupAt()); + comMngCarDO.setCommunityId(comMngVillageDO.getCommunityId()); + try { + comMngCarDO.setCardNo(AESUtil.encrypt128(comMngCarSaveDTO.getCardNo(),aesKey)); + }catch (Exception e){ + + } comMngCarDO.setCreateAt(new Date()); comMngCarDO.setSource(2); R<SysUserVO> sysUserVOR = userService.getSysUserVOByPhone(comMngCarSaveDTO.getMobile()); @@ -157,6 +177,11 @@ if (count == 0 && areaMap.containsKey(vo.getAreaName())) { ComMngCarDO comMngCarDO = new ComMngCarDO(); BeanUtils.copyProperties(vo, comMngCarDO); + try { + comMngCarDO.setCardNo(AESUtil.encrypt128(vo.getCardNo(),aesKey)); + }catch (Exception e){ + + } comMngCarDO.setCommunityId(communityId); comMngCarDO.setAreaId(areaMap.get(vo.getAreaName()).getId()); R<SysUserVO> sysUserVOR = userService.getSysUserVOByPhone(vo.getMobile()); @@ -171,4 +196,10 @@ this.saveBatch(comMngCarDOS); return R.ok("共计导入车辆数量:" + comMngCarDOS.size()); } + + @Override + public R exportRealCar(ExportComMngCarExcelDTO exportComMngCarExcelDTO) { + List<ComMngCarExcelVO> list = comMngCarDAO.exportRealCar(exportComMngCarExcelDTO); + return R.ok(list); + } } -- Gitblit v1.7.1