Explorar el Código

经纪人管理

by su hace 4 años
padre
commit
d43ad17d97
Se han modificado 23 ficheros con 539 adiciones y 891 borrados
  1. 4 0
      .gitignore
  2. 13 1
      house-auth/house-auth.iml
  3. 13 1
      house-biz/house-biz.iml
  4. 7 0
      house-biz/pom.xml
  5. 26 18
      house-biz/src/main/java/com/ljq/house/biz/dao/TmAgencyDao.java
  6. 2 0
      house-biz/src/main/java/com/ljq/house/biz/dao/TmStoreDao.java
  7. 1 1
      house-biz/src/main/java/com/ljq/house/biz/generator/MysqlGenerator.java
  8. 53 23
      house-biz/src/main/java/com/ljq/house/biz/model/TmAgency.java
  9. 37 0
      house-biz/src/main/java/com/ljq/house/biz/service/ITmAgencyService.java
  10. 95 0
      house-biz/src/main/java/com/ljq/house/biz/service/impl/TmAgencyServiceImpl.java
  11. 27 0
      house-biz/src/main/java/com/ljq/house/biz/vo/request/TmAgencyReqVo.java
  12. 9 15
      house-biz/src/main/java/com/ljq/house/biz/vo/response/TmAgencyRspVo.java
  13. 172 0
      house-biz/src/main/resources/mapper/TmAgencyDap.xml
  14. 0 121
      house-biz/src/main/resources/mapper/TmAgencyMapper.xml
  15. 19 4
      house-biz/src/main/resources/mapper/TmEstateDao.xml
  16. 6 0
      house-biz/src/main/resources/mapper/TmStoreDao.xml
  17. 1 8
      house-common/src/main/java/com/ljq/house/common/service/HouseHelperService.java
  18. 1 1
      house-common/src/main/java/com/ljq/house/common/service/UserService.java
  19. 0 2
      house-web/pom.xml
  20. 41 172
      house-web/src/main/java/com/ljq/house/admin/controller/AdminTmAgencyController.java
  21. 9 0
      house-web/src/main/java/com/ljq/house/admin/controller/AdminTmEstateController.java
  22. 0 520
      house-web/src/main/java/com/ljq/house/admin/controller/AdminTmHouseController.java
  23. 3 4
      house-web/src/main/java/com/ljq/house/app/controller/AppAgencyController.java

+ 4 - 0
.gitignore

@@ -396,3 +396,7 @@ house-web/target/house_web_01/WEB-INF/lib/xmlbeans-2.6.0.jar
 house-web/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
 house-web/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
 house-web/target/test-classes/com/ljq/house/app/JasyptTest.class
+house-common/target/classes/com/ljq/house/common/data/SubscribeMessageVo$Thing1.class
+house-common/target/classes/com/ljq/house/common/data/SubscribeMessageVo$Thing2.class
+house-common/target/classes/com/ljq/house/common/data/SubscribeMessageVo$Thing3.class
+house-common/target/classes/com/ljq/house/common/data/SubscribeMessageVo$Time4.class

+ 13 - 1
house-auth/house-auth.iml

@@ -182,15 +182,27 @@
     <orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.1.1" level="project" />
     <orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.3" level="project" />
     <orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.3" level="project" />
+    <orderEntry type="library" name="Maven: org.freemarker:freemarker:2.3.28" level="project" />
     <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-boot-starter:3.3.1.tmp" level="project" />
     <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus:3.3.1.tmp" level="project" />
     <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-generator:3.3.1.tmp" level="project" />
     <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.3.1.tmp" level="project" />
     <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-core:3.3.1.tmp" level="project" />
     <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.3.1.tmp" level="project" />
-    <orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:3.1" level="project" />
     <orderEntry type="library" name="Maven: org.apache.velocity:velocity-engine-core:2.1" level="project" />
     <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
+    <orderEntry type="library" name="Maven: tk.mybatis:mapper-spring-boot-starter:2.0.2" level="project" />
+    <orderEntry type="library" name="Maven: tk.mybatis:mapper-core:1.0.2" level="project" />
+    <orderEntry type="library" name="Maven: tk.mybatis:mapper-base:1.0.1" level="project" />
+    <orderEntry type="library" name="Maven: tk.mybatis:mapper-weekend:1.1.3" level="project" />
+    <orderEntry type="library" name="Maven: tk.mybatis:mapper-spring:1.0.1" level="project" />
+    <orderEntry type="library" name="Maven: tk.mybatis:mapper-extra:1.0.1" level="project" />
+    <orderEntry type="library" name="Maven: tk.mybatis:mapper-spring-boot-autoconfigure:2.0.2" level="project" />
+    <orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.2.5" level="project" />
+    <orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.2.5" level="project" />
+    <orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.1.4" level="project" />
+    <orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:1.0" level="project" />
+    <orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.3" level="project" />
     <orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.12" level="project" />
     <orderEntry type="library" name="Maven: io.springfox:springfox-swagger2:2.8.0" level="project" />
     <orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.5.14" level="project" />

+ 13 - 1
house-biz/house-biz.iml

@@ -58,6 +58,7 @@
         <SOURCES />
       </library>
     </orderEntry>
+    <orderEntry type="library" name="Maven: org.freemarker:freemarker:2.3.28" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.2.5.RELEASE" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.2.5.RELEASE" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.2.5.RELEASE" level="project" />
@@ -142,9 +143,20 @@
     <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.3.1.tmp" level="project" />
     <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-core:3.3.1.tmp" level="project" />
     <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.3.1.tmp" level="project" />
-    <orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:3.1" level="project" />
     <orderEntry type="library" name="Maven: org.apache.velocity:velocity-engine-core:2.1" level="project" />
     <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
+    <orderEntry type="library" name="Maven: tk.mybatis:mapper-spring-boot-starter:2.0.2" level="project" />
+    <orderEntry type="library" name="Maven: tk.mybatis:mapper-core:1.0.2" level="project" />
+    <orderEntry type="library" name="Maven: tk.mybatis:mapper-base:1.0.1" level="project" />
+    <orderEntry type="library" name="Maven: tk.mybatis:mapper-weekend:1.1.3" level="project" />
+    <orderEntry type="library" name="Maven: tk.mybatis:mapper-spring:1.0.1" level="project" />
+    <orderEntry type="library" name="Maven: tk.mybatis:mapper-extra:1.0.1" level="project" />
+    <orderEntry type="library" name="Maven: tk.mybatis:mapper-spring-boot-autoconfigure:2.0.2" level="project" />
+    <orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.2.5" level="project" />
+    <orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.2.5" level="project" />
+    <orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.1.4" level="project" />
+    <orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:1.0" level="project" />
+    <orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.3" level="project" />
     <orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.12" level="project" />
     <orderEntry type="library" name="Maven: io.springfox:springfox-swagger2:2.8.0" level="project" />
     <orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.5.14" level="project" />

+ 7 - 0
house-biz/pom.xml

@@ -73,6 +73,13 @@
             <version>${druid.version}</version>
         </dependency>
 
+        <dependency>
+            <groupId>org.freemarker</groupId>
+            <artifactId>freemarker</artifactId>
+            <version>2.3.28</version>
+            <scope>compile</scope>
+        </dependency>
+
 
     </dependencies>
 </project>

+ 26 - 18
house-biz/src/main/java/com/ljq/house/biz/dao/TmAgencyDao.java

@@ -1,31 +1,39 @@
 package com.ljq.house.biz.dao;
 
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.ljq.house.biz.model.TmAgency;
-import com.ljq.house.biz.model.TmHouse;
-import com.ljq.house.biz.model.TmUser;
-import org.apache.ibatis.annotations.Mapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ljq.house.biz.model.TmEstate;
+import com.ljq.house.biz.vo.request.TmAgencyReqVo;
+import com.ljq.house.biz.vo.request.TmEstateReqVo;
+import com.ljq.house.biz.vo.response.TmAgencyRspVo;
+import com.ljq.house.biz.vo.response.TmEstateRspVo;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
-import java.util.Map;
 
 /**
- * @author abnerhou
- * @date 2020/4/24 11:08
- * @desciption
+ * <p>
+ * 经纪人信息表 Mapper 接口
+ * </p>
+ *
+ * @author anthor
+ * @since 2021-06-07
  */
-
-@Mapper
 public interface TmAgencyDao extends BaseMapper<TmAgency> {
 
-    public  List<TmAgency> selectTmAgencyByHouseId(@Param("houseId") String houseId);
-    public  TmAgency selectTmAgencyById(@Param("agencyUserId") String agencyUserId);
+    public List<TmAgencyRspVo> getList(@Param("cm") TmAgencyReqVo tmAgencyReqVo);
+
     public Long countAll();
-    public int delete(@Param("agencyUserId") String agencyUserId);
-    public int updateByIdSelectively(@Param("tmAgency") TmAgency tmAgency);
-    public TmAgency setectAgencyByCondition(@Param("tmAgency") TmAgency tmAgency);
-    public IPage<Map<String ,Object>> queryAgencyList(IPage<TmAgency> page , @Param("ew") QueryWrapper<TmAgency> queryWrapper);
+
+    public int insert(@Param("cm") TmAgency tmAgency);
+
+    public int update(@Param("cm") TmAgency tmAgency);
+
+    public int del(@Param("agencyId") String agencyId, @Param("updateUserId") String updateUserId);
+
+    TmAgency selectTmAgencyById(@Param("agencyUserId") String agencyUserId);
+
+    //根据房源ID 获取经纪人
+    TmAgency selectTmAgencyByHouseId(@Param("estateId") String estateId);
+
 }

+ 2 - 0
house-biz/src/main/java/com/ljq/house/biz/dao/TmStoreDao.java

@@ -19,4 +19,6 @@ import java.util.Map;
  */
 public interface TmStoreDao extends BaseMapper<TmStore> {
    public IPage<Map<String ,Object>> getAllStore(IPage<TmStore> page ,@Param("ew") QueryWrapper<TmStore> queryWrapper);
+
+   public TmStore getStoreInfo(@Param("id") Integer id);
 }

+ 1 - 1
house-biz/src/main/java/com/ljq/house/biz/generator/MysqlGenerator.java

@@ -81,7 +81,7 @@ public class MysqlGenerator {
 
 
         strategy.setNaming(NamingStrategy.underline_to_camel);// 表名生成策略
-         strategy.setInclude(new String[] { "tm_estate","tm_buyingpoint" }); // 需要生成的表
+         strategy.setInclude(new String[] {"tm_agency"}); // 需要生成的表
 //        strategy.setExclude(new String[]{"sys_dict","tb_goods"}); // 排除生成的表
         // 自定义实体父类
         // strategy.setSuperEntityClass("com.baomidou.demo.TestEntity");

+ 53 - 23
house-biz/src/main/java/com/ljq/house/biz/model/TmAgency.java

@@ -1,58 +1,88 @@
 package com.ljq.house.biz.model;
 
-import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.fasterxml.jackson.annotation.JsonProperty;
-import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
-import javax.persistence.Table;
+import java.time.LocalDateTime;
 import java.io.Serializable;
+import java.util.Date;
 
 /**
- * @author abnerhou
- * @date 2020/4/24 10:55
- * @desciption
+ * <p>
+ * 经纪人信息表
+ * </p>
+ *
+ * @author anthor
+ * @since 2021-06-07
  */
 @Data
-@ApiModel(value = "经纪人对象" , description = "经纪人对象")
-@Table
-public class TmAgency extends BaseEntity implements Serializable {
+public class TmAgency extends Model<TmAgency> {
 
-    @ApiModelProperty(value="id",name="agencyId")
-    private String agencyId;
+    private static final long serialVersionUID = 1L;
 
-    @ApiModelProperty(value="头像图片地址",name="avatar",example="http://4dkankan.com/icon.jpg")
+    @ApiModelProperty(value = "经纪用户id")
+    @JsonProperty("agency_user_id")
+    private String agencyUserId;
+
+    @ApiModelProperty(value = "头像图片地址")
     private String avatar;
 
-    @ApiModelProperty(value="名字",name="name",example="张三")
+    @ApiModelProperty(value = "名")
     private String name;
 
-    @ApiModelProperty(value="英文名字",name="name",example="zhangsan")
+    @ApiModelProperty(value = "英文名")
     private String nameEn;
 
-    @ApiModelProperty(value="经纪人身份",name="name",example="zhangsan")
+    @ApiModelProperty(value = "经纪人身份")
     private String agencyIdentity;
 
-    @ApiModelProperty(value="联系方式",name="name",example="")
+    @ApiModelProperty(value = "联系方式")
     private String tel;
 
-    @ApiModelProperty(value="所在门店",name="name",example="")
-    private String storeId;
+    @ApiModelProperty(value = "门店id")
+    private Integer storeId;
 
-    @ApiModelProperty(value="代理公司",name="name",example="")
+    @ApiModelProperty(value = "代理公司")
     private String agencyCompany;
 
-    @ApiModelProperty(value="执照号码",name="name",example="")
+    @ApiModelProperty(value = "执照号码")
     private String licenseNumber;
 
-    @ApiModelProperty(value="支持语言",name="name",example="")
+    @ApiModelProperty(value = "支持语言")
     private String supportLanguage;
 
-    @ApiModelProperty(value="邮箱",name="email",example="0756@qq.com")
+    @ApiModelProperty(value = "电子邮箱")
     private String email;
 
-    @ApiModelProperty(value="从业资格证",name="work_pass_image",example="http://4dkankan.com/icon.jpg")
+    @ApiModelProperty(value = "工作证图片地址")
     private String workPassImage;
 
+    @ApiModelProperty(value = "A:正常 I:删除")
+    private String recStatus;
+
+    @ApiModelProperty(value = "创建者id")
+    private String createUserId;
+
+    @ApiModelProperty(value = "创建者部门id")
+    private Long createUserDeptId;
+
+    @ApiModelProperty(value = "创建日期")
+    private Date createTime;
+
+    @ApiModelProperty(value = "更新者id")
+    private String updateUserId;
+
+    @ApiModelProperty(value = "更新日期")
+    private Date updateTime;
+
+    @ApiModelProperty(value="是否启用 1:启动,0:不启用",name="enable",example="1")
+    private Integer enable;
+
+    @ApiModelProperty(value="微信openId",name="wx_open_id",example="dfsdfsfx443vfdsf")
+    @JsonProperty("wx_open_id")
+    private String wxOpenId;
+
+
 }

+ 37 - 0
house-biz/src/main/java/com/ljq/house/biz/service/ITmAgencyService.java

@@ -0,0 +1,37 @@
+package com.ljq.house.biz.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ljq.house.biz.model.TmAgency;
+import com.ljq.house.biz.model.TmEstate;
+import com.ljq.house.biz.vo.request.TmAgencyReqVo;
+import com.ljq.house.biz.vo.request.TmEstateReqVo;
+import com.ljq.house.biz.vo.response.TmAgencyRspVo;
+import com.ljq.house.biz.vo.response.TmEstateRspVo;
+import com.ljq.house.biz.vo.util.Page;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 房源管理 服务类
+ * </p>
+ *
+ * @author anthor
+ * @since 2021-06-03
+ */
+public interface ITmAgencyService extends IService<TmEstate> {
+
+    public Page<TmAgencyRspVo> getList(TmAgencyReqVo tmAgencyReqVo);
+
+    public int insert(TmAgency tmAgency);
+
+    public int update(TmAgency tmAgency);
+
+    public int del(String agencyUserId);
+
+    TmAgency selectTmAgencyById( String agencyUserId);
+
+    //根据房源ID 获取经纪人
+    TmAgency selectTmAgencyByHouseId(String estateId);
+}

+ 95 - 0
house-biz/src/main/java/com/ljq/house/biz/service/impl/TmAgencyServiceImpl.java

@@ -0,0 +1,95 @@
+package com.ljq.house.biz.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ljq.house.biz.dao.TmAgencyDao;
+import com.ljq.house.biz.dao.TmBuyingpointDao;
+import com.ljq.house.biz.dao.TmEstateDao;
+import com.ljq.house.biz.model.TmAgency;
+import com.ljq.house.biz.model.TmBuyingpoint;
+import com.ljq.house.biz.model.TmEstate;
+import com.ljq.house.biz.service.ITmAgencyService;
+import com.ljq.house.biz.service.ITmBuyingpointService;
+import com.ljq.house.biz.service.ITmEstateService;
+import com.ljq.house.biz.vo.request.TmAgencyReqVo;
+import com.ljq.house.biz.vo.request.TmEstateReqVo;
+import com.ljq.house.biz.vo.response.TmAgencyRspVo;
+import com.ljq.house.biz.vo.response.TmEstateRspVo;
+import com.ljq.house.biz.vo.util.IdStarterEnum2;
+import com.ljq.house.biz.vo.util.Page;
+import com.ljq.house.biz.vo.util.UUidGenerator2;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * <p>
+ * 房源管理 服务实现类
+ * </p>
+ *
+ * @author anthor
+ * @since 2021-06-03
+ */
+@Service
+public class TmAgencyServiceImpl extends ServiceImpl<TmEstateDao, TmEstate> implements ITmAgencyService {
+
+    @Autowired
+    private TmAgencyDao tmAgencyDao;
+
+    @Autowired
+    private ITmEstateService iTmEstateService;
+
+
+    @Override
+    public Page<TmAgencyRspVo> getList(TmAgencyReqVo tmAgencyReqVo) {
+
+        tmAgencyReqVo.setLimit(tmAgencyReqVo.getPageSize());
+        tmAgencyReqVo.setOffset((tmAgencyReqVo.getCurrPage() - 1) * tmAgencyReqVo.getPageSize());
+
+        List<TmAgencyRspVo> tmAgencyRspVoList = tmAgencyDao.getList(tmAgencyReqVo);
+        if(tmAgencyRspVoList!=null && tmAgencyRspVoList.size()>0){
+            for(TmAgencyRspVo ter:tmAgencyRspVoList){
+                ter.setEstateNum(iTmEstateService.findAgencyNum(ter.getAgencyUserId()));
+            }
+        }
+
+        Long total = tmAgencyDao.countAll();
+        Page<TmAgencyRspVo> tmAgencyRspVoPage = new Page<>();
+        tmAgencyRspVoPage.setCurrentPage(tmAgencyReqVo.getCurrPage());
+        tmAgencyRspVoPage.setCurrentCount(tmAgencyReqVo.getPageSize());
+        tmAgencyRspVoPage.setTotalCount(total);
+        tmAgencyRspVoPage.setProductList(tmAgencyRspVoList);
+
+        return tmAgencyRspVoPage;
+    }
+
+    @Override
+    public int insert(TmAgency tmAgency) {
+
+        tmAgency.setAgencyUserId(UUidGenerator2.generatorUuid(IdStarterEnum2.AGENCY.getStarter()));
+        return tmAgencyDao.insert(tmAgency);
+    }
+
+    @Override
+    public int update(TmAgency tmAgency) {
+        return tmAgencyDao.update(tmAgency);
+    }
+
+    @Override
+    public int del(String agencyUserId) {
+        return tmAgencyDao.del(agencyUserId,"");
+    }
+
+    @Override
+    public TmAgency selectTmAgencyById(String agencyUserId){
+        return tmAgencyDao.selectTmAgencyById(agencyUserId);
+    }
+
+    //根据房源ID 获取经纪人
+    @Override
+    public TmAgency selectTmAgencyByHouseId(String estateId){
+        return tmAgencyDao.selectTmAgencyByHouseId(estateId);
+    }
+}

+ 27 - 0
house-biz/src/main/java/com/ljq/house/biz/vo/request/TmAgencyReqVo.java

@@ -0,0 +1,27 @@
+package com.ljq.house.biz.vo.request;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class TmAgencyReqVo {
+
+    @ApiModelProperty(value = "门店id")
+    private Integer storeId;
+
+    @ApiModelProperty(value = "姓名,姓英文姓名,执照号码")
+    private String gjz;
+
+    @ApiModelProperty(value = "每页显示的条目数")
+    private Integer pageSize;
+
+    @ApiModelProperty(value = "当前显示的页数")
+    private Integer currPage;
+
+    @ApiModelProperty(value = "",hidden = true)
+    private Integer limit;
+
+    @ApiModelProperty(value = "",hidden = true)
+    private Integer offset;
+
+}

+ 9 - 15
house-biz/src/main/java/com/ljq/house/biz/vo/response/TmAgencyRspVo.java

@@ -1,26 +1,20 @@
 package com.ljq.house.biz.vo.response;
 
-import com.fasterxml.jackson.annotation.JsonProperty;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.ljq.house.biz.model.TmAgency;
+import com.ljq.house.biz.model.TmEstate;
+import com.ljq.house.biz.model.TmStore;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
-import java.util.Date;
-
-/**
- * @author abnerhou
- * @date 2020/6/12 15:15
- * @desciption
- */
-
 @Data
 public class TmAgencyRspVo extends TmAgency {
 
-    @JsonProperty("house_num")
-    private Integer houseNum;
-    @JsonProperty("user_num")
-    private Integer userNum;
 
+    @ApiModelProperty(value = "门店名称")
+    private TmStore tmStore;
 
-}
-
+    @ApiModelProperty(value = "房源数量")
+    private Integer estateNum;
 
+}

+ 172 - 0
house-biz/src/main/resources/mapper/TmAgencyDap.xml

@@ -0,0 +1,172 @@
+<?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.ljq.house.biz.dao.TmAgencyDao">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.ljq.house.biz.model.TmAgency">
+        <id column="agency_user_id" property="agencyUserId" />
+        <result column="avatar" property="avatar" />
+        <result column="name" property="name" />
+        <result column="name_en" property="nameEn" />
+        <result column="agency_identity" property="agencyIdentity" />
+        <result column="tel" property="tel" />
+        <result column="store_id" property="storeId" />
+        <result column="agency_company" property="agencyCompany" />
+        <result column="license_number" property="licenseNumber" />
+        <result column="support_language" property="supportLanguage" />
+        <result column="email" property="email" />
+        <result column="work_pass_image" property="workPassImage" />
+        <result column="rec_status" property="recStatus" />
+        <result column="create_user_id" property="createUserId" />
+        <result column="create_user_dept_id" property="createUserDeptId" />
+        <result column="create_time" property="createTime" />
+        <result column="update_user_id" property="updateUserId" />
+        <result column="update_time" property="updateTime" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        agency_id, avatar, name, name_en, agency_identity, tel, store_id, agency_company, license_number, support_language, email, work_pass_image, rec_status, create_user_id, create_user_dept_id, create_time, update_user_id, update_time
+    </sql>
+
+
+    <select id="getList" resultType="com.ljq.house.biz.vo.response.TmAgencyRspVo">
+       SELECT *
+         FROM tm_agency
+        WHERE rec_status = 'A'
+          AND store_id = 11
+        <if test=" cm.gjz != null  and cm.gjz.trim!='' ">
+        AND (name LIKE CONCAT('%',#{gjz},'%')
+             OR name_en LIKE CONCAT('%',#{gjz},'%')
+             OR license_number LIKE CONCAT('%',#{gjz},'%'))
+        </if>
+        order by create_time desc
+        <if test=" cm.limit != null  and cm.offset != null ">
+            limit #{cm.limit} offset #{cm.offset}
+        </if>
+    </select>
+
+    <select id="countAll" resultType="java.lang.Long">
+        select count(*)
+        from tm_agency
+        where rec_status = 'A'
+    </select>
+
+
+    <select id="selectTmAgencyById" resultType="com.ljq.house.biz.model.TmAgency">
+        select *
+          from tm_agency
+        <where>
+            <if test="agencyUserId != null and agencyUserId.trim() != '' ">
+                and agency_user_id = #{agencyUserId}
+            </if>
+        </where>
+        limit 1
+    </select>
+
+    <insert id="insert" parameterType="com.ljq.house.biz.model.TmAgency">
+
+        INSERT INTO tm_agency
+        (
+         agencyUserId
+        ,avatar
+        ,name
+        ,name_en
+        ,agency_identity
+        ,tel
+        ,store_id
+        ,agency_company
+        ,license_number
+        ,support_language
+        ,email
+        ,work_pass_image
+        ,rec_status
+        ,create_user_id
+        ,create_user_dept_id
+        ,create_time
+        ,update_user_id
+        ,update_time
+        ,enable
+        ,wx_open_id
+        )
+        VALUES
+        (
+         #{cm.agencyUserId}
+        ,#{cm.avatar}
+        ,#{cm.name}
+        ,#{cm.nameEn}
+        ,#{cm.agencyIdentity}
+        ,#{cm.tel}
+        ,#{cm.storeId}
+        ,#{cm.agencyCompany}
+        ,#{cm.licenseNumber}
+        ,#{cm.supportLanguage}
+        ,#{cm.email}
+        ,#{cm.workPassImage}
+        ,#{cm.recStatus}
+        ,#{cm.createUserId}
+        ,#{cm.createUserDeptId}
+        ,#{cm.createTime}
+        ,#{cm.updateUserId}
+        ,#{cm.updateTime}
+        ,'A'
+        ,#{cm.createUserId}
+        ,#{cm.createUserDeptId}
+        ,now()
+        ,#{cm.updateUserId}
+        ,now()
+        ,#{enable}
+        ,#{wxOpenId}
+        )
+    </insert>
+
+
+    <update id="update" parameterType="com.ljq.house.biz.model.TmAgency">
+        update tm_agency
+        <set>
+            <if test="cm.avatar != null and cm.avatar.trim() != ''">avatar = #{cm.avatar},</if>
+            <if test="cm.name != null and cm.name.trim() != ''">name = #{cm.avatar},</if>
+            <if test="cm.nameEn != null and cm.nameEn.trim() != ''">name_en = #{cm.nameEn},</if>
+            <if test="cm.agencyIdentity != null and cm.agencyIdentity.trim() != ''">agency_identity = #{cm.agencyIdentity},</if>
+            <if test="cm.tel != null and cm.tel.trim() != ''">tel = #{cm.tel},</if>
+            <if test="cm.storeId != null">store_id = #{cm.storeId},</if>
+            <if test="cm.agencyCompany != null and cm.agencyCompany.trim() != ''">agency_company = #{cm.agencyCompany},</if>
+            <if test="cm.licenseNumber != null and cm.licenseNumber.trim() != ''">license_number = #{cm.licenseNumber},</if>
+            <if test="cm.supportLanguage != null and cm.supportLanguage.trim() != ''">support_language = #{cm.supportLanguage},</if>
+            <if test="cm.email != null and cm.email.trim() != ''">email = #{cm.email},</if>
+            <if test="cm.workPassImage != null and cm.workPassImage.trim() != ''">work_pass_image = #{cm.workPassImage},</if>
+            <if test="cm.updateUserId != null and cm.updateUserId.trim() != ''">update_user_id = #{cm.updateUserId},</if>
+            <if test="cm.enable != null">enable = #{enable},</if>
+            <if test="cm.wxOpenId != null and cm.wxOpenId.trim() != ''">wx_open_id = #{wxOpenId},</if>
+            update_time = now()
+        </set>
+        where `agency_user_id` = #{cm.agencyUserId}
+        limit 1
+    </update>
+
+    <update id="del">
+        update tm_agency
+        <set>
+            rec_status = 'I',
+            <if test=" updateUserId != null and updateUserId.trim() != ''">update_user_id = #{updateUserId},</if>
+            update_time = now()
+        </set>
+        where `agency_user_id` = #{cm.agencyUserId}
+        limit 1
+    </update>
+
+
+
+    <select id="selectTmAgencyByHouseId" resultType="com.ljq.house.biz.model.TmAgency">
+
+        SELECT *
+        FROM tm_agency M
+        LEFT JOIN tm_estate X on  M.agency_user_id = X.agency_user_id AND .rec_status = 'A'
+        WHERE M.rec_status = 'A'
+        <if test="estateId != null and estateId.trim() != '' ">
+            AND X.estate_id = #{estateId}
+        </if>
+        limit 1
+    </select>
+
+</mapper>

+ 0 - 121
house-biz/src/main/resources/mapper/TmAgencyMapper.xml

@@ -1,121 +0,0 @@
-<?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.ljq.house.biz.dao.TmAgencyDao">
-    <resultMap id="getAgencyByHouseId" type="com.ljq.house.biz.model.TmAgency">
-        <id property="agencyUserId" column="agency_user_id" jdbcType="VARCHAR" />
-        <result property="wxOpenId" column="wx_open_id" jdbcType="VARCHAR" />
-        <result property="name" column="name" jdbcType="VARCHAR" />
-        <result property="phone" column="phone" jdbcType="VARCHAR" />
-        <result property="tel" column="tel" jdbcType="VARCHAR" />
-        <result property="email" column="email" jdbcType="VARCHAR" />
-        <result property="avatar" column="avatar" jdbcType="VARCHAR" />
-        <result property="agencyId" column="agency_id" jdbcType="VARCHAR" />
-        <result property="store" column="store" jdbcType="VARCHAR" />
-        <result property="authState" column="auth_state" jdbcType="VARCHAR" />
-        <result property="agencyCompanyName" column="agency_company_name" jdbcType="VARCHAR" />
-        <result property="tag" column="tag" jdbcType="VARCHAR" />
-        <result property="enable" column="enable" jdbcType="VARCHAR" />
-        <result property="volumeHalfYear" column="volume_half_year" jdbcType="INTEGER" />
-        <result property="dealAveragePeriod" column="deal_average_period" jdbcType="DOUBLE" />
-        <result property="recentRecommendVrs" column="recent_recommend_vrs" jdbcType="INTEGER" />
-        <result property="workPassImage" column="work_pass_image" jdbcType="VARCHAR" />
-    </resultMap>
-
-    <select id="countAll" resultType="java.lang.Long">
-        select count(1) from tm_agency where enable = 1;;
-    </select>
-
-    <select id="selectTmAgencyByHouseId" resultMap="getAgencyByHouseId">
-        select * from tm_house_agency_relation rel
-         left join tm_agency agency on rel.agency_user_id = agency.agency_user_id
-        <where>
-            <if test="houseId != null and houseId != '' ">
-                and house_id = #{houseId}
-            </if>
-        </where>
-        limit 1000
-    </select>
-
-
-    <select id="selectTmAgencyById" resultType="com.ljq.house.biz.model.TmAgency">
-        select * from tm_agency
-        <where>
-            <if test="agencyUserId != null and agencyUserId.trim() != '' ">
-                and agency_user_id = #{agencyUserId}
-            </if>
-        </where>
-        limit 1
-    </select>
-
-
-    <select id="setectAgencyByCondition" resultType="com.ljq.house.biz.model.TmAgency">
-        select * from tm_agency
-        <where>
-
-            <if test="tmAgency != null and tmAgency.wxOpenId != '' ">
-                and wx_open_id = #{tmAgency.wxOpenId}
-            </if>
-
-            <if test="tmAgency != null and tmAgency.phone != '' ">
-                and phone = #{tmAgency.phone}
-            </if>
-        </where>
-        limit 1
-    </select>
-
-
-    <select id="queryAgencyList" resultType="java.util.Map">
-      select
-        agency.avatar,
-        agency.agency_user_id,
-        agency.name,
-        agency.phone,
-        agency.store,
-        agency.type,
-        agency.create_time,
-        agency.enable,
-        count(house.house_id) as house_num ,
-        count(user.user_id) as user_num
-             from tm_agency agency
-            left  join tm_house_agency_relation house on house.agency_user_id = agency.agency_user_id and house.is_valid = 1
-            left  join tm_agency_user_relation user on user.agency_user_id = agency.agency_user_id and user.is_valid = 1
-
-        ${ew.customSqlSegment}
-
-    </select>
-
-
-    <delete id="delete">
-    delete from tm_agency
-    where agency_user_id=#{agency_user_id}
-   </delete>
-
-
-    <update id="updateByIdSelectively" parameterType="com.ljq.house.biz.model.TmAgency">
-        update tm_agency
-        <set>
-            <if test="tmAgency.wxOpenId != null and tmAgency.wxOpenId.trim() != ''">`wx_open_id` = #{tmAgency.wxOpenId},</if>
-            <if test="tmAgency.name != null and tmAgency.name.trim() != ''">`name` = #{tmAgency.name},</if>
-            <if test="tmAgency.phone != null and tmAgency.phone.trim() != ''">`phone` = #{tmAgency.phone},</if>
-            <if test="tmAgency.tel != null and tmAgency.tel.trim() != ''">`tel` = #{tmAgency.tel},</if>
-            <if test="tmAgency.email != null and tmAgency.email.trim() != ''">`email` = #{tmAgency.email},</if>
-            <if test="tmAgency.passwd != null and tmAgency.passwd.trim() != ''">`email` = #{tmAgency.passwd},</if>
-            <if test="tmAgency.avatar != null and tmAgency.avatar.trim() != ''">`avatar` = #{tmAgency.avatar},</if>
-            <if test="tmAgency.agency_id != null and tmAgency.agency_id.trim() != ''">`agency_id` = #{tmAgency.agencyId},</if>
-            <if test="tmAgency.store != null and tmAgency.store.trim() != ''">`store` = #{tmAgency.store},</if>
-            <if test="tmAgency.enable != null ">`enable` = #{tmAgency.enable},</if>
-            <if test="tmAgency.authState != null ">`auth_state` = #{tmAgency.authState},</if>
-            <if test="tmAgency.tag != null and tmAgency.tag.trim() != ''">`tag` = #{tmAgency.tag},</if>
-            <if test="tmAgency.agencyCompanyName != null and tmAgency.agencyCompanyName.trim() != ''">`agency_company_name` = #{tmAgency.agencyCompanyName},</if>
-            <if test="tmAgency.volumeHalfYear != null">`volume_half_year` = #{tmAgency.volumeHalfYear},</if>
-            <if test="tmAgency.dealAveragePeriod != null">`deal_average_period` = #{tmAgency.dealAveragePeriod},</if>
-            <if test="tmAgency.recentRecommendVrs != null">`recent_recommend_vrs` = #{tmAgency.recentRecommendVrs},</if>
-            <if test="tmAgency.reserve1 != null and tmAgency.reserve1.trim() != ''">`reserve1` = #{tmAgency.reserve1},</if>
-            <if test="tmAgency.reserve2 != null and tmAgency.reserve2.trim() != ''">`reserve2` = #{tmAgency.reserve2},</if>
-            last_modify_datetime = now()
-        </set>
-        where `agency_user_id` = #{tmAgency.agencyUserId}
-        limit 1
-    </update>
-
-</mapper>

+ 19 - 4
house-biz/src/main/resources/mapper/TmEstateDao.xml

@@ -18,7 +18,7 @@
         <result column="house_label" property="houseLabel" />
         <result column="ancillary_facility" property="ancillaryFacility" />
         <result column="is_agent_relation" property="isAgentRelation" />
-        <result column="agent_id" property="agentId" />
+        <result column="agency_user_id" property="agencyUserId" />
         <result column="sell_type" property="sellType" />
         <result column="scene_address" property="sceneAddress" />
         <result column="ADDITIONS_IMAGES" property="additionsImages" />
@@ -82,7 +82,7 @@
          house_label,
          ancillary_facility,
          is_agent_relation,
-         agent_id,
+         agency_user_id,
          sell_type,
          scene_address,
          ADDITIONS_IMAGES,
@@ -113,7 +113,7 @@
                , #{cm.houseLabel}
                , #{cm.ancillaryFacility}
                , #{cm.isAgentRelation}
-               , #{cm.agentId}
+               , #{cm.agencyUserId}
                , #{cm.sellType}
                , #{cm.sceneAddress}
                , #{cm.additionsImages}
@@ -149,7 +149,7 @@
             <if test="cm.houseLabel != null and cm.houseLabel.trim() != ''"> house_label = #{cm.houseLabel},</if>
             <if test="cm.ancillaryFacility != null and cm.ancillaryFacility.trim() != ''"> ancillary_facility = #{cm.ancillaryFacility},</if>
             <if test="cm.isAgentRelation != null and cm.isAgentRelation.trim() != ''"> is_agent_relation = #{cm.isAgentRelation},</if>
-            <if test="cm.agentId != null and cm.agentId.trim() != ''"> agent_id = #{cm.agentId},</if>
+            <if test="cm.agencyUserId != null and cm.agencyUserId.trim() != ''"> agency_user_id = #{cm.agencyUserId},</if>
             <if test="cm.sellType != null and cm.sellType.trim() != ''"> sell_type = #{cm.sellType},</if>
             <if test="cm.sceneAddress != null and cm.sceneAddress.trim() != ''"> scene_address = #{cm.sceneAddress},</if>
             <if test="cm.additionsImages != null and cm.additionsImages.trim() != ''">additions_images = #{cm.additionsImages},</if>
@@ -177,4 +177,19 @@
         limit 1
     </update>
 
+    <select id="findAgencyEstate" resultType="com.ljq.house.biz.model.TmEstate">
+        select *
+          from tm_estate
+         where rec_status = 'A'
+           and agency_user_id = #{cm.agencyUserId}
+      order by create_time desc
+    </select>
+
+    <select id="findAgencyNum" resultType="java.lang.Integer">
+        select count(*)
+        from tm_estate
+        where rec_status = 'A'
+          and agency_user_id = #{cm.agencyUserId}
+    </select>
+
 </mapper>

+ 6 - 0
house-biz/src/main/resources/mapper/TmStoreDao.xml

@@ -7,4 +7,10 @@
              from tm_store
         ${ew.customSqlSegment}
     </select>
+
+    <select id="getStoreInfo" resultType="com.ljq.house.biz.model.TmStore">
+        select  *
+        from tm_store
+        where id = #{id}
+    </select>
 </mapper>

+ 1 - 8
house-common/src/main/java/com/ljq/house/common/service/HouseHelperService.java

@@ -231,14 +231,7 @@ public class HouseHelperService {
         }
 
         if(null != tmAgency){
-            result.put("agencyId" , tmAgency.getAgencyUserId());
-            result.put("agencyName" , tmAgency.getName());
-            result.put("agencyStore" , tmAgency.getStore());
-            result.put("agencyTag" , tmAgency.getTag());
-            result.put("agnencyPhone" , tmAgency.getPhone());
-            result.put("agencyHalfYearVolume" , tmAgency.getVolumeHalfYear());
-            result.put("agencyDealAverage" , tmAgency.getDealAveragePeriod());
-            result.put("agencyRecentRecommend" , tmAgency.getRecentRecommendVrs());
+
             result.put("agencyAvatar" , tmAgency.getAvatar());
             result.put("agencyAvatar" , tmAgency.getAvatar());
             result.put("agencyPassImage" , tmAgency.getWorkPassImage());

+ 1 - 1
house-common/src/main/java/com/ljq/house/common/service/UserService.java

@@ -74,7 +74,7 @@ public class UserService {
 
     public int addUserToAgency(TmAgency tmAgency , TmUser tmUser){
         TmAgencyUserRelation tmAgencyUserRelation = new TmAgencyUserRelation();
-        tmAgencyUserRelation.setAgencyId(tmAgency.getAgencyId());
+        tmAgencyUserRelation.setAgencyId(String.valueOf(tmAgency.getAgencyId()));
         tmAgencyUserRelation.setUserId(tmUser.getUserId());
         tmAgencyUserRelation.setUserName(tmUser.getName());
         tmAgencyUserRelation.setUserPhone(tmUser.getPhone());

+ 0 - 2
house-web/pom.xml

@@ -104,8 +104,6 @@
         </dependency>
 
 
-
-
     </dependencies>
 
     <build>

+ 41 - 172
house-web/src/main/java/com/ljq/house/admin/controller/AdminTmAgencyController.java

@@ -1,213 +1,82 @@
 package com.ljq.house.admin.controller;
 
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ljq.house.biz.dao.TmAgencyUserRelationDao;
-import com.ljq.house.biz.dao.TmHouseAgencyRelationDao;
-import com.ljq.house.biz.model.TmHouseAgencyRelation;
-import com.ljq.house.biz.vo.response.TmAgencyRspVo;
-import com.ljq.house.common.exception.CommonBaseException;
-import com.ljq.house.biz.dao.TmAgencyDao;
 import com.ljq.house.biz.model.Result;
 import com.ljq.house.biz.model.TmAgency;
-import com.ljq.house.biz.vo.request.DeleteRequestVo;
-import com.ljq.house.common.enums.IdStarterEnum;
+import com.ljq.house.biz.service.ITmAgencyService;
+import com.ljq.house.biz.vo.request.TmAgencyReqVo;
+import com.ljq.house.biz.vo.response.TmAgencyRspVo;
+import com.ljq.house.biz.vo.util.Page;
 import com.ljq.house.common.enums.ResultCodeEnum;
-import com.ljq.house.common.utils.DataUtils;
-import com.ljq.house.common.utils.UUidGenerator;
-import com.sun.corba.se.spi.orbutil.threadpool.WorkQueue;
-import io.swagger.annotations.*;
+import com.ljq.house.common.exception.CommonBaseException;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
 import lombok.extern.log4j.Log4j2;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.authz.annotation.Logical;
 import org.apache.shiro.authz.annotation.RequiresRoles;
-import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.dao.DuplicateKeyException;
 import org.springframework.stereotype.Controller;
-import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
-import javax.servlet.http.HttpServletRequest;
-import java.util.*;
-
 /**
  * @author abnerhou
- * @date 2020/4/24 13:34
+ * @date 2020/4/24 15:10
  * @desciption
  */
-@Api(description = "管理后台-经纪人管理接口")
+@Api(description = "管理后台-经纪人管理")
 @Controller
-@RequestMapping("admin/agency")
+@RequestMapping("admin/estate")
 @Log4j2
 public class AdminTmAgencyController {
 
-
-    @Autowired
-    private TmAgencyDao tmAgencyDao;
-
     @Autowired
-    private TmHouseAgencyRelationDao tmHouseAgencyRelationDao;
+    private ITmAgencyService iTmAgencyService;
 
-    @Autowired
-    private TmAgencyUserRelationDao tmAgencyUserRelationDao;
-
-
-    @ApiOperation(value = "获取经纪人详情")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "agency_user_id", value = "经纪人ID(32位)", paramType = "query", required = true, dataType = "String")}
-    )
-    @GetMapping("/detail")
+    @ApiOperation(value = "根据条件获取所有经纪人信息 分页 ")
+    @PostMapping("/list")
     @ResponseBody
-    @RequiresRoles(value = {"super_admin","normal_admin"},logical = Logical.OR)
-    public Result getAgencyById(HttpServletRequest req) {
-        String agencyUserId = req.getParameter("agency_user_id");
-        TmAgency tmAgency = tmAgencyDao.selectTmAgencyById(agencyUserId);
-        return Result.success(tmAgency);
+    @RequiresRoles(value = {"super_admin","normal_admin","agency"},logical = Logical.OR)
+    public Result list(@RequestBody TmAgencyReqVo tmAgencyReqVo) {
+        Page<TmAgencyRspVo> tmAgencyRspVoPage = iTmAgencyService.getList(tmAgencyReqVo);
+        return Result.success(tmAgencyRspVoPage);
     }
 
-    @ApiOperation(value = "根据条件拉取经纪人")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "store", value = "门店名称", paramType = "query", required = false, dataType = "String"),
-            @ApiImplicitParam(name = "page_num", value = "当前页码", paramType = "query", required = false, dataType = "Long"),
-            @ApiImplicitParam(name = "page_size", value = "每页大小", paramType = "query", required = false, dataType = "Long"),
-            @ApiImplicitParam(name = "keyword", value = "查询条件", paramType = "query", required = false, dataType = "String"),
-
-    }
-    )
-    @GetMapping("/queryList")
+    @ApiParam(name = "增加经纪人信息",  required = true)
+    @ApiOperation(value = "增加经纪人信息")
+    @PostMapping("/add")
     @ResponseBody
-    @RequiresRoles(value = {"super_admin","normal_admin"},logical = Logical.OR)
-    public Result getQueryList(@RequestParam(name = "store") String store,
-                               @RequestParam(name = "keyword") String keyword,
-                               @RequestParam(name = "page_num") Long pageNum,
-                               @RequestParam(name = "page_size") Long pageSize) {
-        QueryWrapper<TmAgency> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("enable" , 1);
-        queryWrapper.orderByDesc("create_time");
-        queryWrapper.groupBy("agency_user_id");
-        Map<String, Object> constantReq = new HashMap<>();
-        if(StringUtils.isNotBlank(store)){
-            constantReq.put("agency.store", store);
-        }
-        //keyword是动态查询条件,动态去匹配agency_user_id 、 name 、phone这三个字段,因为是用了like操作,所以需要添加索引
-        //TODO:防止慢查询
-        DataUtils.assembleTimeQueryWrapper(constantReq, keyword, queryWrapper, "agency_user_id", "name", "phone");
-
-        //页面配置入参
-        Page<TmAgency> page = new Page(pageNum, pageSize);
-        //页面配置出参
-        IPage<TmAgency> resultPage = new Page<>();
-        IPage<TmAgencyRspVo> totalResult = new Page<>();
-
-        resultPage = tmAgencyDao.selectPage(page, queryWrapper);
-        List<TmAgencyRspVo> listAgency = new ArrayList<>();
-        if(!CollectionUtils.isEmpty(resultPage.getRecords())){
-            for (TmAgency tmAgency : resultPage.getRecords()){
-                   TmAgencyRspVo tmAgencyRspVo = new TmAgencyRspVo();
-                   BeanUtils.copyProperties(tmAgency , tmAgencyRspVo);
-                   //单独去获取关联的房源数、用户数
-                   tmAgencyRspVo.setHouseNum(tmHouseAgencyRelationDao.countRelationHouse(tmAgency.getAgencyUserId()));
-                   tmAgencyRspVo.setUserNum(tmAgencyUserRelationDao.countRelationUser(tmAgency.getAgencyUserId()));
-                   listAgency.add(tmAgencyRspVo);
-            }
-        }
-
-        totalResult.setRecords(listAgency);
-        totalResult.setTotal(resultPage.getTotal());
-        totalResult.setPages(resultPage.getPages());
-        totalResult.setCurrent(resultPage.getCurrent());
-        totalResult.setSize(resultPage.getSize());
-        return Result.success(DataUtils.assembleResult(totalResult.getTotal(), totalResult.getPages(),
-                totalResult.getCurrent(), totalResult.getRecords()));
+    @RequiresRoles(value = {"super_admin","normal_admin","agency"},logical = Logical.OR)
+    public Result addEstate(@RequestBody TmAgency tmAgency) {
+        return Result.success(iTmAgencyService.insert(tmAgency));
     }
 
-    private int getRelationHouseNum(TmAgency tmAgency){
-        if(null != tmAgency){
-
-        }
-        return 0;
-    }
-
-
-    @ApiOperation(value = "修改经纪人信息")
+    @ApiParam(name = "更新经纪人信息",  required = true)
+    @ApiOperation(value = "更新经纪人信息")
     @PostMapping("/update")
     @ResponseBody
-    @RequiresRoles(value = {"super_admin","normal_admin"},logical = Logical.OR)
-    public Result update(@RequestBody @ApiParam(name = "经纪人对象", value = "传入json格式", required = true) TmAgency tmAgency) {
-        if (null == tmAgency && StringUtils.isBlank(tmAgency.getAgencyUserId())) {
+    @RequiresRoles(value = {"super_admin","normal_admin","agency"},logical = Logical.OR)
+    public Result update(@RequestBody TmAgency tmAgency) {
+        if(tmAgency.getAgencyUserId() == null || StringUtils.isNotEmpty(tmAgency.getAgencyUserId())){
             throw new CommonBaseException(ResultCodeEnum.D017);
         }
-        UpdateWrapper<TmAgency> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.eq("agency_user_id" , tmAgency.getAgencyUserId());
-        updateWrapper.last("limit 1");
-        TmAgency dbAgency = tmAgencyDao.selectOne(updateWrapper);
-        if(null == dbAgency){
-            throw new CommonBaseException(ResultCodeEnum.D033);
-        }
-        tmAgency.setLastModifyDatetime(new Date());
-        int result = tmAgencyDao.update(tmAgency  , updateWrapper);
-        return result == 1 ? Result.success("更新经纪人数据成功") : Result.failure("更新经纪人数据失败");
+        return Result.success(iTmAgencyService.update(tmAgency));
     }
 
-
-    @ApiOperation(value = "新增经纪人")
-    @PostMapping("/add")
+    @ApiParam(name = "删除房源信息",  required = true)
+    @ApiOperation(value = "删除房源信息")
+    @PostMapping("/del")
     @ResponseBody
-    @RequiresRoles(value = {"super_admin","normal_admin"},logical = Logical.OR)
-    public Result addAgency(@RequestBody @ApiParam(name = "经纪人对象", value = "传入json格式", required = true) TmAgency tmAgency) {
-        boolean result = false;
-        String agencyUserId = UUidGenerator.generatorUuid(IdStarterEnum.AGENCY.getStarter());
-        if (null != tmAgency) {
-            if (StringUtils.isBlank(tmAgency.getPhone())) {
-                throw new CommonBaseException(ResultCodeEnum.D022);
-            }
-            QueryWrapper<TmAgency> queryWrapper = new QueryWrapper<>();
-            queryWrapper.eq("phone", tmAgency.getPhone());
-            queryWrapper.last("limit 1");
-            TmAgency dbAg = tmAgencyDao.selectOne(queryWrapper);
-            if (null != dbAg) {
-                throw new CommonBaseException(ResultCodeEnum.D021);
-            } else {
-                tmAgency.setAgencyUserId(agencyUserId);
-                try {
-                    tmAgency.setCreateTime(new Date());
-                    tmAgency.setLastModifyDatetime(new Date());
-                    tmAgency.setEnable(1);
-                    int insert = tmAgencyDao.insert(tmAgency);
-                    if (insert == 1) {
-                        result = true;
-                        log.info("成功插入经纪人[{}]数据", agencyUserId);
-                    }
-                } catch (Exception e) {
-                    if (e instanceof DuplicateKeyException) {
-                        log.error("一个手机号[{}]只可以绑定一个经纪人", tmAgency.getPhone());
-                    }
-                }
-            }
-        } else {
-            log.warn("数据非法,无法新增经纪人");
+    @RequiresRoles(value = {"super_admin","normal_admin","agency"},logical = Logical.OR)
+    public Result update(@RequestParam String agencyUserId) {
+        if(agencyUserId == null || StringUtils.isNotEmpty(agencyUserId)){
+            throw new CommonBaseException(ResultCodeEnum.D017);
         }
-        return result ? Result.success("新增经纪人成功", agencyUserId) : Result.failure("新增经纪人失败");
+        return Result.success(iTmAgencyService.del(agencyUserId));
     }
 
-    @ApiOperation(value = "删除经纪人")
-    @PostMapping("/delete")
-    @ResponseBody
-    @RequiresRoles(value = {"super_admin","normal_admin"},logical = Logical.OR)
-    public Result delete(@RequestBody @ApiParam(name = "删除请求体", value = "传入json格式", required = true) DeleteRequestVo requestVo) {
 
-        if(!CollectionUtils.isEmpty(requestVo.getStrIds())){
-            for (String id : requestVo.getStrIds()){
-                UpdateWrapper<TmAgency> updateWrapper = new UpdateWrapper<>();
-                TmAgency tmAgency = new TmAgency();
-                tmAgency.setEnable(0);
-                updateWrapper.eq("agency_user_id" , id);
-                tmAgencyDao.update(tmAgency , updateWrapper);
-            }
-        }
-        return Result.success("删除成功");
-    }
+
+
+
 }

+ 9 - 0
house-web/src/main/java/com/ljq/house/admin/controller/AdminTmEstateController.java

@@ -7,9 +7,12 @@ import com.ljq.house.biz.model.Result;
 import com.ljq.house.biz.vo.response.TmEstateRspVo;
 import com.ljq.house.biz.vo.util.Page;
 import com.ljq.house.common.enums.IdStarterEnum;
+import com.ljq.house.common.enums.ResultCodeEnum;
+import com.ljq.house.common.exception.CommonBaseException;
 import com.ljq.house.common.utils.UUidGenerator;
 import io.swagger.annotations.*;
 import lombok.extern.log4j.Log4j2;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.authz.annotation.Logical;
 import org.apache.shiro.authz.annotation.RequiresRoles;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -56,6 +59,9 @@ public class AdminTmEstateController {
     @ResponseBody
     @RequiresRoles(value = {"super_admin","normal_admin","agency"},logical = Logical.OR)
     public Result update(@RequestBody TmEstate tmEstate) {
+        if(tmEstate.getEstateId() == null || StringUtils.isNotEmpty(tmEstate.getEstateId())){
+            throw new CommonBaseException(ResultCodeEnum.D017);
+        }
         return Result.success(iTmEstateService.update(tmEstate));
     }
 
@@ -65,6 +71,9 @@ public class AdminTmEstateController {
     @ResponseBody
     @RequiresRoles(value = {"super_admin","normal_admin","agency"},logical = Logical.OR)
     public Result update(@RequestParam String estateId) {
+        if(estateId == null || StringUtils.isNotEmpty(estateId)){
+            throw new CommonBaseException(ResultCodeEnum.D017);
+        }
         return Result.success(iTmEstateService.del(estateId));
     }
 

+ 0 - 520
house-web/src/main/java/com/ljq/house/admin/controller/AdminTmHouseController.java

@@ -1,520 +0,0 @@
-package com.ljq.house.admin.controller;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ljq.house.biz.dao.TmAgencyDao;
-import com.ljq.house.biz.dao.TmHouseAgencyRelationDao;
-import com.ljq.house.biz.dao.TmHouseDao;
-import com.ljq.house.biz.model.*;
-import com.ljq.house.biz.vo.request.DeleteRequestVo;
-import com.ljq.house.biz.vo.request.HouseAttachAgencyChange;
-import com.ljq.house.biz.vo.request.HouseAttachAgencyVO;
-import com.ljq.house.biz.vo.request.RequestScene;
-import com.ljq.house.common.enums.IdStarterEnum;
-import com.ljq.house.common.enums.ResultCodeEnum;
-import com.ljq.house.common.exception.CommonBaseException;
-import com.ljq.house.common.utils.*;
-import io.swagger.annotations.*;
-import lombok.extern.log4j.Log4j2;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.shiro.authz.annotation.Logical;
-import org.apache.shiro.authz.annotation.RequiresRoles;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.dao.DuplicateKeyException;
-import org.springframework.stereotype.Controller;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.servlet.http.HttpServletRequest;
-import java.io.*;
-import java.sql.SQLIntegrityConstraintViolationException;
-import java.util.*;
-import java.util.prefs.BackingStoreException;
-
-/**
- * @author abnerhou
- * @date 2020/4/23 17:25
- * @desciption
- */
-@Api(description = "管理后台-房源管理接口")
-@Controller
-@RequestMapping("/admin/house")
-@Log4j2
-public class AdminTmHouseController {
-
-
-    @Autowired
-    private TmHouseDao tmHouseDao;
-
-    @Autowired
-    private TmAgencyDao tmAgencyDao;
-
-    @Autowired
-    private TmHouseAgencyRelationDao houseAgencyRelationDao;
-
-    @Autowired
-    private UploadToOssUtil uploadToOssUtil;
-
-    @Autowired
-    private OssCheckPointUploadUtil ossCheckPointUploadUtil;
-
-    @Value("${oss.image.file.path}")
-    private String ossImagePath;
-
-    @Value("${oss.video.file.path}")
-    private String ossVideoPath;
-
-    @Value("${video-file-path}")
-    private String videoLocalBackupPath;
-
-    @Value("${oss.point}")
-    private String endpoint;
-
-    @Value("${oss.bucket}")
-    private String bucketName;
-
-    @Value("${oss.query.url}")
-    private String ossQueryUrl;
-
-    @Value("${4dkankan.host}")
-    private String kankanHost;
-
-    @Value("${file-backup-path}")
-    private String imageFilePath;
-
-    @Value("${user.wx.app.id}")
-    private String userWxAppId;
-
-    @Value("${user.wx.app.secret}")
-    private String userWxAppSecret;
-
-    @Value("${4dkankan.vr.house.path}")
-    private String vrHousePath;
-
-    @Autowired
-    private TmHouseAgencyRelationDao tmHouseAgencyRelationDao;
-
-    @ApiOperation(value = "获取房源详情")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "house_id", value = "房源ID(32位)", paramType = "query", required = true, dataType = "String")}
-    )
-    @GetMapping("/house")
-    @ResponseBody
-    @RequiresRoles(value = {"super_admin","normal_admin","agency"},logical = Logical.OR)
-    public Result getHousesDetailById(HttpServletRequest req) {
-        String houseId = req.getParameter("house_id");
-        if (StringUtils.isBlank(houseId)) {
-            throw new CommonBaseException(ResultCodeEnum.D023);
-        }
-        TmHouse tmHouse = tmHouseDao.selectHouseById(houseId);
-        if(null != tmHouse && 1 != tmHouse.getEnable()){
-            return Result.failure("该房源已经被删除");
-        }
-        return Result.success(tmHouse);
-    }
-
-    @ApiOperation(value = "修改房源信息")
-    @PostMapping("/update")
-    @ResponseBody
-    @RequiresRoles(value = {"super_admin","normal_admin","agency"},logical = Logical.OR)
-    public Result updateHouseInfo(@RequestBody @ApiParam(name = "房源对象", value = "传入json格式", required = true) TmHouse tmHouse) {
-        if (null == tmHouse || StringUtils.isBlank(tmHouse.getHouseId())) {
-            throw new CommonBaseException(ResultCodeEnum.D017);
-        }
-        QueryWrapper<TmHouse> houseQueryWrapper = new QueryWrapper<>();
-        houseQueryWrapper.eq("house_id" , tmHouse.getHouseId());
-        houseQueryWrapper.last("limit 1");
-        TmHouse dbHouse = tmHouseDao.selectOne(houseQueryWrapper);
-        if(null == dbHouse){
-            throw new CommonBaseException(ResultCodeEnum.D017 , "房源不存在,无需更新");
-        }
-        int result = -1;
-        try{
-            result = tmHouseDao.updateByIdSelectively(tmHouse);
-        }catch (Exception e){
-            if(e instanceof DuplicateKeyException){
-                return  Result.failure("请检查场景码是否已经绑定过房源了");
-            }else{
-                Result.failure("修改房源信息失败,请检查数据是否有重复");
-            }
-            log.info("修改房源出现异常:{}" , e);
-        }
-
-        return result == 1 ? Result.success("修改房源信息成功") : Result.failure("修改房源信息失败");
-    }
-
-    @ApiOperation(value = "关联经纪人(新增)")
-    @PostMapping("/attachAgency")
-    @ResponseBody
-    @Transactional(rollbackFor = Exception.class)
-    @RequiresRoles(value = {"super_admin","normal_admin","agency"},logical = Logical.OR)
-    public Result attachAgency(@RequestBody @ApiParam(name = "房源关联经纪人请求体", value = "传入json格式", required = true) HouseAttachAgencyVO houseAttachAgencyVO) {
-        if (null == houseAttachAgencyVO) {
-            throw new CommonBaseException(ResultCodeEnum.D017);
-        }
-        TmAgency tmAgency = tmAgencyDao.selectTmAgencyById(houseAttachAgencyVO.getAgencyUserId());
-        if (null == tmAgency || 1 != tmAgency.getEnable()) {
-            throw new CommonBaseException(ResultCodeEnum.D033);
-        }
-        List<String> houseIds = houseAttachAgencyVO.getHouseIds();
-        if (CollectionUtils.isEmpty(houseIds)) {
-            throw new CommonBaseException(ResultCodeEnum.D023);
-        }
-        for (String houseId : houseIds) {
-            TmHouse house = tmHouseDao.selectHouseById(houseId);
-            if (null != house) {
-                insertHouseAgencyRelation(house , tmAgency);
-                house.setDistributeStatus(1);
-                int updateResult = tmHouseDao.updateByIdSelectively(house);
-                if (updateResult != 1) {
-                    log.info("关联房源:{}到经纪人:{}失败,全部回滚db操作", houseId, tmAgency.getAgencyUserId());
-                    throw new CommonBaseException(ResultCodeEnum.D100);
-                }
-            }
-        }
-        return Result.success("关联房源成功");
-    }
-    
-    public void insertHouseAgencyRelation(TmHouse tmHouse, TmAgency tmAgency){
-        TmHouseAgencyRelation houseAgencyRelation = new TmHouseAgencyRelation();
-        houseAgencyRelation.setHouseId(tmHouse.getHouseId());
-        houseAgencyRelation.setEstateId(tmHouse.getEstateId());
-        houseAgencyRelation.setAgencyUserId(tmAgency.getAgencyUserId());
-        houseAgencyRelation.setName(tmAgency.getName());
-        houseAgencyRelation.setVrScene(tmHouse.getSceneNum());
-        houseAgencyRelation.setCreateTime(new Date());
-        houseAgencyRelation.setLastModifyDatetime(new Date());
-        houseAgencyRelation.setVrScene(tmHouse.getSceneNum());
-        houseAgencyRelation.setIsValid(1);
-        int insertResult = houseAgencyRelationDao.insert(houseAgencyRelation);
-        if (insertResult != 1) {
-            log.info("关联房源:{}到经纪人:{}失败,全部回滚db操作", tmHouse.getHouseId(), tmAgency.getAgencyUserId());
-            throw new CommonBaseException(ResultCodeEnum.D100);
-        }
-    }
-
-    @ApiOperation(value = "关联经纪人(修改)")
-    @PostMapping("/changeAgency")
-    @ResponseBody
-    @Transactional(rollbackFor = Exception.class)
-    @RequiresRoles(value = {"super_admin","normal_admin","agency"},logical = Logical.OR)
-    public Result changeAttachAgency(@RequestBody @ApiParam(name = "修改房源关联经纪人请求体", value = "传入json格式", required = true) HouseAttachAgencyChange houseAttachAgencyChange) {
-        if (null == houseAttachAgencyChange) {
-            throw new CommonBaseException(ResultCodeEnum.D017);
-        }
-        TmAgency tmAgencyOld = tmAgencyDao.selectTmAgencyById(houseAttachAgencyChange.getAgencyUserIdOld());
-        if (null == tmAgencyOld || 1 != tmAgencyOld.getEnable()) {
-            throw new CommonBaseException(ResultCodeEnum.D033);
-        }
-        TmAgency tmAgencyNew = tmAgencyDao.selectTmAgencyById(houseAttachAgencyChange.getAgencyUserIdNew());
-        if (null == tmAgencyNew || 1 != tmAgencyNew.getEnable()) {
-            throw new CommonBaseException(ResultCodeEnum.D033);
-        }
-        if (StringUtils.isBlank( houseAttachAgencyChange.getHouseId())) {
-            throw new CommonBaseException(ResultCodeEnum.D023);
-        }
-        TmHouse house = tmHouseDao.selectHouseById(houseAttachAgencyChange.getHouseId());
-        if (null != house) {
-                //先删除旧的关联关系如果存在
-                QueryWrapper<TmHouseAgencyRelation> queryWrapper = new QueryWrapper<>();
-                queryWrapper.eq("agency_user_id" , tmAgencyOld.getAgencyUserId());
-                queryWrapper.eq("house_id" , house.getHouseId());
-                queryWrapper.last("limit 1");
-                TmHouseAgencyRelation oldRelation = houseAgencyRelationDao.selectOne(queryWrapper);
-                if(null != oldRelation){
-                    int delete = houseAgencyRelationDao.delete(queryWrapper);
-                    if(delete != 1){
-                        log.error("删除经纪人[{}]-房源[{}]的关系失败",tmAgencyOld.getAgencyUserId() , house.getHouseId());
-                    }
-                }
-                //新插一个经纪人房源管理关系
-                insertHouseAgencyRelation(house , tmAgencyNew);
-                house.setDistributeStatus(1);
-                int updateResult = tmHouseDao.updateByIdSelectively(house);
-                if (updateResult != 1) {
-                    log.info("关联房源:{}到经纪人:{}失败,全部回滚db操作", houseAttachAgencyChange.getHouseId(), tmAgencyOld.getAgencyUserId());
-                    throw new CommonBaseException(ResultCodeEnum.D100);
-                }
-        }
-        return Result.success("关联房源成功");
-    }
-
-    @ApiOperation(value = "上传视频")
-    @PostMapping("/upLoadVideo")
-    @ResponseBody
-    @RequiresRoles(value = {"super_admin","normal_admin","agency"},logical = Logical.OR)
-    public Result uploadIntroduceVideo(@RequestParam("file") MultipartFile file) {
-        if (null == file) {
-            throw new CommonBaseException(ResultCodeEnum.D017);
-        }
-        String downLoanVideoPath = FileUtils.parseFile(file , videoLocalBackupPath);
-        log.info("视频文件已经下载到本地:{}" ,downLoanVideoPath);
-        //视频文件名一般为:xxx.mp4这种格式
-        String videoFilePureName = file.getOriginalFilename();
-        log.info("视频文件名为:{}" ,videoFilePureName);
-        //去掉格式,只获取纯名字
-        int index = videoFilePureName.indexOf(".mp4");
-        //获取纯名字
-        if(index != -1){
-            videoFilePureName = videoFilePureName.substring(0 , index);
-        }else{
-            Random random = new Random();
-            videoFilePureName = "default_imag_" + random.nextInt(10000);
-            log.info("采用默认的图片名字:{}" ,videoFilePureName);
-        }
-        //这里默认第一帧图片是jpg格式
-        String imageFormatter = "jpg";
-        //视频在oss中的object name
-        String imageOssObjectName = ossVideoPath  + videoFilePureName + "." + imageFormatter;
-        //截取视频第一帧图片
-        boolean cutFirstImageResult = FileUtils.executeCodecs(downLoanVideoPath , videoLocalBackupPath ,
-                videoFilePureName, imageFormatter);
-
-        if(cutFirstImageResult){
-            log.info("成功截取第一帧图片,将上传到oss上");
-            String imageLocalPath = videoLocalBackupPath + videoFilePureName + "." + imageFormatter;
-            uploadToOssUtil.uploadThenDelete(imageLocalPath , imageOssObjectName);
-            log.info("上传第一帧图片到oss完成");
-        }
-
-        String videoObjectName = ossVideoPath  + file.getOriginalFilename();
-        ossCheckPointUploadUtil.doUploadThenDelete(downLoanVideoPath , videoObjectName);
-
-        Map<String , Object> resultMap = new HashMap<>();
-        resultMap.put("image" , ossQueryUrl  + imageOssObjectName);
-        resultMap.put("video" , ossQueryUrl  + videoObjectName);
-        return Result.success("视频文件上传oss结束" , resultMap);
-    }
-
-
-    @ApiOperation(value = "新增房源")
-    @PostMapping(value = "/add")
-    @ResponseBody
-    @RequiresRoles(value = {"super_admin","normal_admin","agency"},logical = Logical.OR)
-    public Result addHouse(@RequestBody @ApiParam(name = "房源对象", value = "传入json格式", required = true) TmHouse tmHouse) {
-
-        boolean result = false;
-        String houseId = UUidGenerator.generatorUuid(IdStarterEnum.HOUSE.getStarter());
-        if (null != tmHouse) {
-            if (StringUtils.isBlank(tmHouse.getAddress())) {
-                throw new CommonBaseException(ResultCodeEnum.D024);
-            }
-            //管控一个场景只能绑定一个房源
-            if(StringUtils.isNoneBlank(tmHouse.getSceneNum())){
-                QueryWrapper<TmHouse> queryWrapper = new QueryWrapper<>();
-                queryWrapper.eq("scene_num", tmHouse.getSceneNum());
-                queryWrapper.last("limit 1");
-                TmHouse dbhouse = tmHouseDao.selectOne(queryWrapper);
-                if (null != dbhouse) {
-                    throw new CommonBaseException(ResultCodeEnum.D025);
-                }
-            }
-            if(StringUtils.isNoneBlank(tmHouse.getVrLink())){
-                String qrCodeUrl = "/pages/web/web?vr_link=" + tmHouse.getVrLink();
-                //生成带看页面的二维码
-                String imageLocalPath = imageFilePath + houseId + "_QRCode.png";
-                WxOpUtils.getWxQRCode(qrCodeUrl , userWxAppId  ,userWxAppSecret , imageLocalPath);
-                String ossPath = ossImagePath +  houseId + "_QRCode.png";
-                ossCheckPointUploadUtil.upload2(imageLocalPath , ossPath);
-                String imageTotalOssUrl = ossQueryUrl + ossPath;
-                tmHouse.setWxAqrCode(imageTotalOssUrl);
-                File file = new File(imageLocalPath);
-                if(file.exists()){
-                    //删除本地缓存的二维码
-                    file.delete();
-                }
-            }
-            tmHouse.setHouseId(houseId);
-            tmHouse.setDistributeStatus(0);
-            tmHouse.setCreateTime(new Date());
-            tmHouse.setLastModifyDatetime(new Date());
-            tmHouse.setEnable(1);
-            tmHouse.setQueryNum(0l);
-            int insert = tmHouseDao.insert(tmHouse);
-            if (insert == 1) {
-                result = true;
-                log.info("成功插入房源[{}]数据", houseId);
-            } else {
-                log.info("插入房源失败:{}", insert);
-            }
-
-        } else {
-            log.warn("数据非法,无法新增房源");
-        }
-        return result ? Result.success("新增房源成功", houseId) : Result.failure("新增房源失败");
-    }
-
-    @ApiOperation(value = "根据条件获取未分配的房源")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "sale_type", value = "类型", paramType = "query", required = true, dataType = "Integer"),
-            @ApiImplicitParam(name = "query_name", value = "搜索条件(房源ID/名称/楼盘)", paramType = "query", required = true, dataType = "String")}
-    )
-    @GetMapping("/queryHouse")
-    @ResponseBody
-//    @RequiresPermissions("admin:house:queryHouse")
-    @RequiresRoles(value = {"super_admin","normal_admin","agency"},logical = Logical.OR)
-    public Result queryUnDistributeHouse(@RequestParam(name = "sale_type") Integer saleType,
-                                         @RequestParam(name = "query_name") String queryName,
-                                         @RequestParam(name = "page_num") Long pageNum,
-                                         @RequestParam(name = "page_size") Long pageSize
-    ) {
-
-        QueryWrapper<TmHouse> queryWrapper = new QueryWrapper<>();
-        Page<TmHouse> page = new Page(pageNum, pageSize);
-        IPage<TmHouse> resultPage = new Page<>();
-        Map<String, Object> constantQuery = new HashMap<>();
-        if (null != saleType) {
-            constantQuery.put("sale_type", saleType);
-        }
-        //只捞取未分配的房源
-        constantQuery.put("distribute_status", 0);
-        //只捞未删除的数据
-        constantQuery.put("enable", 1);
-        resultPage = timesQueryHouse(constantQuery, queryName, page, queryWrapper,
-                "house_id", "title", "estate_name");
-
-        return Result.success(DataUtils.assembleResult(resultPage.getTotal(), resultPage.getPages(),
-                resultPage.getCurrent(), resultPage.getRecords()));
-    }
-
-
-    @ApiOperation(value = "根据条件获取所有房源")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "estate_name", value = "楼盘名称", paramType = "query", required = true, dataType = "String"),
-            @ApiImplicitParam(name = "sale_type", value = "类型", paramType = "query", required = true, dataType = "Integer"),
-            @ApiImplicitParam(name = "page_num", value = "当前页码", paramType = "query", required = true, dataType = "Long"),
-            @ApiImplicitParam(name = "page_size", value = "每页大小", paramType = "query", required = true, dataType = "Long"),
-            @ApiImplicitParam(name = "query_name", value = "搜索条件(房源ID/名称/楼盘)", paramType = "query", required = true, dataType = "String")}
-    )
-    @GetMapping("/queryAll")
-    @ResponseBody
-//    @RequiresPermissions("admin:house:queryAll")
-    @RequiresRoles(value = {"super_admin","normal_admin","agency"},logical = Logical.OR)
-    public Result queryAllHouse(@RequestParam(name = "estate_name") String estateName,
-                                @RequestParam(name = "sale_type") Integer saleType,
-                                @RequestParam(name = "query_name") String queryName,
-                                @RequestParam(name = "page_num") Long pageNum,
-                                @RequestParam(name = "page_size") Long pageSize) {
-
-        QueryWrapper<TmHouse> houseQueryWrapper = new QueryWrapper<>();
-        //只捞取未删除的数据
-        houseQueryWrapper.eq("a.enable" , 1);
-        Page<TmHouse> page = new Page(pageNum, pageSize);
-        IPage<Map<String ,Object>> resultPage = new Page<>();
-        Map<String, Object> constantQuery = new HashMap<>();
-        if (null != saleType) {
-            constantQuery.put("a.sale_type", saleType);
-        }
-        if (StringUtils.isNotBlank(estateName)) {
-            constantQuery.put("a.estate_name", estateName);
-        }
-
-        DataUtils.assembleTimeQueryWrapper(constantQuery, queryName, houseQueryWrapper, "a.house_id", "a.title", "a.name");
-
-        houseQueryWrapper.orderByDesc("a.create_time");
-
-        resultPage = tmHouseDao.selectHouseInfoList(page, houseQueryWrapper);
-
-        return Result.success(DataUtils.assembleResult(resultPage.getTotal(), resultPage.getPages(),
-                resultPage.getCurrent(), resultPage.getRecords()));
-    }
-
-    private IPage<TmHouse> timesQueryHouse(Map<String, Object> constantQuery, String dynamicQuery,
-                                           Page page, QueryWrapper<TmHouse> queryWrapper,
-                                           String idQuery, String secondQuery, String thirdQuery) {
-        IPage<TmHouse> resultPage = new Page<>();
-        DataUtils.assembleTimeQueryWrapper(constantQuery, dynamicQuery, queryWrapper, idQuery, secondQuery, thirdQuery);
-        resultPage = tmHouseDao.selectPage(page, queryWrapper);
-        return resultPage;
-    }
-    @ApiOperation(value = "获取客户所有的场景列表")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "page_num", value = "当前页码", paramType = "query", required = true, dataType = "Long"),
-            @ApiImplicitParam(name = "page_size", value = "每页大小", paramType = "query", required = true, dataType = "Long")}
-    )
-    @PostMapping("/getAllScene")
-    @ResponseBody
-    @RequiresRoles(value = {"super_admin","normal_admin","agency"},logical = Logical.OR)
-    public Result getAllScene( @RequestBody @ApiParam(name = "房源对象", value = "传入json格式", required = true) RequestScene requestScene) {
-        if (null == requestScene || StringUtils.isBlank(requestScene.getToken())) {
-            throw new CommonBaseException(ResultCodeEnum.D017);
-        }
-        if(requestScene.getPageNum() == 0){
-            //看看的页码从1开始算起
-            requestScene.setPageNum(1);
-        }
-        String url = kankanHost + "/scene/list";
-        Map<String , Object> headers = new HashMap<>();
-        headers.put("token" , requestScene.getToken());
-        String kankanResult = HttpClientUtil.doPostJsonWithHeader(url, JSON.toJSONString(requestScene), headers);
-        //把信息封装为json
-        JSONObject res = JSONObject.parseObject(kankanResult);
-        if(null != res){
-            log.info("看看获取场景列表返回:{}", res.toJSONString());
-            int code = -10;
-            if(res.containsKey("code")){
-                code = (int) res.get("code");
-                if(code != 0){
-                    Result.failure("调用看看失败" );
-                }
-            }else{
-                Result.failure("调用看看失败" );
-            }
-        }else{
-            Result.failure("调用看看失败" );
-        }
-        return Result.success("获取场景结束" , res.get("data"));
-    }
-
-    @ApiOperation(value = "删除房源")
-    @PostMapping("/delete")
-    @ResponseBody
-    @RequiresRoles(value = {"super_admin","normal_admin","agency"},logical = Logical.OR)
-    @Transactional(rollbackFor = Exception.class)
-    public Result delete(@RequestBody @ApiParam(name = "删除请求体", value = "传入json格式", required = true)
-                                     DeleteRequestVo requestVo) {
-
-        if(!CollectionUtils.isEmpty(requestVo.getStrIds())){
-            for (String id : requestVo.getStrIds()){
-                if(StringUtils.isNotBlank(id)){
-                    UpdateWrapper<TmHouse> updateWrapper = new UpdateWrapper<>();
-                    TmHouse tmHouse = new TmHouse();
-                    tmHouse.setEnable(0);
-                    updateWrapper.eq("house_id" , id);
-                    tmHouseDao.update(tmHouse , updateWrapper);
-                    //TODO:删除房源经纪人关系
-                    QueryWrapper<TmHouseAgencyRelation> relationQueryWrapper = new QueryWrapper<>();
-                    relationQueryWrapper.eq("house_id" , id);
-                    //目前一个房源只会绑定一个经纪人
-                    relationQueryWrapper.last("limit 1000");
-                    List<TmHouseAgencyRelation> houseAgencyRelationList = tmHouseAgencyRelationDao.selectList(relationQueryWrapper);
-                    if(!CollectionUtils.isEmpty(houseAgencyRelationList)){
-                        for (TmHouseAgencyRelation relation : houseAgencyRelationList){
-                            UpdateWrapper<TmHouseAgencyRelation> relationUpdateWrapper = new UpdateWrapper<>();
-                            relationUpdateWrapper.eq("house_id" , id);
-                            relationUpdateWrapper.eq("agency_user_id" , relation.getAgencyUserId());
-                            relationUpdateWrapper.last("limit 1");
-                            relation.setIsValid(0);
-                            relation.setLastModifyDatetime(new Date());
-                            int updateRelation = tmHouseAgencyRelationDao.update(relation , relationUpdateWrapper);
-                            if(updateRelation != 1){
-                                throw new CommonBaseException(ResultCodeEnum.D101, "删除房源经纪人关联关系失败");
-                            }
-                        }
-                    }
-
-                }
-
-            }
-        }
-        return Result.success("删除成功");
-    }
-
-}

+ 3 - 4
house-web/src/main/java/com/ljq/house/app/controller/AppAgencyController.java

@@ -96,8 +96,7 @@ public class AppAgencyController {
                 UpdateWrapper<TmAgency> updateWrapper = new UpdateWrapper<>();
                 updateWrapper.eq("agency_user_id" ,dbAgency.getAgencyUserId());
                 updateWrapper.last("limit 1");
-                dbAgency.setLastModifyDatetime(new Date());
-                dbAgency.setWxOpenId(wxOpenId);
+                dbAgency.setUpdateTime(new Date());
                 int update = tmAgencyDao.update(dbAgency , updateWrapper);
                 if(update != 1){
                     log.error("更新经纪人:{}的微信openid失败" ,dbAgency.getAgencyUserId());
@@ -310,8 +309,8 @@ public class AppAgencyController {
         //TODO:分页处理
         String houseId = req.getParameter("house_id");
         //TODO:如果加了分页,mapper.xml里面的limit语句要去掉
-        List<TmAgency> tmAgencyList = tmAgencyDao.selectTmAgencyByHouseId(houseId);
-        return Result.success(tmAgencyList);
+        TmAgency tmAgency = tmAgencyDao.selectTmAgencyByHouseId(houseId);
+        return Result.success(tmAgency);
     }
 
 }