From 23c4967b4cb8dbce8277f830f7152d315c5a4a57 Mon Sep 17 00:00:00 2001
From: luo <2855143437@qq.com>
Date: 星期一, 25 十二月 2023 09:25:17 +0800
Subject: [PATCH] 12.25
---
guns-management/src/main/java/com/stylefeng/guns/core/intercept/GunsUserFilter.java | 3
guns-management/src/main/java/com/stylefeng/guns/modular/system/service/IEncyclopedicKnowledgeService.java | 2
guns-admin/src/main/java/com/stylefeng/guns/modular/file/OSSService.java | 211 ++
guns-management/src/main/java/com/stylefeng/guns/modular/system/util/ResultUtil.java | 2
guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/SearchHousingDemandListRes.java | 31
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/HouseTypeMapper.xml | 5
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/RoleMapper.xml | 4
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/TAppUserAuditRecordMapper.java | 10
guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReportHousingDemandServiceImpl.java | 21
guns-management/src/main/java/com/stylefeng/guns/modular/system/controller/LoginController.java | 19
guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/SysDeptController.java | 18
guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/req/ReportHouseResourceReq.java | 2
guns-management/src/main/java/com/stylefeng/guns/modular/system/model/HouseType.java | 4
guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/HouseResourceInfoRes.java | 9
.idea/jarRepositories.xml | 5
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/HouseResourceMapper.xml | 16
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/BannerMapper.xml | 13
guns-management/pom.xml | 6
guns-management/src/main/java/com/stylefeng/guns/modular/system/util/ListToTreeUtil.java | 50
guns-management/src/main/java/com/stylefeng/guns/modular/system/service/IHouseTypeService.java | 3
guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/MediumController.java | 92 +
guns-admin/src/main/java/com/stylefeng/guns/modular/api/HouseResourceController.java | 134 +
guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/HostController.java | 15
guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/BannerServiceImpl.java | 6
guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/FeedBack.java | 2
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/EncyclopedicKnowledgeMapper.java | 2
guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/ContactInformationRes.java | 2
guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/HouseResource.java | 40
guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/req/HousingDemandReq.java | 31
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/RoleMapper.xml | 4
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/BannerMapper.java | 3
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/AppUserMapper.xml | 14
guns-management/src/main/java/com/stylefeng/guns/modular/system/dto/Node.java | 63
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/HouseResourceMapper.xml | 19
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/EncyclopedicKnowledgeMapper.xml | 6
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/FeedBackMapper.xml | 2
guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/AppletLoginRes.java | 4
guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/UserController.java | 197 +
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/FeedBackMapper.xml | 2
guns-management/src/main/java/com/stylefeng/guns/modular/system/controller/RoleController.java | 9
guns-management/src/main/java/com/stylefeng/guns/modular/system/util/MyScheduledTasks.java | 60
guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/Constants.java | 136 +
guns-management/src/main/java/com/stylefeng/guns/modular/system/dto/Medium.java | 32
guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/SysRoleController.java | 70
guns-core/src/main/java/com/stylefeng/guns/core/node/ZTreeNode.java | 11
guns-management/src/main/java/com/stylefeng/guns/modular/system/model/AppUser.java | 8
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/HouseResourceMapper.xml | 51
guns-management/src/main/java/com/stylefeng/guns/modular/system/service/TAppUserAuditRecordService.java | 9
guns-admin/src/main/java/com/stylefeng/guns/core/util/Contrast.java | 2
guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/HouseTypeServiceImpl.java | 6
guns-management/src/main/java/com/stylefeng/guns/config/web/ShiroConfig.java | 3
guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/ReportController.java | 25
guns-management/src/main/resources/application-dev.yml | 2
guns-admin/src/main/java/com/stylefeng/guns/core/intercept/GunsUserFilter.java | 11
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/HousingDemandMapper.java | 25
guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/ReportHouseResource.java | 5
guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/AuthDTO.java | 55
guns-admin/src/main/java/com/stylefeng/guns/modular/api/FileController.java | 73
guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/EncyclopedicKnowledgeServiceImpl.java | 4
guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/AppUserServiceImpl.java | 414 +++-
guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/HouseResourceService.java | 29
guns-admin/src/main/java/com/stylefeng/guns/modular/api/BannerController.java | 2
guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TaskUtilHouseResource.java | 65
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/HouseTypeMapper.java | 3
guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/HousingDemand.java | 49
guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/auth/AuthIntercepter.java | 18
guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/HouseController.java | 137 +
guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/RegionVO.java | 26
guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/HousingDemandServiceImpl.java | 246 ++
guns-admin/pom.xml | 15
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/EncyclopedicKnowledgeMapper.xml | 6
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/HouseResourceMapper.java | 2
guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/Page.java | 35
guns-management/src/main/java/com/stylefeng/guns/modular/system/model/HouseResource.java | 3
guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/HousingDemandInfoRes.java | 4
guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/httpClinet/HttpClientUtil.java | 7
guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/CollectRes.java | 3
guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IHousingDemandService.java | 9
guns-admin/src/test/java/com/stylefeng/guns/GunsApplicationTest.java | 2
guns-admin/src/main/java/com/stylefeng/guns/modular/api/AppUserController.java | 201 ++
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/UserMapper.xml | 2
guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/SysBannerController.java | 69
guns-management/src/main/java/com/stylefeng/guns/modular/system/model/Role.java | 2
guns-management/src/main/java/com/stylefeng/guns/modular/system/model/EncyclopedicKnowledge.java | 2
guns-management/src/main/java/com/stylefeng/guns/modular/system/model/TAppUserAuditRecord.java | 36
guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/DateUtils.java | 447 +++++
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserMapper.xml | 2
guns-admin/src/main/resources/application.yml | 8
guns-admin/src/main/java/com/stylefeng/guns/modular/file/OSSConfig.java | 25
guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/req/UserInfoDTO.java | 6
guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/SearchHouseResourceListRes.java | 10
guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReportHouseResourceServiceImpl.java | 23
guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/HouseResourceService.java | 301 +++
guns-admin/src/main/java/com/stylefeng/guns/modular/api/RegionController.java | 15
guns-management/target/classes/application-dev.yml | 2
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/HousingDemandMapper.xml | 104 +
guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/OssController.java | 51
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/HouseTypeMapper.xml | 5
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/AppUserMapper.xml | 14
guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/AppUser.java | 12
guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/CollectListRes.java | 22
guns-management/src/main/java/com/stylefeng/guns/modular/system/dto/BannerVo.java | 21
guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/WxAppletTools.java | 78 +
guns-management/src/main/java/com/stylefeng/guns/modular/system/dto/TreeBean.java | 94 +
guns-admin/src/main/resources/application-dev.yml | 33
guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/req/SearchHousingDemandReq.java | 6
guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IAppUserService.java | 5
guns-admin/src/main/java/com/stylefeng/guns/modular/api/HousingDemandController.java | 45
guns-management/src/main/java/com/stylefeng/guns/modular/system/service/IBannerService.java | 3
guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/BannerMapper.xml | 13
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/AppUserMapper.java | 2
guns-admin/src/main/java/com/stylefeng/guns/modular/api/EncyclopedicKnowledgeController.java | 9
guns-management/src/main/java/com/stylefeng/guns/modular/system/dto/THouseResource.java | 5
guns-management/target/classes/META-INF/spring-configuration-metadata.json | 90 +
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/AppUserMapper.xml | 31
guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IHouseResourceService.java | 5
guns-management/src/main/java/com/stylefeng/guns/modular/system/warpper/req/AddHouseReq.java | 1
guns-admin/src/main/java/com/stylefeng/guns/core/intercept/RestApiInteceptor.java | 6
guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/TAppUserAuditRecordServiceImpl.java | 12
guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/req/AddHouseReq.java | 24
120 files changed, 3,982 insertions(+), 604 deletions(-)
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
index 712ab9d..c4ded14 100644
--- a/.idea/jarRepositories.xml
+++ b/.idea/jarRepositories.xml
@@ -12,6 +12,11 @@
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
+ <option name="id" value="central" />
+ <option name="name" value="Central Repository" />
+ <option name="url" value="http://maven.aliyun.com/nexus/content/groups/public" />
+ </remote-repository>
+ <remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
diff --git a/guns-admin/pom.xml b/guns-admin/pom.xml
index 7a23e1c..b738570 100644
--- a/guns-admin/pom.xml
+++ b/guns-admin/pom.xml
@@ -16,7 +16,10 @@
<packaging>war</packaging>
<dependencies>
-
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ </dependency>
<dependency>
<groupId>com.stylefeng</groupId>
<artifactId>guns-core</artifactId>
@@ -25,7 +28,15 @@
<groupId>com.stylefeng</groupId>
<artifactId>guns-generator</artifactId>
</dependency>
-
+ <dependency>
+ <groupId>com.aliyun</groupId>
+ <artifactId>oss20190517</artifactId>
+ <version>1.0.6</version>
+ </dependency>
+ <!-- Aliyun OSS SDK -->
+ <dependency><groupId>com.aliyun.oss</groupId>
+ <artifactId>aliyun-sdk-oss</artifactId>
+ <version>3.14.0</version></dependency>
<!--spring boot依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/core/intercept/GunsUserFilter.java b/guns-admin/src/main/java/com/stylefeng/guns/core/intercept/GunsUserFilter.java
index 5ff14b5..280a85d 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/core/intercept/GunsUserFilter.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/core/intercept/GunsUserFilter.java
@@ -41,13 +41,13 @@
/**
* Returns <code>true</code> if the request is a
- * {@link #isLoginRequest(javax.servlet.ServletRequest, javax.servlet.ServletResponse) loginRequest} or
- * if the current {@link #getSubject(javax.servlet.ServletRequest, javax.servlet.ServletResponse) subject}
+ * {@link #isLoginRequest(ServletRequest, ServletResponse) loginRequest} or
+ * if the current {@link #getSubject(ServletRequest, ServletResponse) subject}
* is not <code>null</code>, <code>false</code> otherwise.
*
* @return <code>true</code> if the request is a
- * {@link #isLoginRequest(javax.servlet.ServletRequest, javax.servlet.ServletResponse) loginRequest} or
- * if the current {@link #getSubject(javax.servlet.ServletRequest, javax.servlet.ServletResponse) subject}
+ * {@link #isLoginRequest(ServletRequest, ServletResponse) loginRequest} or
+ * if the current {@link #getSubject(ServletRequest, ServletResponse) subject}
* is not <code>null</code>, <code>false</code> otherwise.
*/
protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) {
@@ -62,7 +62,7 @@
/**
* This default implementation simply calls
- * {@link #saveRequestAndRedirectToLogin(javax.servlet.ServletRequest, javax.servlet.ServletResponse) saveRequestAndRedirectToLogin}
+ * {@link #saveRequestAndRedirectToLogin(ServletRequest, ServletResponse) saveRequestAndRedirectToLogin}
* and then immediately returns <code>false</code>, thereby preventing the chain from continuing so the redirect may
* execute.
*/
@@ -78,7 +78,6 @@
httpServletResponse.setHeader("sessionstatus", "timeout");
return false;
} else {
-
/**
* 第一次点击页面
*/
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/core/intercept/RestApiInteceptor.java b/guns-admin/src/main/java/com/stylefeng/guns/core/intercept/RestApiInteceptor.java
index 3599103..143503d 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/core/intercept/RestApiInteceptor.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/core/intercept/RestApiInteceptor.java
@@ -72,12 +72,10 @@
/**
* 根据token返回用户id
*/
- String key = null;
+ String key = authToken;
int length = authToken.length();
if(length > 16){
- key = authToken.substring(length - 16);
- }else{
- key = authToken;
+ key = authToken.substring(4, 12);
}
String value = redisUtil.getValue(key);
if(ToolUtil.isEmpty(value)){
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/core/util/Contrast.java b/guns-admin/src/main/java/com/stylefeng/guns/core/util/Contrast.java
index 84755d3..fa087f6 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/core/util/Contrast.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/core/util/Contrast.java
@@ -138,7 +138,7 @@
Method getMethod = null;
try {
getMethod = clazz.getDeclaredMethod(prefix + StrKit.firstCharToUpperCase(field.getName()));
- } catch (java.lang.NoSuchMethodException e) {
+ } catch (NoSuchMethodException e) {
System.out.println("this className:" + clazz.getName() + " is not methodName: " + e.getMessage());
continue;
}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/api/AppUserController.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/api/AppUserController.java
index 6067cfb..ec49227 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/api/AppUserController.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/api/AppUserController.java
@@ -1,12 +1,14 @@
package com.stylefeng.guns.modular.api;
-import com.stylefeng.guns.modular.system.model.AppUser;
-import com.stylefeng.guns.modular.system.model.FeedBack;
-import com.stylefeng.guns.modular.system.model.HouseResource;
-import com.stylefeng.guns.modular.system.service.IAppUserService;
-import com.stylefeng.guns.modular.system.service.IFeedBackService;
-import com.stylefeng.guns.modular.system.service.IHouseResourceService;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.stylefeng.guns.modular.system.model.*;
+import com.stylefeng.guns.modular.system.service.*;
import com.stylefeng.guns.modular.system.service.impl.FeedBackServiceImpl;
+import com.stylefeng.guns.modular.system.service.impl.HouseTypeServiceImpl;
+import com.stylefeng.guns.modular.system.util.Page;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import com.stylefeng.guns.modular.system.warpper.req.*;
import com.stylefeng.guns.modular.system.warpper.res.AppletLoginRes;
@@ -20,7 +22,10 @@
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.Date;
+import java.util.List;
/**
* @author zhibing.pu
@@ -36,8 +41,21 @@
private IFeedBackService feedBackService;
@Autowired
private IHouseResourceService houseResourceService;
-
-
+ @Autowired
+ private IHousingDemandService housingDemandService;
+ @Autowired
+ private IHouseTypeService houseTypeService;
+ @Autowired
+ private IRegionService regionService;
+ @Autowired
+ private IBannerService bannerService;
+ @ResponseBody
+ @GetMapping("/base/appUser/agreement")
+ @ApiOperation(value = "协议", tags = {"协议"})
+ public ResultUtil agreement(Integer type){
+ Banner banners = bannerService.selectOne(new EntityWrapper<Banner>().eq("position",type));
+ return ResultUtil.success(banners);
+ }
@ResponseBody
@PostMapping("/base/appUser/appletLogin")
@ApiOperation(value = "微信小程序登录", tags = {"登录注册"})
@@ -67,6 +85,7 @@
@ApiImplicitParam(name = "Authorization", value = "Bearer eyJhbGciOiJIUzUxMiJ....", required = true, paramType = "header")
})
public ResultUtil<AppUser> userInfo(){
+
return appUserService.userInfo();
}
@@ -77,8 +96,8 @@
@ApiImplicitParams({
@ApiImplicitParam(name = "Authorization", value = "Bearer eyJhbGciOiJIUzUxMiJ....", required = true, paramType = "header")
})
- public ResultUtil<CollectRes> release(){
- return appUserService.collect();
+ public ResultUtil<CollectRes> release(UserInfoQuery query){
+ return appUserService.collect(query);
}
// todo 放行
@@ -90,13 +109,46 @@
return appUserService.release(query);
}
+
// todo 放行
@ResponseBody
- @GetMapping("/base/appUser/edit/{id}")
+ @GetMapping("/base/appUser/edit/{id}/{data}")
@ApiOperation(value = "编辑发布的房源", tags = {"个人中心"})
- public ResultUtil<HouseResource> edit(@PathVariable("id") Integer id){
-
- return ResultUtil.success(houseResourceService.selectById(id));
+ public ResultUtil<Object> edit(@PathVariable("id") Integer id,@PathVariable("data")Integer type){
+ // type=1 求房源
+ if (type == 1){
+ HousingDemand housingDemand = housingDemandService.selectById(id);
+ if (StringUtils.hasLength(housingDemand.getDistrict())){
+ JSONArray jsonArray = JSON.parseArray(housingDemand.getDistrict());
+ housingDemand.setDistrict(jsonArray.toString());
+ }
+ if (housingDemand.getHouseTypeId()!=null && (!housingDemand.getHouseTypeId().equals("0"))){
+ HouseType houseType = houseTypeService.selectById(housingDemand.getHouseTypeId());
+ housingDemand.setHouseTypeName(houseType.getName());
+ }
+ if (housingDemand.getHouseTypeId()!=null && housingDemand.getHouseTypeId().equals("0")){
+ housingDemand.setHouseTypeName("不限");
+ }
+ // 查询求房源选择的区域
+ return ResultUtil.success(housingDemand);
+ }else{
+ HouseResource houseResource = houseResourceService.selectById(id);
+ if (houseResource.getHouseTypeId()!=null){
+ HouseType houseType = houseTypeService.selectById(houseResource.getHouseTypeId());
+ houseResource.setHouseTypeName(houseType.getName());
+ }
+ if (houseResource.getCityId()!=null){
+ Region region = regionService.selectById(houseResource.getCityId());
+ houseResource.setCityName(region.getName());
+ }
+ if (houseResource.getDistrictId()!=null && houseResource.getDistrictId()==0){
+ houseResource.setDistrictName("不限");
+ }else{
+ Region region = regionService.selectById(houseResource.getDistrictId());
+ houseResource.setDistrictName(region.getName());
+ }
+ return ResultUtil.success(houseResource);
+ }
}
// todo 放行
@ResponseBody
@@ -104,47 +156,53 @@
@ApiOperation(value = "中介认证", tags = {"个人中心"})
@ApiImplicitParam(name = "Authorization", value = "Bearer eyJhbGciOiJIUzUxMiJ....",
required = true, paramType = "header")
- public ResultUtil auth(@RequestBody AppUser appUser){
+ public ResultUtil auth(@RequestBody AuthDTO dto){
AppUser appUser1 = appUserService.getAppUser();
- appUser1.setAgentLicenceCode(appUser.getAgentLicenceCode());
- appUser1.setCompanyName(appUser.getCompanyName());
- appUser1.setCompanyAddress(appUser.getCompanyAddress());
- appUser1.setBusinessCardPhoto(appUser.getBusinessCardPhoto());
- appUser1.setCityId(appUser.getCityId());
- appUser1.setDistrictId(appUser.getDistrictId());
- appUser1.setAuditStatus(1);
+ appUser1.setAgentLicenceCode(dto.getAgentLicenceCode());
+ appUser1.setCompanyName(dto.getCompanyName());
+ appUser1.setCompanyAddress(dto.getCompanyAddress());
+ appUser1.setBusinessCardPhoto(dto.getBusinessCardPhoto());
+ appUser1.setCityId(dto.getCityId());
+ appUser1.setDistrictId(dto.getDistrictId());
+ appUser1.setAuth(1);
+ appUser1.setPhone(dto.getPhone());
appUserService.updateById(appUser1);
return ResultUtil.success();
}
+// // todo 放行
+// @ResponseBody
+// @GetMapping("/base/appUser/editSubmit")
+// @ApiOperation(value = "编辑提交", tags = {"个人中心"})
+// @ApiImplicitParam(name = "Authorization", value = "Bearer eyJhbGciOiJIUzUxMiJ....",
+// required = true, paramType = "header")
+// public ResultUtil editSubmit(@RequestBody AddHouseReq req){
+// HouseResource houseResource = new HouseResource();
+// BeanUtils.copyProperties(req,houseResource);
+// houseResource.setInsertTime(new Date());
+// houseResource.setAuthStatus(1);
+// houseResource.setIsDelete(0);
+// houseResource.setUpdateUserId(appUserService.getAppUser().getId());
+// houseResource.setUpdateTime(new Date());
+// houseResource.setStatus(0);
+// houseResource.setLeaseTime(req.getTime());
+// houseResource.setFirmHouse(req.getFirmHouse());
+// if (req.getTime().contains("年")){
+// houseResource.setRentalDuration(2);
+// }else{
+// houseResource.setRentalDuration(1);
+// }
+// return ResultUtil.success();
+// }
// todo 放行
@ResponseBody
- @GetMapping("/base/appUser/editSubmit")
- @ApiOperation(value = "编辑提交", tags = {"个人中心"})
+ @PostMapping("/base/appUser/operate")
@ApiImplicitParam(name = "Authorization", value = "Bearer eyJhbGciOiJIUzUxMiJ....",
required = true, paramType = "header")
- public ResultUtil editSubmit(@RequestBody AddHouseReq req){
- HouseResource houseResource = new HouseResource();
- BeanUtils.copyProperties(req,houseResource);
- houseResource.setInsertTime(new Date());
- houseResource.setAuthStatus(1);
- houseResource.setIsDelete(0);
- houseResource.setUpdateUserId(appUserService.getAppUser().getId());
- houseResource.setUpdateTime(new Date());
- houseResource.setStatus(0);
- houseResource.setLeaseTime(req.getTime());
- houseResource.setFirmHouse(req.getFirmHouse());
- if (req.getTime().contains("年")){
- houseResource.setRentalDuration(2);
- }else{
- houseResource.setRentalDuration(1);
- }
- return ResultUtil.success();
- }
- // todo 放行
- @ResponseBody
- @GetMapping("/base/appUser/operate")
- @ApiOperation(value = "发布-删除/下架/顶上去", tags = {"个人中心"})
+ @ApiOperation(value = "发布-删除/下架/顶上去/上架", tags = {"个人中心"})
public ResultUtil delete(@RequestBody UserInfoDTO dto){
+ AppUser appUser = appUserService.getAppUser();
+ Integer id = appUser.getId();
+ if (dto.getData() == 2){
switch (dto.getType()){
case 1:
HouseResource houseResource = houseResourceService.selectById(dto.getId());
@@ -159,8 +217,59 @@
case 3:
HouseResource houseResource2 = houseResourceService.selectById(dto.getId());
houseResource2.setInsertTime(new Date());
+ houseResource2.setUpTime(new Date());
houseResourceService.updateById(houseResource2);
break;
+ case 4:
+ if (appUser.getAuth()!=2){
+ // 未认证 只能能发布三条房源信息
+ List<HouseResource> houseResources = houseResourceService.selectList(new EntityWrapper<HouseResource>()
+ .eq("app_user_id", id)
+ .eq("is_delete", 1)
+ .eq("status", 1)
+ );
+ if (houseResources.size()>=3){
+ return ResultUtil.error("中介账号未认证,只能同时上架3条房源信息");
+ }
+ }else if (appUser.getAuth()==1){
+ // 已经认证 只能能发布20条房源信息
+ List<HouseResource> houseResources = houseResourceService.selectList(new EntityWrapper<HouseResource>()
+ .eq("app_user_id", id)
+ .eq("is_delete", 1)
+ .eq("status", 1)
+ );
+ if (houseResources.size()>=20){
+ return ResultUtil.error("当前中介账号只能同时上架20条房源信息");
+ }
+ }
+ HouseResource houseResource3 = houseResourceService.selectById(dto.getId());
+ houseResource3.setStatus(1);
+ houseResourceService.updateById(houseResource3);
+ break;
+ }
+ }else{
+ switch (dto.getType()){
+ case 1:
+ HousingDemand houseResource = housingDemandService.selectById(dto.getId());
+ houseResource.setIsDelete(1);
+ housingDemandService.updateById(houseResource);
+ break;
+ case 2:
+ HousingDemand houseResource1 = housingDemandService.selectById(dto.getId());
+ houseResource1.setStatus(0);
+ housingDemandService.updateById(houseResource1);
+ break;
+ case 3:
+ HousingDemand houseResource2 = housingDemandService.selectById(dto.getId());
+ houseResource2.setInsertTime(new Date());
+ housingDemandService.updateById(houseResource2);
+ break;
+ case 4:
+ HousingDemand houseResource3 = housingDemandService.selectById(dto.getId());
+ houseResource3.setStatus(1);
+ housingDemandService.updateById(houseResource3);
+ break;
+ }
}
return ResultUtil.success();
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/api/BannerController.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/api/BannerController.java
index f1669a7..5283065 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/api/BannerController.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/api/BannerController.java
@@ -31,7 +31,7 @@
@GetMapping("/base/banner/getBanners")
@ApiOperation(value = "获取各种banner", tags = {"首页"})
@ApiImplicitParams({
- @ApiImplicitParam(name = "position", value = "位置(1=首页,2=租房,3=买房,4=公司盘,5=求房源)", required = true)
+ @ApiImplicitParam(name = "position", value = "位置(1=首页,6=租房,7=买房,8=公司盘,9=求房源)", required = true)
})
public ResultUtil<List<BannerRes>> getBanners(Integer position){
List<BannerRes> banners = bannerService.getBanners(position);
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/api/EncyclopedicKnowledgeController.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/api/EncyclopedicKnowledgeController.java
index 688632c..44ac2ec 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/api/EncyclopedicKnowledgeController.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/api/EncyclopedicKnowledgeController.java
@@ -15,6 +15,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
+import java.util.ArrayList;
import java.util.List;
/**
@@ -37,7 +38,13 @@
@ApiOperation(value = "获取类别", tags = {"知识百科"})
public ResultUtil<List<SysDataType>> getEncyclopedicKnowledgeType(){
List<SysDataType> sysDataType = sysDataTypeService.getSysDataType(1);
- return ResultUtil.success(sysDataType);
+ List<SysDataType> res = new ArrayList<>();
+ // 如果当前类别下 没有内容就不展示了
+ for (SysDataType dataType : sysDataType) {
+ List<EncyclopedicKnowledgeRes> list = encyclopedicKnowledgeService.getEncyclopedicKnowledgeList(dataType.getId());
+ if (list.size()!=0) res.add(dataType);
+ }
+ return ResultUtil.success(res);
}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/api/FileController.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/api/FileController.java
new file mode 100644
index 0000000..9880f73
--- /dev/null
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/api/FileController.java
@@ -0,0 +1,73 @@
+package com.stylefeng.guns.modular.api;
+
+import com.aliyun.oss.OSS;
+import com.aliyun.oss.OSSClientBuilder;
+import com.aliyun.oss.model.OSSObject;
+import com.aliyun.oss.model.PutObjectResult;
+import com.stylefeng.guns.modular.file.OSSService;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.StreamUtils;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.InputStream;
+
+@RestController
+@RequestMapping("")
+public class FileController {
+
+ @Autowired
+ private OSSService ossService;
+
+ @PostMapping("/base/files/upload")
+ @ApiOperation(value = "文件上传", tags = {"文件上传"})
+ public String uploadFile(@RequestParam("file") MultipartFile file) {
+ return ossService.uploadFile(file);
+ }
+
+// @ApiOperation(value = "服务端上传", notes = "服务端上传")
+// @PostMapping(value = "upload")
+// public String fileUpload(@RequestParam(value = "file") MultipartFile file) throws IOException {
+// InputStream inputStream = file.getInputStream();
+// String filename = System.currentTimeMillis() + file.getOriginalFilename();
+// // Endpoint以杭州为例,其它Region请按实际情况填写。
+// final String endpoint = "oss-cn-hongkong.aliyuncs.com";
+// // 阿里云主账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM账号进行API访问或日常运维,请登录RAM控制台创建RAM账号。
+// final String accessKeyId = "LTAI5tQZzqsZYX5gw8yRNchQ";
+// final String accessKeySecret = "5yJVdXwRzwPZwKKXp07lRAc7tkTxQp";
+// final String bucketName = "bizuphk";
+// // <yourObjectName>上传文件到OSS时需要指定包含文件后缀在内的完整路径,例如abc/efg/123.jpg。
+// String objectName = AliOss.dir + filename;
+// // 创建OSSClient实例。
+// OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
+// // 填写本地文件的完整路径。如果未指定本地路径,则默认从示例程序所属项目对应本地路径中上传文件流。
+// // InputStream inputStream = new FileInputStream("D:\\localpath\\examplefile.txt");
+// // 依次填写Bucket名称(例如examplebucket)和Object完整路径(例如exampledir/exampleobject.txt)。Object完整路径中不能包含Bucket名称。
+// PutObjectResult putObjectResult = ossClient.putObject(bucketName, objectName, inputStream);
+// OSSObject ossObject = ossClient.getObject(bucketName, objectName);
+// String uri = ossObject.getResponse().getUri();
+// // 关闭OSSClient。
+// ossClient.shutdown();
+// uri = uri.replace("http://nn-bucket.oss-cn-shanghai.aliyuncs.com",FILE_CDN);
+// return uri;
+// }
+// @GetMapping("/base/files/download/{fileName}")
+// @ApiOperation(value = "文件下载", tags = {"文件下载"})
+// public void downloadFile(@PathVariable("fileName") String fileName, HttpServletResponse response) {
+// InputStream inputStream = ossService.downloadFile(fileName);
+// if (inputStream != null) {
+// try {
+// StreamUtils.copy(inputStream, response.getOutputStream());
+// response.setContentType("application/octet-stream");
+// response.flushBuffer();
+// } catch (IOException e) {
+// // 处理下载失败的逻辑
+// }
+// } else {
+// // 处理文件不存在的逻辑
+// }
+// }
+}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/api/HouseResourceController.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/api/HouseResourceController.java
index 631d412..e8d7fae 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/api/HouseResourceController.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/api/HouseResourceController.java
@@ -1,17 +1,40 @@
package com.stylefeng.guns.modular.api;
+import com.alipay.api.internal.util.codec.Base64;
+import com.stylefeng.guns.modular.file.OSSService;
+import com.stylefeng.guns.modular.system.model.AppUser;
+import com.stylefeng.guns.modular.system.model.HouseResource;
import com.stylefeng.guns.modular.system.model.HouseType;
import com.stylefeng.guns.modular.system.service.*;
import com.stylefeng.guns.modular.system.util.ResultUtil;
+import com.stylefeng.guns.modular.system.util.WxAppletTools;
import com.stylefeng.guns.modular.system.warpper.req.*;
import com.stylefeng.guns.modular.system.warpper.res.*;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
+import org.apache.http.entity.ContentType;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.*;
+import org.springframework.mock.web.MockMultipartFile;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.*;
+import org.springframework.web.client.RestTemplate;
+import org.springframework.web.multipart.MultipartFile;
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.security.SecureRandom;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
/**
* @author zhibing.pu
@@ -31,6 +54,61 @@
private IReportHouseResourceService reportHouseResourceService;
@Autowired
private IAppUserService appUserService;
+ @Autowired
+ private WxAppletTools wxAppletTools;
+ @Autowired
+ private RestTemplate restTemplate;
+ @Autowired
+ private OSSService ossService;
+ @Value("${wx.appletsAppid}")
+ private String wxAppletsAppid;
+
+ @Value("${wx.appletsAppSecret}")
+ private String wxAppletsAppSecret;
+
+
+ /**
+ * 生成小程序码地址
+ */
+ public static final String CREATE_CODE_URL = "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=ACCESS_TOKEN";
+ // 生成小程序码
+ private String generateMiniProgramCode(String apiUrl, String pagePath, String outputFilePath) throws IOException {
+ URL url = new URL(apiUrl);
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+
+ // 设置请求方法
+ connection.setRequestMethod("POST");
+ connection.setDoOutput(true);
+
+ // 构建请求参数
+ String params = "path=" + URLEncoder.encode(pagePath, "UTF-8");
+
+ // 获取输出流
+ try (OutputStream outputStream = connection.getOutputStream()) {
+ outputStream.write(params.getBytes());
+ }
+
+ // 获取输入流
+ try (InputStream inputStream = connection.getInputStream();
+ FileOutputStream outputStream = new FileOutputStream(outputFilePath)) {
+ // 将返回的图片数据写入文件
+ byte[] buffer = new byte[1024];
+ int bytesRead;
+ while ((bytesRead = inputStream.read(buffer)) != -1) {
+ outputStream.write(buffer, 0, bytesRead);
+ }
+ ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(buffer);
+ MultipartFile file = new MockMultipartFile(ContentType.APPLICATION_OCTET_STREAM.toString(), byteArrayInputStream);
+ return ossService.uploadFile(file);
+ }
+ }
+ @ResponseBody
+ @GetMapping("/base/houseResource/qrCode/{id}")
+ @ApiOperation(value = "海报二维码", tags = {"房源"})
+ public ResultUtil<String> poster(@PathVariable("id") Integer id){
+ HouseResource houseResource = houseResourceService.selectById(id);
+ return ResultUtil.success(houseResource.getQrCode());
+ }
// todo 放行
@ResponseBody
@@ -38,10 +116,10 @@
@ApiOperation(value = "中介身份提示", tags = {"发布"})
@ApiImplicitParam(name = "Authorization", value = "Bearer eyJhbGciOiJIUzUxMiJ....",
required = true, paramType = "header")
- public ResultUtil confirm(@RequestBody Integer userType){
+ public ResultUtil confirm(Integer userType){
return houseResourceService.confirm(userType);
}
- // todo 放行
+
@ResponseBody
@PostMapping("/base/addHouse/add")
@ApiOperation(value = "发布房源", tags = {"发布"})
@@ -95,7 +173,7 @@
@ResponseBody
- @PostMapping("/api/houseResource/collectionHouseResource")
+ @PostMapping("/base/houseResource/collectionHouseResource")
@ApiOperation(value = "收藏/取消收藏房源操作", tags = {"详情"})
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "房源id", required = true),
@@ -120,21 +198,19 @@
@ResponseBody
- @GetMapping("/base/houseResource/getContactInformation")
+ @GetMapping("/base/houseResource/getContactInformation/{id}")
@ApiOperation(value = "获取联系方式", tags = {"详情"})
- @ApiImplicitParams({
- @ApiImplicitParam(name = "id", value = "房源id", required = true),
- })
- public ResultUtil<ContactInformationRes> getContactInformation(Integer id){
+ public ResultUtil<ContactInformationRes> getContactInformation(@PathVariable("id") Integer id){
ContactInformationRes contactInformation = houseResourceService.getContactInformation(id);
return ResultUtil.success(contactInformation);
}
-
-
@ResponseBody
- @PostMapping("/api/houseResource/addReportHouseResource")
+ @PostMapping("/base/houseResource/addReportHouseResource")
@ApiOperation(value = "添加房源举报", tags = {"详情"})
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "Authorization", value = "Bearer eyJhbGciOiJIUzUxMiJ....", required = true, paramType = "header")
+ })
public ResultUtil addReportHouseResource(@RequestBody ReportHouseResourceReq req){
return reportHouseResourceService.addReportHouseResource(req);
}
@@ -144,6 +220,33 @@
public ResultUtil<SearchIntermediaryRes> searchIntermediaryList(@RequestBody SearchIntermediaryReq req){
SearchIntermediaryRes res= appUserService.searchIntermediaryList(req);
return ResultUtil.success(res);
+ }
+ @ResponseBody
+ @PostMapping("/base/intermediary/intermediaryInfo")
+ @ApiOperation(value = "找中介-中介信息", tags = {"服务"})
+ public ResultUtil<SearchIntermediaryListRes> searchIntermediaryInfo(Integer id){
+ SearchIntermediaryListRes res= appUserService.searchIntermediaryInfo(id);
+ if (res==null){
+ SearchIntermediaryListRes searchIntermediaryListRes = new SearchIntermediaryListRes();
+ AppUser appUser = appUserService.selectById(id);
+ searchIntermediaryListRes.setId(id);
+ searchIntermediaryListRes.setNickname(appUser.getNickname());
+ searchIntermediaryListRes.setCompanyName(appUser.getCompanyName());
+ searchIntermediaryListRes.setCompanyAddress(appUser.getCompanyAddress());
+ searchIntermediaryListRes.setIntroduce(appUser.getIntroduce());
+ searchIntermediaryListRes.setProfilePhoto(appUser.getProfilePhoto());
+ searchIntermediaryListRes.setPhone(appUser.getPhone());
+ searchIntermediaryListRes.setHouseCount(0);
+ return ResultUtil.success(searchIntermediaryListRes);
+ }
+ return ResultUtil.success(res);
+ }
+ @ResponseBody
+ @GetMapping("/base/intermediary/getContactInfo/{id}")
+ @ApiOperation(value = "获取中介联系方式", tags = {"详情"})
+ public ResultUtil<AppUser> getContactInfo(@PathVariable("id") Integer id){
+ AppUser appUser = appUserService.selectById(id);
+ return ResultUtil.success(appUser);
}
@ResponseBody
@PostMapping("/base/intermediary/listHouse")
@@ -156,4 +259,13 @@
return ResultUtil.success(res);
}
+ @ResponseBody
+ @PostMapping("/api/housingDemand/getSurplusPushNumber1")
+ @ApiOperation(value = "获取剩余发布数量", tags = {"房源"})
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "Authorization", value = "Bearer eyJhbGciOiJIUzUxMiJ....", required = true, paramType = "header")
+ })
+ public ResultUtil<Integer> getSurplusPushNumber1(){
+ return houseResourceService.getSurplusPushNumber1();
+ }
}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/api/HousingDemandController.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/api/HousingDemandController.java
index a76d17a..eda0929 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/api/HousingDemandController.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/api/HousingDemandController.java
@@ -1,5 +1,7 @@
package com.stylefeng.guns.modular.api;
+import com.stylefeng.guns.modular.system.model.HouseResource;
+import com.stylefeng.guns.modular.system.model.HousingDemand;
import com.stylefeng.guns.modular.system.service.ICollectionHousingDemandService;
import com.stylefeng.guns.modular.system.service.IHousingDemandService;
import com.stylefeng.guns.modular.system.service.IReportHousingDemandService;
@@ -35,80 +37,75 @@
private ICollectionHousingDemandService collectionHousingDemandService;
-
+ @ResponseBody
+ @GetMapping("/base/houseDemand/qrCode/{id}")
+ @ApiOperation(value = "海报二维码", tags = {"求房源"})
+ public ResultUtil<String> poster(@PathVariable("id") Integer id){
+ HousingDemand houseResource = housingDemandService.selectById(id);
+ return ResultUtil.success(houseResource.getQrCode());
+ }
@ResponseBody
@PostMapping("/api/housingDemand/addHousingDemand")
@ApiOperation(value = "添加房源", tags = {"求房源"})
@ApiImplicitParams({
@ApiImplicitParam(name = "Authorization", value = "Bearer eyJhbGciOiJIUzUxMiJ....", required = true, paramType = "header")
})
+
public ResultUtil addHousingDemand(@RequestBody HousingDemandReq req){
return housingDemandService.addHousingDemand(req);
}
-
@ResponseBody
@GetMapping("/base/housingDemand/searchHousingDemand")
@ApiOperation(value = "求房源列表", tags = {"求房源"})
- public ResultUtil<SearchHousingDemandRes> searchHousingDemand(@RequestBody SearchHousingDemandReq req){
+ public ResultUtil<SearchHousingDemandRes> searchHousingDemand(SearchHousingDemandReq req){
SearchHousingDemandRes searchHousingDemandRes = housingDemandService.searchHousingDemand(req);
return ResultUtil.success(searchHousingDemandRes);
}
-
-
@ResponseBody
@PostMapping("/api/housingDemand/housingDemandInfo")
@ApiOperation(value = "获取求房源详情", tags = {"求房源"})
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "数据id", required = true),
- @ApiImplicitParam(name = "Authorization", value = "Bearer eyJhbGciOiJIUzUxMiJ....", required = false, paramType = "header")
+ @ApiImplicitParam(name = "Authorization", value = "Bearer eyJhbGciOiJIUzUxMiJ....", required = true, paramType = "header")
})
- public ResultUtil<HousingDemandInfoRes> housingDemandInfo(@RequestBody Integer id){
+ public ResultUtil<HousingDemandInfoRes> housingDemandInfo(Integer id){
HousingDemandInfoRes housingDemandInfoRes = housingDemandService.housingDemandInfo(id);
return ResultUtil.success(housingDemandInfoRes);
}
-
@ResponseBody
- @PostMapping("/api/housingDemand/addReportHousingDemand")
+ @PostMapping("/base/housingDemand/addReportHousingDemand")
@ApiOperation(value = "添加举报数据", tags = {"求房源"})
@ApiImplicitParams({
@ApiImplicitParam(name = "Authorization", value = "Bearer eyJhbGciOiJIUzUxMiJ....", required = true, paramType = "header")
})
- public ResultUtil addReportHousingDemand(@RequestBody ReportHousingDemandReq req){
+ public ResultUtil addReportHousingDemand(ReportHousingDemandReq req){
return reportHousingDemandService.addReportHousingDemand(req);
}
-
-
-
@ResponseBody
- @PostMapping("/api/housingDemand/collectionHousingDemand")
+ @PostMapping("/base/housingDemand/collectionHousingDemand")
@ApiOperation(value = "收藏/取消收藏房源操作", tags = {"求房源"})
@ApiImplicitParams({
- @ApiImplicitParam(name = "id", value = "房源id", required = true),
@ApiImplicitParam(name = "Authorization", value = "Bearer eyJhbGciOiJIUzUxMiJ....", required = true, paramType = "header")
})
- public ResultUtil collectionHousingDemand(@RequestBody Integer id){
+ public ResultUtil collectionHousingDemand(Integer id){
return collectionHousingDemandService.collectionHousingDemand(id);
}
@ResponseBody
- @GetMapping("/base/housingDemand/getContactInformation")
+ @GetMapping("/base/housingDemand/getContactInformation/{id}")
@ApiOperation(value = "获取联系方式", tags = {"求房源"})
- @ApiImplicitParams({
- @ApiImplicitParam(name = "id", value = "房源id", required = true),
- })
- public ResultUtil<ContactInformationRes> getContactInformation(@RequestBody Integer id){
+ public ResultUtil<ContactInformationRes> getContactInformation(@PathVariable("id") Integer id){
ContactInformationRes contactInformation = housingDemandService.getContactInformation(id);
return ResultUtil.success(contactInformation);
}
-
@ResponseBody
- @PostMapping("/api/housingDemand/getSurplusPushNumber")
+ @PostMapping("/base/housingDemand/getSurplusPushNumber")
@ApiOperation(value = "获取剩余发布数量", tags = {"求房源"})
@ApiImplicitParams({
@ApiImplicitParam(name = "Authorization", value = "Bearer eyJhbGciOiJIUzUxMiJ....", required = true, paramType = "header")
@@ -116,4 +113,6 @@
public ResultUtil<Integer> getSurplusPushNumber(){
return housingDemandService.getSurplusPushNumber();
}
+
+
}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/api/RegionController.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/api/RegionController.java
index 88dd7e7..b34185d 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/api/RegionController.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/api/RegionController.java
@@ -1,5 +1,6 @@
package com.stylefeng.guns.modular.api;
+import com.stylefeng.guns.modular.system.model.RegionVO;
import com.stylefeng.guns.modular.system.service.IRegionService;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import com.stylefeng.guns.modular.system.warpper.res.DistrictRes;
@@ -33,6 +34,20 @@
List<DistrictRes> district = regionService.getDistrict(parentId);
return ResultUtil.success(district);
}
+ @ResponseBody
+ @GetMapping("/base/region/getDistrict1")
+ @ApiOperation(value = "获取区域数据", tags = {"首页"})
+
+ public ResultUtil<RegionVO> getDistrict1(){
+ List<DistrictRes> district1 = regionService.getDistrict(1);
+ List<DistrictRes> district2 = regionService.getDistrict(2);
+ List<DistrictRes> district3 = regionService.getDistrict(3);
+ RegionVO regionVO = new RegionVO();
+ regionVO.setList1(district1);
+ regionVO.setList2(district2);
+ regionVO.setList3(district3);
+ return ResultUtil.success(regionVO);
+ }
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/file/OSSConfig.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/file/OSSConfig.java
new file mode 100644
index 0000000..b665c64
--- /dev/null
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/file/OSSConfig.java
@@ -0,0 +1,25 @@
+package com.stylefeng.guns.modular.file;
+
+import com.aliyun.oss.OSS;
+import com.aliyun.oss.OSSClientBuilder;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class OSSConfig {
+
+ @Value("${oss.endpoint}")
+ private String endpoint;
+
+ @Value("${oss.accessKeyId}")
+ private String accessKeyId;
+
+ @Value("${oss.accessKeySecret}")
+ private String accessKeySecret;
+
+ @Bean
+ public OSS ossClient() {
+ return new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
+ }
+}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/file/OSSService.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/file/OSSService.java
new file mode 100644
index 0000000..b139b76
--- /dev/null
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/file/OSSService.java
@@ -0,0 +1,211 @@
+package com.stylefeng.guns.modular.file;
+
+import com.aliyun.oss.OSS;
+import com.aliyun.oss.OSSException;
+import com.aliyun.oss.common.comm.ResponseMessage;
+import com.aliyun.oss.common.comm.ServiceClient;
+import com.aliyun.oss.model.OSSObject;
+import com.aliyun.oss.model.ObjectMetadata;
+import com.aliyun.oss.model.PutObjectResult;
+import org.apache.commons.lang.StringUtils;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Date;
+
+@Service
+public class OSSService {
+
+ @Autowired
+ private OSS ossClient;
+
+ @Value("${oss.bucketName}")
+ private String bucketName;
+
+ public String uploadFile(MultipartFile file) {
+ try {
+ String fileName = file.getOriginalFilename();
+// if (fileName.equals("")){
+// fileName = "test.jpg";
+// }
+ ossClient.putObject(bucketName, fileName, file.getInputStream());
+ String uri ="https://bizuphk.oss-cn-hongkong.aliyuncs.com/";
+ System.err.println("小程序二维码:"+uri+fileName);
+ return uri+fileName;
+// String fileName = file.getOriginalFilename();
+// PutObjectResult putObjectResult = ossClient.putObject(bucketName, fileName, file.getInputStream());
+// System.err.println("看看返回的文件名");
+// System.err.println(fileName);
+// return fileName;
+ } catch (IOException e) {
+ // 处理上传失败的逻辑
+ }
+ return null;
+ }
+ public InputStream downloadFile(String fileName) {
+ try {
+ OSSObject object = ossClient.getObject(bucketName, fileName);
+ return object.getObjectContent();
+ } catch (OSSException e) {
+ // 处理下载失败的逻辑
+ }
+ return null;
+ }
+ /**
+ * 上传到OSS服务器 如果同名文件会覆盖服务器上的
+ *
+ * @param instream 文件流
+ * @param fileName 文件名称 包括后缀名
+ * @return 出错返回"" ,唯一MD5数字签名
+ */
+ public String uploadFile2OSS(InputStream instream, String fileName) {
+
+ String ret = "";
+ try {
+
+ // 创建上传Object的Metadata
+ ObjectMetadata objectMetadata = new ObjectMetadata();
+ objectMetadata.setContentLength(instream.available());
+ objectMetadata.setCacheControl("no-cache");
+ objectMetadata.setContentType(getContentType(fileName.substring(fileName.lastIndexOf("."))));
+ objectMetadata.setHeader("Pragma", "no-cache");
+// objectMetadata.setContentDisposition("inline;filename=" + fileName);
+ // 上传文件
+ PutObjectResult putResult = ossClient.putObject(bucketName, fileName, instream, objectMetadata);
+ ret = putResult.getETag();
+ } catch (IOException e) {
+ System.err.println(e.getMessage());
+ } finally {
+ try {
+ if (instream != null) {
+ instream.close();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ return ret;
+ }
+
+ /**
+ * 通过文件名判断并获取OSS服务文件上传时文件的contentType
+ *
+ * @param filenameExtension 文件名
+ * @return 文件的contentType
+ */
+ public static final String getContentType(String filenameExtension) {
+
+ if (filenameExtension.equalsIgnoreCase(".bmp")) {
+ return "application/x-bmp";
+ }
+ if (filenameExtension.equalsIgnoreCase(".gif")) {
+ return "image/gif";
+ }
+ if (filenameExtension.equalsIgnoreCase(".jpeg") ||
+ filenameExtension.equalsIgnoreCase(".jpg") ||
+ filenameExtension.equalsIgnoreCase(".png")) {
+ return "image/jpg";
+ }
+ if (filenameExtension.equalsIgnoreCase(".html")) {
+ return "text/html";
+ }
+ if (filenameExtension.equalsIgnoreCase(".txt")) {
+ return "text/plain";
+ }
+ if (filenameExtension.equalsIgnoreCase(".vsd")) {
+ return "application/vnd.visio";
+ }
+ if (filenameExtension.equalsIgnoreCase(".pptx") ||
+ filenameExtension.equalsIgnoreCase(".ppt")) {
+ return "application/vnd.ms-powerpoint";
+ }
+ if (filenameExtension.equalsIgnoreCase(".docx") ||
+ filenameExtension.equalsIgnoreCase(".doc")) {
+ return "application/msword";
+ }
+ if (filenameExtension.equalsIgnoreCase(".xla") ||
+ filenameExtension.equalsIgnoreCase(".xlc") ||
+ filenameExtension.equalsIgnoreCase(".xlm") ||
+ filenameExtension.equalsIgnoreCase(".xls") ||
+ filenameExtension.equalsIgnoreCase(".xlt") ||
+ filenameExtension.equalsIgnoreCase(".xlw")) {
+ return "application/vnd.ms-excel";
+ }
+ if (filenameExtension.equalsIgnoreCase(".xlsx")) {
+ return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+ }
+ if (filenameExtension.equalsIgnoreCase(".xml")) {
+ return "text/xml";
+ }
+ if (filenameExtension.equalsIgnoreCase(".pdf")) {
+ return "application/pdf";
+ }
+ if (filenameExtension.equalsIgnoreCase(".zip")) {
+ return "application/zip";
+ }
+ if (filenameExtension.equalsIgnoreCase(".tar")) {
+ return "application/x-tar";
+ }
+ if (filenameExtension.equalsIgnoreCase(".avi")) {
+ return "video/avi";
+ }
+ if (filenameExtension.equalsIgnoreCase(".mp4")) {
+ return "video/mpeg4";
+ }
+ if (filenameExtension.equalsIgnoreCase(".mp3")) {
+ return "audio/mp3";
+ }
+ if (filenameExtension.equalsIgnoreCase(".mp2")) {
+ return "audio/mp2";
+ }
+ // 默认下载
+// return "application/octet-stream";
+ return "image/jpg";
+ }
+
+ /**
+ * 获得url链接
+ *
+ * @param key
+ * @return
+ */
+ public String getUrl(String key) {
+ // 设置URL过期时间为10年 3600l* 1000*24*365*10
+ Date expiration = new Date(System.currentTimeMillis() + 3600L * 1000 * 24 * 365 * 10);
+ // 生成URL
+ URL url = ossClient.generatePresignedUrl(bucketName, key, expiration);
+ System.out.println("url: " + url);
+ if (url != null) {
+ String host = "https://" + url.getHost() + url.getPath();
+ System.out.println("host: " + host);
+ // http://wxcall-xiaobanben.oss-cn-shenzhen.aliyuncs.com/image/20220129/1643469496754508.jpg
+ return host;
+ }
+ return "";
+ }
+ /**
+ * 获得图片路径
+ *
+ * @param fileUrl
+ * @return
+ */
+ public String getImgUrl(String fileUrl) {
+ System.out.println(fileUrl);
+ if (!StringUtils.isEmpty(fileUrl)) {
+// String[] split = fileUrl.split("/");
+ return this.getUrl(fileUrl);
+ }
+ return "";
+ }
+
+
+
+
+
+}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/AppUserMapper.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/AppUserMapper.java
index 3b197f0..73b3e76 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/AppUserMapper.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/AppUserMapper.java
@@ -15,4 +15,6 @@
List<SearchIntermediaryListRes> searchIntermediaryList(@Param("req") SearchIntermediaryReq req,
@Param("districtIds") List<Integer> districtIds,
@Param("cityIds")List<Integer> cityIds);
+
+ SearchIntermediaryListRes searchIntermediaryInfo(@Param("id")Integer id);
}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/HouseResourceMapper.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/HouseResourceMapper.java
index aef4d41..290b0aa 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/HouseResourceMapper.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/HouseResourceMapper.java
@@ -55,7 +55,7 @@
List<SearchHouseResourceListRes> listHouse(@Param("query") HouseQuery query);
- List<CollectListRes> collect(@Param("ids") List<Integer> ids);
+ List<CollectListRes> collect(@Param("id") Integer id);
List<CollectListRes> release(@Param("query") UserInfoQuery query,@Param("ids")List<Integer> collect);
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/HousingDemandMapper.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/HousingDemandMapper.java
index 0ee07ce..75e1854 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/HousingDemandMapper.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/HousingDemandMapper.java
@@ -25,12 +25,25 @@
* @param houseTypeIds
* @return
*/
- List<SearchHousingDemandListRes> searchHousingDemand(@Param("req") SearchHousingDemandReq req, @Param("district") List<String> district,
- @Param("saleAmountStart") Double saleAmountStart, @Param("saleAmountEnd") Double saleAmountEnd,
- @Param("houseModels") List<String> houseModels, @Param("houseTypeIds") List<Integer> houseTypeIds);
+ List<SearchHousingDemandListRes> searchHousingDemand(@Param("req") SearchHousingDemandReq req,
+ @Param("district") List<Integer> district,
+ @Param("cityIds") List<Integer> cityIds,
+ @Param("saleAmountStart") Double saleAmountStart,
+ @Param("saleAmountEnd") Double saleAmountEnd,
+ @Param("houseModels") List<String> houseModels,
+ @Param("houseTypeIds") List<Integer> houseTypeIds);
- Integer searchHousingDemandCount(@Param("req") SearchHousingDemandReq req, @Param("district") List<String> district,
- @Param("saleAmountStart") Double saleAmountStart, @Param("saleAmountEnd") Double saleAmountEnd,
- @Param("houseModels") List<String> houseModels, @Param("houseTypeIds") List<Integer> houseTypeIds);
+ Integer searchHousingDemandCount(@Param("req") SearchHousingDemandReq req,
+ @Param("district") List<Integer> district,
+ @Param("cityIds") List<Integer> cityIds,
+ @Param("saleAmountStart") Double saleAmountStart,
+ @Param("saleAmountEnd") Double saleAmountEnd,
+ @Param("houseModels") List<String> houseModels,
+ @Param("houseTypeIds") List<Integer> houseTypeIds);
+
+ List<SearchHousingDemandListRes> searchHousingDemand1(@Param("id") Integer id);
+
+ List<SearchHousingDemandListRes> searchHousingDemand2(@Param("ids")List<Integer> id);
+
}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/AppUserMapper.xml b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/AppUserMapper.xml
index 55c7584..f54bd29 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/AppUserMapper.xml
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/AppUserMapper.xml
@@ -11,21 +11,21 @@
left join t_house_resource t2 on t1.id = t2.insert_user_id
<where>
<if test="null != req.name and '' != req.name">
- and t1.nickname = CONCAT('%', #{req.name}, '%')
+ and t1.nickname like CONCAT('%', #{req.name}, '%')
</if>
- <if test="null != cityIds">
- and t1.city_id in
+ <if test="null != cityIds and cityIds.size()>0">
+ and t1.district_id in
<foreach collection="cityIds" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
- <if test="null != districtIds">
- and t1.district_id in
+ <if test="null != districtIds and districtIds.size()>0">
+ and t1.city_id in
<foreach collection="districtIds" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
- and t1.audit_status = 2
+ and t1.auth = 2
and t1.status = 1
and t1.user_type = 3
and t2.auth_status = 2
@@ -36,4 +36,23 @@
group by t1.id
order by houseCount desc
</select>
+ <select id="searchIntermediaryInfo" resultType="com.stylefeng.guns.modular.system.warpper.res.SearchIntermediaryListRes">
+ select t1.id,t1.profile_photo as profilePhoto,t1.nickname as nickname,t1.company_name as companyName,
+ t1.company_address as companyAddress,t1.introduce as introduce,t1.phone as phone,
+ COUNT(t2.id) AS houseCount
+ from t_app_user t1
+ left join t_house_resource t2 on t1.id = t2.insert_user_id
+ where
+ t1.audit_status = 2
+ and t1.status = 1
+ and t1.user_type = 3
+ and t2.auth_status = 2
+ and t2.app_user_id = #{id}
+ and t2.is_delete = 0
+ and t2.status = 1
+ and t2.type=2
+ and t1.id = #{id}
+ group by t1.id
+ order by houseCount desc
+ </select>
</mapper>
\ No newline at end of file
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/HouseResourceMapper.xml b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/HouseResourceMapper.xml
index e872552..60ee480 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/HouseResourceMapper.xml
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/HouseResourceMapper.xml
@@ -15,6 +15,7 @@
concat(rp.`name`, rc.`name`) as address,
hr.longitude,
hr.latitude,
+ hr.platform,
hr.sale_amount as saleAmount,
au.profile_photo as profilePhoto,
au.nickname,
@@ -22,14 +23,15 @@
hr.drying_area as dryingArea,
hr.garden,
hr.carport,
+ hr.air,
hr.balcony,
+ hr.leaseTime,
hr.keep_pet as keepPet
from t_house_resource hr
left join t_app_user au on (hr.app_user_id = au.id)
left join t_region rc on (hr.district_id = rc.id)
left join t_region rp on (rp.id = rc.parent_id)
- where hr.is_delete = 0 and hr.`status` = 1 and hr.auth_status = 2
- and hr.type=2
+ where hr.is_delete = 0 and hr.`status` = 1 and hr.auth_status = 2 and hr.type=2
<if test="null != req.type">
and hr.data_type = #{req.type}
</if>
@@ -40,16 +42,16 @@
and hr.firm_house = 1
</if>
<if test="null != req.content and '' != req.content">
- and hr.title = CONCAT('%', #{req.content}, '%')
+ and hr.title like CONCAT('%', #{req.content}, '%')
</if>
<if test="null != cityIds and cityIds.size()>0" >
- and hr.city_id in
+ and hr.district_id in
<foreach collection="cityIds" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="null != districtIds and districtIds.size()>0">
- and hr.district_id in
+ and hr.city_id in
<foreach collection="districtIds" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
@@ -114,6 +116,7 @@
<if test="null != req.sort and req.sort == 4">
order by hr.sale_amount desc
</if>
+ order by au.user_type desc, hr.insert_time desc
limit #{req.pageNum}, #{req.pageSize}
</select>
@@ -218,8 +221,11 @@
left join t_app_user au on (hr.app_user_id = au.id)
where hr.is_delete = 0 and hr.`status` = 1 and hr.auth_status = 2
and hr.type=2
- <if test="null != userType and 4 != userType">
- and au.user_type = #{userType} and au.status = 1 and au.audit_status = 2
+ <if test="null != userType and 2 == userType">
+ and au.user_type = 2
+ </if>
+ <if test="null != userType and 3 == userType">
+ and au.user_type = 3
</if>
<if test="null != userType and 4 == userType">
and hr.firm_house = 1
@@ -263,11 +269,13 @@
hr.id,
hr.title,
hr.sale_amount as saleAmount,
- hr.elevator,
+ hr.elevator as elevator,
+ hr.house_model as houseModel,
hr.drying_area as dryingArea,
- hr.garden,
- hr.carport,
- hr.balcony,
+ hr.garden as garden,
+ hr.carport as carport,
+ hr.balcony as balcony,
+ hr.app_user_id as appuserId,
hr.city_id as cityId,
hr.district_id as districtId,
hr.keep_pet as keepPet,
@@ -275,17 +283,14 @@
hr.code as code,
hr.leaseTime as leaseTime,
hr.data_type as dataType,
- hr.insert_time as insertTime,hr.type as `type`,
+ hr.insert_time as insertTime,
+ hr.type as `type`,
+ hr.upTime as upTime,
+ 2 as `data`,
hr.status as status
from t_house_resource hr
- left join t_collection_house_resource t1 on hr.id = t1.house_resource_id
- where hr.is_delete = 0 and hr.`status` = 1 and hr.auth_status = 2
- <if test="null != ids and ids.size()>0">
- and hr.id in
- <foreach collection="ids" item="item" index="index" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
+ where hr.is_delete = 0
+ and hr.app_user_id = #{id}
</select>
<select id="release" resultType="com.stylefeng.guns.modular.system.warpper.res.CollectListRes">
select
@@ -309,13 +314,13 @@
hr.house_video as houseVideo,
hr.insert_time as insertTime,hr.type as `type`,
hr.status as status,
+ 2 as `data`,
au.profile_photo as profilePhoto,
au.nickname as nickname,
au.user_type as userType
from t_house_resource hr
- left join t_collection_house_resource t1 on hr.id = t1.house_resource_id
left join t_app_user au on hr.app_user_id = au.id
- where hr.is_delete = 0 and hr.`status` = 1 and hr.auth_status = 2
+ where hr.is_delete = 0 and hr.`status` = 1
<if test="null != ids and ids.size()>0">
and hr.id in
<foreach collection="ids" item="item" index="index" separator="," open="(" close=")">
@@ -323,6 +328,4 @@
</foreach>
</if>
</select>
-
-
</mapper>
\ No newline at end of file
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/HousingDemandMapper.xml b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/HousingDemandMapper.xml
index 6fdf4c0..2c87d57 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/HousingDemandMapper.xml
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/HousingDemandMapper.xml
@@ -17,7 +17,11 @@
hd.garden,
hd.carport,
hd.balcony,
+ hd.air,
hd.type,
+ hd.data_type as dataType,
+ hd.views_number as viewsNumber,
+ hd.type as `type`,
hd.keep_pet as keepPet
from t_housing_demand hd
left join t_app_user au on (hd.app_user_id = au.id)
@@ -26,10 +30,19 @@
and hd.data_type = #{req.type}
</if>
<if test="null != req.content and '' != req.content">
- and hd.title = CONCAT('%', #{req.content}, '%')
+ and hd.title like CONCAT('%', #{req.content}, '%')
</if>
- <if test="null != district and '' != district">
- and hd.id in (select housing_demand_id from t_housing_demand_district where CONCAT('cityId:', city_id, ',districtId:', district_id) in
+ <if test="null != cityIds and cityIds.size()>0">
+ and hd.id in (select housing_demand_id from t_housing_demand_district
+ where t_housing_demand_district.district_id in
+ <foreach collection="cityIds" item="item" index="index" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ )
+ </if>
+ <if test="null != district and district.size()>0">
+ and hd.id in (select housing_demand_id from t_housing_demand_district
+ where t_housing_demand_district.city_id in
<foreach collection="district" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
@@ -53,9 +66,7 @@
<if test="null != req.elevator">
and hd.elevator = #{req.elevator}
</if>
- <if test="null != req.rentalDuration">
- and hd.rental_duration = #{req.rentalDuration}
- </if>
+
<if test="null != req.balcony">
and hd.balcony = #{req.balcony}
</if>
@@ -80,6 +91,9 @@
<if test="null != req.sort and req.sort == 1">
order by hd.insert_time desc
</if>
+ <if test="null != req.sort and req.sort == 2">
+ order by hd.views_number desc
+ </if>
<if test="null != req.sort and req.sort == 3">
order by hd.sale_amount
</if>
@@ -88,8 +102,6 @@
</if>
limit #{req.pageNum}, #{req.pageSize}
</select>
-
-
<select id="searchHousingDemandCount" resultType="int">
select
@@ -102,8 +114,17 @@
<if test="null != req.content and '' != req.content">
and hd.title = CONCAT('%', #{req.content}, '%')
</if>
- <if test="null != district and '' != district">
- and hd.id in (select housing_demand_id from t_housing_demand_district where CONCAT('cityId:', city_id, ',districtId:', district_id) in
+ <if test="null != cityIds and cityIds.size()>0">
+ and hd.id in (select housing_demand_id from t_housing_demand_district
+ where t_housing_demand_district.city_id in
+ <foreach collection="cityIds" item="item" index="index" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ )
+ </if>
+ <if test="null != district and district.size()>0">
+ and hd.id in (select housing_demand_id from t_housing_demand_district
+ where t_housing_demand_district.district_id in
<foreach collection="district" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
@@ -152,4 +173,67 @@
and now() <= DATE_ADD(hd.insert_time,INTERVAL 3 MONTH)
</if>
</select>
+ <select id="searchHousingDemand1"
+ resultType="com.stylefeng.guns.modular.system.warpper.res.SearchHousingDemandListRes">
+ select
+ hd.id,
+ hd.app_user_id as appuserId,
+ hd.title,
+ hd.house_model as houseModel,
+ hd.sale_amount as saleAmount,
+ au.profile_photo as profilePhoto,
+ au.nickname,
+ hd.elevator,
+ hd.rental_duration as rentalDuration,
+ hd.drying_area as dryingArea,
+ hd.garden,
+ hd.carport,
+ hd.balcony,
+ hd.views_number as viewsNumber,
+ hd.type,
+ hd.status,
+ hd.data_type as dataType,
+ hd.insert_time as insertTime,
+ hd.type as `type`,
+ hd.keep_pet as keepPet
+ from t_housing_demand hd
+ left join t_app_user au on (hd.app_user_id = au.id)
+ where hd.is_delete = 0
+ and hd.app_user_id = #{id}
+ </select>
+ <select id="searchHousingDemand2"
+ resultType="com.stylefeng.guns.modular.system.warpper.res.SearchHousingDemandListRes">
+ select
+ hd.id,
+ hd.app_user_id as appuserId,
+ hd.title,
+ hd.house_model as houseModel,
+ hd.sale_amount as saleAmount,
+ au.profile_photo as profilePhoto,
+ au.nickname,
+ hd.elevator,
+ hd.rental_duration as rentalDuration,
+ hd.drying_area as dryingArea,
+ hd.garden,
+ hd.carport,
+ hd.balcony,
+ hd.views_number as viewsNumber,
+ hd.type,
+ hd.status,
+ hd.data_type as dataType,
+ hd.insert_time as insertTime,
+ hd.type as `type`,
+ hd.keep_pet as keepPet
+ from t_housing_demand hd
+ left join t_app_user au on (hd.app_user_id = au.id)
+ where hd.`status` = 1 and hd.is_delete = 0
+
+ <if test="null != ids and ids.size()>0">
+ and hd.id in
+ <foreach collection="ids" item="item" index="index" separator="," open="(" close=")">
+ #{item}
+ </foreach>
+ </if>
+
+ </select>
</mapper>
\ No newline at end of file
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/AppUser.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/AppUser.java
index ae96820..3cd14dd 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/AppUser.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/AppUser.java
@@ -83,7 +83,7 @@
@TableField("business_card_photo")
private String businessCardPhoto;
/**
- * 审核状态(1=待审核,2=审核通过,3=审核拒绝)
+ * 审核状态(0=未认证,1=待审核,2=审核通过,3=审核拒绝)
*/
@TableField("audit_status")
private Integer auditStatus;
@@ -118,4 +118,14 @@
*/
@TableField("district_id")
private Integer districtId;
+ /**
+ * 中介认证审核状态 0未认证 1待审核 2已通过 3已拒绝
+ */
+ @TableField("auth")
+ private Integer auth;
+ /**
+ * 拒绝理由
+ */
+ @TableField("reason")
+ private String reason;
}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/AuthDTO.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/AuthDTO.java
new file mode 100644
index 0000000..445ab2d
--- /dev/null
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/AuthDTO.java
@@ -0,0 +1,55 @@
+package com.stylefeng.guns.modular.system.model;
+
+import com.baomidou.mybatisplus.annotations.TableField;
+import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.annotations.TableName;
+import com.baomidou.mybatisplus.enums.IdType;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 中介认证DTO
+*/
+@Data
+@TableName("t_app_user")
+public class AuthDTO {
+ /**
+ * 联系电话
+ */
+ @ApiModelProperty(value = "联系电话", required = true)
+ private String phone;
+ /**
+ * 代理人牌照号
+ */
+ @ApiModelProperty(value = "代理人牌照号", required = true)
+ private String agentLicenceCode;
+ /**
+ * 公司名称
+ */
+ @ApiModelProperty(value = "公司名称", required = true)
+ private String companyName;
+ /**
+ * 公司地址
+ */
+ @ApiModelProperty(value = "公司地址", required = true)
+ private String companyAddress;
+ /**
+ * 名片照
+ */
+ @ApiModelProperty(value = "名片照", required = true)
+ private String businessCardPhoto;
+
+ /**
+ * 中介所在公司所在的市
+ */
+ @ApiModelProperty(value = "一级", required = true)
+ private Integer cityId;
+ /**
+ * 中介所在公司所在的区
+ */
+ @ApiModelProperty(value = "二级", required = true)
+ private Integer districtId;
+}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/FeedBack.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/FeedBack.java
index 8f64a25..803ac00 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/FeedBack.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/FeedBack.java
@@ -42,7 +42,7 @@
/**
* 反馈内容
*/
- @TableField("insertTime")
+ @TableField("insert_time")
private Date insertTime;
@Override
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/HouseResource.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/HouseResource.java
index af93d21..5f0e469 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/HouseResource.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/HouseResource.java
@@ -227,6 +227,11 @@
@TableField("update_time")
private Date updateTime;
/**
+ * 顶上去 如果时间是当天则不能顶
+ */
+ @TableField("upTime")
+ private Date upTime;
+ /**
* 修改人id
*/
@TableField("update_user_id")
@@ -251,4 +256,39 @@
*/
@TableField("type")
private Integer type;
+ /**
+ * 是否有平台
+ */
+ @TableField("platform")
+ private Integer platform;
+ /**
+ * 是否有晾晒区
+ */
+ @TableField("air")
+ private Integer air;
+ /**
+ * 房屋类型名称
+ */
+ @TableField(value = "房屋类型名称",exist = false)
+ private String houseTypeName;
+ /**
+ * 一级区域名称
+ */
+ @TableField(value = "一级区域名称",exist = false)
+ private String cityName;
+ /**
+ * 二级区域名称
+ */
+ @TableField(value = "二级区域名称",exist = false)
+ private String districtName;
+ /**
+ * 求房源二维码详情
+ */
+ @TableField("qrCode")
+ private String qrCode;
+ /**
+ * 视频封面
+ */
+ @TableField("videoPhoto")
+ private String videoPhoto;
}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/HousingDemand.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/HousingDemand.java
index d695956..01f0dd6 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/HousingDemand.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/HousingDemand.java
@@ -7,6 +7,7 @@
import lombok.Data;
import java.util.Date;
+import java.util.List;
/**
* @author zhibing.pu
@@ -161,8 +162,50 @@
@TableField("type")
private Integer type;
/**
- * 起租日期
+ * 是否需要晾晒区
*/
- @TableField("startTime")
- private String startTime;
+ @TableField("air")
+ private Integer air;
+ /**
+ * 是否有平台
+ */
+ @TableField("platform")
+ private Integer platform;
+ /**
+ * 是否有平台
+ */
+ @TableField("firm_house")
+ private Integer firmHouse;
+
+ /**
+ * 房屋类型名称
+ */
+ @TableField(value = "房屋类型名称",exist = false)
+ private String houseTypeName;
+
+ /**
+ * 微信二维码
+ */
+ @TableField("wechat_qr_code")
+ private String wechatQRCode;
+ /**
+ * 电话号码
+ */
+ @TableField("phone")
+ private String phone;
+ /**
+ * WatchApp
+ */
+ @TableField("watch_app")
+ private String watchApp;
+ /**
+ * 求房源二维码详情
+ */
+ @TableField("qrCode")
+ private String qrCode;
+ /**
+ * 顶上去 如果时间是当天则不能顶
+ */
+ @TableField("upTime")
+ private Date upTime;
}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/RegionVO.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/RegionVO.java
new file mode 100644
index 0000000..9615f20
--- /dev/null
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/RegionVO.java
@@ -0,0 +1,26 @@
+package com.stylefeng.guns.modular.system.model;
+
+import com.baomidou.mybatisplus.annotations.TableField;
+import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.annotations.TableName;
+import com.baomidou.mybatisplus.enums.IdType;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.stylefeng.guns.modular.system.warpper.res.DistrictRes;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+* APP用户
+* @author pzb
+* @Date 2021/12/1 12:03
+*/
+@Data
+
+public class RegionVO {
+ private List<DistrictRes> list1;
+ private List<DistrictRes> list2;
+ private List<DistrictRes> list3;
+
+}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/ReportHouseResource.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/ReportHouseResource.java
index 92dcc48..e4d05ea 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/ReportHouseResource.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/ReportHouseResource.java
@@ -39,4 +39,9 @@
*/
@TableField("insert_time")
private Date insertTime;
+ /**
+ * 审核状态0待审核 1通过 2未通过
+ */
+ @TableField("audit")
+ private Integer audit;
}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IAppUserService.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IAppUserService.java
index 3674ae6..74a96c6 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IAppUserService.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IAppUserService.java
@@ -51,7 +51,10 @@
ResultUtil<AppUser> userInfo();
- ResultUtil<CollectRes> collect();
+ ResultUtil<CollectRes> collect(UserInfoQuery query);
ResultUtil<CollectRes> release(UserInfoQuery query);
+
+ SearchIntermediaryListRes searchIntermediaryInfo(Integer id);
+
}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IHouseResourceService.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IHouseResourceService.java
index 4b40a5b..c8fbc73 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IHouseResourceService.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IHouseResourceService.java
@@ -63,6 +63,9 @@
ResultUtil confirm(Integer userType);
- List<CollectListRes> collect(List<Integer> ids);
+ List<CollectListRes> collect(Integer id);
+
+ ResultUtil<Integer> getSurplusPushNumber1();
+
}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IHousingDemandService.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IHousingDemandService.java
index 8052801..3d84447 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IHousingDemandService.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IHousingDemandService.java
@@ -32,7 +32,14 @@
*/
SearchHousingDemandRes searchHousingDemand(SearchHousingDemandReq req);
-
+ /**
+ * 不带分页的求房源列表数据
+ */
+ SearchHousingDemandRes searchHousingDemand1(Integer id);
+ /**
+ * 不带分页的求房源列表数据 根据用户收藏的ids
+ */
+ SearchHousingDemandRes searchHousingDemand2(List<Integer> id);
/**
* 获取求房源详情
* @param id
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/AppUserServiceImpl.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/AppUserServiceImpl.java
index 6acf120..cc6b676 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/AppUserServiceImpl.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/AppUserServiceImpl.java
@@ -8,21 +8,15 @@
import com.stylefeng.guns.core.util.JwtTokenUtil;
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.system.dao.AppUserMapper;
-import com.stylefeng.guns.modular.system.model.AppUser;
-import com.stylefeng.guns.modular.system.model.CollectionHouseResource;
-import com.stylefeng.guns.modular.system.model.HouseResource;
-import com.stylefeng.guns.modular.system.model.Region;
-import com.stylefeng.guns.modular.system.service.IAppUserService;
-import com.stylefeng.guns.modular.system.service.ICollectionHouseResourceService;
-import com.stylefeng.guns.modular.system.service.IHousingDemandService;
-import com.stylefeng.guns.modular.system.service.IRegionService;
-import com.stylefeng.guns.modular.system.util.RedisUtil;
-import com.stylefeng.guns.modular.system.util.ResultUtil;
-import com.stylefeng.guns.modular.system.util.UUIDUtil;
+import com.stylefeng.guns.modular.system.model.*;
+import com.stylefeng.guns.modular.system.service.*;
+import com.stylefeng.guns.modular.system.util.*;
import com.stylefeng.guns.modular.system.util.weChat.WXCore;
import com.stylefeng.guns.modular.system.util.weChat.WeChatUtil;
import com.stylefeng.guns.modular.system.warpper.req.*;
import com.stylefeng.guns.modular.system.warpper.res.*;
+import io.swagger.annotations.ApiModelProperty;
+import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
@@ -31,10 +25,10 @@
import sun.rmi.runtime.Log;
import javax.servlet.http.HttpServletRequest;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.util.*;
import java.util.stream.Collectors;
/**
@@ -55,7 +49,11 @@
@Autowired
private HouseResourceService houseResourceService;
@Autowired
+ private IHousingDemandService housingDemandService;
+ @Autowired
private CollectionHouseResourceServiceImpl collectionHouseResourceService;
+ @Autowired
+ private ICollectionHousingDemandService collectionHousingDemandService;
@@ -71,7 +69,7 @@
String authorization = request.getHeader("Authorization");
// todo 这里注释了一段代码
// && authorization.contains("Bearer")
- if(ToolUtil.isNotEmpty(authorization) && authorization.contains("Bearer") ){
+ if(ToolUtil.isNotEmpty(authorization) && authorization.contains("Bearer ") ){
String token = authorization.substring(7);
//通过token获取用户id
Integer appUserId = getAppUserIdFromToken(token);
@@ -90,7 +88,8 @@
* @return
*/
@Override
- public ResultUtil<AppletLoginRes> appletLogin(RegisterAccountReq req) {
+ public ResultUtil<AppletLoginRes>
+ appletLogin(RegisterAccountReq req) {
try {
//调用微信获取用户小程序openid
Map<String, Object> map = weChatUtil.code2Session(req.getJscode());
@@ -99,47 +98,46 @@
}
String openid = map.get("openid").toString();
AppUser appUser = this.selectOne(new EntityWrapper<AppUser>()
- .eq("wechat_openid", openid)
- .eq("audit_status", 2)
- .eq("status", 1));
+ .eq("wechat_openid", openid));
+ if(null != appUser && appUser.getStatus() == 2){
+ return ResultUtil.error("账号冻结");
+ }
AppletLoginRes appletLoginRes = new AppletLoginRes();
- if(null != appUser){
- String token = JwtTokenUtil.generateToken(appUser.getPhone());
- appletLoginRes.setToken(token);
- appletLoginRes.setUserType(appUser.getUserType());
- }else{
- System.err.println("新增");
- String sessionKey = map.get("sessionKey").toString();
- //解密手机号
- String phone = WXCore.decrypt(req.getEncryptedPhoneData(), sessionKey, req.getPhone_iv());
- appUser = this.selectOne(new EntityWrapper<AppUser>()
- .eq("phone", phone)
- .eq("audit_status", 2)
- .eq("status", 1));
+ // 当前微信号没有注册过
if(null == appUser){
+ System.err.println("新增");
+ String sessionKey = map.get("sessionKey").toString();
+ //解密手机号
+ String phone = WXCore.decrypt(req.getEncryptedPhoneData(), sessionKey, req.getPhone_iv());
+ appUser = this.selectOne(new EntityWrapper<AppUser>()
+ .eq("phone", phone)
+ .eq("status", 1));
+ JSONObject jsonObject = JSONObject.parseObject(phone);
+ String phone1 = jsonObject.getString("phoneNumber");
+ System.err.println("看看json");
+ System.err.println(jsonObject);
+ System.err.println(phone1);
+ //注册新账号
+ appUser = addNewAppUser(openid, phone1);
+ }else{
+ String sessionKey = map.get("sessionKey").toString();
+ String phone = WXCore.decrypt(req.getEncryptedPhoneData(), sessionKey, req.getPhone_iv());
JSONObject jsonObject = JSONObject.parseObject(phone);
String phone1 = jsonObject.getString("phoneNumber");
- System.err.println("看看json");
- System.err.println(jsonObject);
- System.err.println(phone1);
- //注册新账号
- addNewAppUser(openid, phone1);
- }else{
appUser.setWechatOpenid(openid);
+ appUser.setPhone(phone1);
this.updateById(appUser);
}
- }
- AppUser appUser1 = this.selectOne(new EntityWrapper<AppUser>()
- .eq("wechat_openid", openid)
- .eq("audit_status", 2)
- .eq("status", 1));
//生成token
- String token = JwtTokenUtil.generateToken(appUser1.getPhone());
+ String token = JwtTokenUtil.generateToken(appUser.getPhone());
+
+ System.err.println("token1111--->" + token);
+ appletLoginRes.setState(appUser.getAuth());
appletLoginRes.setToken(token);
- appletLoginRes.setUserType(appUser1.getUserType());
+ appletLoginRes.setUserType(appUser.getUserType());
System.err.println("看看TOKEN:"+token);
//存入缓存中
- addTokenToRedis(token, appUser1.getId());
+ addTokenToRedis(token, appUser.getId());
return ResultUtil.success(appletLoginRes);
}catch (Exception e){
e.printStackTrace();
@@ -166,8 +164,11 @@
String openid = map.get("openid").toString();
AppUser appUser = this.selectOne(new EntityWrapper<AppUser>()
.eq("wechat_openid", openid)
- .eq("audit_status", 2)
+ .ne("audit_status", 3)
.eq("status", 1));
+ if(null != appUser && appUser.getAuditStatus() == 1){
+ return ResultUtil.error("账号审核中");
+ }
AppletLoginRes appletLoginRes = new AppletLoginRes();
if(null == appUser){
String sessionKey = map.get("sessionKey").toString();
@@ -184,22 +185,18 @@
System.err.println(jsonObject);
System.err.println(phone1);
//注册新账号
- addNewAppUser(openid, phone1);
+ appUser = addNewAppUser(openid, phone1);
}else{
appUser.setWechatOpenid(openid);
this.updateById(appUser);
}
}
- AppUser appUser1 = this.selectOne(new EntityWrapper<AppUser>()
- .eq("wechat_openid", openid)
- .eq("audit_status", 2)
- .eq("status", 1));
//生成token
- String token = JwtTokenUtil.generateToken(appUser1.getPhone());
+ String token = JwtTokenUtil.generateToken(appUser.getPhone());
appletLoginRes.setToken(token);
- appletLoginRes.setUserType(appUser1.getUserType());
+ appletLoginRes.setUserType(appUser.getUserType());
//存入缓存中
- addTokenToRedis(token, appUser1.getId());
+ addTokenToRedis(token, appUser.getId());
return ResultUtil.success(appletLoginRes);
}catch (Exception e){
e.printStackTrace();
@@ -238,37 +235,65 @@
return ResultUtil.success(appUser);
}
- @Autowired
- private IHousingDemandService housingDemandService;
+ public static boolean isToday(Date date) {
+ // 将Date类型转换为LocalDate
+ LocalDate inputDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
+ // 获取当前日期
+ LocalDate currentDate = LocalDate.now();
+ // 比较日期是否相等
+ return inputDate.isEqual(currentDate);
+ }
@Override
- public ResultUtil<CollectRes> collect() {
- // 查询发布的求房源信息
- SearchHousingDemandReq req = new SearchHousingDemandReq();
- SearchHousingDemandRes searchHousingDemandRes = housingDemandService.searchHousingDemand(req);
+ public ResultUtil<CollectRes> collect(UserInfoQuery query) {
+ SearchHousingDemandRes searchHousingDemandRes = housingDemandService
+ .searchHousingDemand1(appUserService.getAppUser().getId());
List<SearchHousingDemandListRes> list1 = searchHousingDemandRes.getList();
- List<SearchHousingDemandListRes> collect1 = list1.stream().filter(t -> t.getAppuserId() == appUserService.getAppUser().getId()).
- collect(Collectors.toList());
- // 拿到收藏的房源ids
- List<Integer> ids = new ArrayList<>();
CollectRes searchIntermediaryRes = new CollectRes();
- searchIntermediaryRes.setList1(collect1);
- List<CollectListRes> list = houseResourceService.collect(ids);
- long count1 = collect1.stream().filter(t -> t.getType() == 1).count();
- long count = list.stream().filter(t -> t.getType() == 1).count();
- // 草稿数量
- searchIntermediaryRes.setDraft(Integer.parseInt(String.valueOf(count))+Integer.parseInt(String.valueOf(count1)));
- // 上架房源数
- int size = list.stream().filter(t -> t.getStatus() == 1 && t.getType()==2).collect(Collectors.toList()).size();
- searchIntermediaryRes.setOn(size);
- // 下架房源数
- int size1 = list.stream().filter(t -> t.getStatus() == 0 && t.getType()==2).collect(Collectors.toList()).size();
- searchIntermediaryRes.setOff(size1);
+ List<CollectListRes> list = houseResourceService.collect(appUserService.getAppUser().getId());
+ for (SearchHousingDemandListRes temp : list1) {
+ // 判断顶上去时间是不是今天
+ CollectListRes collectListRes = new CollectListRes();
+ collectListRes.setSaleAmount(temp.getSaleAmount());
+ collectListRes.setData(1);
+ BeanUtils.copyProperties(temp,collectListRes);
+ StringBuilder stringBuilder = new StringBuilder("");
+ if (temp.getAddress()!=null){
+ for (String address : temp.getAddress()) {
+ stringBuilder.append(address+",");
+ }
+ String string = stringBuilder.toString();
+ String substring = string.substring(0, string.length() - 1);
+ collectListRes.setAddress(substring);
+ }
+ list.add(collectListRes);
+ }
for (CollectListRes collectListRes : list) {
+ // 没有顶过
+ if (collectListRes.getUpTime() == null){
+ collectListRes.setUp(1);
+ continue;
+ }
+ if (isToday(collectListRes.getUpTime())){
+ // 时间相同的话 就不能顶
+ collectListRes.setUp(0);
+ }else{
+ collectListRes.setUp(1);
+ }
+ }
+ List<CollectListRes> collect3 = list.stream().distinct().collect(Collectors.toList());
+ // 房源数据
+ List<CollectListRes> collect1 = collect3.stream().filter(t->t.getData()==2).distinct().collect(Collectors.toList());
+ // 求房源数据
+ List<CollectListRes> collect2 = collect3.stream().filter(t->t.getData()==1).distinct().collect(Collectors.toList());
+ for (CollectListRes collectListRes : collect1) {
// 查询这个房源的收藏
int collect = collectionHouseResourceService.selectList(new EntityWrapper<CollectionHouseResource>()
.eq("house_resource_id", collectListRes.getId())).size();
collectListRes.setCollect(collect);
// 根据区id 查询下级
+ if (collectListRes.getCityId()==null){
+ continue;
+ }
Region city = regionService.selectById(collectListRes.getCityId());
Region dis = regionService.selectById(collectListRes.getDistrictId());
Region region = regionService.selectOne(new EntityWrapper<Region>().eq("parent_id",dis.getId()));
@@ -287,48 +312,218 @@
}
collectListRes.setAddress(city.getName()+">"+stringBuilder.toString());
}
- searchIntermediaryRes.setList(list);
- searchIntermediaryRes.setTotal(list.size());
+ for (CollectListRes collectListRes : collect2) {
+ // 查询这个房源的收藏
+ int collect = collectionHousingDemandService.selectList(new EntityWrapper<CollectionHousingDemand>()
+ .eq("housing_demand_id", collectListRes.getId())).size();
+ collectListRes.setCollect(collect);
+
+ }
+ collect1.addAll(collect2);
+ List<CollectListRes> testing = testing(collect1.size(), query.getPageNum(), query.getPageSize(), collect1);
+ List<CollectListRes> collect = testing.stream().filter(t -> t.getData() == 2).distinct().collect(Collectors.toList());
+ List<CollectListRes> collectt = testing.stream().filter(t -> t.getData() == 1).distinct().collect(Collectors.toList());
+
+ long count = collect.stream().filter(t -> t.getType() == 1).count();
+ long count1 = collectt.stream().filter(t -> t.getType() == 1).count();
+ // 草稿数量
+ searchIntermediaryRes.setDraft(Integer.parseInt(String.valueOf(count))+Integer.parseInt(String.valueOf(count1)));
+ // 上架房源数
+ int size = collect.stream().filter(t -> t.getStatus() == 1 && t.getType()==2).collect(Collectors.toList()).size();
+ int size2 = collectt.stream().filter(t -> t.getStatus() == 1 && t.getType()==2).collect(Collectors.toList()).size();
+ searchIntermediaryRes.setOn(size+size2);
+ // 下架房源数
+ int size1 = collect.stream().filter(t -> t.getStatus() == 0 && t.getType()==2).collect(Collectors.toList()).size();
+ int size3 = collectt.stream().filter(t -> t.getStatus() == 0 && t.getType()==2).collect(Collectors.toList()).size();
+ searchIntermediaryRes.setOff(size1+size3);
+// @ApiModelProperty("是否有电梯(0=否,1=是)")
+// private Integer elevator;
+// @ApiModelProperty("是否有晾晒区(0=否,1=是)")
+// private Integer dryingArea;
+// @ApiModelProperty("是否有花园(0=否,1=是)")
+// private Integer garden;
+// @ApiModelProperty("是否有车位(0=否,1=是)")
+// private Integer carport;
+// @ApiModelProperty("是否有平台(0=否,1=是)")
+// private Integer balcony;
+// @ApiModelProperty("是否可养宠物(0=否,1=是)")
+// private Integer keepPet;
+
+ for (CollectListRes t : testing) {
+ StringBuilder temp = new StringBuilder("");
+ if (t.getElevator()==null){
+ temp.append("电梯,");
+ }else if (t.getElevator()==1){
+ temp.append("电梯,");
+ }
+ if (t.getDryingArea()==null){
+ temp.append("晾晒区,");
+ }else if (t.getDryingArea()==1){
+ temp.append("晾晒区,");
+ }
+ if (t.getGarden()==null){
+ temp.append("花园,");
+ }else if (t.getGarden()==1){
+ temp.append("花园,");
+ }
+ if (t.getCarport()==null){
+ temp.append("车位,");
+ }else if (t.getCarport()==1){
+ temp.append("车位,");
+ }
+ if (t.getBalcony()==null){
+ temp.append("平台,");
+ }else if (t.getBalcony()==1){
+ temp.append("平台,");
+ }
+ if (t.getKeepPet()==null){
+ temp.append("宠物,");
+ }else if (t.getKeepPet()==1){
+ temp.append("宠物,");
+ }
+ String string = temp.toString();
+ if (StringUtils.hasLength(string)){
+ String substring = string.substring(0, string.length() - 1);
+ t.setHead(substring);
+ }else{
+ t.setHead("");
+ }
+
+ }
+ searchIntermediaryRes.setList(testing);
+
+ searchIntermediaryRes.setTotal(testing.size());
+
return ResultUtil.success(searchIntermediaryRes);
}
+
+ public static List<CollectListRes> testing(long total, long current, long size, List<CollectListRes> str){
+ List<CollectListRes> result = new ArrayList<>();
+ //获取初始化分页结构
+ Page<CollectListRes> page = new Page().getPage(total, size, current - 1);
+ //获取集合下标初始值
+ long startIndex = page.getStartIndex();
+ //获取集合下标结束值
+ long endInddex = 0;
+ /**
+ * 如果初始值startIndex(size * current)超过总记录数 或者 入参size(一页显示多少条)大于总记录树,
+ * 则下标结束值均设置为集合大小
+ */
+ if(startIndex + page.getCurrent() >= total || size > total){
+ endInddex = total;
+ }else {
+ /**当最后一页,开始下标加上要取值的size 大于总条数,则最终索引改为集合大小-1=》为
+ *集合的最后下标值,防止下标溢出
+ **/
+ if(total < startIndex + page.getSize()){
+ endInddex = total - 1 ;
+ }else {
+ //否则为startIndex(size * current 从哪里开始取)加上一页显示多少条得到结束值
+ endInddex = startIndex + page.getSize();
+ }
+ }
+ //如果输入的开始查询下标大于集合大小,则查询为空值
+ if(startIndex > total){
+ result = Collections.emptyList();
+ }else{
+ result = str.subList((int)startIndex,(int)endInddex);
+ }
+ /**
+ * 此处返回结果可以改为Page<T> T为对应业务的实体类型,最终把分页结果再塞入page的records再返回则得到与
+ * mybatisplus一样的结构
+ * page.setRecords(list);
+ * return page;
+ */
+ return result;
+ }
@Override
public ResultUtil<CollectRes> release(UserInfoQuery query) {
- query.setPageNum((query.getPageNum() - 1) * query.getPageSize());
// 房源ids
List<Integer> ids = collectionHouseResourceService.selectList(new EntityWrapper<CollectionHouseResource>()
.eq("app_user_id", appUserService.getAppUser().getId()))
.stream().map(CollectionHouseResource::getHouseResourceId).collect(Collectors.toList());
- List<Integer> collect = houseResourceService.selectList(new EntityWrapper<HouseResource>()
- .eq("is_delete", 0)
- .eq("status", 1)
- .eq("auth_status", 2)
- .in("id", ids)).stream().map(HouseResource::getId).collect(Collectors.toList());
- List<CollectListRes> list = houseResourceService.release(query,collect);
- for (CollectListRes collectListRes : list) {
+ List<Integer> collect = houseResourceService.selectList(new EntityWrapper<HouseResource>()
+ .eq("is_delete", 0)
+ .eq("status", 1)
+ .eq("auth_status", 2)
+ .in("id", ids)).stream().map(HouseResource::getId).collect(Collectors.toList());
+ List<CollectListRes> list = new ArrayList<>();
+ if (collect.size()==0){
+ }else{
+ list = houseResourceService.release(query,collect);
+ }
+
+ List<CollectListRes> collect1 = list.stream().distinct().collect(Collectors.toList());
+ if (ids.size()==0){
+ collect=new ArrayList<>();
+ list = new ArrayList<>();
+ collect1 = new ArrayList<>();
+ }
+ for (CollectListRes collectListRes : collect1) {
// 根据区id 查询下级
Region city = regionService.selectById(collectListRes.getCityId());
- Region dis = regionService.selectById(collectListRes.getDistrictId());
- Region region = regionService.selectOne(new EntityWrapper<Region>().eq("parent_id",dis.getId()));
StringBuilder stringBuilder = new StringBuilder("");
- stringBuilder.append(dis.getName());
- if (region!=null){
- stringBuilder.append("/"+region.getName());
- Region region1 = regionService.selectOne(new EntityWrapper<Region>().eq("parent_id",region.getId()));
- if (region!=null){
- stringBuilder.append(region1.getName());
- Region region2 = regionService.selectOne(new EntityWrapper<Region>().eq("parent_id",region1.getId()));
- if (region2!=null){
- stringBuilder.append("/"+region2.getName());
+ if (city!=null){
+ Region dis = regionService.selectById(collectListRes.getDistrictId());
+ if (dis!=null){
+ Region region = regionService.selectOne(new EntityWrapper<Region>().eq("parent_id",dis.getId()));
+ stringBuilder.append(dis.getName());
+ if (region!=null){
+ stringBuilder.append("/"+region.getName());
+ Region region1 = regionService.selectOne(new EntityWrapper<Region>().eq("parent_id",region.getId()));
+ if (region!=null){
+ stringBuilder.append(region1.getName());
+ Region region2 = regionService.selectOne(new EntityWrapper<Region>().eq("parent_id",region1.getId()));
+ if (region2!=null){
+ stringBuilder.append("/"+region2.getName());
+ }
+ }
}
+ collectListRes.setAddress(city.getName()+">"+stringBuilder.toString());
}
}
- collectListRes.setAddress(city.getName()+">"+stringBuilder.toString());
}
+ // 查询收藏的求房源ids
+ List<Integer> demand = collectionHousingDemandService.selectList
+ (new EntityWrapper<CollectionHousingDemand>()
+ .eq("app_user_id", appUserService.getAppUser().getId()))
+ .stream().map(CollectionHousingDemand::getHousingDemandId)
+ .collect(Collectors.toList());
+ if (demand.size()!=0){
+ SearchHousingDemandRes searchHousingDemandRes = housingDemandService.searchHousingDemand2(demand);
+ List<SearchHousingDemandListRes> list1 = searchHousingDemandRes.getList();
+ for (SearchHousingDemandListRes temp : list1) {
+ CollectListRes collectListRes = new CollectListRes();
+ collectListRes.setSaleAmount(temp.getSaleAmount());
+ collectListRes.setData(1);
+ BeanUtils.copyProperties(temp,collectListRes);
+ StringBuilder stringBuilder = new StringBuilder("");
+ if (temp.getAddress()!=null){
+ for (String address : temp.getAddress()) {
+ stringBuilder.append(address+",");
+ }
+ String string = stringBuilder.toString();
+ String substring = string.substring(0, string.length() - 1);
+ collectListRes.setAddress(substring);
+ }
+ collect1.add(collectListRes);
+ }
+ }
+
+
CollectRes searchIntermediaryRes = new CollectRes();
- searchIntermediaryRes.setList(list);
- searchIntermediaryRes.setTotal(list.size());
- return ResultUtil.success();
+ List<CollectListRes> testing = testing(collect1.size(), query.getPageNum(), query.getPageSize(), collect1);
+
+ searchIntermediaryRes.setList(testing);
+ searchIntermediaryRes.setTotal(testing.size());
+ return ResultUtil.success(searchIntermediaryRes);
+ }
+
+ @Override
+ public SearchIntermediaryListRes searchIntermediaryInfo(Integer id) {
+ return this.baseMapper.searchIntermediaryInfo(id);
+
}
@@ -337,7 +532,7 @@
* @param openid 微信openid
* @param phone 手机号
*/
- private void addNewAppUser(String openid, String phone){
+ private AppUser addNewAppUser(String openid, String phone){
AppUser appUser = new AppUser();
appUser.setCode(UUIDUtil.getNumberRandom(16));
appUser.setUserType(1);
@@ -345,8 +540,10 @@
appUser.setWechatOpenid(openid);
appUser.setAuditStatus(2);
appUser.setStatus(1);
+ appUser.setAuth(0);
appUser.setInsertTime(new Date());
this.insert(appUser);
+ return appUser;
}
@@ -358,8 +555,8 @@
private void addTokenToRedis(String token, Integer id){
String key = token;
int length = token.length();
- if(length > 16){
- key = token.substring(4, 12);
+ if(length > 32){
+ key = token.substring(token.length() - 32);
}
//30天有效期
redisUtil.setStrValue(key, id.toString(), 2592000);
@@ -372,10 +569,11 @@
* @return
*/
private Integer getAppUserIdFromToken(String token){
+ System.err.println("token--->" + token);
String key = token;
int length = token.length();
- if(length > 16){
- key = token.substring(4, 12);
+ if(length > 32){
+ key = token.substring(token.length() - 32);
}
String value = redisUtil.getValue(key);
if(ToolUtil.isEmpty(value)){
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/HouseResourceService.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/HouseResourceService.java
index 87ef518..4f40b24 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/HouseResourceService.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/HouseResourceService.java
@@ -3,21 +3,27 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
+import com.alipay.api.internal.util.codec.Base64;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.stylefeng.guns.core.util.ToolUtil;
+import com.stylefeng.guns.modular.file.OSSService;
import com.stylefeng.guns.modular.system.dao.HouseResourceMapper;
import com.stylefeng.guns.modular.system.model.*;
import com.stylefeng.guns.modular.system.service.*;
import com.stylefeng.guns.modular.system.util.ResultUtil;
+import com.stylefeng.guns.modular.system.util.WxAppletTools;
import com.stylefeng.guns.modular.system.warpper.PointLocation;
import com.stylefeng.guns.modular.system.warpper.req.AddHouseReq;
import com.stylefeng.guns.modular.system.warpper.req.HouseQuery;
import com.stylefeng.guns.modular.system.warpper.req.SearchHouseResourceReq;
import com.stylefeng.guns.modular.system.warpper.req.UserInfoQuery;
import com.stylefeng.guns.modular.system.warpper.res.*;
+import io.swagger.annotations.ApiOperation;
+import org.apache.http.entity.ContentType;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.geo.Circle;
import org.springframework.data.geo.Distance;
import org.springframework.data.geo.Metrics;
@@ -25,15 +31,25 @@
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
+import org.springframework.http.*;
+import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.client.RestTemplate;
+import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.security.SecureRandom;
import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
import java.util.stream.Collectors;
/**
@@ -57,8 +73,56 @@
private MongoTemplate mongoTemplate;
@Autowired
private IHousingDemandService housingDemandService;
+ @Autowired
+ private WxAppletTools wxAppletTools;
+ @Autowired
+ private RestTemplate restTemplate;
+ @Autowired
+ private OSSService ossService;
+ @Value("${wx.appletsAppid}")
+ private String wxAppletsAppid;
+ @Value("${wx.appletsAppSecret}")
+ private String wxAppletsAppSecret;
+ /**
+ * 生成小程序码地址
+ */
+ public static final String CREATE_CODE_URL = "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=ACCESS_TOKEN";
+ // 生成小程序码
+
+ public String generateMiniProgramCode(String outputFilePath) throws IOException {
+ // 获取access_token
+ String accessToken = wxAppletTools.getAccessToken();
+ // 替换CREATE_CODE_URL
+ String uri = CREATE_CODE_URL.replace("ACCESS_TOKEN", accessToken);
+ // 跳转到的小程序页面路径
+ String pagePath = "pages/index/index";
+ URL url = new URL(uri);
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ // 设置请求方法
+ connection.setRequestMethod("POST");
+ connection.setDoOutput(true);
+ // 构建请求参数
+ String params = "path=" + URLEncoder.encode(pagePath, "UTF-8");
+ // 获取输出流
+ try (OutputStream outputStream = connection.getOutputStream()) {
+ outputStream.write(params.getBytes());
+ }
+ // 获取输入流
+ try (InputStream inputStream = connection.getInputStream();
+ FileOutputStream outputStream = new FileOutputStream(outputFilePath)) {
+ // 将返回的图片数据写入文件
+ byte[] buffer = new byte[1024];
+ int bytesRead;
+ while ((bytesRead = inputStream.read(buffer)) != -1) {
+ outputStream.write(buffer, 0, bytesRead);
+ }
+ ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(buffer);
+ MultipartFile file = new MockMultipartFile(ContentType.APPLICATION_OCTET_STREAM.toString(), byteArrayInputStream);
+ return ossService.uploadFile(file);
+ }
+ }
/**
@@ -109,9 +173,19 @@
Double saleAmountStart = null;
Double saleAmountEnd = null;
if(StringUtils.hasLength(req.getSaleAmount())){
- String[] split = req.getSaleAmount().split("-");
- saleAmountStart = Double.valueOf(split[0]);
- saleAmountEnd = Double.valueOf(split[1]);
+ if (req.getSaleAmount().contains("以上")){
+ saleAmountStart = Double.valueOf(req.getSaleAmount().substring(0, req.getSaleAmount().length() - 2));
+ saleAmountEnd = 10000000000000000000000.0;
+ }else if (req.getSaleAmount().contains("以下")){
+ saleAmountStart = 0.0;
+ saleAmountEnd = Double.valueOf(req.getSaleAmount().substring(0, req.getSaleAmount().length() - 2));
+ }else{
+ String[] split = req.getSaleAmount().split("-");
+ saleAmountStart = Double.valueOf(split[0]);
+ saleAmountEnd = Double.valueOf(split[1]);
+ }
+
+
}
//户型
List<String> houseModels = null;
@@ -132,11 +206,9 @@
SearchHouseResourceRes searchHouseResource = new SearchHouseResourceRes();
List<SearchHouseResourceListRes> searchHouseResourceListRes = this.baseMapper.searchHouseResource(req, cityIds, districtIds, saleAmountStart, saleAmountEnd, houseModels, houseTypeIds);
searchHouseResource.setList(searchHouseResourceListRes);
- Integer integer = this.baseMapper.searchHouseResourceCount(req, cityIds, districtIds, saleAmountStart, saleAmountEnd, houseModels, houseTypeIds);
- searchHouseResource.setTotal(integer);
+ searchHouseResource.setTotal(searchHouseResourceListRes.size());
return searchHouseResource;
}
-
/**
* 填装历史搜索记录和修改历史搜索记录
@@ -200,11 +272,15 @@
*/
@Override
public HouseResourceInfoRes getHouseResourceInfo(Integer id) {
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
AppUser appUser = appUserService.getAppUser();
HouseResource houseResource = this.selectById(id);
HouseResourceInfoRes houseResourceInfoRes = new HouseResourceInfoRes();
+ houseResourceInfoRes.setDataType(houseResource.getDataType());
houseResourceInfoRes.setId(id);
+ houseResourceInfoRes.setBuildingOrientation(houseResource.getBuildingOrientation());
+ houseResourceInfoRes.setVideoPhoto(houseResource.getVideoPhoto());
+ houseResourceInfoRes.setQrCode(houseResource.getQrCode());
houseResourceInfoRes.setTitle(houseResource.getTitle());
houseResourceInfoRes.setSaleAmount(houseResource.getSaleAmount());
houseResourceInfoRes.setHouseModel(houseResource.getHouseModel());
@@ -212,7 +288,7 @@
houseResourceInfoRes.setSaleDate(houseResource.getStartTime());
houseResourceInfoRes.setHousePhoto(houseResource.getHousePhoto());
HouseType houseType = houseTypeService.selectById(houseResource.getHouseTypeId());
- houseResourceInfoRes.setHouseType(houseType.getName());
+ if (houseType!=null)houseResourceInfoRes.setHouseType(houseType.getName());
houseResourceInfoRes.setFloor(houseResource.getFloor());
houseResourceInfoRes.setElevator(houseResource.getElevator());
houseResourceInfoRes.setDryingArea(houseResource.getDryingArea());
@@ -220,7 +296,13 @@
houseResourceInfoRes.setKeepPet(houseResource.getKeepPet());
Region region = regionService.selectById(houseResource.getDistrictId());
Region region1 = regionService.selectById(houseResource.getCityId());
- houseResourceInfoRes.setAddress(region1.getName() + " > " + region.getName() + "/" + houseResource.getHouseAddress());
+ if (region != null&®ion1 != null){
+ if (houseResource.getHouseAddress()==null){
+ houseResourceInfoRes.setAddress(region1.getName() + " > " + region.getName());
+ }else{
+ houseResourceInfoRes.setAddress(region1.getName() + " > " + region.getName() + "/" +houseResource.getHouseAddress() );
+ }
+ }
houseResourceInfoRes.setLongitude(houseResource.getLongitude());
houseResourceInfoRes.setLatitude(houseResource.getLatitude());
houseResourceInfoRes.setMoreIntroduction(houseResource.getMoreIntroduction());
@@ -266,10 +348,11 @@
public List<SearchHouseResourceListRes> getNearbyHouseResource(Integer id) {
HouseResource houseResource = this.selectById(id);
//获取中心半径5KM范围内的房源数据
+ if (houseResource.getLongitude()!=null && houseResource.getLatitude()!=null){
Double x = Double.valueOf(houseResource.getLongitude());
Double y = Double.valueOf(houseResource.getLatitude());
Point point = new Point(x, y);
- Circle circle = new Circle(point, new Distance(5, Metrics.KILOMETERS));
+ Circle circle = new Circle(point, new Distance(100000, Metrics.KILOMETERS));
Query query = Query.query(Criteria.where("geoJsonPoint").withinSphere(circle));
List<PointLocation> pointLocations = mongoTemplate.find(query, PointLocation.class);
List<Integer> ids = pointLocations.stream().map(PointLocation::getHouseId).collect(Collectors.toList());
@@ -300,9 +383,10 @@
}
return list;
}
+
+ }
List<SearchHouseResourceListRes> list = new ArrayList<>();
return list;
-
}
@@ -328,55 +412,126 @@
res.setTotal(res.getList().size());
return res;
}
-
@Override
public ResultUtil addHouse(AddHouseReq req) {
Integer appUserId = appUserService.getAppUser().getId();
AppUser appUser = appUserService.selectOne(new EntityWrapper<AppUser>()
.eq("id", appUserId)
- .eq("audit_status", 2)
.eq("status", 1));
if (appUser!=null){
-
- if (appUser.getAgentLicenceCode()==null){
- // 未认证 只能能发布三条房源信息
- List<HouseResource> houseResources = this.selectList(new EntityWrapper<HouseResource>()
- .eq("app_user_id", appUserId)
- .eq("is_delete", 1)
- .eq("status", 1)
- );
- if (houseResources.size()>=3){
- return ResultUtil.error("中介账号未认证,只能同时上架3条房源信息");
+ if (req.getId()==null){
+ if (req.getType()!=1){
+ if (appUser.getAuditStatus()!=2){
+ // 未认证 只能能发布三条房源信息
+ List<HouseResource> houseResources = this.selectList(new EntityWrapper<HouseResource>()
+ .eq("app_user_id", appUserId)
+ .eq("is_delete", 1)
+ .eq("status", 1)
+ );
+ if (houseResources.size()>=3){
+ return ResultUtil.error("中介账号未认证,只能同时上架3条房源信息");
+ }
+ }else if (appUser.getAuditStatus()==2){
+ // 已经认证 只能能发布20条房源信息
+ List<HouseResource> houseResources = this.selectList(new EntityWrapper<HouseResource>()
+ .eq("app_user_id", appUserId)
+ .eq("is_delete", 1)
+ .eq("status", 1)
+ );
+ if (houseResources.size()>=20){
+ return ResultUtil.error("当前中介账号只能同时上架20条房源信息");
+ }
}
- }else{
- // 已经认证 只能能发布20条房源信息
- List<HouseResource> houseResources = this.selectList(new EntityWrapper<HouseResource>()
- .eq("app_user_id", appUserId)
- .eq("is_delete", 1)
- .eq("status", 1)
- );
- if (houseResources.size()>=20){
- return ResultUtil.error("当前中介账号只能同时上架20条房源信息");
}
}
-
HouseResource houseResource = new HouseResource();
+ houseResource.setPlatform(req.getPlatform());
BeanUtils.copyProperties(req,houseResource);
- System.err.println(houseResource);
+ houseResource.setType(req.getType());
houseResource.setInsertTime(new Date());
- houseResource.setAuthStatus(1);
+ houseResource.setGoodHouse(0);
houseResource.setIsDelete(0);
houseResource.setInsertUserId(appUserId);
houseResource.setViewsNumber(0);
- houseResource.setStatus(0);
+ // todo 修改回审核和上下架状态
+ houseResource.setStatus(1);
+ houseResource.setDataType(req.getDataType());
+
+ houseResource.setAuthStatus(1);
houseResource.setLeaseTime(req.getTime());
+ houseResource.setAppUserId(appUserService.getAppUser().getId());
houseResource.setFirmHouse(req.getFirmHouse());
- if (req.getTime().contains("年")){
- houseResource.setRentalDuration(2);
- }else{
- houseResource.setRentalDuration(1);
+ if (StringUtils.hasLength(req.getTime())){
+ if (req.getTime().contains("年")){
+ houseResource.setRentalDuration(2);
+ }else{
+ houseResource.setRentalDuration(1);
+ }
}
- this.baseMapper.insert(houseResource);
+ if (req.getType()==2){
+ InputStream inputStream = null;
+ OutputStream outputStream = null;
+ String accessToken = wxAppletTools.getAccessToken();
+ try {
+ String url = "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=" + accessToken;
+ Map<String, Object> param = new HashMap<>();
+ param.put("path", "pages/home/home");
+// param.put("page", "pages/index/index"); // 路径 如果没有默认跳转到首页面微信小程序发布后才可以使用不能添加参数
+ param.put("width", 200); //二维码尺寸
+ param.put("is_hyaline", true); // 是否需要透明底色, is_hyaline 为true时,生成透明底色的小程序码 参数仅对小程序码生效
+ param.put("auto_color", true); // 自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调 参数仅对小程序码生效
+ Map<String, Object> line_color = new HashMap<>();
+ line_color.put("r", 0);
+ line_color.put("g", 0);
+ line_color.put("b", 0);
+ param.put("line_color", line_color);
+ System.err.println("调用生成微信URL接口传参:" + param);
+ MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();
+ HttpEntity requestEntity = new HttpEntity(param, headers);
+ ResponseEntity<byte[]> entity = restTemplate.exchange(url, HttpMethod.POST, requestEntity, byte[].class, new Object[0]);
+ System.err.println("调用小程序生成微信永久小程序码URL接口返回结果:" + entity.getBody());
+ byte[] result = entity.getBody();
+ System.err.println(Base64.encodeBase64String(result));
+ inputStream = new ByteArrayInputStream(result);
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+ // 最后上传生成的文件名
+ String finalFileName = System.currentTimeMillis() + "" + new SecureRandom().nextInt(0x0400) + ".jpg";
+ // oss中的文件夹名
+ String objectName = sdf.format(new Date()) + "/" + finalFileName;
+ // 上传oss
+ ossService.uploadFile2OSS(inputStream, objectName);
+ //获取文件的URl地址
+ String imgUrl = ossService.getImgUrl(objectName);
+ houseResource.setQrCode(imgUrl);
+ System.err.println("看看文件路径" + imgUrl);
+ } catch (Exception e) {
+ System.err.println("调用小程序生成微信永久小程序码URL接口异常" + e);
+ } finally {
+ if (inputStream != null) {
+ try {
+ inputStream.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ if (outputStream != null) {
+ try {
+ outputStream.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+ }
+ this.baseMapper.insert(houseResource);
+ }else{
+ if (req.getId()==null){
+ this.baseMapper.insert(houseResource);
+ }else{
+ this.baseMapper.updateById(houseResource);
+ }
+ }
return ResultUtil.success();
}
return ResultUtil.success();
@@ -385,30 +540,50 @@
@Override
public ResultUtil confirm(Integer userType) {
AppUser appUser = appUserService.getAppUser();
- if (userType == 3){
- // 需要下架所有个人房源和求房源信息
- List<HouseResource> list = this.selectList(new EntityWrapper<HouseResource>()
- .eq("app_user_id", appUser.getId()));
- for (HouseResource houseResource : list) {
- houseResource.setStatus(0);
- this.baseMapper.updateById(houseResource);
- }
- List<HousingDemand> list2 = housingDemandService.selectList(new EntityWrapper<HousingDemand>()
- .eq("app_user_id", appUser.getId()));
- for (HousingDemand housingDemand : list2) {
- housingDemand.setStatus(0);
- housingDemandService.updateById(housingDemand);
- }
-// housingDemandService.updateBatchById(list2);
- }
appUser.setUserType(userType);
appUserService.updateById(appUser);
return ResultUtil.success();
}
@Override
- public List<CollectListRes> collect(List<Integer> ids) {
- return this.baseMapper.collect(ids);
+ public List<CollectListRes> collect(Integer id) {
+ return this.baseMapper.collect(id);
+ }
+
+ @Override
+ public ResultUtil<Integer> getSurplusPushNumber1() {
+ AppUser appUser = appUserService.getAppUser();
+ // 判断这个人是什么身份
+ if (appUser.getUserType()==2){
+ // 最多只能发布三条房源信息
+ int size = this.baseMapper.selectList(new EntityWrapper<HouseResource>()
+ .eq("app_user_id", appUser.getId())
+ .eq("is_delete", 1)
+ ).size();
+ if (3-size<0)size=0;
+ return ResultUtil.success(3-size);
+ }
+ if (appUser.getUserType()==3){
+ // 如果是中介 判断他是否认证成功
+ if (appUser.getAuditStatus()==2){
+ // 可以发布20条
+ // 最多只能发布三条房源信息
+ int size = this.baseMapper.selectList(new EntityWrapper<HouseResource>()
+ .eq("app_user_id", appUser.getId())
+ .eq("is_delete", 1)
+ ).size();
+ if (20-size<0)size=0;
+ return ResultUtil.success(3-size);
+ }else{
+ int size = this.baseMapper.selectList(new EntityWrapper<HouseResource>()
+ .eq("app_user_id", appUser.getId())
+ .eq("is_delete", 1)
+ ).size();
+ if (3-size<0)size=0;
+ return ResultUtil.success(3-size);
+ }
+ }
+ return ResultUtil.success(0);
}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/HousingDemandServiceImpl.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/HousingDemandServiceImpl.java
index 94ccf05..4403e5d 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/HousingDemandServiceImpl.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/HousingDemandServiceImpl.java
@@ -3,14 +3,17 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
+import com.alipay.api.internal.util.codec.Base64;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.stylefeng.guns.core.util.ToolUtil;
+import com.stylefeng.guns.modular.file.OSSService;
import com.stylefeng.guns.modular.system.dao.HousingDemandMapper;
import com.stylefeng.guns.modular.system.model.*;
import com.stylefeng.guns.modular.system.service.*;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import com.stylefeng.guns.modular.system.util.UUIDUtil;
+import com.stylefeng.guns.modular.system.util.WxAppletTools;
import com.stylefeng.guns.modular.system.warpper.req.HousingDemandReq;
import com.stylefeng.guns.modular.system.warpper.req.SearchHousingDemandReq;
import com.stylefeng.guns.modular.system.warpper.res.ContactInformationRes;
@@ -19,14 +22,23 @@
import com.stylefeng.guns.modular.system.warpper.res.SearchHousingDemandRes;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
+import org.springframework.web.client.RestTemplate;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.security.SecureRandom;
import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
/**
* @author zhibing.pu
@@ -46,8 +58,12 @@
@Autowired
private ICollectionHousingDemandService collectionHousingDemandService;
-
-
+ @Autowired
+ private WxAppletTools wxAppletTools;
+ @Autowired
+ private RestTemplate restTemplate;
+ @Autowired
+ private OSSService ossService;
/**
* 添加房源需求
@@ -59,8 +75,14 @@
if(null == appUser){
return ResultUtil.tokenErr();
}
+ String s=null;
+ if (StringUtils.hasLength(req.getDistrict())){
+ s = req.getDistrict().replaceAll("\"", "");
+ }
HousingDemand housingDemand = new HousingDemand();
+ housingDemand.setType(req.getType());
BeanUtils.copyProperties(req, housingDemand);
+ housingDemand.setDistrict(s);
try {
housingDemand.setCode(UUIDUtil.getRandomCode(8));
} catch (Exception e) {
@@ -69,7 +91,68 @@
housingDemand.setIsDelete(0);
housingDemand.setInsertTime(new Date());
housingDemand.setInsertUserId(appUser.getId());
- this.insert(housingDemand);
+ housingDemand.setAppUserId(appUser.getId());
+ housingDemand.setStatus(1);
+ if (req.getType()==2){
+ InputStream inputStream = null;
+ OutputStream outputStream = null;
+ String accessToken = wxAppletTools.getAccessToken();
+ try {
+ String url = "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=" + accessToken;
+ Map<String, Object> param = new HashMap<>();
+ param.put("path", "pages/home/home");
+// param.put("page", "pages/index/index"); // 路径 如果没有默认跳转到首页面微信小程序发布后才可以使用不能添加参数
+ param.put("width", 200); //二维码尺寸
+ param.put("is_hyaline", true); // 是否需要透明底色, is_hyaline 为true时,生成透明底色的小程序码 参数仅对小程序码生效
+ param.put("auto_color", true); // 自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调 参数仅对小程序码生效
+ Map<String, Object> line_color = new HashMap<>();
+ line_color.put("r", 0);
+ line_color.put("g", 0);
+ line_color.put("b", 0);
+ param.put("line_color", line_color);
+ System.err.println("调用生成微信URL接口传参:" + param);
+ MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();
+ HttpEntity requestEntity = new HttpEntity(param, headers);
+ ResponseEntity<byte[]> entity = restTemplate.exchange(url, HttpMethod.POST, requestEntity, byte[].class, new Object[0]);
+ System.err.println("调用小程序生成微信永久小程序码URL接口返回结果:" + entity.getBody());
+ byte[] result = entity.getBody();
+ System.err.println(Base64.encodeBase64String(result));
+ inputStream = new ByteArrayInputStream(result);
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+ // 最后上传生成的文件名
+ String finalFileName = System.currentTimeMillis() + "" + new SecureRandom().nextInt(0x0400) + ".jpg";
+ // oss中的文件夹名
+ String objectName = sdf.format(new Date()) + "/" + finalFileName;
+ // 上传oss
+ ossService.uploadFile2OSS(inputStream, objectName);
+ //获取文件的URl地址
+ String imgUrl = ossService.getImgUrl(objectName);
+ housingDemand.setQrCode(imgUrl);
+ System.err.println("看看文件路径" + imgUrl);
+ } catch (Exception e) {
+ System.err.println("调用小程序生成微信永久小程序码URL接口异常" + e);
+ } finally {
+ if (inputStream != null) {
+ try {
+ inputStream.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ if (outputStream != null) {
+ try {
+ outputStream.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+ }
+ this.insert(housingDemand);
+ }else{
+ this.updateById(housingDemand);
+ }
List<HousingDemandDistrict> list = new ArrayList<>();
if(ToolUtil.isNotEmpty(req.getDistrict())){
JSONArray jsonArray = JSON.parseArray(req.getDistrict());
@@ -102,31 +185,37 @@
*/
@Override
public SearchHousingDemandRes searchHousingDemand(SearchHousingDemandReq req) {
- req.setPageNum(req.getPageNum() - 1 * req.getPageSize());
- //区域
- List<String> district = null;
- if(StringUtils.hasLength(req.getDistrict())){
- district = new ArrayList<>();
- JSONArray jsonArray = JSON.parseArray(req.getDistrict());
- for (int i = 0; i < jsonArray.size(); i++) {
- JSONObject jsonObject = jsonArray.getJSONObject(i);
- Integer cityId = jsonObject.getInteger("cityId");
- Integer districtId = jsonObject.getInteger("districtId");
- //不限区域
- if(null == districtId){
- districtId = 0;
+ req.setPageNum((req.getPageNum() - 1) * req.getPageSize());
+ //区域一级
+ List<Integer> districtIds = new ArrayList<>();
+ // 二级
+ List<Integer> areaIds = new ArrayList<>();
+ if (req.getDistrict() != null &&(!req.getDistrict().equals("")) ){
+ // 一级id
+ Integer integer = Integer.valueOf(req.getDistrict());
+ districtIds.add(integer);
+ if (req.getArea()!=null && (!req.getArea().equals(""))){
+ String[] split = req.getArea().split(",");
+ for (String s : split) {
+ areaIds.add(Integer.valueOf(s));
}
- district.add("cityId:" + cityId + ",districtId:" + districtId);
}
}
-
//价格范围
Double saleAmountStart = null;
Double saleAmountEnd = null;
if(StringUtils.hasLength(req.getSaleAmount())){
- String[] split = req.getSaleAmount().split("-");
- saleAmountStart = Double.valueOf(split[0]);
- saleAmountEnd = Double.valueOf(split[1]);
+ if (req.getSaleAmount().contains("以上")){
+ saleAmountEnd =1000000.0;
+ saleAmountStart = 2000.0;
+ }else if (req.getSaleAmount().contains("以下")){
+ saleAmountEnd =500.0;
+ saleAmountStart = 0.0;
+ }else{
+ String[] split = req.getSaleAmount().split("-");
+ saleAmountStart = Double.valueOf(split[0]);
+ saleAmountEnd = Double.valueOf(split[1]);
+ }
}
//户型
List<String> houseModels = null;
@@ -144,8 +233,58 @@
}
}
+
+
SearchHousingDemandRes searchHouseResource = new SearchHousingDemandRes();
- List<SearchHousingDemandListRes> searchHouseResourceListRes = this.baseMapper.searchHousingDemand(req, district, saleAmountStart, saleAmountEnd, houseModels, houseTypeIds);
+ List<SearchHousingDemandListRes> searchHouseResourceListRes = this.baseMapper.searchHousingDemand
+ (req, districtIds,areaIds, saleAmountStart, saleAmountEnd, houseModels, houseTypeIds);
+
+ for (SearchHousingDemandListRes searchHouseResourceListRe : searchHouseResourceListRes) {
+ List<HousingDemandDistrict> list = housingDemandDistrictService.selectList(new EntityWrapper<HousingDemandDistrict>()
+ .eq("housing_demand_id", searchHouseResourceListRe.getId()));
+ List<String> dis = new ArrayList<>();
+ for (HousingDemandDistrict housingDemandDistrict : list) {
+ Region region = regionService.selectById(housingDemandDistrict.getCityId());
+ Region region1 = regionService.selectById(housingDemandDistrict.getDistrictId());
+ dis.add(region.getName() + ">" + (null == region1 ? "不限" : region1.getName()));
+ }
+ //城市不限用空判断
+ searchHouseResourceListRe.setAddress(dis.size() == 0 ? null : dis);
+ }
+ List<SearchHousingDemandListRes> collect = new ArrayList<>();
+ if (req.getRentalDuration()!=null){
+ if (req.getRentalDuration().equals("一年以上")){
+ collect = searchHouseResourceListRes.stream().filter(t -> t.getRentalDuration() >= 12)
+ .collect(Collectors.toList());
+ }else if (req.getRentalDuration().equals("一年以下")){
+ collect = searchHouseResourceListRes.stream().filter(t -> t.getRentalDuration() < 12)
+ .collect(Collectors.toList());
+ }
+
+ searchHouseResource.setList(collect);
+ searchHouseResource.setTotal(collect.size());
+ }else{
+ searchHouseResource.setList(searchHouseResourceListRes);
+ searchHouseResource.setTotal(searchHouseResourceListRes.size());
+ }
+
+
+ Integer integer = this.baseMapper.searchHousingDemandCount(req, districtIds,areaIds, saleAmountStart, saleAmountEnd, houseModels, houseTypeIds);
+
+ return searchHouseResource;
+ }
+
+
+ /**
+ * 搜索求房源列表数据
+
+ * @return
+ */
+ @Override
+ public SearchHousingDemandRes searchHousingDemand1(Integer id) {
+
+ SearchHousingDemandRes searchHouseResource = new SearchHousingDemandRes();
+ List<SearchHousingDemandListRes> searchHouseResourceListRes = this.baseMapper.searchHousingDemand1(id);
for (SearchHousingDemandListRes searchHouseResourceListRe : searchHouseResourceListRes) {
List<HousingDemandDistrict> list = housingDemandDistrictService.selectList(new EntityWrapper<HousingDemandDistrict>()
@@ -161,14 +300,35 @@
searchHouseResourceListRe.setAddress(dis.size() == 0 ? null : dis);
}
searchHouseResource.setList(searchHouseResourceListRes);
- Integer integer = this.baseMapper.searchHousingDemandCount(req, district, saleAmountStart, saleAmountEnd, houseModels, houseTypeIds);
- searchHouseResource.setTotal(integer);
+ searchHouseResource.setTotal(searchHouseResourceListRes.size());
return searchHouseResource;
}
+ @Override
+ public SearchHousingDemandRes searchHousingDemand2(List<Integer> id) {
+ SearchHousingDemandRes searchHouseResource = new SearchHousingDemandRes();
+ List<SearchHousingDemandListRes> searchHouseResourceListRes = this.baseMapper.searchHousingDemand2(id);
+
+ for (SearchHousingDemandListRes searchHouseResourceListRe : searchHouseResourceListRes) {
+ List<HousingDemandDistrict> list = housingDemandDistrictService.selectList(new EntityWrapper<HousingDemandDistrict>()
+ .eq("housing_demand_id", searchHouseResourceListRe.getId()));
+ List<String> dis = new ArrayList<>();
+ for (HousingDemandDistrict housingDemandDistrict : list) {
+ Region region = regionService.selectById(housingDemandDistrict.getCityId());
+ Region region1 = regionService.selectById(housingDemandDistrict.getDistrictId());
+ dis.add(region.getName() + ">" + (null == region1 ? "不限" : region1.getName()));
+
+ }
+ //城市不限用空判断
+ searchHouseResourceListRe.setAddress(dis.size() == 0 ? null : dis);
+ }
+ searchHouseResource.setList(searchHouseResourceListRes);
+ searchHouseResource.setTotal(searchHouseResourceListRes.size());
+ return searchHouseResource;
+ }
/**
- * 获取求房源详情
+ * 不带分页的求房源列表
* @param id
* @return
*/
@@ -179,18 +339,22 @@
HousingDemandInfoRes housingDemandInfoRes = new HousingDemandInfoRes();
AppUser appUser = appUserService.getAppUser();
housingDemandInfoRes.setId(id);
+ housingDemandInfoRes.setDataType(housingDemand.getDataType());
+ housingDemandInfoRes.setQrCode(housingDemand.getQrCode());
housingDemandInfoRes.setTitle(housingDemand.getTitle());
housingDemandInfoRes.setSaleAmount(housingDemand.getSaleAmount());
housingDemandInfoRes.setHouseModel(housingDemand.getHouseModel());
housingDemandInfoRes.setRentalDuration(housingDemand.getRentalDuration());
housingDemandInfoRes.setSaleDate(housingDemand.getSaleDate());
- String[] split = housingDemand.getHouseTypeId().split(",");
- String houseType = "";
- for (String s : split) {
- HouseType htype = houseTypeService.selectById(s);
- houseType += htype.getName() + " / ";
+ if (StringUtils.hasLength(housingDemand.getHouseTypeId())){
+ String[] split = housingDemand.getHouseTypeId().split(",");
+ String houseType = "";
+ for (String s : split) {
+ HouseType htype = houseTypeService.selectById(s);
+ houseType += htype.getName() + " / ";
+ }
+ housingDemandInfoRes.setHouseType(houseType.substring(0, houseType.lastIndexOf("/")));
}
- housingDemandInfoRes.setHouseType(houseType.substring(0, houseType.lastIndexOf("/")));
housingDemandInfoRes.setFloor(housingDemand.getFloor());
housingDemandInfoRes.setElevator(housingDemand.getElevator());
housingDemandInfoRes.setDryingArea(housingDemand.getDryingArea());
@@ -213,13 +377,20 @@
housingDemandInfoRes.setProfilePhoto(appUser1.getProfilePhoto());
housingDemandInfoRes.setNickname(appUser1.getNickname());
housingDemandInfoRes.setInsertTime(sdf.format(housingDemand.getInsertTime()));
- housingDemandInfoRes.setUpdateTime(sdf.format(housingDemand.getUpdateTime()));
+ if (housingDemand.getUpdateTime()==null){
+ housingDemandInfoRes.setUpdateTime(sdf.format(housingDemand.getInsertTime()));
+ }else{
+ housingDemandInfoRes.setUpdateTime(sdf.format(housingDemand.getUpdateTime()));
+ }
housingDemandInfoRes.setCode(housingDemand.getCode());
int collectionTimes = collectionHousingDemandService.selectCount(new EntityWrapper<CollectionHousingDemand>().eq("housing_demand_id", id));
housingDemandInfoRes.setCollectionTimes(collectionTimes);
housingDemandInfoRes.setCollection(0);
if(null != appUser){
- int collection = collectionHousingDemandService.selectCount(new EntityWrapper<CollectionHousingDemand>().eq("housing_demand_id", id).eq("app_user_id", appUser.getId()));
+ int collection = collectionHousingDemandService
+ .selectCount(new EntityWrapper<CollectionHousingDemand>()
+ .eq("housing_demand_id", id)
+ .eq("app_user_id", appUser.getId()));
housingDemandInfoRes.setCollection(0 == collection ? 0 : 1);
}
//添加访问次数记录
@@ -250,6 +421,7 @@
ContactInformationRes contactInformationRes = new ContactInformationRes();
contactInformationRes.setWhatsApp(appUser.getWatchApp());
contactInformationRes.setPhone(appUser.getPhone());
+ contactInformationRes.setWechatQrCode(appUser.getWechatQRCode());
return contactInformationRes;
}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReportHouseResourceServiceImpl.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReportHouseResourceServiceImpl.java
index 4e79811..f553cdd 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReportHouseResourceServiceImpl.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReportHouseResourceServiceImpl.java
@@ -1,10 +1,13 @@
package com.stylefeng.guns.modular.system.service.impl;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.stylefeng.guns.modular.system.dao.ReportHouseResourceMapper;
import com.stylefeng.guns.modular.system.model.AppUser;
+import com.stylefeng.guns.modular.system.model.HouseResource;
import com.stylefeng.guns.modular.system.model.ReportHouseResource;
import com.stylefeng.guns.modular.system.service.IAppUserService;
+import com.stylefeng.guns.modular.system.service.IHouseResourceService;
import com.stylefeng.guns.modular.system.service.IReportHouseResourceService;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import com.stylefeng.guns.modular.system.warpper.req.ReportHouseResourceReq;
@@ -23,6 +26,8 @@
@Autowired
private IAppUserService appUserService;
+ @Autowired
+ private IHouseResourceService houseResourceService;
/**
@@ -35,13 +40,31 @@
if(null == appUser){
return ResultUtil.tokenErr();
}
+ int house_resource_id = this.selectList(new EntityWrapper<ReportHouseResource>()
+ .eq("house_resource_id", req.getHouseResourceId())
+ .eq("audit",1)).size();
+ if (house_resource_id >= 3){
+ HouseResource houseResource = houseResourceService.selectById(req.getHouseResourceId());
+ houseResource.setIsDelete(1);
+ houseResourceService.updateById(houseResource);
+ return ResultUtil.success();
+ }
//组装数据对象
ReportHouseResource reportHouseResource = new ReportHouseResource();
reportHouseResource.setAppUserId(appUser.getId());
reportHouseResource.setContent(req.getContent());
reportHouseResource.setHouseResourceId(req.getHouseResourceId());
reportHouseResource.setInsertTime(new Date());
+ reportHouseResource.setAudit(0);
this.insert(reportHouseResource);
+ // 查询当前房源被举报通过了多少次
+
+// if (house_resource_id==1 || house_resource_id==2){
+// HouseResource houseResource = houseResourceService.selectById(req.getHouseResourceId());
+// houseResource.setAuthStatus(1);
+// houseResourceService.updateById(houseResource);
+// }
+
return ResultUtil.success();
}
}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReportHousingDemandServiceImpl.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReportHousingDemandServiceImpl.java
index e8fbb95..6dc6a11 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReportHousingDemandServiceImpl.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReportHousingDemandServiceImpl.java
@@ -1,10 +1,11 @@
package com.stylefeng.guns.modular.system.service.impl;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.stylefeng.guns.modular.system.dao.ReportHousingDemandMapper;
-import com.stylefeng.guns.modular.system.model.AppUser;
-import com.stylefeng.guns.modular.system.model.ReportHousingDemand;
+import com.stylefeng.guns.modular.system.model.*;
import com.stylefeng.guns.modular.system.service.IAppUserService;
+import com.stylefeng.guns.modular.system.service.IHousingDemandService;
import com.stylefeng.guns.modular.system.service.IReportHousingDemandService;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import com.stylefeng.guns.modular.system.warpper.req.ReportHousingDemandReq;
@@ -23,6 +24,8 @@
@Autowired
private IAppUserService appUserService;
+ @Autowired
+ private IHousingDemandService housingDemandService;
/**
@@ -39,7 +42,21 @@
BeanUtils.copyProperties(req, reportHousingDemand);
reportHousingDemand.setAppUserId(appUser.getId());
reportHousingDemand.setInsertTime(new Date());
+ reportHousingDemand.setHousingDemandId(req.getHousingDemandIid());
this.insert(reportHousingDemand);
+ // 查询当前房源被举报通过了多少次
+ int house_resource_id = this.selectList(new EntityWrapper<ReportHousingDemand>()
+ .eq("housing_demand_id", req.getHousingDemandIid())).size();
+ if (house_resource_id==1 || house_resource_id==2){
+ HousingDemand houseResource = housingDemandService.selectById(req.getHousingDemandIid());
+ houseResource.setStatus(0);
+ housingDemandService.updateById(houseResource);
+ }
+ if (house_resource_id >= 3){
+ HousingDemand houseResource = housingDemandService.selectById(req.getHousingDemandIid());
+ houseResource.setIsDelete(1);
+ housingDemandService.updateById(houseResource);
+ }
return ResultUtil.success();
}
}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/Constants.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/Constants.java
new file mode 100644
index 0000000..da59d14
--- /dev/null
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/Constants.java
@@ -0,0 +1,136 @@
+package com.stylefeng.guns.modular.system.util;
+
+/**
+ * 通用常量信息
+ *
+ * @author ruoyi
+ */
+public class Constants
+{
+ /**
+ * UTF-8 字符集
+ */
+ public static final String UTF8 = "UTF-8";
+
+ /**
+ * GBK 字符集
+ */
+ public static final String GBK = "GBK";
+
+ /**
+ * www主域
+ */
+ public static final String WWW = "www.";
+
+ /**
+ * RMI 远程方法调用
+ */
+ public static final String LOOKUP_RMI = "rmi:";
+
+ /**
+ * LDAP 远程方法调用
+ */
+ public static final String LOOKUP_LDAP = "ldap:";
+
+ /**
+ * LDAPS 远程方法调用
+ */
+ public static final String LOOKUP_LDAPS = "ldaps:";
+
+ /**
+ * http请求
+ */
+ public static final String HTTP = "http://";
+
+ /**
+ * https请求
+ */
+ public static final String HTTPS = "https://";
+
+ /**
+ * 成功标记
+ */
+ public static final Integer SUCCESS = 200;
+
+ /**
+ * 失败标记
+ */
+ public static final Integer FAIL = 500;
+
+ /**
+ * 登录成功状态
+ */
+ public static final String LOGIN_SUCCESS_STATUS = "0";
+
+ /**
+ * 登录失败状态
+ */
+ public static final String LOGIN_FAIL_STATUS = "1";
+
+ /**
+ * 登录成功
+ */
+ public static final String LOGIN_SUCCESS = "Success";
+
+ /**
+ * 注销
+ */
+ public static final String LOGOUT = "Logout";
+
+ /**
+ * 注册
+ */
+ public static final String REGISTER = "Register";
+
+ /**
+ * 登录失败
+ */
+ public static final String LOGIN_FAIL = "Error";
+
+ /**
+ * 当前记录起始索引
+ */
+ public static final String PAGE_NUM = "pageNum";
+
+ /**
+ * 每页显示记录数
+ */
+ public static final String PAGE_SIZE = "pageSize";
+
+ /**
+ * 排序列
+ */
+ public static final String ORDER_BY_COLUMN = "orderByColumn";
+
+ /**
+ * 排序的方向 "desc" 或者 "asc".
+ */
+ public static final String IS_ASC = "isAsc";
+
+ /**
+ * 验证码有效期(分钟)
+ */
+ public static final long CAPTCHA_EXPIRATION = 2;
+
+ /**
+ * 资源映射路径 前缀
+ */
+ public static final String RESOURCE_PREFIX = "/profile";
+
+ /**
+ * 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加)
+ */
+ public static final String[] JOB_WHITELIST_STR = { "com.ruoyi" };
+
+ /**
+ * 时间格式化
+ */
+ public static final String DATE_FORMATTER_TIME = "yyyy-MM-dd HH:mm:ss";
+ public static final String DATE_FORMATTER_DATE = "yyyy-MM-dd";
+
+ /**
+ * 定时任务违规的字符
+ */
+ public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
+ "org.springframework", "org.apache", "com.ruoyi.common.core.utils.file" };
+}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/DateUtils.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/DateUtils.java
new file mode 100644
index 0000000..b56d3bf
--- /dev/null
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/DateUtils.java
@@ -0,0 +1,447 @@
+package com.stylefeng.guns.modular.system.util;
+
+import org.apache.commons.lang3.time.DateFormatUtils;
+
+import java.lang.management.ManagementFactory;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.*;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+
+/**
+ * 时间工具类
+ *
+ * @author ruoyi
+ */
+public class DateUtils extends org.apache.commons.lang3.time.DateUtils
+{
+ private static TimeZone tz = TimeZone.getTimeZone("GMT+8");
+
+ public static String YYYY = "yyyy";
+
+ public static String YYYY_MM = "yyyy-MM";
+
+ public static String YYYY_MM_DD = "yyyy-MM-dd";
+
+ public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
+
+ public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
+
+ private static String[] parsePatterns = {
+ "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
+ "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
+ "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
+
+ /**
+ * 获取当前Date型日期
+ *
+ * @return Date() 当前日期
+ */
+ public static Date getNowDate()
+ {
+ return new Date();
+ }
+
+ /**
+ * 获取当前日期, 默认格式为yyyy-MM-dd
+ *
+ * @return String
+ */
+ public static String getDate()
+ {
+ return dateTimeNow(YYYY_MM_DD);
+ }
+
+ public static final String getTime()
+ {
+ return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
+ }
+
+ public static final String dateTimeNow()
+ {
+ return dateTimeNow(YYYYMMDDHHMMSS);
+ }
+
+ public static final String dateTimeNow(final String format)
+ {
+ return parseDateToStr(format, new Date());
+ }
+
+ public static final String dateTime(final Date date)
+ {
+ return parseDateToStr(YYYY_MM_DD, date);
+ }
+
+ public static final String parseDateToStr(final String format, final Date date)
+ {
+ return new SimpleDateFormat(format).format(date);
+ }
+
+ public static final Date dateTime(final String format, final String ts)
+ {
+ try
+ {
+ return new SimpleDateFormat(format).parse(ts);
+ }
+ catch (ParseException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * 日期路径 即年/月/日 如2018/08/08
+ */
+ public static final String datePath()
+ {
+ Date now = new Date();
+ return DateFormatUtils.format(now, "yyyy/MM/dd");
+ }
+
+ /**
+ * 日期路径 即年/月/日 如20180808
+ */
+ public static final String dateTime()
+ {
+ Date now = new Date();
+ return DateFormatUtils.format(now, "yyyyMMdd");
+ }
+
+ /**
+ * 日期型字符串转化为日期 格式
+ */
+ public static Date parseDate(Object str)
+ {
+ if (str == null)
+ {
+ return null;
+ }
+ try
+ {
+ return parseDate(str.toString(), parsePatterns);
+ }
+ catch (ParseException e)
+ {
+ return null;
+ }
+ }
+
+ /**
+ * 获取服务器启动时间
+ */
+ public static Date getServerStartDate()
+ {
+ long time = ManagementFactory.getRuntimeMXBean().getStartTime();
+ return new Date(time);
+ }
+
+ /**
+ * 计算时间差
+ *
+ * @param endTime 最后时间
+ * @param startTime 开始时间
+ * @return 时间差(天/小时/分钟)
+ */
+ public static String timeDistance(Date endTime, Date startTime)
+ {
+ long nd = 1000 * 24 * 60 * 60;
+ long nh = 1000 * 60 * 60;
+ long nm = 1000 * 60;
+ // long ns = 1000;
+ // 获得两个时间的毫秒时间差异
+ long diff = endTime.getTime() - startTime.getTime();
+ // 计算差多少天
+ long day = diff / nd;
+ // 计算差多少小时
+ long hour = diff % nd / nh;
+ // 计算差多少分钟
+ long min = diff % nd % nh / nm;
+ // 计算差多少秒//输出结果
+ // long sec = diff % nd % nh % nm / ns;
+ return day + "天" + hour + "小时" + min + "分钟";
+ }
+
+ /**
+ * 增加 LocalDateTime ==> Date
+ */
+ public static Date toDate(LocalDateTime temporalAccessor)
+ {
+ ZonedDateTime zdt = temporalAccessor.atZone(ZoneId.systemDefault());
+ return Date.from(zdt.toInstant());
+ }
+
+ /**
+ * 增加 LocalDate ==> Date
+ */
+ public static Date toDate(LocalDate temporalAccessor)
+ {
+ LocalDateTime localDateTime = LocalDateTime.of(temporalAccessor, LocalTime.of(0, 0, 0));
+ ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
+ return Date.from(zdt.toInstant());
+ }
+
+ /**
+ * 计算两个日期之间相差的天数
+ *
+ * @param smdate 较小的时间
+ * @param bdate 较大的时间
+ * @return 相差天数
+ */
+ public static int daysBetween(Date smdate, Date bdate) {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(smdate);
+ long time1 = cal.getTimeInMillis();
+ cal.setTime(bdate);
+ long time2 = cal.getTimeInMillis();
+ long days = (time2 - time1) / (1000 * 3600 * 24);
+ return Integer.parseInt(String.valueOf(days));
+ }
+
+ /**
+ * 得到系统日期
+ *
+ * @return
+ */
+ public static Date getDateTime() {
+ TimeZone.setDefault(tz);
+ return new Date();
+ }
+
+ /**
+ * 字符串日期转Date yyyy-MM-dd HH:mm:ss
+ *
+ * @param dateStr
+ * @return
+ */
+ public static Date getDate_str3(String dateStr) {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ sdf.setTimeZone(tz);
+ if ("".equals(dateStr)) {
+ dateStr = sdf.format(DateUtils.getDateTime());
+ }
+ Date date = null;
+ try {
+ date = sdf.parse(dateStr);
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ return date;
+ }
+
+ /**
+ * 指定日期所在周的周一和周日时间
+ *
+ * @return 结果集
+ */
+ public static Map<String, Date> getWeekDate(Date date) {
+ Map<String, Date> map = new HashMap<>(2);
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(date);
+ // 设置一个星期的第一天,按中国的习惯一个星期的第一天是星期一
+ cal.setFirstDayOfWeek(Calendar.MONDAY);
+ // 获得当前日期是一个星期的第几天
+ int dayWeek = cal.get(Calendar.DAY_OF_WEEK);
+ if (dayWeek == 1) {
+ dayWeek = 8;
+ }
+ // 根据日历的规则,给当前日期减去星期几与一个星期第一天的差值
+ cal.add(Calendar.DATE, cal.getFirstDayOfWeek() - dayWeek);
+ Date mondayDate = cal.getTime();
+ cal.add(Calendar.DATE, 4 + cal.getFirstDayOfWeek());
+ Date sundayDate = cal.getTime();
+ map.put("first", mondayDate);
+ map.put("last", sundayDate);
+ return map;
+ }
+
+ /**
+ * 指定日期所在月的第一天/最后一天时间
+ *
+ * @return 结果集
+ */
+ public static Map<String, Date> getMonthDate(Date date) {
+ Map<String, Date> map = new HashMap<>(2);
+ Calendar cal = Calendar.getInstance();
+ //设置指定日期
+ cal.setTime(date);
+ //获取当月第一天日期
+ int first = cal.getActualMinimum(Calendar.DAY_OF_MONTH);
+ cal.set(Calendar.DAY_OF_MONTH, first);
+ Date firstDay = cal.getTime();
+ map.put("first", firstDay);
+ //获取当月最后一天日期
+ int last = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
+ cal.set(Calendar.DAY_OF_MONTH, last);
+ Date lastDay = cal.getTime();
+ map.put("last", lastDay);
+ return map;
+ }
+
+ /**
+ * 指定日期所在年的第一天/最后一天时间
+ *
+ * @return 结果集
+ */
+ public static Map<String, Date> getYearDate(Date date) {
+ Map<String, Date> map = new HashMap<>(2);
+ Calendar cal = Calendar.getInstance();
+ //设置指定日期
+ cal.setTime(date);
+ //获取本年第一天日期
+ int first = cal.getActualMinimum(Calendar.DAY_OF_YEAR);
+ cal.set(Calendar.DAY_OF_YEAR, first);
+ Date firstDay = cal.getTime();
+ map.put("first", firstDay);
+ //获取本年最后一天日期
+ int last = cal.getActualMaximum(Calendar.DAY_OF_YEAR);
+ cal.set(Calendar.DAY_OF_YEAR, last);
+ Date lastDay = cal.getTime();
+ map.put("last", lastDay);
+ return map;
+ }
+
+ /**
+ * 分别获取日期中的年月日
+ *
+ * @param date 需要获取的日期
+ * @return 结果集合
+ */
+ public static Map<String, String> getYearMonthDay(Date date) {
+ String year = String.format("%tY", date);
+ String month = String.format("%tm", date);
+ String day = String.format("%td", date);
+ Map<String, String> result = new HashMap<>(3);
+ result.put("year", year);
+ result.put("month", month);
+ result.put("day", day);
+ result.put("time", String.valueOf(date.getTime()));
+ return result;
+ }
+
+ /**
+ * Date转为LocalDateTime
+ *
+ * @param date 日期
+ * @return LocalDateTime
+ */
+ public static LocalDateTime dateToLocalDateTime(Date date) {
+ Instant instant = date.toInstant();
+ ZoneId zoneId = ZoneId.systemDefault();
+ return instant.atZone(zoneId).toLocalDateTime();
+ }
+
+ /**
+ * LocalDateTime转Date
+ *
+ * @param dateTime 日期
+ * @return Date
+ */
+ public static Date localDateTimeToDate(LocalDateTime dateTime) {
+ ZoneId zoneId = ZoneId.systemDefault();
+ ZonedDateTime zdt = dateTime.atZone(zoneId);
+ return Date.from(zdt.toInstant());
+ }
+
+ /**
+ * 获取当天的00:00:00
+ *
+ * @return
+ */
+ public static LocalDateTime getDayStart(LocalDateTime time) {
+ return time.with(LocalTime.MIN);
+ }
+
+
+ /**
+ * 获取当天的23:59:59
+ *
+ * @return
+ */
+ public static LocalDateTime getDayEnd(LocalDateTime time) {
+ return time.with(LocalTime.MAX);
+ }
+
+ /**
+ * localdate转为字符串
+ *
+ * @param time localdate
+ * @return 字符串
+ */
+ public static String localDateToString(LocalDate time) {
+ DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ return df.format(time);
+ }
+
+ /**
+ * 字符串转为localdate
+ *
+ * @param time localdate
+ * @return 字符串
+ */
+ public static LocalDate stringToLocalDate(String time) {
+ return LocalDate.parse(time, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+ }
+
+ /**
+ * localdatetime转为字符串
+ *
+ * @param time localdatetime
+ * @return 字符串
+ */
+ public static String localDateTimeToString(LocalDateTime time) {
+ DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+ return df.format(time);
+ }
+
+ /**
+ * 指定日期所在季度的第一天/最后一天时间
+ *
+ * @return 结果集
+ */
+ public static Map<String, Date> getQuarterDate(Date date) {
+ Map<String, Date> map = new HashMap<>(2);
+
+ int quarter = getQuarterOfYear(date);
+ int year = dateToLocalDateTime(date).getYear();
+
+ int startMonth = (quarter - 1) * 3;
+ // 根据月获取开始时间
+ Calendar cal = Calendar.getInstance();
+ cal.set(Calendar.YEAR, year);
+ cal.set(Calendar.MONTH, startMonth);
+ cal.set(Calendar.DAY_OF_MONTH, 1);
+ cal.set(Calendar.HOUR, 0);
+ cal.set(Calendar.MINUTE, 0);
+ cal.set(Calendar.SECOND, 0);
+ Date first = cal.getTime();
+ map.put("first", first);
+
+ int lastMonth = quarter * 3 - 1;
+ // 根据月获取结束时间
+ cal = Calendar.getInstance();
+ cal.set(Calendar.YEAR, year);
+ cal.set(Calendar.MONTH, lastMonth);
+ cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
+ cal.set(Calendar.HOUR, 0);
+ cal.set(Calendar.MINUTE, 0);
+ cal.set(Calendar.SECOND, 0);
+ Date last = cal.getTime();
+ map.put("last", last);
+
+ return map;
+ }
+
+ /**
+ * 获取日期逻辑中所在的季度数
+ *
+ * @param date 当前日期
+ * @return 第几季度
+ */
+ public static int getQuarterOfYear(Date date) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(date);
+ return calendar.get(Calendar.MONTH) / 3 + 1;
+ }
+
+}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/Page.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/Page.java
new file mode 100644
index 0000000..95c0533
--- /dev/null
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/Page.java
@@ -0,0 +1,35 @@
+package com.stylefeng.guns.modular.system.util;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.util.List;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class Page<T> implements Serializable {
+
+ private List<T> records; //最终查询的结果记录
+ private long total; //共有多少条记录
+ private long size; //一页显示多少条
+ private long current; //取第几页显示
+ private long pages; //总共几页
+ private long startIndex; //从哪里开始截取集合的下标
+ //获取初始化分页对象 这里用long类型是为了与mybatisplus保持一致
+ public Page<String> getPage(long total, long size ,long current){
+ Page<String> page = new Page<>();
+ page.setTotal(total);
+ page.setSize(size);
+ //总页数的计算 如果集合总记录数能被入参size(一页几条)整除,则为对应商,否则多出部分也独立算一页
+ page.setPages(total % size == 0 ? total / size : total / size + 1);
+ //前端约定入参从1开始,但此处入参调用时会减1,此处+1恢复原值供前端展示
+ page.setCurrent(current + 1);
+ //开始索引的设置
+ page.setStartIndex(size * current);
+ return page;
+ }
+
+}
\ No newline at end of file
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TaskUtilHouseResource.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TaskUtilHouseResource.java
new file mode 100644
index 0000000..1d51ed5
--- /dev/null
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TaskUtilHouseResource.java
@@ -0,0 +1,65 @@
+package com.stylefeng.guns.modular.system.util;
+
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.stylefeng.guns.modular.system.model.HouseResource;
+import com.stylefeng.guns.modular.system.model.ReportHouseResource;
+import com.stylefeng.guns.modular.system.service.IHouseResourceService;
+import com.stylefeng.guns.modular.system.service.IReportHouseResourceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @author shaqian
+ * 定时任务修改房源状态 如果被举报 且举报通过了一次 就将房源设置为待审核状态
+ * 如果被举报通过两次 将房源设置为待审核状态
+ * 如果被举报通过三次 将房源删除
+ *
+ */
+@Component
+public class TaskUtilHouseResource {
+ @Autowired
+ private IReportHouseResourceService reportHouseResourceService;
+ @Autowired
+ private IHouseResourceService houseResourceService;
+
+ /**
+ * 每十分钟去处理的定时任务
+ */
+ @Scheduled(fixedRate = 600000)
+ public void taskMinute() {
+ // 查询所有房源
+ List<HouseResource> houseResources = houseResourceService.selectList(new EntityWrapper<>());
+ // 遍历房源列表 查询当前房源 被举报次数
+ for (HouseResource houseResource : houseResources) {
+ Integer id = houseResource.getId();
+ int size = reportHouseResourceService.selectList(new EntityWrapper<ReportHouseResource>()
+ .eq("house_resource_id", id)
+ .eq("audit", 1)).size();
+ switch (size){
+ case 1:
+ // 将房源设置为待审核状态
+ houseResource.setAuthStatus(1);
+ houseResourceService.updateById(houseResource);
+ break;
+ case 2:
+ // 将房源设置为待审核状态
+ houseResource.setAuthStatus(1);
+ houseResourceService.updateById(houseResource);
+ break;
+ case 3:
+ // 将房源删除
+ houseResourceService.deleteById(houseResource.getId());
+ // 同时删除该房源举报记录?
+ break;
+ }
+
+
+ }
+ }
+
+}
+
+
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/WxAppletTools.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/WxAppletTools.java
new file mode 100644
index 0000000..636e8f8
--- /dev/null
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/WxAppletTools.java
@@ -0,0 +1,78 @@
+package com.stylefeng.guns.modular.system.util;
+
+import com.alibaba.fastjson.JSONObject;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.springframework.web.client.RestTemplate;
+
+import java.text.MessageFormat;
+
+/**
+ * @author liheng
+ * @ClassName WxAppletTools
+ * @Description
+ * @date 2020-12-04 13:55
+ */
+@Slf4j
+@Component
+public class WxAppletTools {
+
+ @Autowired
+ private RestTemplate restTemplate;
+ @Value("${wx.appletsAppid}")
+ private String wxAppletsAppid;
+
+ @Value("${wx.appletsAppSecret}")
+ private String wxAppletsAppSecret;
+ private final static String ACCESSTOKEN_CACHE_KEY = "accessToken";
+ /**
+ * 请求参数
+ * 属性 类型 默认值 必填 说明
+ * appid string 是 小程序 appId
+ * secret string 是 小程序 appSecret
+ * js_code string 是 登录时获取的 code
+ * grant_type string 是 授权类型,此处只需填写 authorization_cod
+ * <p>
+ * 返回值:
+ * <p>
+ * 属性 类型 说明
+ * openid string 用户唯一标识
+ * session_key string 会话密钥
+ * unionid string 用户在开放平台的唯一标识符,若当前小程序已绑定到微信开放平台帐号下会返回,详见 UnionID 机制说明。
+ * errcode number 错误码
+ * errmsg string 错误信息
+ */
+ private static final String JSCODE_2_SESSION_URL = "https://api.weixin.qq.com/sns/jscode2session?appid={0}&secret={1}&js_code={2}&grant_type=authorization_code";
+
+
+ /**
+ * 请求参数
+ * 属性 类型 默认值 必填 说明
+ * grant_type string 是 填写 client_credential
+ * appid string 是 小程序唯一凭证,即 AppID,可在「微信公众平台 - 设置 - 开发设置」页中获得。(需要已经成为开发者,且帐号没有异常状态)
+ * secret string 是 小程序唯一凭证密钥,即 AppSecret,获取方式同 appid
+ * 返回值
+ * Object
+ * 返回的 JSON 数据包
+ * <p>
+ * 属性 类型 说明
+ * access_token string 获取到的凭证
+ * expires_in number 凭证有效时间,单位:秒。目前是7200秒之内的值。
+ * errcode number 错误码
+ * errmsg string 错误信息
+ */
+ private static String ACCESS_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={0}&secret={1}";
+
+ /**
+ * @return
+ */
+ public String getAccessToken() {
+ String requestUrl = MessageFormat.format(ACCESS_TOKEN_URL, wxAppletsAppid, wxAppletsAppSecret);
+ String respBody = restTemplate.getForEntity(requestUrl, String.class).getBody();
+ JSONObject jsonObject = JSONObject.parseObject(respBody);
+ return jsonObject.getString("access_token");
+ }
+}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/auth/AuthIntercepter.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/auth/AuthIntercepter.java
index b7973f8..8329c35 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/auth/AuthIntercepter.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/auth/AuthIntercepter.java
@@ -22,15 +22,15 @@
@Override
public boolean preHandle(HttpServletRequest req, HttpServletResponse res, Object handler) throws IOException {
- String appid = req.getParameter("appid");
- String sign = req.getParameter("sign");
- ResultUtil resultUtil = authService.checkSyncAuth(appid, sign, req);
- if (resultUtil.getCode() != 200) {
- res.setStatus(HttpStatus.OK.value());
- res.setHeader("Content-type", "text/html;charset=UTF-8");
- res.getWriter().print(JSON.toJSONString(resultUtil));//Res.Failure("req timeout, please try again")
- return false;
- }
+// String appid = req.getParameter("appid");
+// String sign = req.getParameter("sign");
+// ResultUtil resultUtil = authService.checkSyncAuth(appid, sign, req);
+// if (resultUtil.getCode() != 200) {
+// res.setStatus(HttpStatus.OK.value());
+// res.setHeader("Content-type", "text/html;charset=UTF-8");
+// res.getWriter().print(JSON.toJSONString(resultUtil));//Res.Failure("req timeout, please try again")
+// return false;
+// }
return true;
}
}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/httpClinet/HttpClientUtil.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/httpClinet/HttpClientUtil.java
index 767d6fa..d50232b 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/httpClinet/HttpClientUtil.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/httpClinet/HttpClientUtil.java
@@ -2,15 +2,12 @@
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.stylefeng.guns.modular.system.util.UUIDUtil;
-import com.stylefeng.guns.modular.system.util.auth.UrlEncoderUtils;
import org.apache.http.NameValuePair;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
-import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
@@ -18,19 +15,15 @@
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.message.BasicNameValuePair;
-import org.apache.http.protocol.HTTP;
import org.apache.http.ssl.SSLContexts;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.boot.ApplicationArguments;
-import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import javax.net.ssl.SSLContext;
import java.io.File;
import java.io.FileInputStream;
-import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.security.KeyStore;
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/req/AddHouseReq.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/req/AddHouseReq.java
index ebb1f2f..77a732f 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/req/AddHouseReq.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/req/AddHouseReq.java
@@ -13,12 +13,13 @@
@Data
@ApiModel
public class AddHouseReq {
-
+ @ApiModelProperty(value = "数据id", required = true)
+ private Integer id;
@ApiModelProperty(value = "类型 1=租赁 2=买卖", required = true)
private Integer dataType;
@ApiModelProperty(value = "户型", required = true)
private String houseModel;
- @ApiModelProperty(value = "出租时长(买卖房不填该字段) 例:1 = 不限 /1年1月 ", required = true)
+ @ApiModelProperty(value = "出租时长(买卖房不填该字段) 例:1 = 不限 /1年1月", required = true)
private String time;
@ApiModelProperty(value = "出租(售卖)日期 例:随时/九月上旬", required = true)
private String startTime;
@@ -30,14 +31,21 @@
private String floor;
@ApiModelProperty(value = "是否有电梯(0=否,1=是)", required = true)
private Integer elevator;
- @ApiModelProperty(value = "是否有晾晒区(0=否,1=是)", required = true)
+ @ApiModelProperty(value = "是否有天台(0=否,1=是)", required = true)
private Integer dryingArea;
+ @ApiModelProperty(value = "无(0=否,1=是)", required = true)
+ private Integer air;
+ @ApiModelProperty(value = "是否有阳台(0=否,1=是)", required = true)
+ private Integer balcony;
+
@ApiModelProperty(value = "是否有花园(0=否,1=是)", required = true)
private Integer garden;
+ @ApiModelProperty(value = "是否有平台(0=否,1=是)", required = true)
+ private Integer platform;
@ApiModelProperty(value = "是否有车位(0=否,1=是)", required = true)
private Integer carport;
- @ApiModelProperty(value = "是否有平台(0=否,1=是)", required = true)
- private Integer balcony;
+ @ApiModelProperty(value ="公司盘 0=否1=是",required = false)
+ private Integer firmHouse;
@ApiModelProperty(value = "是否可养宠物(0=否,1=是)", required = true)
private Integer keepPet;
@ApiModelProperty(value = "房屋面积", required = true)
@@ -52,6 +60,8 @@
private String cellName;
@ApiModelProperty(value = "房源照片", required = true)
private String housePhoto;
+ @ApiModelProperty(value = "视频封面", required = true)
+ private String videoPhoto;
@ApiModelProperty(value = "房源视频", required = true)
private String houseVideo;
@ApiModelProperty(value = "标题", required = true)
@@ -66,15 +76,13 @@
private String phone;
@ApiModelProperty(value = "房屋朝向", required = false)
private String buildingOrientation;
- @ApiModelProperty(value ="公司盘 0=否1=是",required = false)
- private Integer firmHouse;
@ApiModelProperty(value ="经度",required = true)
private String longitude;
@ApiModelProperty(value ="纬度",required = true)
private String latitude;
@ApiModelProperty(value ="性别要求 1男2女3不限",required = true)
private Integer sex;
- @ApiModelProperty(value ="类型1为草稿 2为发布",required = true)
+ @ApiModelProperty(value ="1=保存并退出,2=发布",required = true)
private Integer type;
}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/req/HousingDemandReq.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/req/HousingDemandReq.java
index 4a7d89d..bea2d24 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/req/HousingDemandReq.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/req/HousingDemandReq.java
@@ -1,5 +1,6 @@
package com.stylefeng.guns.modular.system.warpper.req;
+import com.baomidou.mybatisplus.annotations.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -11,6 +12,8 @@
@Data
@ApiModel
public class HousingDemandReq {
+ @ApiModelProperty("房源id")
+ private Integer id;
@ApiModelProperty("房源类型(1=租房,2=买房)")
private Integer dataType;
@ApiModelProperty("标题")
@@ -33,18 +36,42 @@
private String floor;
@ApiModelProperty("是否有电梯(0=否,1=是)")
private Integer elevator;
- @ApiModelProperty("是否有晾晒区(0=否,1=是)")
+ @ApiModelProperty("是否有天台(0=否,1=是)")
private Integer dryingArea;
@ApiModelProperty("是否有花园(0=否,1=是)")
private Integer garden;
@ApiModelProperty("是否有车位(0=否,1=是)")
private Integer carport;
- @ApiModelProperty("是否有平台(0=否,1=是)")
+ @ApiModelProperty("是否有阳台(0=否,1=是)")
private Integer balcony;
@ApiModelProperty("是否可养宠物(0=否,1=是)")
private Integer keepPet;
+ @ApiModelProperty(value = "是否有平台(0=否,1=是)", required = true)
+ private Integer platform;
@ApiModelProperty("更多介绍")
private String moreIntroduction;
@ApiModelProperty("状态(0=保存,1=发布)")
private Integer status;
+ @ApiModelProperty(value ="1=保存并退出,2=发布",required = true)
+ private Integer type;
+ @ApiModelProperty("无(0=否,1=是)")
+ private Integer air;
+ @ApiModelProperty("是否公司盘(0=否,1=是)")
+ private Integer firmHouse;
+
+ /**
+ * 微信二维码
+ */
+ @ApiModelProperty("微信二维码")
+ private String wechatQRCode;
+ /**
+ * 电话号码
+ */
+ @ApiModelProperty("电话号码")
+ private String phone;
+ /**
+ * WatchApp
+ */
+ @ApiModelProperty("WatchApp")
+ private String watchApp;
}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/req/ReportHouseResourceReq.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/req/ReportHouseResourceReq.java
index 3fc71b4..7907a1e 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/req/ReportHouseResourceReq.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/req/ReportHouseResourceReq.java
@@ -13,6 +13,6 @@
public class ReportHouseResourceReq {
@ApiModelProperty("房源id")
private Integer houseResourceId;
- @ApiModelProperty("举报内容")
+ @ApiModelProperty("小作文")
private String content;
}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/req/SearchHousingDemandReq.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/req/SearchHousingDemandReq.java
index c0f8897..1058353 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/req/SearchHousingDemandReq.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/req/SearchHousingDemandReq.java
@@ -15,8 +15,10 @@
private Integer type;
@ApiModelProperty(value = "搜索内容", required = false)
private String content;
- @ApiModelProperty(value = "区域code[{cityId:1,districtId:0},{cityId:2,districtId:6}]", required = false)
+ @ApiModelProperty(value = "区域id", required = false)
private String district;
+ @ApiModelProperty(value = "二级区域不限不传 1,2,3", required = false)
+ private String area;
@ApiModelProperty(value = "租金1000-2000", required = false)
private String saleAmount;
@ApiModelProperty(value = "户型,多个逗号分隔", required = false)
@@ -26,7 +28,7 @@
@ApiModelProperty(value = "房屋类型id,多个逗号分隔", required = false)
private String houseTypeId;
@ApiModelProperty(value = "租期时长(1=一年以下,2=一年以上)", required = false)
- private Integer rentalDuration;
+ private String rentalDuration;
@ApiModelProperty(value = "有阳台(1=是)", required = false)
private Integer balcony;
@ApiModelProperty(value = "可养宠物(1=是)", required = false)
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/req/UserInfoDTO.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/req/UserInfoDTO.java
index f87d0d4..5188c83 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/req/UserInfoDTO.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/req/UserInfoDTO.java
@@ -13,7 +13,11 @@
@ApiModel
public class UserInfoDTO {
- @ApiModelProperty(value = "类型 1=删除 2=下架 3=顶上去", required = true)
+ @ApiModelProperty(value = "数据类型 1=求房源 2=房源", required = true)
+ private Integer data;
+
+
+ @ApiModelProperty(value = "类型 1=删除 2=下架 3=顶上去 4=上架", required = true)
private Integer type;
@ApiModelProperty(value = "房源id", required = true)
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/AppletLoginRes.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/AppletLoginRes.java
index 50a5c1f..4db955b 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/AppletLoginRes.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/AppletLoginRes.java
@@ -16,4 +16,8 @@
@ApiModelProperty("登录用户类型1=普通用户 2=房东 3=中介")
private Integer userType;
+
+ @ApiModelProperty("1=未认证 2=已认证通过 3=已认证待审核 4=已认证被拒绝 ")
+ private Integer state;
+
}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/CollectListRes.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/CollectListRes.java
index b6f38f9..39ee693 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/CollectListRes.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/CollectListRes.java
@@ -7,6 +7,7 @@
import java.math.BigDecimal;
import java.util.Date;
+import java.util.List;
/**
个人中心 房源列表
@@ -16,7 +17,9 @@
public class CollectListRes {
@ApiModelProperty("数据库-房源id")
private Integer id;
- @ApiModelProperty("房源类型")
+ @ApiModelProperty("用户id")
+ private Integer appuserId;
+ @ApiModelProperty("房源类型 1=出租 2=买卖")
private Integer dataType;
@ApiModelProperty("标题")
private String title;
@@ -24,10 +27,12 @@
private Integer cityId;
@ApiModelProperty("区id")
private Integer districtId;
- @ApiModelProperty("地址")
+ @ApiModelProperty("房源地址")
private String address;
+ @ApiModelProperty("房源户型")
+ private String houseModel;
@ApiModelProperty("售卖金额(月租金额)")
- private BigDecimal saleAmount;
+ private String saleAmount;
@ApiModelProperty("浏览量")
private Integer viewsNumber;
@ApiModelProperty("收藏量")
@@ -53,7 +58,7 @@
private String leaseTime;
@ApiModelProperty("状态 0下架 1上架")
private Integer status;
- @ApiModelProperty("状态 0下架 1上架")
+ @ApiModelProperty("状态 1草稿 2发布")
private Integer type;
@ApiModelProperty("照片")
private String housePhoto;
@@ -67,6 +72,15 @@
private String nickname;
@ApiModelProperty("发布用户身份 1=普通 2=房东 3=中介")
private Integer userType;
+ @ApiModelProperty("来源 1=求房源 2=房源")
+ private Integer data;
+ @ApiModelProperty("是否可顶 0否1是")
+ private Integer up;
+ @ApiModelProperty("上次顶上去的时间")
+ private Date upTime;
+ @ApiModelProperty("阳台 花园 。。。")
+ private String head;
+
}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/CollectRes.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/CollectRes.java
index f23649e..d82c182 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/CollectRes.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/CollectRes.java
@@ -22,6 +22,5 @@
private Integer draft;
@ApiModelProperty("房源")
private List<CollectListRes> list;
- @ApiModelProperty("求房源")
- private List<SearchHousingDemandListRes> list1;
+
}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/ContactInformationRes.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/ContactInformationRes.java
index dfbea8a..b93e45e 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/ContactInformationRes.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/ContactInformationRes.java
@@ -15,4 +15,6 @@
private String whatsApp;
@ApiModelProperty("电话号码")
private String phone;
+ @ApiModelProperty("微信二维码")
+ private String wechatQrCode;
}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/HouseResourceInfoRes.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/HouseResourceInfoRes.java
index 0a36dde..2b463dc 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/HouseResourceInfoRes.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/HouseResourceInfoRes.java
@@ -17,6 +17,8 @@
private Integer id;
@ApiModelProperty("标题")
private String title;
+ @ApiModelProperty("房源类型1出租2买卖")
+ private Integer dataType;
@ApiModelProperty("价格")
private BigDecimal saleAmount;
@ApiModelProperty("户型")
@@ -65,5 +67,12 @@
private Integer collectionTimes;
@ApiModelProperty("是否收藏(0=否,1=是)")
private Integer collection;
+ @ApiModelProperty("房源二维码")
+ private String qrCode;
+ @ApiModelProperty("视频封面")
+ private String videoPhoto;
+ @ApiModelProperty("房屋朝向")
+ private String buildingOrientation;
+
}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/HousingDemandInfoRes.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/HousingDemandInfoRes.java
index 6839d89..85b6fd3 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/HousingDemandInfoRes.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/HousingDemandInfoRes.java
@@ -16,6 +16,8 @@
public class HousingDemandInfoRes {
@ApiModelProperty("数据id")
private Integer id;
+ @ApiModelProperty("房源类型 1出租 2买卖")
+ private Integer dataType;
@ApiModelProperty("标题")
private String title;
@ApiModelProperty("价格")
@@ -58,4 +60,6 @@
private Integer collectionTimes;
@ApiModelProperty("是否收藏(0=否,1=是)")
private Integer collection;
+ @ApiModelProperty("求房源二维码")
+ private String qrCode;
}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/SearchHouseResourceListRes.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/SearchHouseResourceListRes.java
index 4138326..a0e81ca 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/SearchHouseResourceListRes.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/SearchHouseResourceListRes.java
@@ -37,14 +37,20 @@
private String nickname;
@ApiModelProperty("是否有电梯(0=否,1=是)")
private Integer elevator;
- @ApiModelProperty("是否有晾晒区(0=否,1=是)")
+ @ApiModelProperty("是否有天台(0=否,1=是)")
private Integer dryingArea;
+ @ApiModelProperty("是否有平台(0=否,1=是)")
+ private Integer platform;
@ApiModelProperty("是否有花园(0=否,1=是)")
private Integer garden;
@ApiModelProperty("是否有车位(0=否,1=是)")
private Integer carport;
- @ApiModelProperty("是否有平台(0=否,1=是)")
+ @ApiModelProperty("是否有阳台(0=否,1=是)")
private Integer balcony;
+ @ApiModelProperty("无(0=否,1=是)")
+ private Integer air;
@ApiModelProperty("是否可养宠物(0=否,1=是)")
private Integer keepPet;
+ @ApiModelProperty("租期")
+ private String leaseTime;
}
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/SearchHousingDemandListRes.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/SearchHousingDemandListRes.java
index 2221e67..4fb2ddd 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/SearchHousingDemandListRes.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/res/SearchHousingDemandListRes.java
@@ -1,9 +1,11 @@
package com.stylefeng.guns.modular.system.warpper.res;
+import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
+import java.util.Date;
import java.util.List;
/**
@@ -17,6 +19,10 @@
private Integer id;
@ApiModelProperty("用户id")
private Integer appuserId;
+ @ApiModelProperty("租期")
+ private Integer rentalDuration;
+ @ApiModelProperty("类型 1=出租 2=买卖")
+ private Integer dataType;
@ApiModelProperty("标题")
private String title;
@ApiModelProperty("户型")
@@ -24,23 +30,38 @@
@ApiModelProperty("地址")
private List<String> address;
@ApiModelProperty("价格")
- private Double saleAmount;
+ private String saleAmount;
@ApiModelProperty("头像")
private String profilePhoto;
@ApiModelProperty("昵称")
private String nickname;
@ApiModelProperty("是否有电梯(0=否,1=是)")
private Integer elevator;
- @ApiModelProperty("是否有晾晒区(0=否,1=是)")
+ @ApiModelProperty("无(0=否,1=是)")
+ private Integer air;
+ @ApiModelProperty("是否有天台(0=否,1=是)")
private Integer dryingArea;
- @ApiModelProperty("是否有花园(0=否,1=是)")
- private Integer garden;
+ @ApiModelProperty("是否有阳台(0=否,1=是)")
+ private Integer balcony;
+
@ApiModelProperty("是否有车位(0=否,1=是)")
private Integer carport;
@ApiModelProperty("是否有平台(0=否,1=是)")
- private Integer balcony;
+ private Integer platform;
+ @ApiModelProperty("是否有花园(0=否,1=是)")
+ private Integer garden;
+
@ApiModelProperty("是否可养宠物(0=否,1=是)")
private Integer keepPet;
@ApiModelProperty("类型 1=草稿 2=发布")
private Integer type;
+ @ApiModelProperty("发布时间")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private Date insertTime;
+ @ApiModelProperty("状态 0下架 1上架")
+ private Integer status;
+ @ApiModelProperty("浏览量")
+ private Integer viewsNumber;
+ @ApiModelProperty("收藏量")
+ private Integer collect;
}
diff --git a/guns-admin/src/main/resources/application-dev.yml b/guns-admin/src/main/resources/application-dev.yml
index 699d1aa..7044032 100644
--- a/guns-admin/src/main/resources/application-dev.yml
+++ b/guns-admin/src/main/resources/application-dev.yml
@@ -1,12 +1,12 @@
server:
- port: 81
+ port: 82
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
- url: jdbc:mysql://127.0.0.1:3306/rental_house_applet?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai
+ url: jdbc:mysql://192.168.110.64:3306/rental_house_applet?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai
username: root
- password: 123456
+ password: root
db-name: rental_house_applet #用来搜集数据库的所有表
filters: wall,mergeStat
@@ -16,7 +16,7 @@
open: false #生产环境设置true 读写分离(从数据库)
url: jdbc:mysql://127.0.0.1:3306/rental_house_applet?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai
username: root
- password: 123456
+ password: root
dataSourceNames:
- dataSourceGuns
- dataSourceBiz
@@ -27,8 +27,8 @@
grantType: authorization_code #填authorization_code
appid: 11 #应用唯一标识,在微信开放平台提交应用审核通过后获得
appSecret: 11 #应用密钥AppSecret,在微信开放平台提交应用审核通过后获得
- appletsAppid: 111 #小程序APPid
- appletsAppSecret: 1111 #
+ appletsAppid: wx6ecd78982c8c401c #小程序APPid
+ appletsAppSecret: 9d0cdb19e0d54301abcda3a1dcfd8389 #
officialAccountAppid: 11111
officialAccountAppSecret: 1111
webAppId: 111
@@ -53,10 +53,25 @@
max-idle: 100
min-idle: 0
-
-
---
spring:
data:
mongodb:
- uri: mongodb://127.0.0.1:27017/admin
\ No newline at end of file
+ # 指定MongoDB服务地址
+ host: 192.168.110.64
+ # 指定端口,默认就为27017
+ port: 27017
+ # 指定使用的数据库(集合)
+ database: applet
+ # 登录认证的逻辑库名
+ authentication-database: applet
+ # 用户名
+ username: root
+ # 密码
+ password: root
+---
+oss:
+ endpoint: oss-cn-hongkong.aliyuncs.com
+ accessKeyId: LTAI5tQZzqsZYX5gw8yRNchQ
+ accessKeySecret: 5yJVdXwRzwPZwKKXp07lRAc7tkTxQp
+ bucketName: bizuphk
diff --git a/guns-admin/src/main/resources/application.yml b/guns-admin/src/main/resources/application.yml
index 5d46647..89c851a 100644
--- a/guns-admin/src/main/resources/application.yml
+++ b/guns-admin/src/main/resources/application.yml
@@ -30,10 +30,4 @@
spring:
profiles:
- active: @spring.active@
-
-pagehelper:
-helperDialect: mysql
-reasonable: true\
-supportMethodsArguments: true
-params: count=countSql
+ active: @spring.active@
\ No newline at end of file
diff --git a/guns-admin/src/test/java/com/stylefeng/guns/GunsApplicationTest.java b/guns-admin/src/test/java/com/stylefeng/guns/GunsApplicationTest.java
index cb249b3..ba85c7f 100644
--- a/guns-admin/src/test/java/com/stylefeng/guns/GunsApplicationTest.java
+++ b/guns-admin/src/test/java/com/stylefeng/guns/GunsApplicationTest.java
@@ -1,4 +1,4 @@
-//package com.stylefeng.guns;
+package com.stylefeng.guns;//package com.stylefeng.guns;
//
//import com.alibaba.fastjson.JSON;
//import com.baomidou.mybatisplus.mapper.EntityWrapper;
diff --git a/guns-core/src/main/java/com/stylefeng/guns/core/node/ZTreeNode.java b/guns-core/src/main/java/com/stylefeng/guns/core/node/ZTreeNode.java
index a330514..58d382f 100644
--- a/guns-core/src/main/java/com/stylefeng/guns/core/node/ZTreeNode.java
+++ b/guns-core/src/main/java/com/stylefeng/guns/core/node/ZTreeNode.java
@@ -1,5 +1,7 @@
package com.stylefeng.guns.core.node;
+import java.util.List;
+
/**
*
* jquery ztree 插件的节点
@@ -18,6 +20,15 @@
private Boolean open;//是否打开节点
private Boolean checked;//是否被选中
+ private List<ZTreeNode> children;//是否被选中
+
+ public List<ZTreeNode> getChildren() {
+ return children;
+ }
+
+ public void setChildren(List<ZTreeNode> children) {
+ this.children = children;
+ }
public Long getId() {
return id;
diff --git a/guns-management/pom.xml b/guns-management/pom.xml
index 9210dda..a36149a 100644
--- a/guns-management/pom.xml
+++ b/guns-management/pom.xml
@@ -12,6 +12,12 @@
<dependencies>
<dependency>
+ <groupId>com.aliyun.oss</groupId>
+ <artifactId>aliyun-sdk-oss</artifactId>
+ <version>3.11.0</version>
+ </dependency>
+
+ <dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.4.0</version>
diff --git a/guns-management/src/main/java/com/stylefeng/guns/config/web/ShiroConfig.java b/guns-management/src/main/java/com/stylefeng/guns/config/web/ShiroConfig.java
index c65fd7d..8bcca06 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/config/web/ShiroConfig.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/config/web/ShiroConfig.java
@@ -168,7 +168,7 @@
hashMap.put("/swagger-resources/configuration/ui/**", "anon");
hashMap.put("/swagger-resources/configuration/security/**", "anon");
- hashMap.put("/base/**", "anon");
+// hashMap.put("/base/**", "anon");
hashMap.put("/upload/**", "anon");
hashMap.put("/api/**", "anon");
hashMap.put("/auth/**", "anon");
@@ -181,6 +181,7 @@
hashMap.put("/global/sessionError", "anon");
hashMap.put("/kaptcha", "anon");
hashMap.put("/base/user/login", "anon");
+ hashMap.put("/base/oss/upload", "anon");
hashMap.put("/**", "user");
shiroFilter.setFilterChainDefinitionMap(hashMap);
return shiroFilter;
diff --git a/guns-management/src/main/java/com/stylefeng/guns/core/intercept/GunsUserFilter.java b/guns-management/src/main/java/com/stylefeng/guns/core/intercept/GunsUserFilter.java
index b9589f4..9553ac5 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/core/intercept/GunsUserFilter.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/core/intercept/GunsUserFilter.java
@@ -93,7 +93,8 @@
*/
if (ShiroKit.getSession().getAttribute("sessionFlag") == null) {
httpServletRequest.setAttribute("tips", "session超时");
- httpServletRequest.getRequestDispatcher("/login").forward(request, response);
+// httpServletRequest.getRequestDispatcher("/login").forward(request, response);
+ httpServletRequest.getRequestDispatcher("/base/user/tt").forward(request, response);
return false;
} else {
saveRequestAndRedirectToLogin(request, response);
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/HostController.java b/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/HostController.java
index 0240601..f39ab26 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/HostController.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/HostController.java
@@ -36,7 +36,7 @@
@ResponseBody
@PostMapping("/add")
@ApiOperation(value = "添加用户", tags = {"后台-用户管理"})
- public ResultUtil addHost( Host host){
+ public ResultUtil addHost(@RequestBody Host host){
System.out.println("===================添加房东==");
AppUser appUser = new AppUser();
BeanUtils.copyProperties(host,appUser);
@@ -62,7 +62,7 @@
@ResponseBody
@PutMapping("/update")
@ApiOperation(value = "编辑用户信息", tags = {"后台-用户管理"})
- public ResultUtil update(Host host){
+ public ResultUtil update(@RequestBody Host host){
AppUser appUser =new AppUser();
BeanUtils.copyProperties(host,appUser);
appUserService.updateById(appUser);
@@ -72,10 +72,15 @@
@ResponseBody
@PutMapping("/forzen")
@ApiOperation(value = "更改状态1=正常,2=冻结,3=删除", tags = {"后台-用户管理"})
- public ResultUtil frozen(Integer id,Integer status){
- AppUser appUser = appUserService.selectById(id);
+ public ResultUtil frozen(String ids,Integer status){
+ String[] split = ids.split(",");
+ for (String s : split) {
+
+
+ AppUser appUser = appUserService.selectById(Integer.valueOf(s));
appUser.setStatus(status);
appUserService.updateById(appUser);
+ }
String res = "";
switch (status) {
case 1:
@@ -102,7 +107,7 @@
@ApiImplicitParam(name = "userType", value = "用户类型(1=普通,2=房东)",dataType = "int",required = false),
@ApiImplicitParam(name = "status", value = "状态(1=正常,2=冻结,3=删除)",dataType = "int",required = false),
@ApiImplicitParam(name = "phone", value = "电话",required = false),
- @ApiImplicitParam(name = "pageNo", required = false),
+ @ApiImplicitParam(name = "pageNum", required = false),
@ApiImplicitParam(name = "pageSize",required = false),
})
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/HouseController.java b/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/HouseController.java
index 9630509..20f8267 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/HouseController.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/HouseController.java
@@ -1,27 +1,36 @@
package com.stylefeng.guns.modular.code.controller;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
+import com.stylefeng.guns.core.shiro.ShiroKit;
import com.stylefeng.guns.modular.system.dto.Host;
import com.stylefeng.guns.modular.system.dto.THouseResource;
-import com.stylefeng.guns.modular.system.model.HouseResource;
-import com.stylefeng.guns.modular.system.model.HouseType;
+import com.stylefeng.guns.modular.system.model.*;
+import com.stylefeng.guns.modular.system.service.IAppUserService;
import com.stylefeng.guns.modular.system.service.IHouseResourceService;
import com.stylefeng.guns.modular.system.service.IHouseTypeService;
+import com.stylefeng.guns.modular.system.service.IHousingDemandService;
+import com.stylefeng.guns.modular.system.util.RedisUtil;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import com.stylefeng.guns.modular.system.warpper.req.AddHouseReq;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
+import org.bouncycastle.cms.PasswordRecipient;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.util.ArrayList;
import java.util.Date;
import java.util.List;
+import java.util.Objects;
@Controller
@RequestMapping("/base/house")
@@ -32,6 +41,84 @@
@Autowired
private IHouseResourceService houseResourceService;
+
+ @Autowired
+ private IHousingDemandService demandService;
+
+ @Autowired
+ private IAppUserService appUserService;
+
+ @Autowired
+ private RedisUtil redisUtil;
+
+
+ @ResponseBody
+ @GetMapping("/data")
+ @ApiOperation(value = "统计", tags = {"后台-主页"})
+ public List<Integer> data(){
+
+ Date date = new Date(); // 假设这是您的java.util.Date对象
+
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+ String formattedDate = sdf.format(date);
+
+ LocalDate today = LocalDate.now();
+
+ List<Integer> data = new ArrayList<>();
+ //总房源
+ Integer one = houseResourceService.selectCount(new EntityWrapper<HouseResource>().eq("is_delete", 0));
+ data.add(one);
+ //总出租房源
+ Integer two = houseResourceService.selectCount(new EntityWrapper<HouseResource>().eq("is_delete", 0).eq("data_type",1));
+ data.add(two);
+ //总卖房源
+ Integer three = houseResourceService.selectCount(new EntityWrapper<HouseResource>().eq("is_delete", 0).eq("data_type",2));
+ data.add(three);
+ //总求买房
+ Integer four = demandService.selectCount(new EntityWrapper<HousingDemand>().eq("is_delete", 0).eq("data_type",2));
+ data.add(four);
+ //总求租房
+ Integer five = demandService.selectCount(new EntityWrapper<HousingDemand>().eq("is_delete", 0).eq("data_type",1));
+ data.add(five);
+ //总中介
+ Integer six = appUserService.selectCount(new EntityWrapper<AppUser>().eq("user_type",3).ne("status",3));
+ data.add(six);
+ //总房东
+ Integer seven = appUserService.selectCount(new EntityWrapper<AppUser>().eq("user_type",3).ne("status",2));
+ data.add(seven);
+ //总用户
+ Integer eight = appUserService.selectCount(new EntityWrapper<AppUser>().ne("status",2));
+ data.add(eight);
+ //今日新增中介
+ Integer nine = appUserService.selectCount(new EntityWrapper<AppUser>()
+ .eq("user_type", 3)
+ .ne("status", 3)
+ .like("changeTime", formattedDate));
+ data.add(nine);
+ //今日新增房东
+ Integer ten = appUserService.selectCount(new EntityWrapper<AppUser>()
+ .eq("user_type",2)
+ .ne("status",3)
+ .like("changeTime", formattedDate));
+ data.add(ten);
+ //今日新增用户
+ Integer eleven = appUserService.selectCount(new EntityWrapper<AppUser>().ne("status",3).like("insert_time", formattedDate));
+ data.add(eleven);
+ //今日新增房源出租
+ Integer twelve = houseResourceService.selectCount(new EntityWrapper<HouseResource>().eq("is_delete", 0).ne("type",1).eq("data_type",1).like("auth_time", formattedDate));
+ data.add(twelve);
+ //今日卖房源
+ Integer thirteen = houseResourceService.selectCount(new EntityWrapper<HouseResource>().eq("is_delete", 0).ne("type",1).eq("data_type",2).like("auth_time", formattedDate));
+ data.add(thirteen);
+ //今日求租房
+ Integer fourteen = demandService.selectCount(new EntityWrapper<HousingDemand>().eq("is_delete", 0).ne("type",1).eq("data_type",1).like("insert_time", formattedDate));
+ data.add(fourteen);
+ //今日求买房
+ Integer fifteen = demandService.selectCount(new EntityWrapper<HousingDemand>().eq("is_delete", 0).ne("type",1).eq("data_type",2).like("insert_time", formattedDate));
+ data.add(fifteen);
+
+ return data;
+ }
@ResponseBody
@@ -50,14 +137,28 @@
return ResultUtil.success(houseTypes);
}
+ @ResponseBody
+ @GetMapping("/getHouseTypeList")
+ @ApiOperation(value = "获取房源类型列表", tags = {"后台-房源管理"})
+ public Object getHouseTypeList(@RequestParam int pageNum,@RequestParam int pageSize){
+
+ PageHelper.startPage(pageNum,pageSize);
+ List<HouseType> houseTypes = houseTypeService.list();
+ PageInfo<HouseType> info=new PageInfo<>(houseTypes);
+ System.err.println(info);
+ return info;
+ }
+
@ResponseBody
@PostMapping("/addHouseType")
@ApiOperation(value = "增加房源类型", tags = {"后台-房源管理"})
- public ResultUtil addHouseType(HouseType houseType){
+ public ResultUtil addHouseType(@RequestBody HouseType houseType){
houseType.setInsertTime(new Date());
+ houseType.setCreateBy(Objects.requireNonNull(ShiroKit.getUser()).id);
houseTypeService.insert(houseType);
+
return ResultUtil.success("增加成功");
}
@@ -76,8 +177,28 @@
HouseResource houseResource = houseResourceService.selectById(id);
AddHouseReq addHouseReq = new AddHouseReq();
BeanUtils.copyProperties(houseResource,addHouseReq);
+ addHouseReq.setTime(houseResource.getLeaseTime());
return addHouseReq;
+ }
+
+ @ResponseBody
+ @GetMapping("/auth/setting")
+ @ApiOperation(value = "房源审核设置", tags = {"后台-房源审核设置"})
+ public ResultUtil setting(){
+ String tt = redisUtil.getValue("HouseAuthSetting");
+ if (tt.equals("null")){
+ tt = "0";
+ }
+ return ResultUtil.success(tt);
+ }
+
+ @ResponseBody
+ @PutMapping("/auth/setting/update")
+ @ApiOperation(value = "房源审核设置修改", tags = {"后台-房源审核设置"})
+ public ResultUtil settingUpdate(Integer num){
+ redisUtil.setStrValue("HouseAuthSetting", String.valueOf(num));
+ return ResultUtil.success("保存成功");
}
@@ -154,20 +275,26 @@
@ResponseBody
@PutMapping("/change")
@ApiOperation(value = "(0=下架,1=上架,2=删除,3通过审核,4拒绝审核)", tags = {"后台-房源管理"})
- public ResultUtil change(Integer id,Integer status){
- HouseResource houseResource = houseResourceService.selectById(id);
+ public ResultUtil change(String ids,Integer status,String reason){
+ String[] split = ids.split(",");
+ for (String id : split) {
+ HouseResource houseResource = houseResourceService.selectById(Integer.valueOf(id));
if (status==0||status==1){
houseResource.setStatus(status);
}else if (status==2){
houseResource.setIsDelete(1);
}else if (status ==3){
+ houseResource.setAuthTime(new Date());
houseResource.setAuthStatus(2);
}else if (status == 4){
+ houseResource.setAuthTime(new Date());
+ houseResource.setReason(reason);
houseResource.setAuthStatus(3);
}
houseResourceService.updateById(houseResource);
+ }
return ResultUtil.success("操作成功");
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/MediumController.java b/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/MediumController.java
index 2638ba2..cc93e95 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/MediumController.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/MediumController.java
@@ -1,12 +1,16 @@
package com.stylefeng.guns.modular.code.controller;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.mapper.Wrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.stylefeng.guns.modular.system.dto.Host;
import com.stylefeng.guns.modular.system.dto.Medium;
import com.stylefeng.guns.modular.system.dto.THouseResource;
import com.stylefeng.guns.modular.system.model.AppUser;
+import com.stylefeng.guns.modular.system.model.TAppUserAuditRecord;
import com.stylefeng.guns.modular.system.service.IAppUserService;
+import com.stylefeng.guns.modular.system.service.TAppUserAuditRecordService;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@@ -26,6 +30,8 @@
@Autowired
private IAppUserService appUserService;
+ @Autowired
+ private TAppUserAuditRecordService appUserAuditRecordService;
@ResponseBody
@GetMapping("/list")
@@ -43,7 +49,7 @@
Integer userType = 3;
PageHelper.startPage(pageNum,pageSize);
- List<Medium> medius = appUserService.listMedium(nickname,userType,status,phone);
+ List<Medium> medius = appUserService.listMedium(nickname,null,status,phone);
PageInfo<Medium> info=new PageInfo<>(medius);
System.err.println(info);
return info;
@@ -53,7 +59,7 @@
@ResponseBody
@PostMapping("/add")
@ApiOperation(value = "添加中介", tags = {"后台-中介管理"})
- public ResultUtil addHost( Medium host){
+ public ResultUtil addHost(@RequestBody Medium host){
System.out.println("===================添加房东==");
AppUser appUser = new AppUser();
BeanUtils.copyProperties(host,appUser);
@@ -67,7 +73,7 @@
@ResponseBody
@GetMapping("/pre/update")
- @ApiOperation(value = "编辑前获取中介信息", tags = {"后台-中介管理"})
+ @ApiOperation(value = "编辑前获取中介信息", tags = {"后台-中介管理"},response = Medium.class)
public Medium preupdate(Integer id){
AppUser appUser = appUserService.selectById(id);
Medium host = new Medium();
@@ -78,10 +84,14 @@
@ResponseBody
@PutMapping("/forzen")
@ApiOperation(value = "更改状态1=正常,2=冻结,3=删除", tags = {"后台-中介管理"})
- public ResultUtil frozen(Integer id,Integer status){
- AppUser appUser = appUserService.selectById(id);
+ public ResultUtil frozen(String ids,Integer status){
+ String[] split = ids.split(",");
+ for (String s : split) {
+ AppUser appUser = appUserService.selectById(Integer.valueOf(s));
appUser.setStatus(status);
appUserService.updateById(appUser);
+ }
+
String res = "";
switch (status) {
case 1:
@@ -101,7 +111,7 @@
@ResponseBody
@PutMapping("/update")
@ApiOperation(value = "编辑中介", tags = {"后台-中介管理"})
- public ResultUtil update(Medium host){
+ public ResultUtil update(@RequestBody Medium host){
// AppUser appUser = appUserService.selectById(id);
// Host host = new Host();
AppUser appUser =new AppUser();
@@ -116,36 +126,90 @@
@ApiImplicitParams({
@ApiImplicitParam(name = "nickname", value = "微信昵称", required = false),
@ApiImplicitParam(name = "userType", value = "3(中介)",dataType = "int",required = true),
- @ApiImplicitParam(name = "status", value = "状态(1=正常,2=冻结,3=删除)",dataType = "int",required = false),
+ @ApiImplicitParam(name = "status", value = "1=待审核,2=审核通过,3=审核拒绝",dataType = "int",required = false),
@ApiImplicitParam(name = "phone", value = "电话",required = false),
@ApiImplicitParam(name = "pageNum", required = true),
@ApiImplicitParam(name = "pageSize",required = true),
})
public Object aulist(String nickname, Integer userType, Integer status, String phone, int pageNum, int pageSize){
-
PageHelper.startPage(pageNum,pageSize);
- List<Medium> medius = appUserService.listAuMedium(nickname,userType,status,phone);
+ List<Medium> medius = appUserService.listAuMedium(nickname,null,status,phone);
PageInfo<Medium> info=new PageInfo<>(medius);
System.err.println(info);
return info;
}
@ResponseBody
+ @GetMapping("/auth/record/list")
+ @ApiOperation(value = "查询中介审核记录列表", tags = {"后台-中介审核管理"},response = TAppUserAuditRecord.class)
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "status", value = "1=待审核,2=审核通过,3=审核拒绝",dataType = "int",required = false),
+ @ApiImplicitParam(name = "pageNum", required = true),
+ @ApiImplicitParam(name = "pageSize",required = true),
+ @ApiImplicitParam(name = "auId",value ="中介id" ,required = true)
+ })
+ public Object record(Integer auId,Integer status,int pageNum, int pageSize){
+ Wrapper<TAppUserAuditRecord> wrapper = new EntityWrapper<TAppUserAuditRecord>();
+
+ wrapper.eq("app_user_id", auId);
+ if (status!=null){
+ wrapper.eq("audit_status",status);
+ }
+ PageHelper.startPage(pageNum,pageSize);
+ List<TAppUserAuditRecord> list = appUserAuditRecordService.selectList(wrapper);
+ PageInfo<TAppUserAuditRecord> info=new PageInfo<>(list);
+ System.err.println(info);
+ return info;
+ }
+
+ @ResponseBody
+ @DeleteMapping("/auth/record/delete")
+ @ApiOperation(value = "查询中介审核列表-删除", tags = {"后台-中介审核管理"},response = TAppUserAuditRecord.class)
+ public Object recordDelete(String ids){
+ String[] split = ids.split(",");
+ for (String id : split) {
+ appUserAuditRecordService.deleteById(Integer.valueOf(id));
+ }
+ return ResultUtil.success("删除成功");
+ }
+
+ @ResponseBody
@PutMapping("/auth/change")
- @ApiOperation(value = "更改状态1=审核通过,2=审核拒绝,3=删除", tags = {"后台-中介审核管理"})
- public ResultUtil frozen(Integer id,Integer status,String reason){
- AppUser appUser = appUserService.selectById(id);
+ @ApiOperation(value = "(批量)更改状态1=审核通过,2=审核拒绝,3=删除", tags = {"后台-中介审核管理"})
+ public ResultUtil frozen(String ids,Integer status,String reason){
+ String[] split = ids.split(",");
+ for (String id : split) {
+ AppUser appUser = appUserService.selectById(Integer.valueOf(id));
if (status==1){
- appUser.setAuditStatus(2);
+ appUser.setAuth(2);
+ appUser.setUserType(3);
+// appUser.setRefuseDate(new Date());
+ appUser.setChangeTime(new Date());
+ //记录
+ TAppUserAuditRecord appUserAuditRecord = new TAppUserAuditRecord();
+ appUserAuditRecord.setAppUserId(Integer.valueOf(id));
+ appUserAuditRecord.setAuditStatus(2);
+ appUserAuditRecord.setInsertTime(new Date());
+ appUserAuditRecordService.insert(appUserAuditRecord);
}else if (status==2){
- appUser.setAuditStatus(1);
+ appUser.setAuth(3);
appUser.setAuditNote(reason);
+ appUser.setRefuseDate(new Date());
+ //记录
+ TAppUserAuditRecord appUserAuditRecord = new TAppUserAuditRecord();
+ appUserAuditRecord.setAppUserId(Integer.valueOf(id));
+ appUserAuditRecord.setAuditStatus(3);
+ appUserAuditRecord.setInsertTime(new Date());
+ appUserAuditRecord.setAuditNote(reason);
+ appUserAuditRecordService.insert(appUserAuditRecord);
}else if (status==3){
appUser.setStatus(3);
}
appUserService.updateById(appUser);
+ }
+
return ResultUtil.success("操作成功");
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/OssController.java b/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/OssController.java
new file mode 100644
index 0000000..5c5b2d5
--- /dev/null
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/OssController.java
@@ -0,0 +1,51 @@
+package com.stylefeng.guns.modular.code.controller;
+
+import com.aliyun.oss.OSSClient;
+import com.aliyun.oss.model.ObjectMetadata;
+import com.aliyun.oss.model.PutObjectRequest;
+import com.aliyun.oss.model.PutObjectResult;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import java.io.IOException;
+
+@CrossOrigin
+@RestController
+@RequestMapping("/base/oss")
+public class OssController {
+
+ private static final String endpoint = "oss-cn-hongkong.aliyuncs.com";
+ private static final String accessKeyId = "LTAI5tQZzqsZYX5gw8yRNchQ";
+ private static final String accessKeySecret = "5yJVdXwRzwPZwKKXp07lRAc7tkTxQp";
+ private static final String bucketName = "bizuphk";
+
+ @PostMapping("/upload")
+ @ApiOperation(value = "文件上传",tags = "文件上传")
+ public ResponseEntity<String> upload(@RequestParam("file") MultipartFile file) throws IOException {
+ // 创建 OSSClient 实例
+ OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret);
+
+
+ // 创建 PutObjectRequest 对象
+ PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, file.getOriginalFilename(), file.getInputStream());
+
+ ObjectMetadata metadata = new ObjectMetadata();
+ // 取消文件缓存,文件每次都会从OSS服务器获取
+ metadata.setHeader("Cache-Control", "no-cache");
+ metadata.setHeader("Expires", "0");
+
+
+ // 上传文件
+ PutObjectResult putObjectResult = ossClient.putObject(putObjectRequest);
+
+ // 关闭 OSSClient 实例
+ ossClient.shutdown();
+
+ String fileUrl = "https://" + bucketName + "." + endpoint + "/" + file.getOriginalFilename();
+ return ResponseEntity.ok(fileUrl);
+ }
+
+
+}
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/ReportController.java b/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/ReportController.java
index 979e69c..3f8f436 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/ReportController.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/ReportController.java
@@ -4,6 +4,7 @@
import com.github.pagehelper.PageInfo;
import com.stylefeng.guns.modular.system.dto.FeedBackVo;
import com.stylefeng.guns.modular.system.dto.THouseResource;
+import com.stylefeng.guns.modular.system.model.HouseResource;
import com.stylefeng.guns.modular.system.model.ReportHouseResource;
import com.stylefeng.guns.modular.system.service.IFeedBackService;
import com.stylefeng.guns.modular.system.service.IHouseResourceService;
@@ -16,6 +17,7 @@
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
+import java.util.Date;
import java.util.List;
@Controller
@@ -64,18 +66,27 @@
@ResponseBody
@PutMapping("/change")
@ApiOperation(value = "status 1=通过,2=拒绝,3删除)", tags = {"后台-房源举报管理"})
- public ResultUtil change(Integer id, Integer status,String reason){
- ReportHouseResource reportHouseResource = reportHouseResourceService.selectById(id);
+ public ResultUtil change(String ids, Integer status,String reason){
+ String[] split = ids.split(",");
+ for (String id : split) {
+
+ ReportHouseResource reportHouseResource = reportHouseResourceService.selectById(Integer.valueOf(id));
if (status==1){
reportHouseResource.setAudit(1);
}else if (status ==2){
reportHouseResource.setAudit(2);
+ reportHouseResource.setBackDate(new Date());
reportHouseResource.setBackReason(reason);
+ HouseResource houseResource = houseResourceService.selectById(reportHouseResource.getHouseResourceId());
+ houseResource.setStatus(0);
+ houseResourceService.updateById(houseResource);
}else if (status == 3){
- reportHouseResourceService.deleteById(id);
+ reportHouseResourceService.deleteById(Integer.valueOf(id));
return ResultUtil.success();
}
reportHouseResourceService.updateById(reportHouseResource);
+ }
+
return ResultUtil.success();
}
@@ -108,11 +119,15 @@
@ResponseBody
@DeleteMapping("/feedback/delete")
@ApiOperation(value = "删除", tags = {"后台-意见反馈"})
- public ResultUtil delete(Integer id){
- feedBackService.deleteById(id);
+ public ResultUtil delete(Integer[] ids){
+ for (Integer id : ids) {
+ feedBackService.deleteById(Integer.valueOf(id));
+ }
return ResultUtil.success("删除成功");
}
+
+
}
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/SysBannerController.java b/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/SysBannerController.java
new file mode 100644
index 0000000..2e6ce81
--- /dev/null
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/SysBannerController.java
@@ -0,0 +1,69 @@
+package com.stylefeng.guns.modular.code.controller;
+
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.stylefeng.guns.core.shiro.ShiroKit;
+import com.stylefeng.guns.modular.system.dto.BannerVo;
+import com.stylefeng.guns.modular.system.dto.THouseResource;
+import com.stylefeng.guns.modular.system.model.Banner;
+import com.stylefeng.guns.modular.system.model.HouseType;
+import com.stylefeng.guns.modular.system.service.IBannerService;
+import com.stylefeng.guns.modular.system.util.ResultUtil;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+
+import javax.print.attribute.IntegerSyntax;
+import java.util.Date;
+import java.util.List;
+import java.util.Objects;
+
+@Controller
+@RequestMapping("/base/banner")
+public class SysBannerController {
+
+ @Autowired
+ private IBannerService bannerService;
+ @ResponseBody
+ @GetMapping("/list")
+ @ApiOperation(value = "列表", tags = {"后台-轮播图管理"},response = BannerVo.class)
+ public Object list(int pageNum,int pageSize,Integer position,Integer sort){
+ PageHelper.startPage(pageNum,pageSize);
+ List<BannerVo> list = bannerService.list(position,sort);
+ PageInfo<BannerVo> info=new PageInfo<>(list);
+ System.err.println(info);
+ return info;
+ }
+
+ @ResponseBody
+ @PostMapping ("/add")
+ @ApiOperation(value = "添加", tags = {"后台-轮播图管理"})
+ public ResultUtil add(@RequestBody BannerVo bannerVo){
+ List<Banner> position = bannerService.selectList(new EntityWrapper<Banner>().eq("position", bannerVo.getPosition()));
+ if (!position.isEmpty()){
+ return ResultUtil.error("当前模块已经上传");
+ }
+ Banner banner = new Banner();
+ BeanUtils.copyProperties(bannerVo,banner);
+ banner.setInsertUserId(Objects.requireNonNull(ShiroKit.getUser()).id);
+ banner.setInsertTime(new Date());
+ bannerService.insertOrUpdate(banner);
+ return ResultUtil.success("操作成功");
+ }
+
+
+ @ResponseBody
+ @DeleteMapping("/delete")
+ @ApiOperation(value = "批量删除", tags = {"后台-轮播图管理"})
+ public ResultUtil add(String ids){
+ String[] split = ids.split(",");
+ for (String s : split) {
+ bannerService.deleteById(Integer.valueOf(s));
+ }
+
+ return ResultUtil.success("删除成功");
+ }
+}
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/SysDeptController.java b/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/SysDeptController.java
index f0e6580..733b570 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/SysDeptController.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/SysDeptController.java
@@ -1,5 +1,6 @@
package com.stylefeng.guns.modular.code.controller;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.stylefeng.guns.core.common.annotion.BussinessLog;
import com.stylefeng.guns.core.common.constant.dictmap.DeptDict;
import com.stylefeng.guns.core.common.constant.factory.ConstantFactory;
@@ -10,7 +11,9 @@
import com.stylefeng.guns.core.node.ZTreeNode;
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.system.model.Dept;
+import com.stylefeng.guns.modular.system.model.User;
import com.stylefeng.guns.modular.system.service.IDeptService;
+import com.stylefeng.guns.modular.system.service.IUserService;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import com.stylefeng.guns.modular.system.warpper.DeptWarpper;
import io.swagger.annotations.ApiOperation;
@@ -69,12 +72,21 @@
return deptService.selectList(null);
// return tree;
}
-
+ @Autowired
+ private IUserService userService;
@DeleteMapping ("/delete")
@ResponseBody
@ApiOperation(value = "删除部门", tags = {"后台-部门管理"})
- public ResultUtil delete(Integer id) {
- deptService.deleteById(id);
+ public ResultUtil delete(String ids) {
+ String[] split = ids.split(",");
+ for (String id : split) {
+ User user = userService.selectById(Integer.valueOf(id));
+ if (user!=null){
+ return ResultUtil.error("当前部门已绑定用户,无法删除");
+ }
+ deptService.deleteById(Integer.valueOf(id));
+
+ }
return ResultUtil.success("删除成功");
}
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/SysRoleController.java b/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/SysRoleController.java
index 1098cb8..6b30d01 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/SysRoleController.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/SysRoleController.java
@@ -1,6 +1,7 @@
package com.stylefeng.guns.modular.code.controller;
-import com.stylefeng.guns.core.base.tips.Tip;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.google.gson.Gson;
import com.stylefeng.guns.core.cache.CacheKit;
import com.stylefeng.guns.core.common.annotion.BussinessLog;
import com.stylefeng.guns.core.common.constant.Const;
@@ -14,22 +15,26 @@
import com.stylefeng.guns.core.node.ZTreeNode;
import com.stylefeng.guns.core.shiro.ShiroKit;
import com.stylefeng.guns.core.util.ToolUtil;
+import com.stylefeng.guns.modular.system.dto.TreeBean;
import com.stylefeng.guns.modular.system.model.Role;
+import com.stylefeng.guns.modular.system.model.User;
import com.stylefeng.guns.modular.system.service.IMenuService;
import com.stylefeng.guns.modular.system.service.IRoleService;
+import com.stylefeng.guns.modular.system.service.IUserService;
+import com.stylefeng.guns.modular.system.util.ListToTreeUtil;
import com.stylefeng.guns.modular.system.util.ResultUtil;
-import com.stylefeng.guns.modular.system.warpper.RoleWarpper;
import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
+import org.springframework.util.CollectionUtils;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
+import java.util.stream.Collectors;
+
@Controller
@RequestMapping("/base/role")
public class SysRoleController {
@@ -38,6 +43,8 @@
private IRoleService roleService;
@Autowired
private IMenuService menuService;
+ @Autowired
+ private IUserService userService;
@GetMapping(value = "/list")
@ApiOperation(value = "列表", tags = {"后台-角色管理"})
@@ -60,6 +67,9 @@
role.setDeptid(0);
role.setPid(0);
role.setInsertTime(new Date());
+
+ role.setCreateBy(Objects.requireNonNull(ShiroKit.getUser()).id);
+
this.roleService.insert(role);
return ResultUtil.success("添加成功");
}
@@ -89,12 +99,20 @@
}
- @PostMapping(value = "/delete/{id}")
+ @PostMapping(value = "/delete")
@BussinessLog(value = "删除角色", key = "name", dict = RoleDict.class)
@ApiOperation(value = "删除角色", tags = {"后台-角色管理"})
@ResponseBody
- public ResultUtil delete(@PathVariable Integer id) {
- if (ToolUtil.isEmpty(id)) {
+ public ResultUtil delete( String ids) {
+ String[] split = ids.split(",");
+ for (String id : split) {
+ List<User> roleid = userService.selectList(new EntityWrapper<User>().eq("roleid", Integer.valueOf(id)));
+ if (!roleid.isEmpty()){
+ return ResultUtil.error("当前角色已绑定用户,无法删除");
+ }
+
+
+ if (ToolUtil.isEmpty(id)) {
throw new GunsException(BizExceptionEnum.REQUEST_NULL);
}
@@ -104,11 +122,13 @@
}
//缓存被删除的角色名称
- LogObjectHolder.me().set(ConstantFactory.me().getSingleRoleName(id));
+ LogObjectHolder.me().set(ConstantFactory.me().getSingleRoleName(Integer.valueOf(id)));
Role role = roleService.selectById(id);
- this.roleService.delRoleById(id);
+ this.roleService.delRoleById(Integer.valueOf(id));
//删除缓存
CacheKit.removeAll(Cache.CONSTANT);
+ }
+
return ResultUtil.success("删除成功");
}
@@ -119,18 +139,40 @@
@GetMapping (value = "/menuTreeListByRoleId/{roleId}")
@ApiOperation(value = "角色分配权限获取列表", tags = {"后台-角色管理"})
@ResponseBody
- public List<ZTreeNode> menuTreeListByRoleId(@PathVariable Integer roleId) {
+ public List<TreeBean> menuTreeListByRoleId(@PathVariable Integer roleId) {
List<Long> menuIds = this.menuService.getMenuIdsByRoleId(roleId);
if (ToolUtil.isEmpty(menuIds)) {
List<ZTreeNode> roleTreeList = this.menuService.menuTreeList();
- return roleTreeList;
+// List<ZTreeNode> parent = roleTreeList.stream().filter(e -> e.getpId() == 0).collect(Collectors.toList());
+ List<TreeBean> root = ListToTreeUtil.toTree(roleTreeList, "root");
+ return root;
}else {
List<ZTreeNode> roleTreeListByUserId = this.menuService.menuTreeListByMenuIds(menuIds);
- return roleTreeListByUserId;
+// List<ZTreeNode> parent = roleTreeListByUserId.stream().filter(e -> e.getpId() == 0).collect(Collectors.toList());
+ List<TreeBean> root = ListToTreeUtil.toTree(roleTreeListByUserId, "root");
+ return root;
}
}
+ private List<ZTreeNode> getParent(List<ZTreeNode> roleTreeListByUserId,List<ZTreeNode> parent){
+ List<ZTreeNode> result = new ArrayList<>();
+ for (ZTreeNode zTreeNode : parent) {
+
+ List<ZTreeNode> children = roleTreeListByUserId.stream().filter(e -> e.getpId().equals(zTreeNode.getId())).collect(Collectors.toList());
+ if(CollectionUtils.isEmpty(children)){
+ zTreeNode.setChildren(children);
+ }else {
+ getParent(roleTreeListByUserId,children);
+ }
+ ZTreeNode zTreeNode1 = new ZTreeNode();
+ BeanUtils.copyProperties(zTreeNode,zTreeNode1);
+ result.add(zTreeNode1);
+ }
+ return result;
+ }
+
+
@DataSource(name = "dataSourceGuns")
@RequestMapping("/setAuthority")
@BussinessLog(value = "配置权限操作", key = "roleId,ids", dict = RoleDict.class)
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/UserController.java b/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/UserController.java
index 6687aa8..605d4b8 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/UserController.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/UserController.java
@@ -4,35 +4,32 @@
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.stylefeng.guns.core.base.tips.ErrorTip;
-import com.stylefeng.guns.core.base.tips.Tip;
import com.stylefeng.guns.core.common.annotion.BussinessLog;
import com.stylefeng.guns.core.common.constant.Const;
import com.stylefeng.guns.core.common.constant.dictmap.UserDict;
-import com.stylefeng.guns.core.common.constant.factory.ConstantFactory;
import com.stylefeng.guns.core.common.constant.state.ManagerStatus;
import com.stylefeng.guns.core.common.exception.BizExceptionEnum;
import com.stylefeng.guns.core.exception.GunsException;
import com.stylefeng.guns.core.log.LogManager;
-import com.stylefeng.guns.core.log.LogObjectHolder;
import com.stylefeng.guns.core.log.factory.LogTaskFactory;
import com.stylefeng.guns.core.mutidatasource.annotion.DataSource;
+import com.stylefeng.guns.core.node.ZTreeNode;
import com.stylefeng.guns.core.shiro.ShiroKit;
import com.stylefeng.guns.core.shiro.ShiroUser;
import com.stylefeng.guns.core.support.HttpKit;
import com.stylefeng.guns.core.util.JwtTokenUtil;
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.system.dao.UserMapper;
-import com.stylefeng.guns.modular.system.dto.Host;
-import com.stylefeng.guns.modular.system.dto.Medium;
+import com.stylefeng.guns.modular.system.dto.TreeBean;
import com.stylefeng.guns.modular.system.factory.UserFactory;
import com.stylefeng.guns.modular.system.model.*;
-import com.stylefeng.guns.modular.system.service.IBannerService;
-import com.stylefeng.guns.modular.system.service.IEncyclopedicKnowledgeService;
-import com.stylefeng.guns.modular.system.service.ISysDataTypeService;
-import com.stylefeng.guns.modular.system.service.IUserService;
+import com.stylefeng.guns.modular.system.service.*;
import com.stylefeng.guns.modular.system.transfer.UserDto;
+import com.stylefeng.guns.modular.system.util.ListToTreeUtil;
import com.stylefeng.guns.modular.system.util.ResultUtil;
-import com.stylefeng.guns.modular.system.warpper.UserWarpper;
+import com.stylefeng.guns.modular.system.warpper.res.DistrictRes;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.authc.UsernamePasswordToken;
@@ -40,7 +37,6 @@
import org.apache.shiro.crypto.hash.Md5Hash;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.util.ByteSource;
-import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
@@ -51,11 +47,9 @@
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.swing.text.Position;
import javax.validation.Valid;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import static com.stylefeng.guns.core.support.HttpKit.getIp;
@@ -81,12 +75,32 @@
@Autowired
private ISysDataTypeService typeService;
+ @Autowired
+ private IMenuService menuService;
+
+ @Autowired
+ private IRegionService regionService;
@Autowired
private UserMapper userMapper;
- @ApiOperation(value = "拿token", tags = {"登录"})
+// @ApiOperation(value = "拿token", tags = {"登录"})
+
+
+ @ResponseBody
+ @GetMapping("/base/region/getDistrict")
+ @ApiOperation(value = "获取区域数据", tags = {"区域下拉框"})
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "parentId", value = "上级数据id,没有传0", required = true)
+ })
+ public ResultUtil<List<DistrictRes>> getDistrict(Integer parentId){
+ List<DistrictRes> district = regionService.getDistrict(parentId);
+ return ResultUtil.success(district);
+ }
+
+
+
@PostMapping("/token/auth")
@ResponseBody
public Object auth(@RequestParam("username") String username,
@@ -143,20 +157,21 @@
}
}
- @GetMapping(value = "/tt")
+ @RequestMapping (value = "/tt")
@ApiOperation(value = "tt", tags = {"登录"})
@ResponseBody
- public void tt() {
- System.err.println(ShiroKit.getUser().getName());
+ public ResultUtil tt() {
+ return new ResultUtil(-1,"请登录");
+
}
@ApiOperation(value = "登录", tags = {"登录"})
@ResponseBody
@PostMapping(value = "/login")
- public ResultUtil loginVali(Model model) {
+ public ResultUtil loginVali(String username,String password,Model model) {
model.addAttribute("updatePaw", false);
- String username = "admin";
- String password = "123456";
+// String username = "admin";
+// String password = "123456";
//验证验证码是否正确
// if (KaptchaUtil.getKaptchaOnOff()) {
@@ -170,6 +185,12 @@
User user = userService.selectOne(new EntityWrapper<User>().eq("account", username).ne("status", 3));
+ if (user == null){
+ return ResultUtil.error("账号不存在");
+ }
+ if (user.getStatus()==2){
+ return ResultUtil.error("您的账号已被冻结,请联系管理员");
+ }
// if(null == user.getUpdatePasswordTime() || (user.getUpdatePasswordTime().getTime() + 7776000000L) <= System.currentTimeMillis()){
// model.addAttribute("tips", "密码已经90天没更新了,请先修改密码!");
@@ -207,7 +228,12 @@
UsernamePasswordToken token = new UsernamePasswordToken(username, password.toCharArray());
token.setRememberMe(false);
-// currentUser.login(token);
+ try {
+ currentUser.login(token);
+
+ }catch (Exception ignored){
+
+ }
ShiroUser shiroUser = ShiroKit.getUser();
// super.getSession().setAttribute("shiroUser", shiroUser);
@@ -218,7 +244,28 @@
ShiroKit.getSession().setAttribute("sessionFlag", true);
System.out.println(ShiroKit.getUser().getName());
- return ResultUtil.success("1");
+
+
+ List<TreeBean> root = new ArrayList<>();
+
+ User user1 = userService.selectById(ShiroKit.getUser().getId());
+ List<Long> menuIds = this.menuService.getMenuIdsByRoleId(Integer.valueOf(user1.getRoleid()));
+ if (ToolUtil.isEmpty(menuIds)) {
+ List<ZTreeNode> roleTreeList = this.menuService.menuTreeList();
+// List<ZTreeNode> parent = roleTreeList.stream().filter(e -> e.getpId() == 0).collect(Collectors.toList());
+ root = ListToTreeUtil.toTree(roleTreeList, "root");
+
+ }else {
+ List<ZTreeNode> roleTreeListByUserId = this.menuService.menuTreeListByMenuIds(menuIds);
+// List<ZTreeNode> parent = roleTreeListByUserId.stream().filter(e -> e.getpId() == 0).collect(Collectors.toList());
+ root = ListToTreeUtil.toTree(roleTreeListByUserId, "root");
+
+ }
+ Map<String,Object> map = new HashMap<>();
+ map.put("user",user1);
+ map.put("root",root);
+
+ return ResultUtil.success(map);
}
@@ -232,13 +279,17 @@
if (result.hasErrors()) {
throw new GunsException(BizExceptionEnum.REQUEST_NULL);
}
+ User user1 = userService.selectOne(new EntityWrapper<User>().eq("account", user.getPhone()).ne("status", 3));
+ if (user1!=null){
+ return ResultUtil.error("当前手机号已存在");
+ }
// 判断账号是否重复
User theUser = userService.getByAccount(user.getAccount());
if (theUser != null) {
throw new GunsException(BizExceptionEnum.USER_ALREADY_REG);
}
-
+ user.setAccount(user.getPhone());
// 完善账号信息
user.setSalt(ShiroKit.getRandomSalt(5));
user.setPassword(ShiroKit.md5(user.getPassword(), user.getSalt()));
@@ -256,10 +307,10 @@
@ApiOperation(value = "查询管理员", tags = {"后台-系统设置"})
@GetMapping("/list")
@ResponseBody
- public Object list(String account, @RequestParam()int pageNo, @RequestParam()int pageSize) {
+ public Object list(String account, @RequestParam()int pageNum, @RequestParam()int pageSize) {
// int index = (pageNo-1)*pageSize;
// int size = pageSize;
- PageHelper.startPage(pageNo,pageSize);
+ PageHelper.startPage(pageNum,pageSize);
List<Map<String, Object>> users = userService.getUsers(account);
PageInfo<Map<String, Object>> info=new PageInfo<>(users);
@@ -292,6 +343,7 @@
@DataSource(name = "dataSourceBiz")
@GetMapping("/pre/edit/{userId}")
@ApiOperation(value = "编辑获取信息", tags = {"后台-系统设置"})
+ @ResponseBody
public User edit(@PathVariable Integer userId, Model model) {
User user = this.userService.selectById(userId);
@@ -322,11 +374,15 @@
@BussinessLog(value = "冻结-解冻-删除", key = "account", dict = UserDict.class)
@ApiOperation(value = "冻结-解冻-删除", tags = {"后台-系统设置"})
@ResponseBody
- public ResultUtil frozen(@RequestParam Integer userId,@RequestParam("1:解冻 2:冻结 3:删除") Integer status ) throws NoPermissionException {
- User user = userService.selectById(userId);
+ public ResultUtil frozen(String ids,Integer status ) throws NoPermissionException {
+ String[] split = ids.split(",");
+ String res = "";
+
+ for (String s : split) {
+
+ User user = userService.selectById(s);
user.setStatus(status);
userService.updateById(user);
- String res = "";
switch (status) {
case 1:
res = "解冻";
@@ -338,6 +394,8 @@
res = "删除";
break;
}
+
+ }
return ResultUtil.success(res+"成功");
}
@@ -345,17 +403,21 @@
@ResponseBody
@GetMapping ("/text")
@ApiOperation(value = "3系统公告.4隐私5用户协议", tags = {"后台-基础信息管理"})
- public List<Banner> text(){
- Integer [] ids = {3,4,5};
- return bannerService.selectList(new EntityWrapper<Banner>().in("position",ids));
+ public ResultUtil text(Integer position){
+// Integer [] ids = {3,4,5};
+ return ResultUtil.success(bannerService.selectOne(new EntityWrapper<Banner>().eq("position",position)));
}
@ResponseBody
@PutMapping ("/text/edit")
@ApiOperation(value = "编辑系统公告", tags = {"后台-基础信息管理"})
- public ResultUtil textUpdate(Banner banner){
- bannerService.insertOrUpdate(banner);
+ public ResultUtil textUpdate(@RequestBody Banner banner){
+ Banner banner1 = bannerService.selectOne(new EntityWrapper<Banner>().eq("position", banner.getPosition()));
+ if (banner1!=null){
+ banner.setId(banner1.getId());
+ }
+ bannerService.insertOrUpdate(banner);
return ResultUtil.success("保存成功");
}
@@ -364,12 +426,16 @@
@ResponseBody
@GetMapping ("/know/list")
@ApiOperation(value = "列表", tags = {"后台-知识百科"},response = EncyclopedicKnowledge.class)
- public List<EncyclopedicKnowledge> list(Integer type, String title,@RequestParam int pageNo,@RequestParam int pageSize){
+ public Object list(Integer type, String title,@RequestParam int pageNum,@RequestParam int pageSize){
- int index = (pageNo-1)*pageSize;
- int size = pageSize;
+ PageHelper.startPage(pageNum,pageSize);
- return knowledgeService.list(type,title,index,size);
+
+ List<EncyclopedicKnowledge> list = knowledgeService.list(type, title);
+ PageInfo<EncyclopedicKnowledge> info=new PageInfo<>(list);
+ System.err.println(info);
+
+ return info;
}
@@ -378,30 +444,64 @@
@GetMapping ("/know/select")
@ApiOperation(value = "类型下拉框", tags = {"后台-知识百科"})
public List<SysDataType> select(){
- return typeService.getSysDataType(1);
+ List<EncyclopedicKnowledge> list = knowledgeService.list(null, null);
+ List<Integer> ids = new ArrayList<>();
+ for (EncyclopedicKnowledge encyclopedicKnowledge : list) {
+ ids.add(encyclopedicKnowledge.getSysDataTypeId());
+ }
+ List<SysDataType> id = typeService.selectList(new EntityWrapper<SysDataType>().in("id", ids));
+ return id;
}
@ResponseBody
@PostMapping ("/know/add")
@ApiOperation(value = "添加", tags = {"后台-知识百科"})
- public ResultUtil add(EncyclopedicKnowledge knowledge){
+ public ResultUtil add(@RequestBody EncyclopedicKnowledge knowledge){
+ SysDataType name = typeService.selectOne(new EntityWrapper<SysDataType>().eq("name", knowledge.getType()));
+ if (name!=null){
+ knowledge.setSysDataTypeId(name.getId());
+ }else {
+ SysDataType sysDataType = new SysDataType();
+ sysDataType.setName(knowledge.getType());
+ sysDataType.setType(1);
+ typeService.insert(sysDataType);
+ knowledge.setSysDataTypeId(sysDataType.getId());
+ }
knowledge.setInsertTime(new Date());
+ knowledge.setCreateBy(Objects.requireNonNull(ShiroKit.getUser()).id);
knowledgeService.insert(knowledge);
return ResultUtil.success("添加成功");
}
+
+ @Autowired
+ private ISysDataTypeService dataTypeService;
+
@ResponseBody
@GetMapping ("/know/pre/edit")
@ApiOperation(value = "编辑获取信息", tags = {"后台-知识百科"})
public EncyclopedicKnowledge preedit(Integer id){
- return knowledgeService.selectById(id);
+ EncyclopedicKnowledge encyclopedicKnowledge = knowledgeService.selectById(id);
+ SysDataType sysDataType = dataTypeService.selectById(encyclopedicKnowledge.getSysDataTypeId());
+ encyclopedicKnowledge.setType(sysDataType.getName());
+ return encyclopedicKnowledge;
}
@ResponseBody
@PutMapping ("/know/edit")
@ApiOperation(value = "修改", tags = {"后台-知识百科"})
- public ResultUtil edit(EncyclopedicKnowledge knowledge){
+ public ResultUtil edit(@RequestBody EncyclopedicKnowledge knowledge){
+ SysDataType name = typeService.selectOne(new EntityWrapper<SysDataType>().eq("name", knowledge.getType()));
+ if (name!=null){
+ knowledge.setSysDataTypeId(name.getId());
+ }else {
+ SysDataType sysDataType = new SysDataType();
+ sysDataType.setName(knowledge.getType());
+ sysDataType.setType(1);
+ typeService.insert(sysDataType);
+ knowledge.setSysDataTypeId(sysDataType.getId());
+ }
knowledgeService.updateById(knowledge);
return ResultUtil.success("修改成功");
}
@@ -409,9 +509,14 @@
@ResponseBody
@DeleteMapping ("/know/delete")
- @ApiOperation(value = "编辑获取信息", tags = {"后台-知识百科"})
- public ResultUtil delete(Integer id){
- knowledgeService.deleteById(id);
+ @ApiOperation(value = "删除", tags = {"后台-知识百科"})
+ public ResultUtil delete(String ids){
+ String[] split = ids.split(",");
+ for (String id : split) {
+
+ knowledgeService.deleteById(Integer.valueOf(id));
+ }
+
return ResultUtil.success("删除成功");
}
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/controller/LoginController.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/controller/LoginController.java
index 2ff381d..35b2d1e 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/controller/LoginController.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/controller/LoginController.java
@@ -16,6 +16,7 @@
import com.stylefeng.guns.modular.system.model.User;
import com.stylefeng.guns.modular.system.service.IMenuService;
import com.stylefeng.guns.modular.system.service.IUserService;
+import com.stylefeng.guns.modular.system.util.ResultUtil;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
@@ -83,14 +84,18 @@
/**
* 跳转到登录页面
*/
+// @RequestMapping(value = "/login", method = RequestMethod.GET)
+// public String login(Model model) {
+// model.addAttribute("updatePaw", false);
+// if (ShiroKit.isAuthenticated() || ShiroKit.getUser() != null) {
+// return REDIRECT + "/";
+// } else {
+// return "/login.html";
+// }
+// }
@RequestMapping(value = "/login", method = RequestMethod.GET)
- public String login(Model model) {
- model.addAttribute("updatePaw", false);
- if (ShiroKit.isAuthenticated() || ShiroKit.getUser() != null) {
- return REDIRECT + "/";
- } else {
- return "/login.html";
- }
+ public ResultUtil login(Model model) {
+ return ResultUtil.error("请登录");
}
/**
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/controller/RoleController.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/controller/RoleController.java
index 20fbd11..03b764a 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/controller/RoleController.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/controller/RoleController.java
@@ -20,14 +20,12 @@
import com.stylefeng.guns.modular.system.service.IRoleService;
import com.stylefeng.guns.modular.system.service.IUserService;
import com.stylefeng.guns.modular.system.warpper.RoleWarpper;
+import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
@@ -190,8 +188,9 @@
* 配置权限
*/
@DataSource(name = "dataSourceGuns")
- @RequestMapping("/setAuthority")
+ @PutMapping("/base/setAuthority")
@BussinessLog(value = "配置权限", key = "roleId,ids", dict = RoleDict.class)
+ @ApiOperation(value = "角色分配权限", tags = {"后台-角色管理"})
@ResponseBody
public Tip setAuthority(@RequestParam("roleId") Integer roleId, @RequestParam("ids") String ids) {
if (ToolUtil.isOneEmpty(roleId)) {
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/BannerMapper.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/BannerMapper.java
index d28d5cf..e2199b4 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/BannerMapper.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/BannerMapper.java
@@ -1,6 +1,7 @@
package com.stylefeng.guns.modular.system.dao;
import com.baomidou.mybatisplus.mapper.BaseMapper;
+import com.stylefeng.guns.modular.system.dto.BannerVo;
import com.stylefeng.guns.modular.system.model.Banner;
import com.stylefeng.guns.modular.system.warpper.res.BannerRes;
@@ -19,4 +20,6 @@
* @return
*/
List<BannerRes> getBanners(Integer position);
+
+ List<BannerVo> list(Integer position,Integer sort);
}
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/EncyclopedicKnowledgeMapper.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/EncyclopedicKnowledgeMapper.java
index 6158a28..5dbde27 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/EncyclopedicKnowledgeMapper.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/EncyclopedicKnowledgeMapper.java
@@ -21,5 +21,5 @@
*/
List<EncyclopedicKnowledgeRes> getEncyclopedicKnowledgeList(@Param("typeId") Integer typeId);
- List<EncyclopedicKnowledge> list(Integer type, String title, int index, int size);
+ List<EncyclopedicKnowledge> list(@Param("type") Integer type, @Param("title")String title);
}
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/HouseTypeMapper.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/HouseTypeMapper.java
index 8504890..dc24c02 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/HouseTypeMapper.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/HouseTypeMapper.java
@@ -3,9 +3,12 @@
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.stylefeng.guns.modular.system.model.HouseType;
+import java.util.List;
+
/**
* @author zhibing.pu
* @Date 2023/11/14 14:44
*/
public interface HouseTypeMapper extends BaseMapper<HouseType> {
+ List<HouseType> list();
}
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/TAppUserAuditRecordMapper.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/TAppUserAuditRecordMapper.java
new file mode 100644
index 0000000..9d164f3
--- /dev/null
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/TAppUserAuditRecordMapper.java
@@ -0,0 +1,10 @@
+package com.stylefeng.guns.modular.system.dao;
+
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+import com.stylefeng.guns.modular.system.model.TAppUserAuditRecord;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface TAppUserAuditRecordMapper extends BaseMapper<TAppUserAuditRecord> {
+
+}
\ No newline at end of file
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/AppUserMapper.xml b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/AppUserMapper.xml
index 52f3240..2297a2d 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/AppUserMapper.xml
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/AppUserMapper.xml
@@ -37,7 +37,7 @@
order by houseCount desc
</select>
<select id="listHost" resultType="com.stylefeng.guns.modular.system.dto.Host">
- SELECT id,insert_time,nickname,phone,profile_photo,user_type,wechat_qr_code,watch_app,phone,status
+ SELECT id,insert_time as insertTime,nickname,phone,profile_photo as profilePhoto,user_type as userType,wechat_qr_code as wechatQrCode,watch_app as watchApp,phone,status
from t_app_user
<where>
status != 3
@@ -54,14 +54,14 @@
and phone like CONCAT('%', #{phone}, '%')
</if>
</where>
-
+ ORDER BY insert_time desc
</select>
<select id="listMedium" resultType="com.stylefeng.guns.modular.system.dto.Medium">
- SELECT id,insert_time,nickname,company_name,agent_licence_code,wechat_qr_code,watch_app,phone,status
+ SELECT id,insert_time as insertTime,nickname,company_name as companyName,agent_licence_code as agentLicenceCode,wechat_qr_code as wechatQrCode,watch_app as watchApp,phone,status
from t_app_user
<where>
- status != 3 and audit_status = 2
+ status != 3 and auth = 2
<if test="null != nickname and '' != nickname">
and nickname like CONCAT('%', #{nickname}, '%')
</if>
@@ -81,11 +81,11 @@
<select id="listAuMedium" resultType="com.stylefeng.guns.modular.system.dto.Medium">
SELECT id,insert_time as insertTime,nickname,company_name as companyName,
- agent_licence_code as agentLicenceCode,wechat_qr_code as wechatQrCode,watch_app as watchapp,phone,status,audit_status as auditStatus,audit_note as auditNote
+ agent_licence_code as agentLicenceCode,wechat_qr_code as wechatQrCode,watch_app as watchApp,phone,status,auth as auditStatus,audit_note as auditNote
,refuse_date as refuseDate
from t_app_user
<where>
- status != 3
+ status != 3 and auth != 0
<if test="null != nickname and '' != nickname">
and nickname like CONCAT('%', #{nickname}, '%')
</if>
@@ -93,7 +93,7 @@
and user_type = #{userType}
</if>
<if test="null != status">
- and status = #{status}
+ and audit_status = #{status}
</if>
<if test="null != phone and '' != phone">
and phone like CONCAT('%', #{phone}, '%')
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/BannerMapper.xml b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/BannerMapper.xml
index 56abc0c..2f6a4e5 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/BannerMapper.xml
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/BannerMapper.xml
@@ -7,4 +7,17 @@
<select id="getBanners" resultType="com.stylefeng.guns.modular.system.warpper.res.BannerRes">
select id, img_url as imgUrl, content from t_banner where `position` = #{position} order by `sort` desc
</select>
+ <select id="list" resultType="com.stylefeng.guns.modular.system.dto.BannerVo">
+ SELECT tb.id,tb.position,tb.sort,tb.img_url as imgUrl,su.`name` as createBy,tb.insert_time as insertTime
+ from t_banner tb
+ LEFT JOIN sys_user su on tb.insert_user_id = su.id
+ <where>
+ <if test="null != position">
+ and tb.position = #{position}
+ </if>
+ <if test="null != sort">
+ and tb.sort = #{sort}
+ </if>
+ </where>
+ </select>
</mapper>
\ No newline at end of file
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/EncyclopedicKnowledgeMapper.xml b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/EncyclopedicKnowledgeMapper.xml
index af4b1cf..a97e9cb 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/EncyclopedicKnowledgeMapper.xml
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/EncyclopedicKnowledgeMapper.xml
@@ -12,7 +12,7 @@
from t_encyclopedic_knowledge where sys_data_type_id = #{typeId} order by insert_time desc
</select>
<select id="list" resultType="com.stylefeng.guns.modular.system.model.EncyclopedicKnowledge">
- SELECT kn.id,ty.`name` as type ,kn.title,kn.content,us.`name`,kn.insert_time as insertTime
+ SELECT kn.id,ty.`name` as type ,kn.title,kn.content,us.`name` as createByName,kn.insert_time as insertTime,kn.sys_data_type_id as sysDataTypeId
FROM t_encyclopedic_knowledge kn
LEFT JOIN t_sys_data_type ty ON kn.sys_data_type_id = ty.id
LEFT JOIN sys_user us ON kn.create_by = us.id
@@ -21,6 +21,10 @@
and kn.sys_data_type_id = #{type}
</if>
+ <if test="null != title and '' != title">
+ and kn.title like CONCAT('%', #{title}, '%')
+ </if>
+
</where>
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/FeedBackMapper.xml b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/FeedBackMapper.xml
index e4e61a0..878d1f8 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/FeedBackMapper.xml
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/FeedBackMapper.xml
@@ -5,7 +5,7 @@
<select id="list" resultType="com.stylefeng.guns.modular.system.dto.FeedBackVo">
- SELECT tf.insert_time as insertTime, au.nickname,au.phone,tf.content
+ SELECT tf.insert_time as insertTime, au.nickname,au.phone,tf.content,tf.id
from t_feedback tf
LEFT JOIN t_app_user au ON tf.app_user_id =au.id
<where>
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/HouseResourceMapper.xml b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/HouseResourceMapper.xml
index 3d0e2cd..17d6f57 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/HouseResourceMapper.xml
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/HouseResourceMapper.xml
@@ -28,8 +28,7 @@
left join t_app_user au on (hr.app_user_id = au.id)
left join t_region rc on (hr.district_id = rc.id)
left join t_region rp on (rp.id = rc.parent_id)
- where hr.is_delete = 0 and hr.`status` = 1 and hr.auth_status = 2
- and hr.type=2
+ where hr.is_delete = 0 and hr.`status` = 1 and hr.auth_status = 2 and hr.type=2
<if test="null != req.type">
and hr.data_type = #{req.type}
</if>
@@ -332,18 +331,18 @@
WHEN hs.is_manage IS NULL AND ap.user_type = 3 THEN 3
ELSE hs.is_manage
END AS isManage,
- IFNULL(ap.nickname,su.`name`) as name, IFNULL(ap.phone,su.phone) as phone,
+ IFNULL(su.`name`,ap.nickname) as name, IFNULL(ap.phone,su.phone) as phone,
hs.house_model as houseModel, hs.building_orientation as buildingOrientation, hs.sale_amount as saleAmount,
hs.house_area as houseArea , hs.status
FROM t_house_resource hs
LEFT JOIN t_app_user ap ON hs.insert_user_id = ap.id
LEFT JOIN sys_user su ON hs.insert_user_id = su.id AND hs.is_manage = 1
- where hs.is_delete = 0 and hs.auth_status = 2
+ where hs.is_delete = 0 and hs.auth_status = 2 and hs.type = 2
) a
<where>
<if test="null != cellName and '' != cellName">
- and a.cell_name like CONCAT('%', #{cellName}, '%')
+ and a.cellName like CONCAT('%', #{cellName}, '%')
</if>
<if test="null != dataType">
and a.dataType = #{dataType}
@@ -375,14 +374,14 @@
WHEN hs.is_manage IS NULL AND ap.user_type = 3 THEN 3
ELSE hs.is_manage
END AS isManage,
- IFNULL(ap.nickname,su.`name`) as name, IFNULL(ap.phone,su.phone) as phone,
+ IFNULL(su.`name`,ap.nickname) as name, IFNULL(ap.phone,su.phone) as phone,
hs.house_model as houseModel, hs.building_orientation as buildingOrientation, hs.sale_amount as saleAmount,
hs.house_area as houseArea , hs.status,hs.auth_status AS authStatus
FROM t_house_resource hs
LEFT JOIN t_app_user ap ON hs.insert_user_id = ap.id
LEFT JOIN sys_user su ON hs.insert_user_id = su.id AND hs.is_manage = 1
- where hs.is_delete = 0
-
+ where hs.is_delete = 0 and hs.type = 2
+ order by hs.insert_time desc
) a
<where>
@@ -414,7 +413,7 @@
</select>
<select id="reprotList" resultType="com.stylefeng.guns.modular.system.dto.THouseResource">
select * from (
- SELECT hs.insert_time as insertTime, hs.id, hs.cell_name as cellName, hs.house_address as houseAddress,
+ SELECT hs.insert_time as insertTime, hr.id, hs.cell_name as cellName, hs.house_address as houseAddress,
hs.data_type as dataType,
CASE
WHEN hs.is_manage IS NULL AND ap.user_type = 2 THEN 2
@@ -423,7 +422,7 @@
END AS isManage,
IFNULL(ap.nickname,su.`name`) as name, IFNULL(ap.phone,su.phone) as phone,
hs.house_model as houseModel, hs.building_orientation as buildingOrientation, hs.sale_amount as saleAmount,
- hs.house_area as houseArea , hs.status,hr.content,hr.audit,hr.back_reason as backReason,hr.back_date as backDate
+ hs.house_area as houseArea , hs.status,hr.content,hr.audit,hr.back_reason as backReason,hr.back_date as backDate,hs.id as houseId
from t_report_house_resource hr
LEFT JOIN t_house_resource hs on hr.house_resource_id = hs.id
LEFT JOIN t_app_user ap ON hs.insert_user_id = ap.id
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/HouseTypeMapper.xml b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/HouseTypeMapper.xml
index 9744aee..a91f79c 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/HouseTypeMapper.xml
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/HouseTypeMapper.xml
@@ -1,4 +1,9 @@
<?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="com.stylefeng.guns.modular.system.dao.HouseTypeMapper">
+ <select id="list" resultType="com.stylefeng.guns.modular.system.model.HouseType">
+ SELECT hy.id,hy.insert_time as insertTime,hy.`name`,su.`name` as createName
+ from t_house_type hy
+ LEFT JOIN sys_user su on hy.create_by = su.id
+ </select>
</mapper>
\ No newline at end of file
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/RoleMapper.xml b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/RoleMapper.xml
index 8de4a7e..fa3c532 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/RoleMapper.xml
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/RoleMapper.xml
@@ -19,11 +19,11 @@
<select id="selectRoles" resultType="map">
select
- sr.id, sr.num, sr.pid, sr.name, sr.deptid, sr.tips, sr.version,su.name as createBy
+ sr.id, sr.num, sr.pid, sr.name, sr.deptid, sr.tips, sr.version,su.name as createBy,sr.insert_time as insertTime
from sys_role sr
left join sys_user su on sr.create_by = su.id
<if test="condition != null">
- where name like CONCAT('%',#{condition},'%')
+ where sr.name like CONCAT('%',#{condition},'%')
</if>
order by id
</select>
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserMapper.xml b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserMapper.xml
index 01fac41..2245460 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserMapper.xml
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserMapper.xml
@@ -79,7 +79,7 @@
select * ,IF( sex = 1, '男', '女' ) sexName FROM sys_user where id=#{id}
</select>
<select id="getUsers" resultType="java.util.Map">
- SELECT us.createtime,us.account,us.`name`,us.sex,sr.`name` as roleName,sd.simplename as deptName,us.email,us.phone,us.`status`
+ SELECT us.id,us.createtime,us.account,us.`name`,us.sex,sr.`name` as roleName,sd.simplename as deptName,us.email,us.phone,us.`status`
from sys_user us
LEFT JOIN sys_role sr ON us.roleid = sr.id
LEFT JOIN sys_dept sd on us.deptid = sd.id
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dto/BannerVo.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dto/BannerVo.java
new file mode 100644
index 0000000..456ab71
--- /dev/null
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dto/BannerVo.java
@@ -0,0 +1,21 @@
+package com.stylefeng.guns.modular.system.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+@Data
+public class BannerVo {
+ @ApiModelProperty("id")
+ Integer id;
+ @ApiModelProperty("排序")
+ Integer sort;
+ @ApiModelProperty("图片")
+ String imgUrl;
+ @ApiModelProperty("创建人")
+ String createBy;
+ @ApiModelProperty("创建时间")
+ Date insertTime;
+ @ApiModelProperty("(1=首页,(6租房、7买房、8公司盘、9求房源)")
+ Integer position;
+}
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dto/Medium.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dto/Medium.java
index dd140e3..75d0da2 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dto/Medium.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dto/Medium.java
@@ -12,22 +12,22 @@
@ApiModel
public class Medium {
@TableField("profile_photo")
- @ApiModelProperty(value = "头像", required = true)
+ @ApiModelProperty(value = "头像")
private String profilePhoto;
@TableField("nickname")
- @ApiModelProperty(value = "昵称", required = true)
+ @ApiModelProperty(value = "昵称")
private String nickname;
@TableField("user_type")
- @ApiModelProperty(value = "用户类型(1=普通,2=房东)", required = true)
+ @ApiModelProperty(value = "用户类型(1=普通,2=房东)")
private Integer userType;
@TableField("phone")
- @ApiModelProperty(value = "电话号码", required = true)
+ @ApiModelProperty(value = "电话号码")
private String phone;
@TableField("wechat_qr_code")
- @ApiModelProperty(value = "微信二维码", required = true)
+ @ApiModelProperty(value = "微信二维码")
private String wechatQRCode;
@TableField("watch_app")
- @ApiModelProperty(value = "watchApp", required = true)
+ @ApiModelProperty(value = "watchApp")
private String watchApp;
@TableField("status")
@ApiModelProperty(value = "状态(1=正常,2=冻结,3=删除)", required = false)
@@ -37,24 +37,26 @@
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "注册时间", required = false)
private Date insertTime;
- @ApiModelProperty(value = "名片照", required = true)
+ @ApiModelProperty(value = "名片照")
private String businessCardPhoto;
- @ApiModelProperty(value = "个人简介", required = true)
+ @ApiModelProperty(value = "个人简介")
private String introduce;
- @ApiModelProperty(value = "代理人牌照号", required = true)
+ @ApiModelProperty(value = "代理人牌照号")
private String agentLicenceCode;
- @ApiModelProperty(value = "公司名称", required = true)
+ @ApiModelProperty(value = "公司名称")
private String companyName;
- @ApiModelProperty(value = "公司地址", required = true)
+ @ApiModelProperty(value = "公司地址")
private String companyAddress;
- @ApiModelProperty(value = "城市id", required = true)
+ @ApiModelProperty(value = "城市id")
private Integer cityId;
- @ApiModelProperty(value = "区id", required = true)
+ @ApiModelProperty(value = "区id")
private Integer districtId;
@ApiModelProperty(value = "是否审核通过(1=待审核,2=审核通过,3=审核拒绝)", required = false)
private Integer auditStatus;
-
+ @ApiModelProperty(value = "审核备注", required = false)
private String auditNote;
-
+ @ApiModelProperty(value = "拒绝审核时间", required = false)
private Date refuseDate;
+ @ApiModelProperty(value = "审核时间", required = false)
+ private Date changeTime;
}
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dto/Node.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dto/Node.java
new file mode 100644
index 0000000..9c4b45a
--- /dev/null
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dto/Node.java
@@ -0,0 +1,63 @@
+package com.stylefeng.guns.modular.system.dto;
+
+import com.stylefeng.guns.core.node.ZTreeNode;
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+@Data
+public class Node {
+ private boolean checked;
+ private String id;
+ private boolean isOpen;
+ private String name;
+ private List<Node> children;
+
+ public Node(ZTreeNode zTreeNode) {
+ this.checked = zTreeNode.getChecked();
+ this.id = String.valueOf(zTreeNode.getId());
+ this.isOpen = zTreeNode.getIsOpen();
+ this.name = zTreeNode.getName();
+ this.children = new ArrayList<>();
+ }
+
+ public boolean isChecked() {
+ return checked;
+ }
+
+ public void setChecked(boolean checked) {
+ this.checked = checked;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public boolean isOpen() {
+ return isOpen;
+ }
+
+ public void setOpen(boolean isOpen) {
+ this.isOpen = isOpen;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public List<Node> getChildren() {
+ return children;
+ }
+
+ public void setChildren(List<Node> children) {
+ this.children = children;
+ }
+}
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dto/THouseResource.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dto/THouseResource.java
index 4bb3f55..ae38756 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dto/THouseResource.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dto/THouseResource.java
@@ -1,6 +1,7 @@
package com.stylefeng.guns.modular.system.dto;
import com.baomidou.mybatisplus.annotations.TableField;
+import com.baomidou.mybatisplus.annotations.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -40,11 +41,13 @@
@ApiModelProperty(value = "1=待审核,2=已通过,3=已拒绝", required = false)
private Integer authStatus;
@ApiModelProperty(value = "举报信息", required = false)
- private Integer content;
+ private String content;
@ApiModelProperty(value = "举报模块:审核状态0待审核 1通过 2未通过", required = false)
private Integer audit;
@ApiModelProperty(value = "拒绝理由", required = false)
private String backReason;
@ApiModelProperty(value = "拒绝日期", required = false)
private Date backDate;
+ @TableField(exist = false)
+ private Integer houseId;
}
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/dto/TreeBean.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dto/TreeBean.java
new file mode 100644
index 0000000..fd3020a
--- /dev/null
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/dto/TreeBean.java
@@ -0,0 +1,94 @@
+package com.stylefeng.guns.modular.system.dto;
+
+import com.stylefeng.guns.core.node.ZTreeNode;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 构建tree数据
+ * @author sinder
+ * @date 2023/11/8 22:30
+ */
+@Data
+public class TreeBean {
+ private String treeId;
+
+ private String treePid;
+
+ private String orgName;
+
+ private Integer flag = 0;
+ private Boolean checked;//是否被选中
+
+
+ private List<TreeBean> children;
+
+ private ZTreeNode orgData;
+ public Boolean getChecked() {
+ return checked;
+ }
+
+ public void setChecked(Boolean checked) {
+ this.checked = checked;
+ }
+
+ public String getTreeId() {
+ return treeId;
+ }
+
+ public void setTreeId(String treeId) {
+ this.treeId = treeId;
+ }
+
+ public String getOrgName() {
+ return orgName;
+ }
+
+ public void setOrgName(String orgName) {
+ this.orgName = orgName;
+ }
+
+ public String getTreePid() {
+ return treePid;
+ }
+
+ public void setTreePid(String treePid) {
+ this.treePid = treePid;
+ }
+
+ public List<TreeBean> getChildren() {
+ return children;
+ }
+
+ public void setChildren(List<TreeBean> children) {
+ this.children = children;
+ }
+
+ public ZTreeNode getOrgData() {
+ return orgData;
+ }
+
+ public void setOrgData(ZTreeNode orgData) {
+ this.orgData = orgData;
+ }
+
+ public Integer getFlag() {
+ return flag;
+ }
+
+ public void setFlag(Integer flag) {
+ this.flag = flag;
+ }
+
+ @Override
+ public String toString() {
+ return "TreeBean{" +
+ "treeId='" + treeId + '\'' +
+ ", treePid='" + treePid + '\'' +
+ ", orgName='" + orgName + '\'' +
+ ", children=" + children + '\'' +
+ ", checked=" + checked +
+ '}';
+ }
+}
\ No newline at end of file
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/model/AppUser.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/model/AppUser.java
index 08bcada..b7ac54a 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/model/AppUser.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/model/AppUser.java
@@ -126,4 +126,12 @@
*/
@TableField("district_id")
private Integer districtId;
+ @TableField("refuse_date")
+ private Date refuseDate;
+
+ @TableField("changeTime")
+ private Date changeTime;
+ @TableField("auth")
+ private Integer auth;
+
}
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/model/EncyclopedicKnowledge.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/model/EncyclopedicKnowledge.java
index 0999da5..3bdef97 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/model/EncyclopedicKnowledge.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/model/EncyclopedicKnowledge.java
@@ -27,7 +27,6 @@
* 数据类型id
*/
@TableField("sys_data_type_id")
- @ApiModelProperty(value = "类别", required = true)
private Integer sysDataTypeId;
/**
* 标题
@@ -70,5 +69,6 @@
private String createByName;
@TableField(exist = false)
+ @ApiModelProperty(value = "类别", required = true)
private String type;
}
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/model/HouseResource.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/model/HouseResource.java
index a027be9..58de8be 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/model/HouseResource.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/model/HouseResource.java
@@ -254,4 +254,7 @@
@TableField("is_manage")
private Integer isManage;
+
+ @TableField("reason")
+ private String reason;
}
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/model/HouseType.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/model/HouseType.java
index ead74a7..2ddf38f 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/model/HouseType.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/model/HouseType.java
@@ -28,4 +28,8 @@
@TableField("insert_time")
private Date insertTime;
+ @TableField("create_by")
+ private Integer createBy;
+ @TableField(exist = false)
+ private String createName;
}
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/model/Role.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/model/Role.java
index 24800e4..b0d557a 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/model/Role.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/model/Role.java
@@ -58,6 +58,8 @@
@TableField("insert_time")
private Date insertTime;
+ @TableField("create_by")
+ private Integer createBy;
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/model/TAppUserAuditRecord.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/model/TAppUserAuditRecord.java
new file mode 100644
index 0000000..edcba28
--- /dev/null
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/model/TAppUserAuditRecord.java
@@ -0,0 +1,36 @@
+package com.stylefeng.guns.modular.system.model;
+
+import java.time.LocalDateTime;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotations.TableField;
+import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.annotations.TableName;
+import com.baomidou.mybatisplus.enums.IdType;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@TableName("t_app_user_audit_record")
+public class TAppUserAuditRecord {
+
+ @TableId(value = "id", type = IdType.AUTO)
+ private Integer id;
+
+ @TableField("app_user_id")
+ private Integer appUserId;
+ @ApiModelProperty("审核状态2=审核通过,3=审核拒绝")
+ @TableField("audit_status")
+ private Integer auditStatus;
+ @TableField("audit_note")
+ @ApiModelProperty("拒绝理由")
+ private String auditNote;
+ @TableField("audit_user_id")
+ private Integer auditUserId;
+ @ApiModelProperty("审核时间")
+ @TableField ("insert_time")
+ private Date insertTime;
+
+
+
+}
\ No newline at end of file
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/IBannerService.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/IBannerService.java
index 2846bc7..90eaffc 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/IBannerService.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/IBannerService.java
@@ -1,6 +1,7 @@
package com.stylefeng.guns.modular.system.service;
import com.baomidou.mybatisplus.service.IService;
+import com.stylefeng.guns.modular.system.dto.BannerVo;
import com.stylefeng.guns.modular.system.model.Banner;
import com.stylefeng.guns.modular.system.warpper.res.BannerRes;
@@ -19,4 +20,6 @@
* @return
*/
List<BannerRes> getBanners(Integer position);
+
+ List<BannerVo> list(Integer position,Integer sort);
}
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/IEncyclopedicKnowledgeService.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/IEncyclopedicKnowledgeService.java
index f586bcd..ac1b845 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/IEncyclopedicKnowledgeService.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/IEncyclopedicKnowledgeService.java
@@ -38,5 +38,5 @@
*/
ResultUtil upvoteEncyclopedicKnowledge(Integer id);
- List<EncyclopedicKnowledge> list(Integer type, String title, int index, int size);
+ List<EncyclopedicKnowledge> list(Integer type, String title);
}
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/IHouseTypeService.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/IHouseTypeService.java
index d185d87..9c6bfba 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/IHouseTypeService.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/IHouseTypeService.java
@@ -3,9 +3,12 @@
import com.baomidou.mybatisplus.service.IService;
import com.stylefeng.guns.modular.system.model.HouseType;
+import java.util.List;
+
/**
* @author zhibing.pu
* @Date 2023/11/14 14:45
*/
public interface IHouseTypeService extends IService<HouseType> {
+ List<HouseType> list();
}
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/TAppUserAuditRecordService.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/TAppUserAuditRecordService.java
new file mode 100644
index 0000000..06fb7ee
--- /dev/null
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/TAppUserAuditRecordService.java
@@ -0,0 +1,9 @@
+package com.stylefeng.guns.modular.system.service;
+
+
+import com.baomidou.mybatisplus.service.IService;
+import com.stylefeng.guns.modular.system.model.TAppUserAuditRecord;
+
+public interface TAppUserAuditRecordService extends IService<TAppUserAuditRecord> {
+
+}
\ No newline at end of file
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/BannerServiceImpl.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/BannerServiceImpl.java
index cf7e119..70760e7 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/BannerServiceImpl.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/BannerServiceImpl.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.stylefeng.guns.modular.system.dao.BannerMapper;
+import com.stylefeng.guns.modular.system.dto.BannerVo;
import com.stylefeng.guns.modular.system.model.Banner;
import com.stylefeng.guns.modular.system.service.IBannerService;
import com.stylefeng.guns.modular.system.warpper.res.BannerRes;
@@ -26,4 +27,9 @@
public List<BannerRes> getBanners(Integer position) {
return this.baseMapper.getBanners(position);
}
+
+ @Override
+ public List<BannerVo> list(Integer position,Integer sort) {
+ return this.baseMapper.list(position,sort);
+ }
}
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/EncyclopedicKnowledgeServiceImpl.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/EncyclopedicKnowledgeServiceImpl.java
index abec505..c214ed3 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/EncyclopedicKnowledgeServiceImpl.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/EncyclopedicKnowledgeServiceImpl.java
@@ -100,7 +100,7 @@
}
@Override
- public List<EncyclopedicKnowledge> list(Integer type, String title, int index, int size) {
- return this.baseMapper.list(type,title,index,size);
+ public List<EncyclopedicKnowledge> list(Integer type, String title) {
+ return this.baseMapper.list(type,title);
}
}
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/HouseResourceService.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/HouseResourceService.java
index e7e0b8c..a4ea430 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/HouseResourceService.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/HouseResourceService.java
@@ -5,6 +5,7 @@
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import com.stylefeng.guns.core.shiro.ShiroKit;
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.system.dao.HouseResourceMapper;
import com.stylefeng.guns.modular.system.dto.THouseResource;
@@ -31,10 +32,7 @@
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
import java.util.stream.Collectors;
/**
@@ -343,12 +341,17 @@
houseResource.setStatus(1);
houseResource.setLeaseTime(req.getTime());
houseResource.setFirmHouse(req.getFirmHouse());
- if (req.getTime().contains("年")){
- houseResource.setRentalDuration(2);
- }else{
- houseResource.setRentalDuration(1);
+ houseResource.setAuthTime(new Date());
+ if (req.getDataType()==1) {
+ if (req.getTime().contains("年")) {
+ houseResource.setRentalDuration(2);
+ } else {
+ houseResource.setRentalDuration(1);
+ }
}
houseResource.setIsManage(1);
+ houseResource.setAppUserId(Objects.requireNonNull(ShiroKit.getUser()).id);
+ houseResource.setInsertUserId(Objects.requireNonNull(ShiroKit.getUser()).id);
this.baseMapper.insert(houseResource);
return ResultUtil.success("添加成功");
@@ -358,11 +361,13 @@
public ResultUtil editHouse(AddHouseReq req) {
HouseResource houseResource = new HouseResource();
BeanUtils.copyProperties(req,houseResource);
+ if (req.getDataType()==1) {
- if (req.getTime().contains("年")){
- houseResource.setRentalDuration(2);
- }else{
- houseResource.setRentalDuration(1);
+ if (req.getTime().contains("年")) {
+ houseResource.setRentalDuration(2);
+ } else {
+ houseResource.setRentalDuration(1);
+ }
}
this.baseMapper.updateById(houseResource);
return ResultUtil.success("编辑成功");
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/HouseTypeServiceImpl.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/HouseTypeServiceImpl.java
index 4cb90f5..c57af19 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/HouseTypeServiceImpl.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/HouseTypeServiceImpl.java
@@ -6,10 +6,16 @@
import com.stylefeng.guns.modular.system.service.IHouseTypeService;
import org.springframework.stereotype.Service;
+import java.util.List;
+
/**
* @author zhibing.pu
* @Date 2023/11/14 14:45
*/
@Service
public class HouseTypeServiceImpl extends ServiceImpl<HouseTypeMapper, HouseType> implements IHouseTypeService {
+ @Override
+ public List<HouseType> list() {
+ return this.baseMapper.list();
+ }
}
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/TAppUserAuditRecordServiceImpl.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/TAppUserAuditRecordServiceImpl.java
new file mode 100644
index 0000000..9a8774b
--- /dev/null
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/service/impl/TAppUserAuditRecordServiceImpl.java
@@ -0,0 +1,12 @@
+package com.stylefeng.guns.modular.system.service.impl;
+
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import com.stylefeng.guns.modular.system.dao.TAppUserAuditRecordMapper;
+import com.stylefeng.guns.modular.system.model.TAppUserAuditRecord;
+import com.stylefeng.guns.modular.system.service.TAppUserAuditRecordService;
+import org.springframework.stereotype.Service;
+
+@Service
+public class TAppUserAuditRecordServiceImpl extends ServiceImpl<TAppUserAuditRecordMapper, TAppUserAuditRecord> implements TAppUserAuditRecordService {
+
+}
\ No newline at end of file
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/util/ListToTreeUtil.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/util/ListToTreeUtil.java
new file mode 100644
index 0000000..b4aa2f2
--- /dev/null
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/util/ListToTreeUtil.java
@@ -0,0 +1,50 @@
+package com.stylefeng.guns.modular.system.util;
+
+
+import com.stylefeng.guns.core.node.ZTreeNode;
+import com.stylefeng.guns.modular.system.dto.TreeBean;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+/**
+ * 将List转为Tree
+ *
+ * @author sinder
+ * @date 2023/11/8 22:28
+ */
+public class ListToTreeUtil {
+ public static List<TreeBean> toTree(List<ZTreeNode> list, String root) {
+ if (list.isEmpty()) {
+ return new ArrayList<>();
+ }
+ // 构建数据
+ List<TreeBean> treeBeans = list.stream().map(item -> {
+ TreeBean treeBean = new TreeBean();
+ treeBean.setTreeId(String.valueOf(item.getId()));
+ treeBean.setTreePid(String.valueOf(item.getpId()));
+ treeBean.setChecked(item.getChecked());
+ treeBean.setOrgName(item.getName());
+ return treeBean;
+ }).collect(Collectors.toList());
+
+ // 构建Map数据
+ Map<String, List<TreeBean>> treeMap = treeBeans.stream().collect(Collectors.groupingBy(item -> {
+ if (item.getTreePid().isEmpty()) {
+ item.setTreePid(String.valueOf(0));
+ }
+ return item.getTreePid();
+ }));
+
+ // 将数据进行分组
+ return treeBeans.stream().peek(data -> {
+ List<TreeBean> children = treeMap.get(data.getTreeId());
+ if (children != null && !children.isEmpty()) {
+ data.setChildren(children);
+ }
+ }).filter(data -> data.getTreePid().equals("0")).collect(Collectors.toList());
+ }
+}
\ No newline at end of file
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/util/MyScheduledTasks.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/util/MyScheduledTasks.java
new file mode 100644
index 0000000..6574a61
--- /dev/null
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/util/MyScheduledTasks.java
@@ -0,0 +1,60 @@
+package com.stylefeng.guns.modular.system.util;
+
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.stylefeng.guns.modular.system.model.HouseResource;
+import com.stylefeng.guns.modular.system.service.impl.HouseResourceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.cache.CacheProperties;
+import org.springframework.scheduling.annotation.Scheduled;
+ import org.springframework.stereotype.Component;
+
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.time.temporal.ChronoUnit;
+import java.util.ArrayList;
+import java.util.List;
+
+@Component
+ public class MyScheduledTasks {
+
+ @Autowired
+ private HouseResourceService houseResourceService;
+
+ @Autowired
+ private RedisUtil redisUtil;
+
+ @Scheduled(fixedRate = 60000) // 每隔5秒执行一次任务
+ public void myTask() {
+ // 执行定时任务的逻辑
+ System.err.println("定时任务执行中...");
+ List<HouseResource> authStatus = houseResourceService.selectList(new EntityWrapper<HouseResource>().eq("auth_status", 1));
+ if (!authStatus.isEmpty()){
+ LocalDateTime currentTime = LocalDateTime.now();
+ String min = redisUtil.getValue("HouseAuthSetting");
+ if (!min.equals("null")) {
+
+ List<HouseResource> toUpdate = new ArrayList<>();
+ for (HouseResource resource : authStatus) {
+// LocalDateTime insertTime = resource.getInsertTime();
+ LocalDateTime insertTime = resource.getInsertTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
+ LocalDateTime oneMinuteAfter = insertTime.plus(Integer.parseInt(min), ChronoUnit.MINUTES);
+ if (currentTime.isAfter(oneMinuteAfter)) {
+ resource.setAuthStatus(2);
+ resource.setAppUserId(1);
+ toUpdate.add(resource);
+ // 当前时间超过insertTime之后的一分钟
+ System.out.println("当前时间超过了插入时间之后的一分钟");
+ } else {
+ // 当前时间未超过insertTime之后的一分钟
+ System.out.println("当前时间未超过插入时间之后的一分钟");
+ }
+ }
+ if (!toUpdate.isEmpty()) {
+ houseResourceService.updateBatchById(toUpdate);
+ }
+ }
+ }
+
+
+ }
+ }
\ No newline at end of file
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/util/ResultUtil.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/util/ResultUtil.java
index ed1fa10..2d50297 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/util/ResultUtil.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/util/ResultUtil.java
@@ -51,7 +51,7 @@
return code;
}
- private ResultUtil(Integer code, String msg) {
+ public ResultUtil(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/system/warpper/req/AddHouseReq.java b/guns-management/src/main/java/com/stylefeng/guns/modular/system/warpper/req/AddHouseReq.java
index a3a8887..690baf9 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/system/warpper/req/AddHouseReq.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/system/warpper/req/AddHouseReq.java
@@ -80,5 +80,6 @@
private Integer goodHouse;
private Integer id;
+ private String reason;
}
diff --git a/guns-management/src/main/resources/application-dev.yml b/guns-management/src/main/resources/application-dev.yml
index b21337b..e9a9bdc 100644
--- a/guns-management/src/main/resources/application-dev.yml
+++ b/guns-management/src/main/resources/application-dev.yml
@@ -4,7 +4,7 @@
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
- url: jdbc:mysql://127.0.0.1:3306/rental_house_applet?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai
+ url: jdbc:mysql://192.168.110.64:3306/rental_house_applet?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: root
db-name: rental_house_applet #用来搜集数据库的所有表
diff --git a/guns-management/target/classes/META-INF/spring-configuration-metadata.json b/guns-management/target/classes/META-INF/spring-configuration-metadata.json
index b9a4840..e46e801 100644
--- a/guns-management/target/classes/META-INF/spring-configuration-metadata.json
+++ b/guns-management/target/classes/META-INF/spring-configuration-metadata.json
@@ -71,12 +71,57 @@
},
{
"sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
+ "name": "guns.muti-datasource.data-source-names",
+ "type": "java.lang.String[]"
+ },
+ {
+ "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
+ "name": "guns.muti-datasource.data-source-names",
+ "type": "java.lang.String[]"
+ },
+ {
+ "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
+ "name": "guns.muti-datasource.data-source-names",
+ "type": "java.lang.String[]"
+ },
+ {
+ "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
"name": "guns.muti-datasource.driver-class-name",
"type": "java.lang.String"
},
{
"sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
"name": "guns.muti-datasource.driver-class-name",
+ "type": "java.lang.String"
+ },
+ {
+ "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
+ "name": "guns.muti-datasource.driver-class-name",
+ "type": "java.lang.String"
+ },
+ {
+ "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
+ "name": "guns.muti-datasource.driver-class-name",
+ "type": "java.lang.String"
+ },
+ {
+ "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
+ "name": "guns.muti-datasource.driver-class-name",
+ "type": "java.lang.String"
+ },
+ {
+ "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
+ "name": "guns.muti-datasource.password",
+ "type": "java.lang.String"
+ },
+ {
+ "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
+ "name": "guns.muti-datasource.password",
+ "type": "java.lang.String"
+ },
+ {
+ "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
+ "name": "guns.muti-datasource.password",
"type": "java.lang.String"
},
{
@@ -101,6 +146,21 @@
},
{
"sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
+ "name": "guns.muti-datasource.url",
+ "type": "java.lang.String"
+ },
+ {
+ "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
+ "name": "guns.muti-datasource.url",
+ "type": "java.lang.String"
+ },
+ {
+ "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
+ "name": "guns.muti-datasource.url",
+ "type": "java.lang.String"
+ },
+ {
+ "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
"name": "guns.muti-datasource.username",
"type": "java.lang.String"
},
@@ -111,6 +171,36 @@
},
{
"sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
+ "name": "guns.muti-datasource.username",
+ "type": "java.lang.String"
+ },
+ {
+ "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
+ "name": "guns.muti-datasource.username",
+ "type": "java.lang.String"
+ },
+ {
+ "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
+ "name": "guns.muti-datasource.username",
+ "type": "java.lang.String"
+ },
+ {
+ "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
+ "name": "guns.muti-datasource.validation-query",
+ "type": "java.lang.String"
+ },
+ {
+ "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
+ "name": "guns.muti-datasource.validation-query",
+ "type": "java.lang.String"
+ },
+ {
+ "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
+ "name": "guns.muti-datasource.validation-query",
+ "type": "java.lang.String"
+ },
+ {
+ "sourceType": "com.stylefeng.guns.core.config.properties.MutiDataSourceProperties",
"name": "guns.muti-datasource.validation-query",
"type": "java.lang.String"
},
diff --git a/guns-management/target/classes/application-dev.yml b/guns-management/target/classes/application-dev.yml
index b21337b..e9a9bdc 100644
--- a/guns-management/target/classes/application-dev.yml
+++ b/guns-management/target/classes/application-dev.yml
@@ -4,7 +4,7 @@
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
- url: jdbc:mysql://127.0.0.1:3306/rental_house_applet?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai
+ url: jdbc:mysql://192.168.110.64:3306/rental_house_applet?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: root
db-name: rental_house_applet #用来搜集数据库的所有表
diff --git a/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/AppUserMapper.xml b/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/AppUserMapper.xml
index 52f3240..2297a2d 100644
--- a/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/AppUserMapper.xml
+++ b/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/AppUserMapper.xml
@@ -37,7 +37,7 @@
order by houseCount desc
</select>
<select id="listHost" resultType="com.stylefeng.guns.modular.system.dto.Host">
- SELECT id,insert_time,nickname,phone,profile_photo,user_type,wechat_qr_code,watch_app,phone,status
+ SELECT id,insert_time as insertTime,nickname,phone,profile_photo as profilePhoto,user_type as userType,wechat_qr_code as wechatQrCode,watch_app as watchApp,phone,status
from t_app_user
<where>
status != 3
@@ -54,14 +54,14 @@
and phone like CONCAT('%', #{phone}, '%')
</if>
</where>
-
+ ORDER BY insert_time desc
</select>
<select id="listMedium" resultType="com.stylefeng.guns.modular.system.dto.Medium">
- SELECT id,insert_time,nickname,company_name,agent_licence_code,wechat_qr_code,watch_app,phone,status
+ SELECT id,insert_time as insertTime,nickname,company_name as companyName,agent_licence_code as agentLicenceCode,wechat_qr_code as wechatQrCode,watch_app as watchApp,phone,status
from t_app_user
<where>
- status != 3 and audit_status = 2
+ status != 3 and auth = 2
<if test="null != nickname and '' != nickname">
and nickname like CONCAT('%', #{nickname}, '%')
</if>
@@ -81,11 +81,11 @@
<select id="listAuMedium" resultType="com.stylefeng.guns.modular.system.dto.Medium">
SELECT id,insert_time as insertTime,nickname,company_name as companyName,
- agent_licence_code as agentLicenceCode,wechat_qr_code as wechatQrCode,watch_app as watchapp,phone,status,audit_status as auditStatus,audit_note as auditNote
+ agent_licence_code as agentLicenceCode,wechat_qr_code as wechatQrCode,watch_app as watchApp,phone,status,auth as auditStatus,audit_note as auditNote
,refuse_date as refuseDate
from t_app_user
<where>
- status != 3
+ status != 3 and auth != 0
<if test="null != nickname and '' != nickname">
and nickname like CONCAT('%', #{nickname}, '%')
</if>
@@ -93,7 +93,7 @@
and user_type = #{userType}
</if>
<if test="null != status">
- and status = #{status}
+ and audit_status = #{status}
</if>
<if test="null != phone and '' != phone">
and phone like CONCAT('%', #{phone}, '%')
diff --git a/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/BannerMapper.xml b/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/BannerMapper.xml
index 56abc0c..2f6a4e5 100644
--- a/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/BannerMapper.xml
+++ b/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/BannerMapper.xml
@@ -7,4 +7,17 @@
<select id="getBanners" resultType="com.stylefeng.guns.modular.system.warpper.res.BannerRes">
select id, img_url as imgUrl, content from t_banner where `position` = #{position} order by `sort` desc
</select>
+ <select id="list" resultType="com.stylefeng.guns.modular.system.dto.BannerVo">
+ SELECT tb.id,tb.position,tb.sort,tb.img_url as imgUrl,su.`name` as createBy,tb.insert_time as insertTime
+ from t_banner tb
+ LEFT JOIN sys_user su on tb.insert_user_id = su.id
+ <where>
+ <if test="null != position">
+ and tb.position = #{position}
+ </if>
+ <if test="null != sort">
+ and tb.sort = #{sort}
+ </if>
+ </where>
+ </select>
</mapper>
\ No newline at end of file
diff --git a/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/EncyclopedicKnowledgeMapper.xml b/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/EncyclopedicKnowledgeMapper.xml
index af4b1cf..a97e9cb 100644
--- a/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/EncyclopedicKnowledgeMapper.xml
+++ b/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/EncyclopedicKnowledgeMapper.xml
@@ -12,7 +12,7 @@
from t_encyclopedic_knowledge where sys_data_type_id = #{typeId} order by insert_time desc
</select>
<select id="list" resultType="com.stylefeng.guns.modular.system.model.EncyclopedicKnowledge">
- SELECT kn.id,ty.`name` as type ,kn.title,kn.content,us.`name`,kn.insert_time as insertTime
+ SELECT kn.id,ty.`name` as type ,kn.title,kn.content,us.`name` as createByName,kn.insert_time as insertTime,kn.sys_data_type_id as sysDataTypeId
FROM t_encyclopedic_knowledge kn
LEFT JOIN t_sys_data_type ty ON kn.sys_data_type_id = ty.id
LEFT JOIN sys_user us ON kn.create_by = us.id
@@ -21,6 +21,10 @@
and kn.sys_data_type_id = #{type}
</if>
+ <if test="null != title and '' != title">
+ and kn.title like CONCAT('%', #{title}, '%')
+ </if>
+
</where>
diff --git a/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/FeedBackMapper.xml b/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/FeedBackMapper.xml
index e4e61a0..878d1f8 100644
--- a/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/FeedBackMapper.xml
+++ b/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/FeedBackMapper.xml
@@ -5,7 +5,7 @@
<select id="list" resultType="com.stylefeng.guns.modular.system.dto.FeedBackVo">
- SELECT tf.insert_time as insertTime, au.nickname,au.phone,tf.content
+ SELECT tf.insert_time as insertTime, au.nickname,au.phone,tf.content,tf.id
from t_feedback tf
LEFT JOIN t_app_user au ON tf.app_user_id =au.id
<where>
diff --git a/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/HouseResourceMapper.xml b/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/HouseResourceMapper.xml
index 3d0e2cd..9d2f36d 100644
--- a/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/HouseResourceMapper.xml
+++ b/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/HouseResourceMapper.xml
@@ -332,18 +332,18 @@
WHEN hs.is_manage IS NULL AND ap.user_type = 3 THEN 3
ELSE hs.is_manage
END AS isManage,
- IFNULL(ap.nickname,su.`name`) as name, IFNULL(ap.phone,su.phone) as phone,
+ IFNULL(su.`name`,ap.nickname) as name, IFNULL(ap.phone,su.phone) as phone,
hs.house_model as houseModel, hs.building_orientation as buildingOrientation, hs.sale_amount as saleAmount,
hs.house_area as houseArea , hs.status
FROM t_house_resource hs
LEFT JOIN t_app_user ap ON hs.insert_user_id = ap.id
LEFT JOIN sys_user su ON hs.insert_user_id = su.id AND hs.is_manage = 1
- where hs.is_delete = 0 and hs.auth_status = 2
+ where hs.is_delete = 0 and hs.auth_status = 2 and hs.type = 2
) a
<where>
<if test="null != cellName and '' != cellName">
- and a.cell_name like CONCAT('%', #{cellName}, '%')
+ and a.cellName like CONCAT('%', #{cellName}, '%')
</if>
<if test="null != dataType">
and a.dataType = #{dataType}
@@ -375,14 +375,14 @@
WHEN hs.is_manage IS NULL AND ap.user_type = 3 THEN 3
ELSE hs.is_manage
END AS isManage,
- IFNULL(ap.nickname,su.`name`) as name, IFNULL(ap.phone,su.phone) as phone,
+ IFNULL(su.`name`,ap.nickname) as name, IFNULL(ap.phone,su.phone) as phone,
hs.house_model as houseModel, hs.building_orientation as buildingOrientation, hs.sale_amount as saleAmount,
hs.house_area as houseArea , hs.status,hs.auth_status AS authStatus
FROM t_house_resource hs
LEFT JOIN t_app_user ap ON hs.insert_user_id = ap.id
LEFT JOIN sys_user su ON hs.insert_user_id = su.id AND hs.is_manage = 1
- where hs.is_delete = 0
-
+ where hs.is_delete = 0 and hs.type = 2
+ order by hs.insert_time desc
) a
<where>
@@ -414,7 +414,7 @@
</select>
<select id="reprotList" resultType="com.stylefeng.guns.modular.system.dto.THouseResource">
select * from (
- SELECT hs.insert_time as insertTime, hs.id, hs.cell_name as cellName, hs.house_address as houseAddress,
+ SELECT hs.insert_time as insertTime, hr.id, hs.cell_name as cellName, hs.house_address as houseAddress,
hs.data_type as dataType,
CASE
WHEN hs.is_manage IS NULL AND ap.user_type = 2 THEN 2
@@ -423,7 +423,7 @@
END AS isManage,
IFNULL(ap.nickname,su.`name`) as name, IFNULL(ap.phone,su.phone) as phone,
hs.house_model as houseModel, hs.building_orientation as buildingOrientation, hs.sale_amount as saleAmount,
- hs.house_area as houseArea , hs.status,hr.content,hr.audit,hr.back_reason as backReason,hr.back_date as backDate
+ hs.house_area as houseArea , hs.status,hr.content,hr.audit,hr.back_reason as backReason,hr.back_date as backDate,hs.id as houseId
from t_report_house_resource hr
LEFT JOIN t_house_resource hs on hr.house_resource_id = hs.id
LEFT JOIN t_app_user ap ON hs.insert_user_id = ap.id
diff --git a/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/HouseTypeMapper.xml b/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/HouseTypeMapper.xml
index 9744aee..a91f79c 100644
--- a/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/HouseTypeMapper.xml
+++ b/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/HouseTypeMapper.xml
@@ -1,4 +1,9 @@
<?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="com.stylefeng.guns.modular.system.dao.HouseTypeMapper">
+ <select id="list" resultType="com.stylefeng.guns.modular.system.model.HouseType">
+ SELECT hy.id,hy.insert_time as insertTime,hy.`name`,su.`name` as createName
+ from t_house_type hy
+ LEFT JOIN sys_user su on hy.create_by = su.id
+ </select>
</mapper>
\ No newline at end of file
diff --git a/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/RoleMapper.xml b/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/RoleMapper.xml
index 8de4a7e..fa3c532 100644
--- a/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/RoleMapper.xml
+++ b/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/RoleMapper.xml
@@ -19,11 +19,11 @@
<select id="selectRoles" resultType="map">
select
- sr.id, sr.num, sr.pid, sr.name, sr.deptid, sr.tips, sr.version,su.name as createBy
+ sr.id, sr.num, sr.pid, sr.name, sr.deptid, sr.tips, sr.version,su.name as createBy,sr.insert_time as insertTime
from sys_role sr
left join sys_user su on sr.create_by = su.id
<if test="condition != null">
- where name like CONCAT('%',#{condition},'%')
+ where sr.name like CONCAT('%',#{condition},'%')
</if>
order by id
</select>
diff --git a/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/UserMapper.xml b/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/UserMapper.xml
index 01fac41..2245460 100644
--- a/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/UserMapper.xml
+++ b/guns-management/target/classes/com/stylefeng/guns/modular/system/dao/mapping/UserMapper.xml
@@ -79,7 +79,7 @@
select * ,IF( sex = 1, '男', '女' ) sexName FROM sys_user where id=#{id}
</select>
<select id="getUsers" resultType="java.util.Map">
- SELECT us.createtime,us.account,us.`name`,us.sex,sr.`name` as roleName,sd.simplename as deptName,us.email,us.phone,us.`status`
+ SELECT us.id,us.createtime,us.account,us.`name`,us.sex,sr.`name` as roleName,sd.simplename as deptName,us.email,us.phone,us.`status`
from sys_user us
LEFT JOIN sys_role sr ON us.roleid = sr.id
LEFT JOIN sys_dept sd on us.deptid = sd.id
--
Gitblit v1.7.1