|
@@ -1,19 +1,21 @@
|
|
|
package fcb.project.manager.core.controller;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import fcb.project.manager.base.entity.*;
|
|
|
import fcb.project.manager.base.enums.AuditStatus;
|
|
|
import fcb.project.manager.base.enums.DeleteStatus;
|
|
|
import fcb.project.manager.base.enums.HouseStatus;
|
|
|
import fcb.project.manager.base.enums.SysUserRoleEnums;
|
|
|
+import fcb.project.manager.base.param.house.QueryHouseParam;
|
|
|
import fcb.project.manager.base.service.custom.PanoService;
|
|
|
import fcb.project.manager.base.service.impl.*;
|
|
|
import fcb.project.manager.base.utils.DataUtils;
|
|
|
import fcb.project.manager.base.utils.DateUtil;
|
|
|
import fcb.project.manager.base.utils.ExcelUtil;
|
|
|
+import fcb.project.manager.base.vo.house.HouseVO;
|
|
|
import fcb.project.manager.core.feignInterfaces.SceneFeign;
|
|
|
import fdage.back.sdk.base.entity.Result;
|
|
|
+import fdage.back.sdk.base.entity.ViewResult;
|
|
|
import fdage.back.sdk.base.enums.ResultCodeEnum;
|
|
|
import fdage.back.sdk.base.exception.CommonBaseException;
|
|
|
import fdage.back.sdk.base.uuid.SnowFlakeUUidUtils;
|
|
@@ -28,19 +30,19 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import javax.validation.constraints.NotBlank;
|
|
|
import java.io.*;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 2 * @Author: Abner
|
|
@@ -51,6 +53,7 @@ import java.util.stream.Collectors;
|
|
|
@RestController
|
|
|
@RequestMapping("fcb/project/house")
|
|
|
@Log4j2
|
|
|
+@Validated
|
|
|
public class HouseManagerController extends BaseController{
|
|
|
|
|
|
@Autowired
|
|
@@ -107,29 +110,9 @@ public class HouseManagerController extends BaseController{
|
|
|
|
|
|
@GetMapping("/queryOrSearchList")
|
|
|
@ApiOperation(value = "根据条件拉取所有房源")
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "houseTitle", value = "房源名称", paramType = "query", required = false, dataType = "String"),
|
|
|
- @ApiImplicitParam(name = "status", value = "状态: 0->草稿;1->待审核;2->已审核;3->未通过", paramType = "query", required = false, dataType = "Integer"),
|
|
|
- @ApiImplicitParam(name = "type", value = "房源类型: 1->新房,2->二手房", paramType = "query", required = true, dataType = "String"),
|
|
|
- @ApiImplicitParam(name = "estateId", value = "楼盘ID", paramType = "query", required = true, dataType = "String"),
|
|
|
- @ApiImplicitParam(name = "pageNum", value = "当前页码", paramType = "query", required = true, dataType = "Long"),
|
|
|
- @ApiImplicitParam(name = "pageSize", value = "每页大小", paramType = "query", required = true, dataType = "Long")
|
|
|
- })
|
|
|
- public Result<Object> getHouseList(@RequestParam(required = false) String houseTitle,
|
|
|
- @RequestParam(required = false) Integer status,
|
|
|
- @RequestParam(name = "type") Integer type,
|
|
|
- @RequestParam(name = "estateId") String estateId,
|
|
|
- @RequestParam(name = "pageNum")Long pageNum,
|
|
|
- @RequestParam(name = "pageSize")Long pageSize,
|
|
|
- HttpServletRequest request){
|
|
|
- if(StringUtils.isBlank(estateId)){
|
|
|
-
|
|
|
- return Result.failure("楼盘ID不能为空");
|
|
|
- }
|
|
|
- ContextTokenBean tokenMap = getContextUserInfo();
|
|
|
- IPage<TmHouse> resultPage = tmHouseService.getListByNameOrBelong(houseTitle , status ,
|
|
|
- type , estateId , tokenMap, getToken(), pageNum , pageSize);
|
|
|
- return Result.success(DataUtils.assembleResult(resultPage.getTotal(), resultPage.getPages(),
|
|
|
+ public ViewResult<HouseVO> getHouseList(QueryHouseParam queryHouseParam) {
|
|
|
+ IPage<HouseVO> resultPage = tmEstateService.listProject(queryHouseParam, getContextUserInfo(), getToken());
|
|
|
+ return ViewResult.success(DataUtils.assembleResult(resultPage.getTotal(), resultPage.getPages(),
|
|
|
resultPage.getCurrent(), resultPage.getRecords()));
|
|
|
}
|
|
|
|
|
@@ -192,48 +175,50 @@ public class HouseManagerController extends BaseController{
|
|
|
Map<String, String> item = null;
|
|
|
List<Map> dataList = new ArrayList<Map>();
|
|
|
String outType = "";
|
|
|
+ String[] AUDIT_EXCEL_COLE_NAME = {"序号","VR项目id","VR项目名称","项目类型","所属楼盘","公司","创建人","提审时间","审核状态","审核人", "审核时间"};
|
|
|
+ ExcelUtil excelUtil = new ExcelUtil(Arrays.asList(AUDIT_EXCEL_COLE_NAME));
|
|
|
int num = 0;
|
|
|
for(TmHouse house : houseList){
|
|
|
num += 1;
|
|
|
//楼盘数据
|
|
|
item = new HashMap();
|
|
|
- item.put(ExcelUtil.AUDIT_EXCEL_COLE_NAME[0], String.valueOf(num));
|
|
|
- item.put(ExcelUtil.AUDIT_EXCEL_COLE_NAME[1], house.getId());
|
|
|
- item.put(ExcelUtil.AUDIT_EXCEL_COLE_NAME[2], house.getHouseTitle());
|
|
|
+ item.put(excelUtil.getColeNames().get(0), String.valueOf(num));
|
|
|
+ item.put(excelUtil.getColeNames().get(1), house.getId());
|
|
|
+ item.put(excelUtil.getColeNames().get(2), house.getHouseTitle());
|
|
|
if(house.getType().intValue() == 1){
|
|
|
- item.put(ExcelUtil.AUDIT_EXCEL_COLE_NAME[3], "新房");
|
|
|
+ item.put(excelUtil.getColeNames().get(3), "新房");
|
|
|
}
|
|
|
if(house.getType().intValue() == 2){
|
|
|
- item.put(ExcelUtil.AUDIT_EXCEL_COLE_NAME[3], "二手房");
|
|
|
+ item.put(excelUtil.getColeNames().get(3), "二手房");
|
|
|
}
|
|
|
|
|
|
|
|
|
- item.put(ExcelUtil.AUDIT_EXCEL_COLE_NAME[4], house.getEstateName());
|
|
|
- item.put(ExcelUtil.AUDIT_EXCEL_COLE_NAME[5], house.getBelongCompanyName());
|
|
|
- item.put(ExcelUtil.AUDIT_EXCEL_COLE_NAME[6], house.getCreateByName());
|
|
|
+ item.put(excelUtil.getColeNames().get(4), house.getEstateName());
|
|
|
+ item.put(excelUtil.getColeNames().get(5), house.getBelongCompanyName());
|
|
|
+ item.put(excelUtil.getColeNames().get(6), house.getCreateByName());
|
|
|
|
|
|
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
- item.put(ExcelUtil.AUDIT_EXCEL_COLE_NAME[7], house.getSubmitAuditTime() == null? "" : house.getSubmitAuditTime().format(df));
|
|
|
+ item.put(excelUtil.getColeNames().get(7), house.getSubmitAuditTime() == null? "" : house.getSubmitAuditTime().format(df));
|
|
|
if(house.getStatus().compareTo(HouseStatus.WAITING_AUDIT.getCode()) == 0){
|
|
|
- item.put(ExcelUtil.AUDIT_EXCEL_COLE_NAME[8], HouseStatus.WAITING_AUDIT.getDesc());
|
|
|
+ item.put(excelUtil.getColeNames().get(8), HouseStatus.WAITING_AUDIT.getDesc());
|
|
|
}
|
|
|
if(house.getStatus().compareTo(HouseStatus.AUDITED.getCode()) == 0){
|
|
|
- item.put(ExcelUtil.AUDIT_EXCEL_COLE_NAME[8], HouseStatus.AUDITED.getDesc());
|
|
|
+ item.put(excelUtil.getColeNames().get(8), HouseStatus.AUDITED.getDesc());
|
|
|
}
|
|
|
if(house.getStatus().compareTo(HouseStatus.REJECT.getCode()) == 0){
|
|
|
- item.put(ExcelUtil.AUDIT_EXCEL_COLE_NAME[8], HouseStatus.REJECT.getDesc());
|
|
|
+ item.put(excelUtil.getColeNames().get(8), HouseStatus.REJECT.getDesc());
|
|
|
}
|
|
|
if(house.getStatus().compareTo(HouseStatus.DRAFT.getCode()) == 0){
|
|
|
- item.put(ExcelUtil.AUDIT_EXCEL_COLE_NAME[8], HouseStatus.DRAFT.getDesc());
|
|
|
+ item.put(excelUtil.getColeNames().get(8), HouseStatus.DRAFT.getDesc());
|
|
|
}
|
|
|
if(house.getStatus().compareTo(HouseStatus.WAITING_REGION_AUDIT.getCode()) == 0){
|
|
|
- item.put(ExcelUtil.AUDIT_EXCEL_COLE_NAME[8], HouseStatus.WAITING_REGION_AUDIT.getDesc());
|
|
|
+ item.put(excelUtil.getColeNames().get(8), HouseStatus.WAITING_REGION_AUDIT.getDesc());
|
|
|
}
|
|
|
if(house.getStatus().compareTo(HouseStatus.REGION_REJECT.getCode()) == 0){
|
|
|
- item.put(ExcelUtil.AUDIT_EXCEL_COLE_NAME[8], HouseStatus.REGION_REJECT.getDesc());
|
|
|
+ item.put(excelUtil.getColeNames().get(8), HouseStatus.REGION_REJECT.getDesc());
|
|
|
}
|
|
|
- item.put(ExcelUtil.AUDIT_EXCEL_COLE_NAME[9], house.getAuditorName());
|
|
|
- item.put(ExcelUtil.AUDIT_EXCEL_COLE_NAME[10], house.getAuditTime() == null? "" : house.getAuditTime().format(df));
|
|
|
+ item.put(excelUtil.getColeNames().get(8), house.getAuditorName());
|
|
|
+ item.put(excelUtil.getColeNames().get(8), house.getAuditTime() == null? "" : house.getAuditTime().format(df));
|
|
|
|
|
|
dataList.add(item);
|
|
|
}
|
|
@@ -263,24 +248,18 @@ public class HouseManagerController extends BaseController{
|
|
|
file.getParentFile().mkdirs();
|
|
|
}
|
|
|
|
|
|
- ExcelUtil.writeExcel(dataList, ExcelUtil.AUDIT_EXCEL_COLE_NAME.length, excelLocalPath + fileName, dateStr);
|
|
|
-
|
|
|
-// String agent = request.getHeader("User-Agent");
|
|
|
-// if (agent != null && (agent.contains("MSIE")||agent.contains("Trident"))) {
|
|
|
-// fileName = URLEncoder.encode(fileName, "UTF-8");
|
|
|
-// } else {
|
|
|
-// //非IE浏览器的处理:
|
|
|
-// fileName = new String(fileName.getBytes("UTF-8"), "ISO-8859-1");
|
|
|
-// }
|
|
|
-// response.setHeader("Content-Disposition", "attachment; filename=\""+fileName+"\"");
|
|
|
-// response.setContentType(request.getServletContext().getMimeType(fileName));
|
|
|
-// response.setContentLength((int) file.length());
|
|
|
-// output(response, file);
|
|
|
-
|
|
|
+ excelUtil.writeExcel(dataList, excelUtil.getColeNames().size(), excelLocalPath + fileName, dateStr);
|
|
|
return Result.success((Object) (outerSceneVrHost + "excel/" + dateStr + ".xls"));
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @GetMapping("/exportProjectList")
|
|
|
+ @ApiOperation(value = "vr项目导出")
|
|
|
+ public ViewResult<String> exportProjectList(QueryHouseParam queryHouseParam) throws Exception{
|
|
|
+ String url = tmEstateService.exportProjectList(queryHouseParam, getContextUserInfo(), getToken());
|
|
|
+ return ViewResult.success(url);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@GetMapping("/getShareLinks")
|
|
|
@ApiOperation(value = "根据房源ID获取房源所有分享链接")
|
|
@@ -520,36 +499,9 @@ public class HouseManagerController extends BaseController{
|
|
|
|
|
|
@PostMapping("/addHouse")
|
|
|
@ApiOperation(value = "创建默认房源")
|
|
|
- public Result<Object> addNewHouse(HttpServletRequest request , @RequestParam String estateId){
|
|
|
-
|
|
|
- if(StringUtils.isBlank(estateId)){
|
|
|
- throw new CommonBaseException(ResultCodeEnum.D101 , "楼盘ID不能为空");
|
|
|
- }
|
|
|
- ContextTokenBean tokenMap = getContextUserInfo();
|
|
|
- TmEstate tmEstate = tmEstateService.getById(estateId);
|
|
|
- if(null == tmEstate){
|
|
|
- return Result.failure("楼盘项目不存在");
|
|
|
- }
|
|
|
-
|
|
|
- TmHouse tmHouse = new TmHouse();
|
|
|
- tmHouse.setEstateId(estateId);
|
|
|
- tmHouse.setEstateName(tmEstate.getEstateName());
|
|
|
- if(null != tokenMap){
|
|
|
- tmHouse.setCreateById(tokenMap.getId());
|
|
|
- tmHouse.setCreateByName(tokenMap.getNickName());
|
|
|
- }
|
|
|
- tmHouse.setBelongCompanyId(tmEstate.getBelongCompanyId());
|
|
|
- tmHouse.setBelongCompanyName(tmEstate.getBelongCompanyName());
|
|
|
- tmHouse.setEstateName(tmEstate.getEstateName());
|
|
|
- tmHouse.setStatus(0);
|
|
|
- TmHouse latestHouse = tmHouseService.insertNewWithRsp(tmHouse);
|
|
|
- if(null != latestHouse){
|
|
|
- Map<String , Object> resultMap = new HashMap<>();
|
|
|
- resultMap.put("houseId" , tmHouse.getId());
|
|
|
- return Result.success("新增成功" , resultMap);
|
|
|
- }else{
|
|
|
- return Result.failure("新增失败");
|
|
|
- }
|
|
|
+ public ViewResult addNewHouse(@RequestBody TmEstate tmEstate){
|
|
|
+ Map<String, Object> map = tmEstateService.addProject(tmEstate, getContextUserInfo());
|
|
|
+ return ViewResult.success(map);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/updateVrLink")
|
|
@@ -573,79 +525,15 @@ public class HouseManagerController extends BaseController{
|
|
|
}
|
|
|
return Result.failure("更新失败");
|
|
|
}
|
|
|
- @PostMapping("/deleteHouse")
|
|
|
- @ApiOperation(value = "删除房源信息")
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public Result<Object> deleteHouse(@RequestParam() String houseId){
|
|
|
-
|
|
|
- if(StringUtils.isBlank(houseId)){
|
|
|
- return Result.failure("房源ID不能为空");
|
|
|
- }
|
|
|
- TmHouse dbHouse = tmHouseService.getById(houseId);
|
|
|
- if(null == dbHouse){
|
|
|
- return Result.failure("房源不存在,无需删除");
|
|
|
- }
|
|
|
- if(null != dbHouse.getStatus()){
|
|
|
- //除了草稿、未通过状态,其他状态都不能删除
|
|
|
- if(!HouseStatus.canDelete(dbHouse.getStatus())){
|
|
|
- return Result.failure("存在待审核/已审核数据,无法删除");
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- if(!isCanDelete(dbHouse)){
|
|
|
- return Result.failure("暂无删除权限");
|
|
|
- }
|
|
|
-
|
|
|
- int delete = tmHouseService.deleteHouseById(houseId);
|
|
|
- if(delete != 1){
|
|
|
- return Result.failure("删除失败");
|
|
|
- }
|
|
|
- int ins = tmOperationService.addNewWithTypeAndContent(getContextUserInfo() , "VR楼盘项目" , "删除VR项目/" + dbHouse.getHouseTitle());
|
|
|
- if(ins != 1){
|
|
|
- log.info("插入操作记录失败");
|
|
|
- }
|
|
|
- List<String> sceneNumList = panoService.getKanKanSceneNums(dbHouse.getId() , getToken());
|
|
|
- log.info("720返回的房源的[{}]对应的四维场景码列表为:{}" , dbHouse.getId() , JSON.toJSONString(sceneNumList));
|
|
|
- if(!CollectionUtils.isEmpty(sceneNumList)){
|
|
|
- Map<String , Object> map = new HashMap<>();
|
|
|
- map.put("status" , 2);
|
|
|
- map.put("sceneNum" , sceneNumList.stream().collect(Collectors.joining(";")));
|
|
|
- log.info("上送四维看看的参数为:{}" , JSON.toJSONString(map));
|
|
|
- SceneRspBean rsp = sceneFeign.updateSceneStatus(map , getToken());
|
|
|
- log.info("四维看看翻转状态返回为:{}" , JSON.toJSONString(rsp));
|
|
|
- if(null == rsp || rsp.getCode() != 0){
|
|
|
- log.info("调用看看的更新场景状态微服务失败");
|
|
|
- if(null != rsp){
|
|
|
- log.info("code = {} , msg = {}" , rsp.getCode() , rsp.getMsg());
|
|
|
- }
|
|
|
- throw new CommonBaseException(ResultCodeEnum.D101 , "更新看看场景状态失败");
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- //通知720,告知房源下线(审核通过/上线:4, 下线:3)
|
|
|
- //panoService.noticeVrAuditStatus(houseId , getToken() , 3);
|
|
|
-
|
|
|
- panoService.noticeDeleteVr(houseId , getToken());
|
|
|
- return Result.success("删除房源成功");
|
|
|
|
|
|
+ @PostMapping("/deleteHouse")
|
|
|
+ @ApiOperation(value = "删除房源信息")
|
|
|
+ public ViewResult deleteHouse(@NotBlank(message = "楼盘id不能为空") @RequestParam("楼盘id") String estateId){
|
|
|
+ String msg = tmEstateService.delete(estateId, getContextUserInfo(), getToken());
|
|
|
+ return ViewResult.success(msg);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 是否可以删除的条件
|
|
|
- * 1.地区管理员和集团管理员、超级管理员能删除下属或自己的模型
|
|
|
- * 2.拍摄人员只能删除自己的模型
|
|
|
- * @param dbHouse
|
|
|
- * @return
|
|
|
- */
|
|
|
- private boolean isCanDelete(TmHouse dbHouse) {
|
|
|
- ContextTokenBean user = getContextUserInfo();
|
|
|
- if (SysUserRoleEnums.REGION_SHOOT.getRoleKey().equals(user.getRoleKey())
|
|
|
- && !dbHouse.getCreateById().equals(user.getId())) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- return true;
|
|
|
- }
|
|
|
|
|
|
@PostMapping("/updateHouse")
|
|
|
@ApiOperation(value = "修改房源信息")
|