diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java index a346cc404..89f0795b8 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java @@ -71,6 +71,8 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService { @Autowired private RedisCache redisCache; + + /** * 查询充电站信息 * @@ -134,6 +136,7 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService { // vo.setOrganizationCode(pileStationInfo.getor); vo.setPublicFlag(pileStationInfo.getPublicFlag()); vo.setOpenFlag(pileStationInfo.getOpenFlag()); + vo.setDeptId(pileStationInfo.getDeptId()); if (StringUtils.isNotBlank(pileStationInfo.getPictures())) { vo.setPictures(pileStationInfo.getPictures()); vo.setPictureList(Lists.newArrayList(pileStationInfo.getPictures().split(","))); @@ -249,13 +252,29 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService { * @return 结果 */ @Override + @Transactional(readOnly = false, propagation = Propagation.REQUIRED) public int updatePileStationInfo(PileStationInfo pileStationInfo) { // 清缓存 String redisKey = CacheConstants.SELECT_PILE_STATION_INFO_BY_ID + pileStationInfo.getId(); redisCache.deleteObject(redisKey); + pileStationInfo.setUpdateBy(SecurityUtils.getUsername()); pileStationInfo.setUpdateTime(DateUtils.getNowDate()); - return pileStationInfoMapper.updatePileStationInfo(pileStationInfo); + int i = pileStationInfoMapper.updatePileStationInfo(pileStationInfo); + + // 同步组织中的名称,联系人,电话 + SysDept sysDept = sysDeptService.selectDeptById(Long.parseLong(pileStationInfo.getDeptId())); + if (sysDept != null) { + sysDept.setDeptName(pileStationInfo.getStationName()); + sysDept.setLeader(pileStationInfo.getStationAdminName()); + sysDept.setPhone(pileStationInfo.getStationTel()); + sysDept.setUpdateTime(DateUtils.getNowDate()); + sysDeptService.updateDept(sysDept); + } + + // 再次清缓存 + redisCache.deleteObject(redisKey); + return i; } /** diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/PileStationVO.java b/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/PileStationVO.java index 7eb515ac7..34f28f894 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/PileStationVO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/PileStationVO.java @@ -29,6 +29,11 @@ public class PileStationVO { */ private String stationName; + /** + * 组织id + */ + private String deptId; + /** * 省市辖区编码 */ diff --git a/jsowell-ui/src/views/pile/station/components/SiteInfo.vue b/jsowell-ui/src/views/pile/station/components/SiteInfo.vue index a821a6e5e..161798c23 100644 --- a/jsowell-ui/src/views/pile/station/components/SiteInfo.vue +++ b/jsowell-ui/src/views/pile/station/components/SiteInfo.vue @@ -220,6 +220,7 @@ export default { construction: "", businessHours: "", pictures: "", + deptId: "", }, stationId: this.$route.params.id, publicFlagOptions: [ @@ -293,6 +294,7 @@ export default { ], }, fileList: [], // 用于图片回显 + dialogVisible: null, }; }, created() { @@ -325,9 +327,11 @@ export default { const res = await getStationInfo(this.stationId); console.log(res); this.station = res.data; - var pictures = res.data.pictures.split(','); - for (let i = 0; i < pictures.length; i++) { - this.fileList.push({"url": pictures[i]}); + if (res.data.pictures != null) { + var pictures = res.data.pictures.split(','); + for (let i = 0; i < pictures.length; i++) { + this.fileList.push({"url": pictures[i]}); + } } console.log("queryStationInfo表格数据", this.station); },