From 9af7a5cc082d9c9e7903ec3ae968192a2b2d2b3e Mon Sep 17 00:00:00 2001 From: yueminglinxia <1123_Wu813> Date: Thu, 10 Jun 2021 14:13:16 +0800 Subject: [PATCH] merge --- .../main/java/com/air/common/Constant.java | 2 +- .../housing/controller/HousesController.java | 5 +-- .../controller/HousingEstatesController.java | 4 +-- .../com/air/housing/dto/BlockListDto.java | 5 +++ .../land/controller/LandToListController.java | 2 +- .../java/com/air/land/entity/LandToList.java | 7 ++-- .../air/land/service/LandToListService.java | 3 ++ .../service/impl/LandToListServiceImpl.java | 32 +++++++++++++++++-- .../java/com/air/land/vo/LandToListVo.java | 6 ++-- .../service/impl/SysMessageServiceImpl.java | 3 +- .../main/resources/mapper/BlocksMapper.xml | 11 ++++--- 11 files changed, 57 insertions(+), 23 deletions(-) diff --git a/air/src/main/java/com/air/common/Constant.java b/air/src/main/java/com/air/common/Constant.java index ba08f04..0ea0d1f 100644 --- a/air/src/main/java/com/air/common/Constant.java +++ b/air/src/main/java/com/air/common/Constant.java @@ -8,7 +8,7 @@ package com.air.common; */ public class Constant { - + public static final String COMMON_STATUS_1000 = "1000"; /** * 拟挂牌地块状态 未公示 **/ diff --git a/air/src/main/java/com/air/housing/controller/HousesController.java b/air/src/main/java/com/air/housing/controller/HousesController.java index 686f0b5..b3c847b 100644 --- a/air/src/main/java/com/air/housing/controller/HousesController.java +++ b/air/src/main/java/com/air/housing/controller/HousesController.java @@ -60,7 +60,7 @@ public class HousesController { * @return R */ @ApiOperation(value = "通过id查询", notes = "通过id查询") - @GetMapping("/{blockId}") + @GetMapping("/house/{blockId}") public R getByBlockId(Page page,@PathVariable("blockId") Long blockId) { return R.ok(housesService.page(page,Wrappers.lambdaQuery().eq(Houses::getBlockId,blockId))); } @@ -72,7 +72,6 @@ public class HousesController { */ @ApiOperation(value = "新增房屋信息", notes = "新增房屋信息") @PostMapping - @PreAuthorize("@pms.hasPermission('generator_houses_add')") public R save(@RequestBody Houses houses) { return R.ok(housesService.save(houses)); } @@ -85,7 +84,6 @@ public class HousesController { */ @ApiOperation(value = "修改房屋信息", notes = "修改房屋信息") @PutMapping - @PreAuthorize("@pms.hasPermission('generator_houses_edit')") public R updateById(@RequestBody Houses houses) { return R.ok(housesService.updateById(houses)); } @@ -98,7 +96,6 @@ public class HousesController { */ @ApiOperation(value = "通过id删除房屋信息", notes = "通过id删除房屋信息") @DeleteMapping("/{houseId}") - @PreAuthorize("@pms.hasPermission('generator_houses_del')") public R removeById(@PathVariable Long houseId) { return R.ok(housesService.removeById(houseId)); } diff --git a/air/src/main/java/com/air/housing/controller/HousingEstatesController.java b/air/src/main/java/com/air/housing/controller/HousingEstatesController.java index 136f8b6..d86415d 100644 --- a/air/src/main/java/com/air/housing/controller/HousingEstatesController.java +++ b/air/src/main/java/com/air/housing/controller/HousingEstatesController.java @@ -1,5 +1,6 @@ package com.air.housing.controller; +import com.air.common.Constant; import com.air.housing.dto.HousingDefine; import com.air.housing.dto.HousingEstatesQuery; import com.air.housing.entity.HousingEstates; @@ -7,13 +8,11 @@ import com.air.housing.service.HousingEstatesService; import com.air.housing.vo.HousingEstatesDetail; import com.air.housing.vo.HousingEstatesName; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.cinderella.framework.common.core.util.R; import com.cinderella.framework.common.data.mybatis.QueryPage; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; -import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; @@ -80,6 +79,7 @@ public class HousingEstatesController { @ApiOperation(value = "新增楼盘(小区)", notes = "新增楼盘(小区)") @PostMapping public R save(@RequestBody HousingEstates housingEstates) { + housingEstates.setStatusCd(Constant.COMMON_STATUS_1000); return R.ok(housingEstatesService.save(housingEstates)); } diff --git a/air/src/main/java/com/air/housing/dto/BlockListDto.java b/air/src/main/java/com/air/housing/dto/BlockListDto.java index 746c336..7c5ef80 100644 --- a/air/src/main/java/com/air/housing/dto/BlockListDto.java +++ b/air/src/main/java/com/air/housing/dto/BlockListDto.java @@ -1,12 +1,17 @@ package com.air.housing.dto; +import com.baomidou.mybatisplus.annotation.TableField; import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; /** * @ClassName BlockListDto * @Author Lenovo 102306 * @Date 2021/6/9 10:40 */ +@Data +@EqualsAndHashCode public class BlockListDto { @ApiModelProperty(value = "楼盘id") diff --git a/air/src/main/java/com/air/land/controller/LandToListController.java b/air/src/main/java/com/air/land/controller/LandToListController.java index 677f51b..40b82a3 100644 --- a/air/src/main/java/com/air/land/controller/LandToListController.java +++ b/air/src/main/java/com/air/land/controller/LandToListController.java @@ -132,7 +132,7 @@ public class LandToListController { @ApiOperation(value = "导入拟挂牌地块信息", notes = "导入拟挂牌地块信息") @PostMapping(value = "/importLandToListExcel") public R importLandToListExcel(@RequestParam(value="uploadFile") MultipartFile file){ - return R.ok(); + return R.ok(landToListService.importLandToListExcel(file)); } diff --git a/air/src/main/java/com/air/land/entity/LandToList.java b/air/src/main/java/com/air/land/entity/LandToList.java index 197c78d..0e292e8 100644 --- a/air/src/main/java/com/air/land/entity/LandToList.java +++ b/air/src/main/java/com/air/land/entity/LandToList.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.extension.activerecord.Model; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -36,6 +37,7 @@ public class LandToList extends Model { private String supplyStatus; @ApiModelProperty(value = "预计挂牌时间") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd",timezone = "GMT+8") private LocalDateTime estimatedListingTime; @ApiModelProperty(value = "预计挂牌批次") @@ -107,8 +109,6 @@ public class LandToList extends Model { @ApiModelProperty(value = "商务面积") private String commerceSpace; - - @ApiModelProperty(value = "配建-计容") private String allocationCapacity; @@ -179,7 +179,6 @@ public class LandToList extends Model { private String lonLatBd; - @ApiModelProperty(value = "出让方式") private String transferMode; @@ -220,6 +219,7 @@ public class LandToList extends Model { private String projectCompany; @ApiModelProperty(value = "确权时间") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd",timezone = "GMT+8") private LocalDateTime confirmationTime; @ApiModelProperty(value = "操盘企业") @@ -232,6 +232,7 @@ public class LandToList extends Model { private String conductEnterprise; @ApiModelProperty(value = "项目首开时间") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd",timezone = "GMT+8") private LocalDateTime firstOpenTime; @ApiModelProperty(value = "规划条件函") diff --git a/air/src/main/java/com/air/land/service/LandToListService.java b/air/src/main/java/com/air/land/service/LandToListService.java index 4056bd4..735b74b 100644 --- a/air/src/main/java/com/air/land/service/LandToListService.java +++ b/air/src/main/java/com/air/land/service/LandToListService.java @@ -3,6 +3,7 @@ package com.air.land.service; import com.air.land.entity.LandToList; import com.baomidou.mybatisplus.extension.service.IService; import com.cinderella.framework.common.core.util.R; +import org.springframework.web.multipart.MultipartFile; import java.util.List; @@ -18,4 +19,6 @@ public interface LandToListService extends IService { List> getLandList(List ids); + boolean importLandToListExcel(MultipartFile file); + } diff --git a/air/src/main/java/com/air/land/service/impl/LandToListServiceImpl.java b/air/src/main/java/com/air/land/service/impl/LandToListServiceImpl.java index 9e9f631..a43b012 100644 --- a/air/src/main/java/com/air/land/service/impl/LandToListServiceImpl.java +++ b/air/src/main/java/com/air/land/service/impl/LandToListServiceImpl.java @@ -1,6 +1,7 @@ package com.air.land.service.impl; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.ObjectUtil; import com.air.common.Constant; import com.air.land.entity.LandListed; import com.air.land.entity.LandToList; @@ -8,12 +9,16 @@ import com.air.land.mapper.LandListedMapper; import com.air.land.mapper.LandToListMapper; import com.air.land.service.LandToListService; import com.air.utils.DateUtil; +import com.air.utils.ExcelUtil; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.cinderella.framework.common.core.exception.BusinessException; import com.cinderella.framework.common.core.util.R; import lombok.AllArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; +import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -56,6 +61,29 @@ public class LandToListServiceImpl extends ServiceImpl> dataList = new ArrayList<>(); + try{ + dataList = ExcelUtil.importExcel(file); + }catch (IOException e){ + new BusinessException("导入已挂牌地块数据出错"); + } + List list = new ArrayList<>(dataList.size()); + dataList.forEach(data ->{ + try { + LandToList landListed = listToEntity(data); + if(ObjectUtil.isNotEmpty(landListed)){ + list.add(landListed); + } + }catch (Exception e){ + e.printStackTrace(); + new BusinessException("导入已挂牌地块数据转换出错"); + } + }); + return this.saveBatch(list); + } + private List entityToList(LandToList data) { List list = new ArrayList<>(); list.add(data.getProposedseriaId().toString()); @@ -135,8 +163,8 @@ public class LandToListServiceImpl extends ServiceImpl data) { - LandListed landListed = new LandListed(); + private LandToList listToEntity(List data) { + LandToList landListed = new LandToList(); landListed.setAnnoId(data.get(0)); landListed.setLandCode(data.get(1)); landListed.setLandPosition(data.get(2)); diff --git a/air/src/main/java/com/air/land/vo/LandToListVo.java b/air/src/main/java/com/air/land/vo/LandToListVo.java index d564b94..75ef29a 100644 --- a/air/src/main/java/com/air/land/vo/LandToListVo.java +++ b/air/src/main/java/com/air/land/vo/LandToListVo.java @@ -40,12 +40,10 @@ public class LandToListVo { @ApiModelProperty(value = "公告id,主键,以土地网爬取数据为准,不自增") private String annoId; - @NotBlank(message = "地块编号不能为空") - @ApiModelProperty(value = "地块编号", required = true) + @ApiModelProperty(value = "地块编号") private String landCode; - @NotBlank(message = "地块位置不能为空") - @ApiModelProperty(value = "地块位置", required = true) + @ApiModelProperty(value = "地块位置") private String landPosition; @ApiModelProperty(value = "土地用途") diff --git a/air/src/main/java/com/air/sysMessage/service/impl/SysMessageServiceImpl.java b/air/src/main/java/com/air/sysMessage/service/impl/SysMessageServiceImpl.java index 2bc4037..f7472fa 100644 --- a/air/src/main/java/com/air/sysMessage/service/impl/SysMessageServiceImpl.java +++ b/air/src/main/java/com/air/sysMessage/service/impl/SysMessageServiceImpl.java @@ -46,8 +46,7 @@ public class SysMessageServiceImpl extends ServiceImpl messagePage = sysMessageMapper.getSysMessagePage(page,userId); // page.setRecords(messagePage); return messagePage; diff --git a/air/src/main/resources/mapper/BlocksMapper.xml b/air/src/main/resources/mapper/BlocksMapper.xml index a6f7ec0..6da2191 100644 --- a/air/src/main/resources/mapper/BlocksMapper.xml +++ b/air/src/main/resources/mapper/BlocksMapper.xml @@ -9,17 +9,20 @@