Merge remote-tracking branch 'origin/master'
11 files modified
15 files added
| | |
| | | import com.alibaba.excel.metadata.CellData; |
| | | import com.alibaba.excel.metadata.GlobalConfiguration; |
| | | import com.alibaba.excel.metadata.property.ExcelContentProperty; |
| | | import com.github.xiaoymin.knife4j.core.util.StrUtil; |
| | | import org.springblade.common.cache.DictBizCache; |
| | | import org.springblade.common.utils.SpringUtils; |
| | | import org.springblade.modules.system.entity.DictBiz; |
| | | import org.springblade.modules.system.service.IDictBizService; |
| | |
| | | return CellDataTypeEnum.STRING; |
| | | } |
| | | |
| | | /** |
| | | * 导入excel 解析到java 对象 |
| | | * @param cellData |
| | | * @param excelContentProperty |
| | | * @param globalConfiguration |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public String convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception { |
| | | return null; |
| | | // 获取字典类型 |
| | | Field field = excelContentProperty.getField(); |
| | | ExcelDictItemLabel excel = field.getAnnotation(ExcelDictItemLabel.class); |
| | | String dictType = excel.type(); |
| | | // 为空返回 |
| | | String dictLabel = cellData.getStringValue(); |
| | | if (StrUtil.isBlank(dictLabel)) { |
| | | return dictLabel; |
| | | } |
| | | // 查询字典 |
| | | List<DictBiz> list = DictBizCache.getList(dictType); |
| | | //解析返回 |
| | | String key = ""; |
| | | for (DictBiz dictBiz : list) { |
| | | if (dictBiz.getDictValue().equals(dictLabel)){ |
| | | key = dictBiz.getDictKey(); |
| | | break; |
| | | } |
| | | } |
| | | // 返回key |
| | | return key; |
| | | } |
| | | |
| | | /** |
| | |
| | | Field field = excelContentProperty.getField(); |
| | | ExcelDictItem excel = field.getAnnotation(ExcelDictItem.class); |
| | | String dictType = excel.type(); |
| | | IDictBizService dictBizService = SpringUtils.getBean(IDictBizService.class); |
| | | List<DictBiz> list = dictBizService.getList(dictType); |
| | | List<DictBiz> list = DictBizCache.getList(dictType); |
| | | String value = ""; |
| | | //解析返回 |
| | | for (DictBiz dictBiz : list) { |
| | | if (dictBiz.getDictKey().equals(dictValue)){ |
| | | value = dictBiz.getDictValue(); |
| | | break; |
| | | } |
| | | } |
| | | return new CellData(value); |
| | |
| | | houseEntity.setDistrictCode(doorplateAddressEntity.getAoiCode()); |
| | | houseEntity.setDistrictName(doorplateAddressEntity.getAoiName()); |
| | | houseEntity.setHouseName(doorplateAddressEntity.getAddressName()); |
| | | houseEntity.setFloor(Integer.parseInt(doorplateAddressEntity.getFloor())); |
| | | houseEntity.setFloor(doorplateAddressEntity.getFloor()); |
| | | houseEntity.setBuilding(doorplateAddressEntity.getBuildingName()); |
| | | houseEntity.setUnit(doorplateAddressEntity.getUnitName()); |
| | | houseEntity.setRoom(doorplateAddressEntity.getHouseName()); |
| | |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.house.excel.HouseAndHoldExcel; |
| | | import org.springblade.modules.house.excel.HouseAndHoldImporter; |
| | | import org.springblade.modules.house.excel.HouseImporter; |
| | | import org.springblade.modules.house.vo.HouseParam; |
| | | import org.springblade.modules.house.excel.HouseExcel; |
| | |
| | | /** |
| | | * 导入房屋 |
| | | */ |
| | | @GetMapping("import-house") |
| | | @PostMapping("import-house") |
| | | public R importHouse(MultipartFile file, Integer isCovered) { |
| | | HouseImporter houseImporter = new HouseImporter(houseService, isCovered == 1); |
| | | ExcelUtil.save(file, houseImporter, HouseExcel.class); |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导入房屋及住户/租户人员数据 |
| | | */ |
| | | @PostMapping("import-houseAndHold") |
| | | public R importHouseAndHold(MultipartFile file, Integer isCovered) { |
| | | HouseAndHoldImporter houseImporter = new HouseAndHoldImporter(houseService, isCovered == 1); |
| | | ExcelUtil.save(file, houseImporter, HouseAndHoldExcel.class); |
| | | return R.success("操作成功"); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | * 楼层 |
| | | */ |
| | | @ApiModelProperty(value = "楼层") |
| | | private Integer floor; |
| | | private String floor; |
| | | /** |
| | | * 幢 |
| | | */ |
| New file |
| | |
| | | package org.springblade.modules.house.excel; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnore; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.alibaba.excel.annotation.write.style.ColumnWidth; |
| | | import com.alibaba.excel.annotation.write.style.ContentRowHeight; |
| | | import com.alibaba.excel.annotation.write.style.HeadRowHeight; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | import org.springblade.common.excel.ExcelDictConverter; |
| | | import org.springblade.common.excel.ExcelDictItem; |
| | | import org.springblade.common.excel.ExcelDictItemLabel; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * HouseExcel |
| | | * |
| | | * @author Chill |
| | | */ |
| | | @Data |
| | | @ColumnWidth(25) |
| | | @HeadRowHeight(20) |
| | | @ContentRowHeight(18) |
| | | public class HouseAndHoldExcel implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 2L; |
| | | |
| | | /** 门牌地址编码 */ |
| | | @ExcelProperty( "门牌地址编码") |
| | | private String houseCode; |
| | | |
| | | /** 街道名称 */ |
| | | @ExcelProperty( "街道名称") |
| | | private String streetName; |
| | | |
| | | /** 社区名称 */ |
| | | @ExcelProperty( "社区名称") |
| | | private String communityName; |
| | | |
| | | /** 所属网格 */ |
| | | @ExcelProperty( "所属网格") |
| | | private String gridName; |
| | | |
| | | /** 房屋名称 */ |
| | | @ExcelProperty( "详细地址") |
| | | private String houseName; |
| | | |
| | | /** 小区 */ |
| | | @ExcelProperty( "小区") |
| | | private String districtName; |
| | | |
| | | /** 幢 */ |
| | | @ExcelProperty( "幢") |
| | | private String building; |
| | | |
| | | /** 单元 */ |
| | | @ExcelProperty( "单元") |
| | | private String unit; |
| | | |
| | | /** 楼层 */ |
| | | @ExcelProperty( "楼层") |
| | | private String floor; |
| | | |
| | | /** 室 */ |
| | | @ExcelProperty( "室") |
| | | private String room; |
| | | |
| | | |
| | | /** 面积 */ |
| | | @ExcelProperty( "面积") |
| | | private BigDecimal area; |
| | | |
| | | /** 物业单价 */ |
| | | @ExcelProperty( "物业单价") |
| | | private BigDecimal propertyPrice; |
| | | |
| | | /** 服务到期 */ |
| | | @ExcelProperty( "服务到期") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date serviceDue; |
| | | |
| | | /** 备注 */ |
| | | @ExcelProperty( "备注") |
| | | private String remark; |
| | | |
| | | /** 姓名 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "姓名") |
| | | private String name; |
| | | |
| | | /** 绑定用户--无用 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "绑定用户") |
| | | @ExcelIgnore |
| | | private String bingUser; |
| | | |
| | | /** 手机号 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "手机号") |
| | | private String phoneNumber; |
| | | |
| | | /** 角色 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( value = "角色",converter = ExcelDictConverter.class) |
| | | @ExcelDictItemLabel(type = "roleType") |
| | | private String roleType; |
| | | |
| | | /** 与角色关系(业主,父子,其他) */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( value = "与角色关系",converter = ExcelDictConverter.class) |
| | | @ExcelDictItemLabel(type = "roleRelation") |
| | | private String relationship; |
| | | |
| | | /** 主要联系人 1:是 0:否 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( value = "主要联系人",converter = ExcelDictConverter.class) |
| | | @ExcelDictItemLabel(type = "primaryContactType") |
| | | private String isPrimaryContact; |
| | | |
| | | /** 居住状态 1: 是 0:否 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "居住状态") |
| | | @ExcelIgnore |
| | | private String residentialStatus; |
| | | |
| | | /** 性别 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( value = "性别",converter = ExcelDictConverter.class) |
| | | @ExcelDictItemLabel(type = "sex") |
| | | private String gender; |
| | | |
| | | /** 身份证 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "身份证") |
| | | private String idCard; |
| | | |
| | | /*-----------用户标签-----------*/ |
| | | // /** 退役军人 */ |
| | | // @ColumnWidth(15) |
| | | // @ExcelProperty( "退役军人") |
| | | // private String exServiceman; |
| | | |
| | | /*-----------用户标签-----------*/ |
| | | |
| | | |
| | | /** 是否党员 1:党员 2:群众 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( value = "党员(是/否)",converter = ExcelDictConverter.class) |
| | | @ExcelDictItemLabel(type = "partyEmberType") |
| | | private String partyEmber; |
| | | |
| | | /** 港澳台通行证 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "港澳台通行证") |
| | | private String hkmtPass; |
| | | |
| | | /** 护照 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "护照") |
| | | private String passport; |
| | | |
| | | /** 民族 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( value = "民族",converter = ExcelDictConverter.class) |
| | | @ExcelDictItemLabel(type = "nationType") |
| | | private String ethnicity; |
| | | |
| | | /** 学历 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( value = "学历",converter = ExcelDictConverter.class) |
| | | @ExcelDictItemLabel(type = "educationType") |
| | | private String education; |
| | | |
| | | /** 户籍登记地 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "户籍登记地") |
| | | private String hukouRegistration; |
| | | |
| | | /** 工作状态 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( value = "工作状态",converter = ExcelDictConverter.class) |
| | | @ExcelDictItemLabel(type = "workStatusType") |
| | | private String workStatus; |
| | | |
| | | /** 工作单位 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "工作单位") |
| | | private String employer; |
| | | |
| | | /** 婚姻状态 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( value = "婚姻状态",converter = ExcelDictConverter.class) |
| | | @ExcelDictItemLabel(type = "marriageStatusType") |
| | | private String maritalStatus; |
| | | |
| | | /** 车牌号 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "车牌号") |
| | | private String cardNumber; |
| | | |
| | | /** 其他联系方式 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "其他联系方式") |
| | | private String otherContact; |
| | | // |
| | | // /** 现居住地址 */ |
| | | // @ColumnWidth(15) |
| | | // @ExcelProperty( "现居住地址") |
| | | // private String currentAddress; |
| | | |
| | | /** 残疾证 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "残疾证") |
| | | private String disabilityCert; |
| | | |
| | | /** 备注 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "备注") |
| | | private String remarks; |
| | | |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.house.excel; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springblade.core.excel.support.ExcelImporter; |
| | | import org.springblade.modules.house.service.IHouseService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 人房数据导入类 |
| | | * |
| | | * @author Chill |
| | | */ |
| | | @RequiredArgsConstructor |
| | | public class HouseAndHoldImporter implements ExcelImporter<HouseAndHoldExcel> { |
| | | |
| | | private final IHouseService iHouseService; |
| | | private final Boolean isCovered; |
| | | |
| | | @Override |
| | | public void save(List<HouseAndHoldExcel> data) { |
| | | iHouseService.importHouseAndHold(data, isCovered); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springblade.modules.house.entity.HouseEntity; |
| | | import org.springblade.modules.house.excel.HouseAndHoldExcel; |
| | | import org.springblade.modules.house.vo.HouseParam; |
| | | import org.springblade.modules.house.vo.HouseTree; |
| | | import org.springblade.modules.house.vo.HouseVO; |
| | |
| | | * @return |
| | | */ |
| | | List<HouseTree> getHouseTree(HouseParam houseParam); |
| | | |
| | | /** |
| | | * 人房数据导入 |
| | | * @param data |
| | | * @param isCovered |
| | | */ |
| | | void importHouseAndHold(List<HouseAndHoldExcel> data, Boolean isCovered); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.logging.log4j.util.Strings; |
| | | import org.springblade.common.utils.NodeTreeUtil; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.modules.grid.service.IGridService; |
| | | import org.springblade.modules.house.entity.HouseEntity; |
| | | import org.springblade.modules.house.entity.HouseholdEntity; |
| | | import org.springblade.modules.house.excel.HouseAndHoldExcel; |
| | | import org.springblade.modules.house.service.IHouseholdService; |
| | | import org.springblade.modules.house.vo.HouseParam; |
| | | import org.springblade.modules.house.vo.HouseTree; |
| | | import org.springblade.modules.house.vo.HouseVO; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private IGridService gridService; |
| | | |
| | | @Autowired |
| | | private IHouseholdService householdService; |
| | | |
| | | @Override |
| | | public IPage<HouseVO> selectHousePage(IPage<HouseVO> page, HouseVO house) { |
| | |
| | | } |
| | | return stringList; |
| | | } |
| | | |
| | | /** |
| | | * 人房数据导入 |
| | | * @param data |
| | | * @param isCovered |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void importHouseAndHold(List<HouseAndHoldExcel> data, Boolean isCovered) { |
| | | for (HouseAndHoldExcel houseAndHoldExcel : data) { |
| | | // System.out.println("houseAndHoldExcel = " + houseAndHoldExcel); |
| | | // 保存房屋数据--一个一个插入,防止一个表格中存在多个地址编号相同的数据 |
| | | saveHouseData(houseAndHoldExcel); |
| | | // 保存住户数据(包含标签)--一个一个插入,防止一个表格中存在多个地址编号相同的数据 |
| | | saveHouseholdData(houseAndHoldExcel); |
| | | // 保存租户数据 |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 保存房屋数据 |
| | | * @param houseAndHoldExcel |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveHouseholdData(HouseAndHoldExcel houseAndHoldExcel) { |
| | | // 查询库中是否已存在 |
| | | QueryWrapper<HouseEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("house_code",houseAndHoldExcel.getHouseCode()) |
| | | .eq("is_deleted",0); |
| | | HouseEntity one = getOne(wrapper); |
| | | // 不存在则插入,存在则不操作 |
| | | if (null == one){ |
| | | HouseEntity houseEntity = new HouseEntity(); |
| | | houseEntity.setHouseCode(houseAndHoldExcel.getHouseCode()); |
| | | houseEntity.setHouseName(houseAndHoldExcel.getHouseName()); |
| | | houseEntity.setDistrictName(houseAndHoldExcel.getDistrictName()); |
| | | houseEntity.setUnit(houseAndHoldExcel.getUnit()); |
| | | if (!Strings.isBlank(houseAndHoldExcel.getFloor())){ |
| | | houseEntity.setFloor(houseAndHoldExcel.getFloor()); |
| | | } |
| | | houseEntity.setRoom(houseAndHoldExcel.getRoom()); |
| | | houseEntity.setBuilding(houseAndHoldExcel.getBuilding()); |
| | | houseEntity.setArea(houseAndHoldExcel.getArea()); |
| | | houseEntity.setPropertyPrice(houseAndHoldExcel.getPropertyPrice()); |
| | | houseEntity.setServiceDue(houseAndHoldExcel.getServiceDue()); |
| | | houseEntity.setRemark(houseAndHoldExcel.getRemark()); |
| | | houseEntity.setCreateTime(new Date()); |
| | | houseEntity.setCreateUser(AuthUtil.getUserId().toString()); |
| | | houseEntity.setUpdateTime(new Date()); |
| | | houseEntity.setUpdateUser(AuthUtil.getUserId().toString()); |
| | | // 新增 |
| | | save(houseEntity); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 保存住户数据 |
| | | * @param houseAndHoldExcel |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveHouseData(HouseAndHoldExcel houseAndHoldExcel) { |
| | | // 查询库中是否已存在 |
| | | QueryWrapper<HouseholdEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("house_code",houseAndHoldExcel.getHouseCode()) |
| | | .eq("is_deleted",0) |
| | | .eq("phone_number",houseAndHoldExcel.getPhoneNumber()); |
| | | HouseholdEntity one = householdService.getOne(wrapper); |
| | | // 不存在则插入,存在则不操作 |
| | | if (null == one){ |
| | | HouseholdEntity householdEntity = new HouseholdEntity(); |
| | | householdEntity.setHouseCode(houseAndHoldExcel.getHouseCode()); |
| | | householdEntity.setName(houseAndHoldExcel.getName()); |
| | | householdEntity.setPhoneNumber(houseAndHoldExcel.getPhoneNumber()); |
| | | if (!Strings.isBlank(houseAndHoldExcel.getRoleType())){ |
| | | householdEntity.setRoleType(Integer.parseInt(houseAndHoldExcel.getRoleType())); |
| | | } |
| | | if (!Strings.isBlank(houseAndHoldExcel.getRelationship())){ |
| | | householdEntity.setRelationship(Integer.parseInt(houseAndHoldExcel.getRelationship())); |
| | | } |
| | | if (!Strings.isBlank(houseAndHoldExcel.getIsPrimaryContact())){ |
| | | householdEntity.setIsPrimaryContact(Integer.parseInt(houseAndHoldExcel.getIsPrimaryContact())); |
| | | } |
| | | // 居住状态 |
| | | if (!Strings.isBlank(houseAndHoldExcel.getResidentialStatus())){ |
| | | householdEntity.setResidentialStatus(Integer.parseInt(houseAndHoldExcel.getResidentialStatus())); |
| | | } |
| | | // 性别 |
| | | if (!Strings.isBlank(houseAndHoldExcel.getGender())){ |
| | | householdEntity.setGender(Short.parseShort(houseAndHoldExcel.getGender())); |
| | | } |
| | | householdEntity.setIdCard(houseAndHoldExcel.getIdCard()); |
| | | // 党员 |
| | | if (!Strings.isBlank(houseAndHoldExcel.getPartyEmber())){ |
| | | householdEntity.setPartyEmber(Integer.parseInt(houseAndHoldExcel.getPartyEmber())); |
| | | } |
| | | householdEntity.setHkmtPass(houseAndHoldExcel.getHkmtPass()); |
| | | householdEntity.setPassport(houseAndHoldExcel.getPassport()); |
| | | if (!Strings.isBlank(houseAndHoldExcel.getEthnicity())){ |
| | | householdEntity.setEthnicity(Integer.parseInt(houseAndHoldExcel.getEthnicity())); |
| | | } |
| | | if (!Strings.isBlank(houseAndHoldExcel.getEducation())){ |
| | | householdEntity.setEducation(Integer.parseInt(houseAndHoldExcel.getEducation())); |
| | | } |
| | | householdEntity.setHukouRegistration(houseAndHoldExcel.getHukouRegistration()); |
| | | if (!Strings.isBlank(houseAndHoldExcel.getWorkStatus())){ |
| | | householdEntity.setWorkStatus(Integer.parseInt(houseAndHoldExcel.getWorkStatus())); |
| | | } |
| | | householdEntity.setEmployer(houseAndHoldExcel.getEmployer()); |
| | | if (!Strings.isBlank(houseAndHoldExcel.getMaritalStatus())){ |
| | | householdEntity.setMaritalStatus(Integer.parseInt(houseAndHoldExcel.getMaritalStatus())); |
| | | } |
| | | householdEntity.setCardNumber(houseAndHoldExcel.getCardNumber()); |
| | | householdEntity.setOtherContact(houseAndHoldExcel.getOtherContact()); |
| | | householdEntity.setDisabilityCert(houseAndHoldExcel.getDisabilityCert()); |
| | | householdEntity.setRemark(houseAndHoldExcel.getRemarks()); |
| | | householdEntity.setCreateTime(new Date()); |
| | | householdEntity.setCreateUser(AuthUtil.getUserId()); |
| | | householdEntity.setUpdateTime(new Date()); |
| | | householdEntity.setUpdateUser(AuthUtil.getUserId()); |
| | | // 新增 |
| | | householdService.save(householdEntity); |
| | | } |
| | | } |
| | | } |
| | |
| | | import lombok.AllArgsConstructor; |
| | | import javax.validation.Valid; |
| | | |
| | | import org.springblade.core.excel.util.ExcelUtil; |
| | | import org.springblade.core.secure.BladeUser; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.house.excel.HouseAndHoldExcel; |
| | | import org.springblade.modules.house.excel.HouseAndHoldImporter; |
| | | import org.springblade.modules.place.excel.PlaceAndRelExcel; |
| | | import org.springblade.modules.place.excel.PlaceAndRelImporter; |
| | | import org.springblade.modules.place.excel.PlaceExcel; |
| | | import org.springblade.modules.place.excel.PlaceImporter; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.place.entity.PlaceEntity; |
| | |
| | | import org.springblade.modules.place.wrapper.PlaceWrapper; |
| | | import org.springblade.modules.place.service.IPlaceService; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | /** |
| | | * 场所表 控制器 |
| | |
| | | return R.data(placeService.getDetail(place)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导入场所数据 |
| | | */ |
| | | @PostMapping("/import-place") |
| | | public R importPlace(MultipartFile file, Integer isCovered) { |
| | | PlaceImporter placeImporter = new PlaceImporter(placeService, isCovered == 1); |
| | | ExcelUtil.save(file, placeImporter, PlaceExcel.class); |
| | | return R.success("操作成功"); |
| | | } |
| | | |
| | | /** |
| | | * 导入场所(商超)数据 |
| | | */ |
| | | @PostMapping("/import-placeAndRel") |
| | | public R importPlaceAndRel(MultipartFile file, Integer isCovered) { |
| | | PlaceAndRelImporter placeImporter = new PlaceAndRelImporter(placeService, isCovered == 1); |
| | | ExcelUtil.save(file, placeImporter, PlaceAndRelExcel.class); |
| | | return R.success("操作成功"); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.place.controller; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import lombok.AllArgsConstructor; |
| | | import javax.validation.Valid; |
| | | |
| | | import org.springblade.core.secure.BladeUser; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.place.entity.PlaceRelEntity; |
| | | import org.springblade.modules.place.vo.PlaceRelVO; |
| | | import org.springblade.modules.place.wrapper.PlaceRelWrapper; |
| | | import org.springblade.modules.place.service.IPlaceRelService; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | |
| | | /** |
| | | * 场所区域关联信息表(商超) 控制器 |
| | | * |
| | | * @author BladeX |
| | | * @since 2023-11-20 |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("blade-placeRel/placeRel") |
| | | @Api(value = "场所区域关联信息表(商超)", tags = "场所区域关联信息表(商超)接口") |
| | | public class PlaceRelController { |
| | | |
| | | private final IPlaceRelService placeRelService; |
| | | |
| | | /** |
| | | * 场所区域关联信息表(商超) 详情 |
| | | */ |
| | | @GetMapping("/detail") |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "详情", notes = "传入placeRel") |
| | | public R<PlaceRelVO> detail(PlaceRelEntity placeRel) { |
| | | PlaceRelEntity detail = placeRelService.getOne(Condition.getQueryWrapper(placeRel)); |
| | | return R.data(PlaceRelWrapper.build().entityVO(detail)); |
| | | } |
| | | /** |
| | | * 场所区域关联信息表(商超) 分页 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "分页", notes = "传入placeRel") |
| | | public R<IPage<PlaceRelVO>> list(PlaceRelEntity placeRel, Query query) { |
| | | IPage<PlaceRelEntity> pages = placeRelService.page(Condition.getPage(query), Condition.getQueryWrapper(placeRel)); |
| | | return R.data(PlaceRelWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | /** |
| | | * 场所区域关联信息表(商超) 自定义分页 |
| | | */ |
| | | @GetMapping("/page") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "分页", notes = "传入placeRel") |
| | | public R<IPage<PlaceRelVO>> page(PlaceRelVO placeRel, Query query) { |
| | | IPage<PlaceRelVO> pages = placeRelService.selectPlaceRelPage(Condition.getPage(query), placeRel); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * 场所区域关联信息表(商超) 新增 |
| | | */ |
| | | @PostMapping("/save") |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "新增", notes = "传入placeRel") |
| | | public R save(@Valid @RequestBody PlaceRelEntity placeRel) { |
| | | return R.status(placeRelService.save(placeRel)); |
| | | } |
| | | |
| | | /** |
| | | * 场所区域关联信息表(商超) 修改 |
| | | */ |
| | | @PostMapping("/update") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "修改", notes = "传入placeRel") |
| | | public R update(@Valid @RequestBody PlaceRelEntity placeRel) { |
| | | return R.status(placeRelService.updateById(placeRel)); |
| | | } |
| | | |
| | | /** |
| | | * 场所区域关联信息表(商超) 新增或修改 |
| | | */ |
| | | @PostMapping("/submit") |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "新增或修改", notes = "传入placeRel") |
| | | public R submit(@Valid @RequestBody PlaceRelEntity placeRel) { |
| | | return R.status(placeRelService.saveOrUpdate(placeRel)); |
| | | } |
| | | |
| | | /** |
| | | * 场所区域关联信息表(商超) 删除 |
| | | */ |
| | | @PostMapping("/remove") |
| | | @ApiOperationSupport(order = 7) |
| | | @ApiOperation(value = "逻辑删除", notes = "传入ids") |
| | | public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
| | | return R.status(placeRelService.removeByIds(Func.toLongList(ids))); |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.place.dto; |
| | | |
| | | import org.springblade.modules.place.entity.PlaceRelEntity; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * 场所区域关联信息表(商超) 数据传输对象实体类 |
| | | * |
| | | * @author BladeX |
| | | * @since 2023-11-20 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class PlaceRelDTO extends PlaceRelEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.place.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
| | | import lombok.Data; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springblade.core.tenant.mp.TenantEntity; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | /** |
| | | * 场所区域关联信息表(商超) 实体类 |
| | | * |
| | | * @author BladeX |
| | | * @since 2023-11-20 |
| | | */ |
| | | @Data |
| | | @TableName("jczz_place_rel") |
| | | @ApiModel(value = "PlaceRel对象", description = "场所区域关联信息表(商超)") |
| | | public class PlaceRelEntity implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | @ApiModelProperty("主键id") |
| | | @TableId(value = "id", type = IdType.ASSIGN_ID) |
| | | private Long id; |
| | | /** |
| | | * 场所id |
| | | */ |
| | | @ApiModelProperty(value = "场所id") |
| | | private Long placeId; |
| | | /** |
| | | * 街道名称 |
| | | */ |
| | | @ApiModelProperty(value = "街道名称") |
| | | private String streetName; |
| | | /** |
| | | * 社区名称 |
| | | */ |
| | | @ApiModelProperty(value = "社区名称") |
| | | private String communityName; |
| | | /** |
| | | * 网格名称 |
| | | */ |
| | | @ApiModelProperty(value = "网格名称") |
| | | private String gridName; |
| | | /** |
| | | * 写字楼名称 |
| | | */ |
| | | @ApiModelProperty(value = "写字楼名称") |
| | | private String buildingName; |
| | | /** |
| | | * 门牌号 |
| | | */ |
| | | @ApiModelProperty(value = "门牌号") |
| | | private String doorplateNum; |
| | | /** |
| | | * 楼层 |
| | | */ |
| | | @ApiModelProperty(value = "楼层") |
| | | private String floor; |
| | | |
| | | /** |
| | | * 创建人 |
| | | */ |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | @ApiModelProperty("创建人") |
| | | private Long createUser; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @ApiModelProperty("创建时间") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新人 |
| | | */ |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | @ApiModelProperty("更新人") |
| | | private Long updateUser; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @ApiModelProperty("更新时间") |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty(value = "备注") |
| | | private String remark; |
| | | |
| | | /** |
| | | * 是否删除 |
| | | */ |
| | | @TableLogic |
| | | @ApiModelProperty("是否已删除 0:否 1:是") |
| | | private Integer isDeleted; |
| | | |
| | | } |
| New file |
| | |
| | | package org.springblade.modules.place.excel; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.alibaba.excel.annotation.write.style.ColumnWidth; |
| | | import com.alibaba.excel.annotation.write.style.ContentRowHeight; |
| | | import com.alibaba.excel.annotation.write.style.HeadRowHeight; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * HouseExcel |
| | | * |
| | | * @author Chill |
| | | */ |
| | | @Data |
| | | @ColumnWidth(25) |
| | | @HeadRowHeight(20) |
| | | @ContentRowHeight(18) |
| | | public class PlaceAndRelExcel implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 2L; |
| | | |
| | | /** 序号 */ |
| | | @ExcelProperty( "序号") |
| | | private String idx; |
| | | |
| | | /** 街道名称 */ |
| | | @ExcelProperty( "街道名称") |
| | | private String streetName; |
| | | |
| | | /** 社区名称 */ |
| | | @ExcelProperty( "社区名称") |
| | | private String communityName; |
| | | |
| | | /** 所属网格 */ |
| | | @ExcelProperty( "网格名称") |
| | | private String gridName; |
| | | |
| | | /** 写字楼名称 */ |
| | | @ExcelProperty( "写字楼名称") |
| | | private String buildingName; |
| | | |
| | | /** 门牌号 */ |
| | | @ExcelProperty( "门牌号") |
| | | private String doorplateNum; |
| | | |
| | | /** 楼层 */ |
| | | @ExcelProperty( "楼层") |
| | | private String floor; |
| | | |
| | | /** 经营者 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "经营者") |
| | | private String name; |
| | | |
| | | /** 联系电话 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "联系电话") |
| | | private String phoneNumber; |
| | | |
| | | /** 企业(店铺)名称 */ |
| | | @ColumnWidth(25) |
| | | @ExcelProperty( "企业(店铺)名称") |
| | | private String placeName; |
| | | |
| | | /** 经营地址 */ |
| | | @ExcelProperty( "经营地址") |
| | | private String address; |
| | | |
| | | /** 标签分类代码 */ |
| | | @ExcelProperty( "标签分类代码") |
| | | private String labelCode; |
| | | |
| | | /** 备注 */ |
| | | @ExcelProperty( "备注") |
| | | private String remark; |
| | | |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package org.springblade.modules.place.excel; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springblade.core.excel.support.ExcelImporter; |
| | | import org.springblade.modules.place.service.IPlaceService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 场所(商超)导入类 |
| | | * |
| | | * @author Chill |
| | | */ |
| | | @RequiredArgsConstructor |
| | | public class PlaceAndRelImporter implements ExcelImporter<PlaceAndRelExcel> { |
| | | |
| | | private final IPlaceService placeService; |
| | | private final Boolean isCovered; |
| | | |
| | | @Override |
| | | public void save(List<PlaceAndRelExcel> data) { |
| | | placeService.importAndRelPlace(data, isCovered); |
| | | } |
| | | } |
| New file |
| | |
| | | package org.springblade.modules.place.excel; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.alibaba.excel.annotation.write.style.ColumnWidth; |
| | | import com.alibaba.excel.annotation.write.style.ContentRowHeight; |
| | | import com.alibaba.excel.annotation.write.style.HeadRowHeight; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * HouseExcel |
| | | * |
| | | * @author Chill |
| | | */ |
| | | @Data |
| | | @ColumnWidth(25) |
| | | @HeadRowHeight(20) |
| | | @ContentRowHeight(18) |
| | | public class PlaceExcel implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 2L; |
| | | |
| | | /** 门牌地址编码 */ |
| | | @ExcelProperty( "门牌地址编码") |
| | | private String houseCode; |
| | | |
| | | /** 街道名称 */ |
| | | @ExcelProperty( "街道名称") |
| | | private String streetName; |
| | | |
| | | /** 社区名称 */ |
| | | @ExcelProperty( "社区名称") |
| | | private String communityName; |
| | | |
| | | /** 所属网格 */ |
| | | @ExcelProperty( "所属网格") |
| | | private String gridName; |
| | | |
| | | /** 房屋名称 */ |
| | | @ExcelProperty( "详细地址") |
| | | private String houseName; |
| | | |
| | | /** 姓名 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "姓名") |
| | | private String name; |
| | | |
| | | /** 手机号 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "手机号") |
| | | private String phoneNumber; |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package org.springblade.modules.place.excel; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springblade.core.excel.support.ExcelImporter; |
| | | import org.springblade.modules.place.service.IPlaceService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 场所导入类 |
| | | * |
| | | * @author Chill |
| | | */ |
| | | @RequiredArgsConstructor |
| | | public class PlaceImporter implements ExcelImporter<PlaceExcel> { |
| | | |
| | | private final IPlaceService placeService; |
| | | private final Boolean isCovered; |
| | | |
| | | @Override |
| | | public void save(List<PlaceExcel> data) { |
| | | placeService.importPlace(data, isCovered); |
| | | } |
| | | } |
| | |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springblade.common.node.TreeNode; |
| | | import org.springblade.modules.place.entity.PlaceEntity; |
| | | import org.springblade.modules.place.excel.PlaceAndRelExcel; |
| | | import org.springblade.modules.place.vo.PlaceVO; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | * @return |
| | | */ |
| | | PlaceVO getDetail(@Param("place") PlaceEntity place); |
| | | |
| | | /** |
| | | * 判断商超是否导入 |
| | | * @param placeExcel |
| | | * @return |
| | | */ |
| | | PlaceEntity getPlaceAndRelInfo(@Param("place") PlaceAndRelExcel placeExcel); |
| | | } |
| | |
| | | |
| | | <!--插入用户标签--> |
| | | <insert id="saveUserLabel"> |
| | | insert into jczz_user_label(user_id,label_id,create_time,update_time) |
| | | values(#{userId},#{labelId},now(),now()) |
| | | insert into jczz_user_house_label(user_id,label_id,lable_type) |
| | | values(#{userId},#{labelId},1) |
| | | </insert> |
| | | |
| | | <!--查询所有的场所(手机号不为空)--> |
| | |
| | | and jp.id = #{place.id} |
| | | </if> |
| | | </select> |
| | | |
| | | <!--判断商超是否导入--> |
| | | <select id="getPlaceAndRelInfo" resultType="org.springblade.modules.place.entity.PlaceEntity"> |
| | | select |
| | | jp.* |
| | | from jczz_place jp |
| | | left join jczz_place_rel jpr on jpr.place_id = jp.id and jpr.is_deleted = 0 |
| | | where jp.is_deleted = 0 |
| | | <if test="place.buildingName!=null and place.buildingName!=''"> |
| | | and jpr.building_name = #{place.buildingName} |
| | | </if> |
| | | <if test="place.doorplateNum!=null and place.doorplateNum!=''"> |
| | | and jpr.doorplate_num = #{place.doorplateNum} |
| | | </if> |
| | | <if test="place.placeName!=null and place.placeName!=''"> |
| | | and jp.place_name = #{place.placeName} |
| | | </if> |
| | | limit 1 |
| | | </select> |
| | | </mapper> |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.place.mapper; |
| | | |
| | | import org.springblade.modules.place.entity.PlaceRelEntity; |
| | | import org.springblade.modules.place.vo.PlaceRelVO; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 场所区域关联信息表(商超) Mapper 接口 |
| | | * |
| | | * @author BladeX |
| | | * @since 2023-11-20 |
| | | */ |
| | | public interface PlaceRelMapper extends BaseMapper<PlaceRelEntity> { |
| | | |
| | | /** |
| | | * 自定义分页 |
| | | * |
| | | * @param page |
| | | * @param placeRel |
| | | * @return |
| | | */ |
| | | List<PlaceRelVO> selectPlaceRelPage(IPage page, PlaceRelVO placeRel); |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.springblade.modules.place.mapper.PlaceRelMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="placeRelResultMap" type="org.springblade.modules.place.entity.PlaceRelEntity"> |
| | | <result column="id" property="id"/> |
| | | <result column="place_id" property="placeId"/> |
| | | <result column="street_name" property="streetName"/> |
| | | <result column="community_name" property="communityName"/> |
| | | <result column="grid_name" property="gridName"/> |
| | | <result column="building_name" property="buildingName"/> |
| | | <result column="doorplate_num" property="doorplateNum"/> |
| | | <result column="floor" property="floor"/> |
| | | <result column="create_user" property="createUser"/> |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="update_user" property="updateUser"/> |
| | | <result column="update_time" property="updateTime"/> |
| | | <result column="remark" property="remark"/> |
| | | <result column="is_deleted" property="isDeleted"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="selectPlaceRelPage" resultMap="placeRelResultMap"> |
| | | select * from jczz_place_rel where is_deleted = 0 |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.place.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springblade.modules.place.entity.PlaceRelEntity; |
| | | import org.springblade.modules.place.vo.PlaceRelVO; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | |
| | | /** |
| | | * 场所区域关联信息表(商超) 服务类 |
| | | * |
| | | * @author BladeX |
| | | * @since 2023-11-20 |
| | | */ |
| | | public interface IPlaceRelService extends IService<PlaceRelEntity> { |
| | | |
| | | /** |
| | | * 自定义分页 |
| | | * |
| | | * @param page |
| | | * @param placeRel |
| | | * @return |
| | | */ |
| | | IPage<PlaceRelVO> selectPlaceRelPage(IPage<PlaceRelVO> page, PlaceRelVO placeRel); |
| | | |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springblade.common.node.TreeNode; |
| | | import org.springblade.modules.place.entity.PlaceEntity; |
| | | import org.springblade.modules.place.excel.PlaceAndRelExcel; |
| | | import org.springblade.modules.place.excel.PlaceExcel; |
| | | import org.springblade.modules.place.vo.PlaceVO; |
| | | import org.springblade.core.mp.base.BaseService; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | * @return |
| | | */ |
| | | PlaceVO getDetail(PlaceEntity place); |
| | | |
| | | /** |
| | | * 场所数据到导入 |
| | | * @param data |
| | | * @param isCovered |
| | | */ |
| | | void importPlace(List<PlaceExcel> data, Boolean isCovered); |
| | | |
| | | /** |
| | | * 场所(商超)导入 |
| | | * @param data |
| | | * @param isCovered |
| | | */ |
| | | void importAndRelPlace(List<PlaceAndRelExcel> data, Boolean isCovered); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.place.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.modules.place.entity.PlaceRelEntity; |
| | | import org.springblade.modules.place.vo.PlaceRelVO; |
| | | import org.springblade.modules.place.mapper.PlaceRelMapper; |
| | | import org.springblade.modules.place.service.IPlaceRelService; |
| | | import org.springblade.core.mp.base.BaseServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | |
| | | /** |
| | | * 场所区域关联信息表(商超) 服务实现类 |
| | | * |
| | | * @author BladeX |
| | | * @since 2023-11-20 |
| | | */ |
| | | @Service |
| | | public class PlaceRelServiceImpl extends ServiceImpl<PlaceRelMapper, PlaceRelEntity> implements IPlaceRelService { |
| | | |
| | | @Override |
| | | public IPage<PlaceRelVO> selectPlaceRelPage(IPage<PlaceRelVO> page, PlaceRelVO placeRel) { |
| | | return page.setRecords(baseMapper.selectPlaceRelPage(page, placeRel)); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.logging.log4j.util.Strings; |
| | | import org.springblade.common.node.TreeNode; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | |
| | | import org.springblade.modules.place.entity.PlaceEntity; |
| | | import org.springblade.modules.place.entity.PlaceExtEntity; |
| | | import org.springblade.modules.place.entity.PlacePoiLabel; |
| | | import org.springblade.modules.place.entity.PlaceRelEntity; |
| | | import org.springblade.modules.place.excel.PlaceAndRelExcel; |
| | | import org.springblade.modules.place.excel.PlaceExcel; |
| | | import org.springblade.modules.place.service.IPlaceExtService; |
| | | import org.springblade.modules.place.service.IPlacePoiLabelService; |
| | | import org.springblade.modules.place.service.IPlaceRelService; |
| | | import org.springblade.modules.place.vo.PlaceVO; |
| | | import org.springblade.modules.place.mapper.PlaceMapper; |
| | | import org.springblade.modules.place.service.IPlaceService; |
| | |
| | | |
| | | @Autowired |
| | | private IPlaceExtService placeExtService; |
| | | |
| | | @Autowired |
| | | private IPlaceRelService placeRelService; |
| | | |
| | | @Autowired |
| | | private IDoorplateAddressService doorplateAddressService; |
| | |
| | | if (user != null) { |
| | | //如果用户存在,则该用户id绑定场所 |
| | | placeVO.setPrincipalUserId(user.getId()); |
| | | newUser = user; |
| | | } else { |
| | | //如果用户不存在,则新增一个用户 |
| | | newUser.setAccount(placeVO.getPhone()); |
| | |
| | | // 返回 |
| | | return placeVO; |
| | | } |
| | | |
| | | /** |
| | | * 场所数据到导入 |
| | | * @param data |
| | | * @param isCovered |
| | | */ |
| | | @Override |
| | | public void importPlace(List<PlaceExcel> data, Boolean isCovered) { |
| | | for (PlaceExcel placeExcel : data) { |
| | | // 判断是否存在,不存在则插入,否则不操作 |
| | | QueryWrapper<PlaceEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("is_deleted",0) |
| | | .eq("house_code",placeExcel.getHouseCode()); |
| | | PlaceEntity one = getOne(wrapper); |
| | | if (null == one){ |
| | | Long userId = updateUser(placeExcel); |
| | | // 插入场所 |
| | | PlaceEntity placeEntity = new PlaceEntity(); |
| | | placeEntity.setHouseCode(placeExcel.getHouseCode()); |
| | | placeEntity.setPrincipalUserId(userId); |
| | | placeEntity.setCreateTime(new Date()); |
| | | placeEntity.setCreateUser(AuthUtil.getUserId()); |
| | | placeEntity.setUpdateTime(new Date()); |
| | | placeEntity.setUpdateUser(AuthUtil.getUserId()); |
| | | //一个一个插入,防止同一个表中有相同的数据 |
| | | save(placeEntity); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 更新用户信息 |
| | | * @param placeExcel |
| | | * @return |
| | | */ |
| | | public Long updateUser(PlaceExcel placeExcel) { |
| | | if (!Strings.isBlank(placeExcel.getPhoneNumber()) && |
| | | !Strings.isBlank(placeExcel.getName())) { |
| | | PlaceVO placeVO = new PlaceVO(); |
| | | placeVO.setPhone(placeExcel.getPhoneNumber()); |
| | | placeVO.setUsername(placeExcel.getName()); |
| | | // 更新场所负责人 |
| | | User user = bindUserHandle(placeVO); |
| | | // 返回 |
| | | return user.getId(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 更新用户信息 |
| | | * @param placeExcel |
| | | * @return |
| | | */ |
| | | public Long updateUser(PlaceAndRelExcel placeExcel) { |
| | | if (!Strings.isBlank(placeExcel.getPhoneNumber()) && |
| | | !Strings.isBlank(placeExcel.getName())) { |
| | | PlaceVO placeVO = new PlaceVO(); |
| | | placeVO.setPhone(placeExcel.getPhoneNumber()); |
| | | placeVO.setUsername(placeExcel.getName()); |
| | | // 更新场所负责人 |
| | | User user = bindUserHandle(placeVO); |
| | | // 返回 |
| | | return user.getId(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 场所(商超)导入 |
| | | * @param data |
| | | * @param isCovered |
| | | */ |
| | | @Override |
| | | public void importAndRelPlace(List<PlaceAndRelExcel> data, Boolean isCovered) { |
| | | for (PlaceAndRelExcel placeExcel : data) { |
| | | // 判断是否存在,不存在则插入,否则不操作 |
| | | PlaceEntity one = baseMapper.getPlaceAndRelInfo(placeExcel); |
| | | if (null == one){ |
| | | Long userId = updateUser(placeExcel); |
| | | // 插入场所 |
| | | PlaceEntity placeEntity = new PlaceEntity(); |
| | | placeEntity.setPlaceName(placeExcel.getPlaceName()); |
| | | placeEntity.setLocaltion(placeExcel.getAddress()); |
| | | placeEntity.setPrincipalUserId(userId); |
| | | placeEntity.setCreateTime(new Date()); |
| | | placeEntity.setCreateUser(AuthUtil.getUserId()); |
| | | placeEntity.setUpdateTime(new Date()); |
| | | placeEntity.setUpdateUser(AuthUtil.getUserId()); |
| | | //一个一个插入,防止同一个表中有相同的数据 |
| | | save(placeEntity); |
| | | // 插入标签关系表 |
| | | savPlaceLabelBind(placeExcel,placeEntity); |
| | | // 插入关联数据表 |
| | | PlaceRelEntity placeRelEntity = new PlaceRelEntity(); |
| | | placeRelEntity.setPlaceId(placeEntity.getId()); |
| | | placeRelEntity.setStreetName(placeExcel.getStreetName()); |
| | | placeRelEntity.setCommunityName(placeExcel.getCommunityName()); |
| | | placeRelEntity.setGridName(placeExcel.getGridName()); |
| | | placeRelEntity.setBuildingName(placeExcel.getBuildingName()); |
| | | placeRelEntity.setDoorplateNum(placeExcel.getDoorplateNum()); |
| | | placeRelEntity.setFloor(placeExcel.getFloor()); |
| | | placeRelEntity.setCreateTime(new Date()); |
| | | placeRelEntity.setCreateUser(AuthUtil.getUserId()); |
| | | placeRelEntity.setUpdateTime(new Date()); |
| | | placeRelEntity.setUpdateUser(AuthUtil.getUserId()); |
| | | // 新增 |
| | | placeRelService.save(placeRelEntity); |
| | | }else { |
| | | // 只更新商铺信息 |
| | | Long userId = updateUser(placeExcel); |
| | | // 插入场所 |
| | | PlaceEntity placeEntity = new PlaceEntity(); |
| | | placeEntity.setId(one.getId()); |
| | | placeEntity.setPlaceName(placeExcel.getPlaceName()); |
| | | placeEntity.setLocaltion(placeExcel.getAddress()); |
| | | placeEntity.setPrincipalUserId(userId); |
| | | placeEntity.setCreateTime(new Date()); |
| | | placeEntity.setCreateUser(AuthUtil.getUserId()); |
| | | placeEntity.setUpdateTime(new Date()); |
| | | placeEntity.setUpdateUser(AuthUtil.getUserId()); |
| | | //一个一个插入,防止同一个表中有相同的数据 |
| | | updateById(placeEntity); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 插入标签关系表 |
| | | * @param placeExcel |
| | | */ |
| | | public void savPlaceLabelBind(PlaceAndRelExcel placeExcel,PlaceEntity placeEntity) { |
| | | if (!Strings.isBlank(placeExcel.getLabelCode())){ |
| | | PlaceVO placeVO = new PlaceVO(); |
| | | placeVO.setId(placeEntity.getId()); |
| | | placeVO.setLabel(placeExcel.getLabelCode()); |
| | | // 插入标签 |
| | | placeLabelBind(placeVO); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.place.vo; |
| | | |
| | | import org.springblade.modules.place.entity.PlaceRelEntity; |
| | | import org.springblade.core.tool.node.INode; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * 场所区域关联信息表(商超) 视图实体类 |
| | | * |
| | | * @author BladeX |
| | | * @since 2023-11-20 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class PlaceRelVO extends PlaceRelEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.place.wrapper; |
| | | |
| | | import org.springblade.core.mp.support.BaseEntityWrapper; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.modules.place.entity.PlaceRelEntity; |
| | | import org.springblade.modules.place.vo.PlaceRelVO; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 场所区域关联信息表(商超) 包装类,返回视图层所需的字段 |
| | | * |
| | | * @author BladeX |
| | | * @since 2023-11-20 |
| | | */ |
| | | public class PlaceRelWrapper extends BaseEntityWrapper<PlaceRelEntity, PlaceRelVO> { |
| | | |
| | | public static PlaceRelWrapper build() { |
| | | return new PlaceRelWrapper(); |
| | | } |
| | | |
| | | @Override |
| | | public PlaceRelVO entityVO(PlaceRelEntity placeRel) { |
| | | PlaceRelVO placeRelVO = Objects.requireNonNull(BeanUtil.copy(placeRel, PlaceRelVO.class)); |
| | | |
| | | //User createUser = UserCache.getUser(placeRel.getCreateUser()); |
| | | //User updateUser = UserCache.getUser(placeRel.getUpdateUser()); |
| | | //placeRelVO.setCreateUserName(createUser.getName()); |
| | | //placeRelVO.setUpdateUserName(updateUser.getName()); |
| | | |
| | | return placeRelVO; |
| | | } |
| | | |
| | | |
| | | } |