From 61c001e3651c81084e3a8496b55d4d6500bbca31 Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Tue, 21 Nov 2023 09:16:02 +0800
Subject: [PATCH] 场所导入,商铺导入修改
---
src/main/java/org/springblade/modules/place/entity/PlaceRelEntity.java | 134 +++++++
src/main/java/org/springblade/modules/place/excel/PlaceAndRelImporter.java | 24 +
src/main/java/org/springblade/modules/place/dto/PlaceRelDTO.java | 34 +
src/main/java/org/springblade/modules/place/service/IPlaceRelService.java | 42 ++
src/main/java/org/springblade/modules/place/service/impl/PlaceServiceImpl.java | 149 ++++++++
src/main/java/org/springblade/modules/place/controller/PlaceController.java | 28 +
src/main/java/org/springblade/modules/place/mapper/PlaceRelMapper.xml | 29 +
src/main/java/org/springblade/modules/place/service/impl/PlaceRelServiceImpl.java | 43 ++
src/main/java/org/springblade/modules/place/wrapper/PlaceRelWrapper.java | 50 ++
src/main/java/org/springblade/modules/place/excel/PlaceImporter.java | 24 +
src/main/java/org/springblade/modules/place/mapper/PlaceMapper.xml | 23 +
src/main/java/org/springblade/modules/place/mapper/PlaceMapper.java | 8
src/main/java/org/springblade/modules/house/excel/HouseAndHoldExcel.java | 70 ++-
src/main/java/org/springblade/modules/place/service/IPlaceService.java | 16
src/main/java/org/springblade/modules/place/vo/PlaceRelVO.java | 35 +
src/main/java/org/springblade/modules/house/service/impl/HouseServiceImpl.java | 25 +
src/main/java/org/springblade/modules/place/controller/PlaceRelController.java | 126 +++++++
src/main/java/org/springblade/modules/place/mapper/PlaceRelMapper.java | 43 ++
src/main/java/org/springblade/modules/place/excel/PlaceAndRelExcel.java | 81 ++++
src/main/java/org/springblade/modules/place/excel/PlaceExcel.java | 55 +++
20 files changed, 1,015 insertions(+), 24 deletions(-)
diff --git a/src/main/java/org/springblade/modules/house/excel/HouseAndHoldExcel.java b/src/main/java/org/springblade/modules/house/excel/HouseAndHoldExcel.java
index 5e06756..1118e78 100644
--- a/src/main/java/org/springblade/modules/house/excel/HouseAndHoldExcel.java
+++ b/src/main/java/org/springblade/modules/house/excel/HouseAndHoldExcel.java
@@ -1,5 +1,6 @@
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;
@@ -28,8 +29,20 @@
private static final long serialVersionUID = 2L;
/** 门牌地址编码 */
- @ExcelProperty( "地址编码")
+ @ExcelProperty( "门牌地址编码")
private String houseCode;
+
+ /** 街道名称 */
+ @ExcelProperty( "街道名称")
+ private String streetName;
+
+ /** 社区名称 */
+ @ExcelProperty( "社区名称")
+ private String communityName;
+
+ /** 所属网格 */
+ @ExcelProperty( "所属网格")
+ private String gridName;
/** 房屋名称 */
@ExcelProperty( "详细地址")
@@ -78,6 +91,12 @@
@ExcelProperty( "姓名")
private String name;
+ /** 绑定用户--无用 */
+ @ColumnWidth(15)
+ @ExcelProperty( "绑定用户")
+ @ExcelIgnore
+ private String bingUser;
+
/** 手机号 */
@ColumnWidth(15)
@ExcelProperty( "手机号")
@@ -103,14 +122,35 @@
/** 居住状态 1: 是 0:否 */
@ColumnWidth(15)
- @ExcelProperty( value = "居住状态",converter = ExcelDictConverter.class)
- @ExcelDictItemLabel(type = "residentialStatusType")
+ @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)
@@ -161,26 +201,20 @@
@ExcelProperty( "车牌号")
private String cardNumber;
-// /** 其他联系方式 */
-// @ColumnWidth(15)
-// @ExcelProperty( "其他联系方式")
-// private String otherContact;
+ /** 其他联系方式 */
+ @ColumnWidth(15)
+ @ExcelProperty( "其他联系方式")
+ private String otherContact;
//
// /** 现居住地址 */
// @ColumnWidth(15)
// @ExcelProperty( "现居住地址")
// private String currentAddress;
-//
-// /** 残疾证 */
-// @ColumnWidth(15)
-// @ExcelProperty( "残疾证")
-// private String disabilityCert;
-//
-// /** 是否党员 1:党员 2:群众 */
-// @ColumnWidth(15)
-// @ExcelProperty( value = "是否党员",converter = ExcelDictConverter.class)
-// @ExcelDictItemLabel(type = "partyEmberType")
-// private Integer partyEmber;
+
+ /** 残疾证 */
+ @ColumnWidth(15)
+ @ExcelProperty( "残疾证")
+ private String disabilityCert;
/** 备注 */
@ColumnWidth(15)
diff --git a/src/main/java/org/springblade/modules/house/service/impl/HouseServiceImpl.java b/src/main/java/org/springblade/modules/house/service/impl/HouseServiceImpl.java
index dc5174f..b7a46aa 100644
--- a/src/main/java/org/springblade/modules/house/service/impl/HouseServiceImpl.java
+++ b/src/main/java/org/springblade/modules/house/service/impl/HouseServiceImpl.java
@@ -36,6 +36,7 @@
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;
@@ -147,9 +148,10 @@
* @param isCovered
*/
@Override
+ @Transactional(rollbackFor = Exception.class)
public void importHouseAndHold(List<HouseAndHoldExcel> data, Boolean isCovered) {
for (HouseAndHoldExcel houseAndHoldExcel : data) {
- System.out.println("houseAndHoldExcel = " + houseAndHoldExcel);
+// System.out.println("houseAndHoldExcel = " + houseAndHoldExcel);
// 保存房屋数据--一个一个插入,防止一个表格中存在多个地址编号相同的数据
saveHouseData(houseAndHoldExcel);
// 保存住户数据(包含标签)--一个一个插入,防止一个表格中存在多个地址编号相同的数据
@@ -162,7 +164,8 @@
* 保存房屋数据
* @param houseAndHoldExcel
*/
- private void saveHouseholdData(HouseAndHoldExcel houseAndHoldExcel) {
+ @Transactional(rollbackFor = Exception.class)
+ public void saveHouseholdData(HouseAndHoldExcel houseAndHoldExcel) {
// 查询库中是否已存在
QueryWrapper<HouseEntity> wrapper = new QueryWrapper<>();
wrapper.eq("house_code",houseAndHoldExcel.getHouseCode())
@@ -175,7 +178,9 @@
houseEntity.setHouseName(houseAndHoldExcel.getHouseName());
houseEntity.setDistrictName(houseAndHoldExcel.getDistrictName());
houseEntity.setUnit(houseAndHoldExcel.getUnit());
- houseEntity.setFloor(houseAndHoldExcel.getFloor());
+ if (!Strings.isBlank(houseAndHoldExcel.getFloor())){
+ houseEntity.setFloor(houseAndHoldExcel.getFloor());
+ }
houseEntity.setRoom(houseAndHoldExcel.getRoom());
houseEntity.setBuilding(houseAndHoldExcel.getBuilding());
houseEntity.setArea(houseAndHoldExcel.getArea());
@@ -195,7 +200,8 @@
* 保存住户数据
* @param houseAndHoldExcel
*/
- private void saveHouseData(HouseAndHoldExcel houseAndHoldExcel) {
+ @Transactional(rollbackFor = Exception.class)
+ public void saveHouseData(HouseAndHoldExcel houseAndHoldExcel) {
// 查询库中是否已存在
QueryWrapper<HouseholdEntity> wrapper = new QueryWrapper<>();
wrapper.eq("house_code",houseAndHoldExcel.getHouseCode())
@@ -217,10 +223,19 @@
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())){
@@ -238,6 +253,8 @@
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());
diff --git a/src/main/java/org/springblade/modules/place/controller/PlaceController.java b/src/main/java/org/springblade/modules/place/controller/PlaceController.java
index 333aefe..c30d9a6 100644
--- a/src/main/java/org/springblade/modules/place/controller/PlaceController.java
+++ b/src/main/java/org/springblade/modules/place/controller/PlaceController.java
@@ -23,11 +23,18 @@
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;
@@ -35,6 +42,7 @@
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;
/**
* 场所表 控制器
@@ -158,4 +166,24 @@
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("操作成功");
+ }
}
diff --git a/src/main/java/org/springblade/modules/place/controller/PlaceRelController.java b/src/main/java/org/springblade/modules/place/controller/PlaceRelController.java
new file mode 100644
index 0000000..952d5af
--- /dev/null
+++ b/src/main/java/org/springblade/modules/place/controller/PlaceRelController.java
@@ -0,0 +1,126 @@
+/*
+ * 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)));
+ }
+
+
+}
diff --git a/src/main/java/org/springblade/modules/place/dto/PlaceRelDTO.java b/src/main/java/org/springblade/modules/place/dto/PlaceRelDTO.java
new file mode 100644
index 0000000..26d6911
--- /dev/null
+++ b/src/main/java/org/springblade/modules/place/dto/PlaceRelDTO.java
@@ -0,0 +1,34 @@
+/*
+ * 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;
+
+}
diff --git a/src/main/java/org/springblade/modules/place/entity/PlaceRelEntity.java b/src/main/java/org/springblade/modules/place/entity/PlaceRelEntity.java
new file mode 100644
index 0000000..24af2e5
--- /dev/null
+++ b/src/main/java/org/springblade/modules/place/entity/PlaceRelEntity.java
@@ -0,0 +1,134 @@
+/*
+ * 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;
+
+}
diff --git a/src/main/java/org/springblade/modules/place/excel/PlaceAndRelExcel.java b/src/main/java/org/springblade/modules/place/excel/PlaceAndRelExcel.java
new file mode 100644
index 0000000..a1f7c30
--- /dev/null
+++ b/src/main/java/org/springblade/modules/place/excel/PlaceAndRelExcel.java
@@ -0,0 +1,81 @@
+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;
+
+
+}
+
diff --git a/src/main/java/org/springblade/modules/place/excel/PlaceAndRelImporter.java b/src/main/java/org/springblade/modules/place/excel/PlaceAndRelImporter.java
new file mode 100644
index 0000000..add5b38
--- /dev/null
+++ b/src/main/java/org/springblade/modules/place/excel/PlaceAndRelImporter.java
@@ -0,0 +1,24 @@
+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);
+ }
+}
diff --git a/src/main/java/org/springblade/modules/place/excel/PlaceExcel.java b/src/main/java/org/springblade/modules/place/excel/PlaceExcel.java
new file mode 100644
index 0000000..a1b6961
--- /dev/null
+++ b/src/main/java/org/springblade/modules/place/excel/PlaceExcel.java
@@ -0,0 +1,55 @@
+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;
+
+}
+
diff --git a/src/main/java/org/springblade/modules/place/excel/PlaceImporter.java b/src/main/java/org/springblade/modules/place/excel/PlaceImporter.java
new file mode 100644
index 0000000..a59cc2b
--- /dev/null
+++ b/src/main/java/org/springblade/modules/place/excel/PlaceImporter.java
@@ -0,0 +1,24 @@
+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);
+ }
+}
diff --git a/src/main/java/org/springblade/modules/place/mapper/PlaceMapper.java b/src/main/java/org/springblade/modules/place/mapper/PlaceMapper.java
index 5bd5b18..fa1eef2 100644
--- a/src/main/java/org/springblade/modules/place/mapper/PlaceMapper.java
+++ b/src/main/java/org/springblade/modules/place/mapper/PlaceMapper.java
@@ -19,6 +19,7 @@
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;
@@ -82,4 +83,11 @@
* @return
*/
PlaceVO getDetail(@Param("place") PlaceEntity place);
+
+ /**
+ * 判断商超是否导入
+ * @param placeExcel
+ * @return
+ */
+ PlaceEntity getPlaceAndRelInfo(@Param("place") PlaceAndRelExcel placeExcel);
}
diff --git a/src/main/java/org/springblade/modules/place/mapper/PlaceMapper.xml b/src/main/java/org/springblade/modules/place/mapper/PlaceMapper.xml
index bf9745a..68ecfb1 100644
--- a/src/main/java/org/springblade/modules/place/mapper/PlaceMapper.xml
+++ b/src/main/java/org/springblade/modules/place/mapper/PlaceMapper.xml
@@ -87,8 +87,8 @@
<!--插入用户标签-->
<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>
<!--查询所有的场所(手机号不为空)-->
@@ -126,4 +126,23 @@
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>
diff --git a/src/main/java/org/springblade/modules/place/mapper/PlaceRelMapper.java b/src/main/java/org/springblade/modules/place/mapper/PlaceRelMapper.java
new file mode 100644
index 0000000..8011ea4
--- /dev/null
+++ b/src/main/java/org/springblade/modules/place/mapper/PlaceRelMapper.java
@@ -0,0 +1,43 @@
+/*
+ * 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);
+
+
+}
diff --git a/src/main/java/org/springblade/modules/place/mapper/PlaceRelMapper.xml b/src/main/java/org/springblade/modules/place/mapper/PlaceRelMapper.xml
new file mode 100644
index 0000000..5903b7c
--- /dev/null
+++ b/src/main/java/org/springblade/modules/place/mapper/PlaceRelMapper.xml
@@ -0,0 +1,29 @@
+<?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>
diff --git a/src/main/java/org/springblade/modules/place/service/IPlaceRelService.java b/src/main/java/org/springblade/modules/place/service/IPlaceRelService.java
new file mode 100644
index 0000000..a3aae8b
--- /dev/null
+++ b/src/main/java/org/springblade/modules/place/service/IPlaceRelService.java
@@ -0,0 +1,42 @@
+/*
+ * 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);
+
+
+}
diff --git a/src/main/java/org/springblade/modules/place/service/IPlaceService.java b/src/main/java/org/springblade/modules/place/service/IPlaceService.java
index efb1b15..9db4a3f 100644
--- a/src/main/java/org/springblade/modules/place/service/IPlaceService.java
+++ b/src/main/java/org/springblade/modules/place/service/IPlaceService.java
@@ -19,6 +19,8 @@
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;
@@ -76,4 +78,18 @@
* @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);
}
diff --git a/src/main/java/org/springblade/modules/place/service/impl/PlaceRelServiceImpl.java b/src/main/java/org/springblade/modules/place/service/impl/PlaceRelServiceImpl.java
new file mode 100644
index 0000000..f8363d6
--- /dev/null
+++ b/src/main/java/org/springblade/modules/place/service/impl/PlaceRelServiceImpl.java
@@ -0,0 +1,43 @@
+/*
+ * 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));
+ }
+
+
+}
diff --git a/src/main/java/org/springblade/modules/place/service/impl/PlaceServiceImpl.java b/src/main/java/org/springblade/modules/place/service/impl/PlaceServiceImpl.java
index ea3f411..6a3cf71 100644
--- a/src/main/java/org/springblade/modules/place/service/impl/PlaceServiceImpl.java
+++ b/src/main/java/org/springblade/modules/place/service/impl/PlaceServiceImpl.java
@@ -19,6 +19,7 @@
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;
@@ -28,8 +29,12 @@
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;
@@ -61,6 +66,9 @@
@Autowired
private IPlaceExtService placeExtService;
+
+ @Autowired
+ private IPlaceRelService placeRelService;
@Autowired
private IDoorplateAddressService doorplateAddressService;
@@ -154,6 +162,7 @@
if (user != null) {
//如果用户存在,则该用户id绑定场所
placeVO.setPrincipalUserId(user.getId());
+ newUser = user;
} else {
//如果用户不存在,则新增一个用户
newUser.setAccount(placeVO.getPhone());
@@ -270,4 +279,144 @@
// 返回
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);
+ }
+ }
}
diff --git a/src/main/java/org/springblade/modules/place/vo/PlaceRelVO.java b/src/main/java/org/springblade/modules/place/vo/PlaceRelVO.java
new file mode 100644
index 0000000..2080487
--- /dev/null
+++ b/src/main/java/org/springblade/modules/place/vo/PlaceRelVO.java
@@ -0,0 +1,35 @@
+/*
+ * 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;
+
+}
diff --git a/src/main/java/org/springblade/modules/place/wrapper/PlaceRelWrapper.java b/src/main/java/org/springblade/modules/place/wrapper/PlaceRelWrapper.java
new file mode 100644
index 0000000..4b73ec0
--- /dev/null
+++ b/src/main/java/org/springblade/modules/place/wrapper/PlaceRelWrapper.java
@@ -0,0 +1,50 @@
+/*
+ * 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;
+ }
+
+
+}
--
Gitblit v1.9.3