瀏覽代碼

bug修复

by su 4 年之前
父節點
當前提交
3e9e4a9a71

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

@@ -29,6 +29,8 @@ public interface TmAgencyUserRelationDao extends BaseMapper<TmAgencyUserRelation
 
     public TmAgencyUserRelation getAgencyUserDetail(@Param("agencyUserId")String agencyUserId , @Param("userId")String userId);
 
+    public TmAgencyUserRelation getAgencyUserDetail2(@Param("id")Long id);
+
 
     public int countRelationUser(@Param("agencyUserId")String agencyUserId);
 }

+ 5 - 0
house-biz/src/main/java/com/ljq/house/biz/model/TmAgencyUserRelation.java

@@ -1,5 +1,7 @@
 package com.ljq.house.biz.model;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -19,6 +21,9 @@ import java.util.Date;
 @ApiModel(value = "经纪人下的客源对象" , description = "经纪人用户关联关系")
 public class TmAgencyUserRelation extends BaseEntity implements Serializable {
 
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
     @ApiModelProperty(value="经纪人id",name="agency_user_id",example="dfakjlfdsja1232ksa")
     @JsonProperty("agency_user_id")
     private String agencyUserId;

+ 5 - 0
house-biz/src/main/java/com/ljq/house/biz/model/TmHouse.java

@@ -257,4 +257,9 @@ public class TmHouse extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "更新者ID", name = "update_user_id", example = "1")
     @JsonProperty("update_user_id")
     private String updateUserId;
+
+    @ApiModelProperty(value = "是否在小程序上展示: 1->展示;0->不展示", name = "IS_SHOW", example = "1")
+    @JsonProperty("IS_SHOW")
+    private String isShow;
+
 }

+ 1 - 1
house-biz/src/main/java/com/ljq/house/biz/service/ITmCustomerInformationService.java

@@ -15,7 +15,7 @@ import com.ljq.house.biz.vo.util.Page;
  * @author anthor
  * @since 2021-06-08
  */
-public interface ITmCustomerInformationService extends IService<TmCustomerInformation> {
+public interface ITmUserService extends IService<TmCustomerInformation> {
 
     public Page<TmCustomerInformationRspVo> getList(TmCustomerInformationReqVo tmCustomerInformationReqVo);
 

+ 2 - 2
house-biz/src/main/java/com/ljq/house/biz/service/impl/TmCustomerInformationServiceImpl.java

@@ -3,7 +3,7 @@ package com.ljq.house.biz.service.impl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ljq.house.biz.dao.TmCustomerInformationDao;
 import com.ljq.house.biz.model.TmCustomerInformation;
-import com.ljq.house.biz.service.ITmCustomerInformationService;
+import com.ljq.house.biz.service.ITmUserService;
 import com.ljq.house.biz.vo.request.DeleteRequestVo;
 import com.ljq.house.biz.vo.request.TmCustomerInformationReqVo;
 import com.ljq.house.biz.vo.response.TmCustomerInformationRspVo;
@@ -24,7 +24,7 @@ import java.util.List;
  * @since 2021-06-08
  */
 @Service
-public class TmCustomerInformationServiceImpl extends ServiceImpl<TmCustomerInformationDao, TmCustomerInformation> implements ITmCustomerInformationService {
+public class TmUserServiceImpl extends ServiceImpl<TmCustomerInformationDao, TmCustomerInformation> implements ITmUserService {
 
     @Autowired
     private TmCustomerInformationDao tmCustomerInformationDao;

+ 11 - 0
house-biz/src/main/resources/mapper/TmAgencyUserRelationMapper.xml

@@ -124,6 +124,17 @@
         limit 1
     </select>
 
+    <select id="getAgencyUserDetail2" resultType="com.ljq.house.biz.model.TmAgencyUserRelation">
+        select * from tm_agency_user_relation
+        <where>
+            is_valid = 1
+            <if test="id != null and id != '' ">
+                and id = #{id}
+            </if>
+        </where>
+        limit 1
+    </select>
+
     <select id="countRelationUser" resultType="java.lang.Integer">
         select count(*) from tm_agency_user_relation
         <where>

+ 1 - 0
house-biz/src/main/resources/mapper/TmHouseMapper.xml

@@ -130,6 +130,7 @@
             <if test="tmHouse.videoCoverImage != null and tmHouse.videoCoverImage.trim() != ''">`video_cover_image` = #{tmHouse.videoCoverImage},</if>
             <if test="tmHouse.reserve1 != null and tmHouse.reserve1.trim() != ''">`reserve1` = #{tmHouse.reserve1},</if>
             <if test="tmHouse.reserve2 != null and tmHouse.reserve2.trim() != ''">`reserve2` = #{tmHouse.reserve2},</if>
+            <if test="tmHouse.isShow != null ">`IS_SHOW` = #{tmHouse.isShow},</if>
 
             <if test="tmHouse.propertyNumber != null and tmHouse.propertyNumber.trim() != ''">property_number=#{tmHouse.propertyNumber},</if>
             <if test="tmHouse.bedroomAmount != null">bedroom_amount=#{tmHouse.bedroomAmount},</if>

+ 3 - 2
house-web/src/main/java/com/ljq/house/admin/controller/AdminTmAdminController.java

@@ -124,10 +124,11 @@ public class AdminTmAdminController {
         if (null == pageNum || null == pageSize) {
             throw new CommonBaseException(ResultCodeEnum.D017);
         }
+        TmAdmin user = ShiroUtils.getAdmin();
         QueryWrapper<TmAdmin> queryWrapper = new QueryWrapper<>();
-        if(!ShiroUtils.getSubject().hasRole("super_admin")){
+        if(null != user.getType() && user.getType().compareTo(0) != 0){
             //非超级管理员,则需要过滤数据
-            TmAdmin user = ShiroUtils.getAdmin();
+//            TmAdmin user1 = ShiroUtils.getAdmin();
             if(user == null){
                 log.error("用户未登录,登录");
                 throw new CommonBaseException(ResultCodeEnum.D101 , "未登录,请登录");

+ 7 - 0
house-web/src/main/java/com/ljq/house/admin/controller/AdminTmStoreController.java

@@ -17,6 +17,8 @@ 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.bouncycastle.util.Store;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -46,6 +48,7 @@ public class AdminTmStoreController {
     @ApiOperation(value = "新增门店")
     @PostMapping("/add")
     @ResponseBody
+    @RequiresRoles(value = {"super_admin","normal_admin"},logical = Logical.OR)
     public Result add(@RequestBody @ApiParam(name = "门店对象", value = "传入json格式", required = true) TmStore tmStore) {
         if (null == tmStore || StringUtils.isBlank(tmStore.getName()) || null == tmStore.getAddress()) {
             throw new CommonBaseException(ResultCodeEnum.D017);
@@ -71,6 +74,7 @@ public class AdminTmStoreController {
     @ApiOperation(value = "修改门店")
     @PostMapping("/update")
     @ResponseBody
+    @RequiresRoles(value = {"super_admin","normal_admin"},logical = Logical.OR)
     public Result update(@RequestBody @ApiParam(name = "门店对象", value = "传入json格式", required = true) TmStore tmStore) {
         if (null == tmStore || null == tmStore.getId()) {
             throw new CommonBaseException(ResultCodeEnum.D017);
@@ -82,6 +86,7 @@ public class AdminTmStoreController {
     @ApiOperation(value = "根据条件获取门店列表")
     @GetMapping("/queryList")
     @ResponseBody
+    @RequiresRoles(value = {"super_admin","normal_admin"},logical = Logical.OR)
     public Result update(@RequestParam(name = "keyword") String keyword,
                          @RequestParam(name = "page_num") Long pageNum,
                          @RequestParam(name = "page_size") Long pageSize) {
@@ -104,6 +109,7 @@ public class AdminTmStoreController {
     @ApiOperation(value = "获取所有门店列表")
     @GetMapping("/all")
     @ResponseBody
+    @RequiresRoles(value = {"super_admin","normal_admin","sub_normal_admin"},logical = Logical.OR)
     public Result update(@RequestParam(name = "page_num") Long pageNum,
                          @RequestParam(name = "page_size") Long pageSize) {
 
@@ -126,6 +132,7 @@ public class AdminTmStoreController {
     @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.getIntIds())){

+ 10 - 12
house-web/src/main/java/com/ljq/house/admin/controller/AdminTmCustomerInformationController.java

@@ -7,11 +7,8 @@ import com.ljq.house.biz.dao.TmUserDao;
 import com.ljq.house.biz.model.Result;
 import com.ljq.house.biz.model.TmCustomerInformation;
 import com.ljq.house.biz.model.TmUser;
-import com.ljq.house.biz.service.ITmCustomerInformationService;
+import com.ljq.house.biz.service.ITmUserService;
 import com.ljq.house.biz.vo.request.DeleteRequestVo;
-import com.ljq.house.biz.vo.request.TmCustomerInformationReqVo;
-import com.ljq.house.biz.vo.response.TmCustomerInformationRspVo;
-import com.ljq.house.biz.vo.util.Page;
 import com.ljq.house.common.enums.ResultCodeEnum;
 import com.ljq.house.common.exception.CommonBaseException;
 import com.ljq.house.common.utils.DataUtils;
@@ -36,10 +33,10 @@ import org.springframework.web.bind.annotation.*;
 @Api(description = "管理后台-客户信息管理")
 @Controller
 @RequestMapping("admin/user")
-public class AdminTmCustomerInformationController {
+public class AdminTmUserController {
 
     @Autowired
-    private ITmCustomerInformationService iTmCustomerInformationService;
+    private ITmUserService iTmUserService;
 
     @Autowired
     private TmUserDao tmUserDao;
@@ -49,38 +46,39 @@ public class AdminTmCustomerInformationController {
     @ApiOperation(value = "增加客户信息管理")
     @PostMapping("/add")
     @ResponseBody
-    @RequiresRoles(value = {"super_admin","normal_admin","agency"},logical = Logical.OR)
+    @RequiresRoles(value = {"super_admin","normal_admin"},logical = Logical.OR)
     public Result addEstate(@RequestBody TmCustomerInformation tmCustomerInformation) {
-        return Result.success(iTmCustomerInformationService.insert(tmCustomerInformation));
+        return Result.success(iTmUserService.insert(tmCustomerInformation));
     }
 
     @ApiParam(name = "更新客户信息管理",  required = true)
     @ApiOperation(value = "更新客户信息管理")
     @PostMapping("/update")
     @ResponseBody
-    @RequiresRoles(value = {"super_admin","normal_admin","agency"},logical = Logical.OR)
+    @RequiresRoles(value = {"super_admin","normal_admin"},logical = Logical.OR)
     public Result update(@RequestBody TmCustomerInformation tmCustomerInformation) {
         if(tmCustomerInformation.getCustomerInformationId() == null || StringUtils.isEmpty(tmCustomerInformation.getCustomerInformationId())){
             throw new CommonBaseException(ResultCodeEnum.D017);
         }
-        return Result.success(iTmCustomerInformationService.update(tmCustomerInformation));
+        return Result.success(iTmUserService.update(tmCustomerInformation));
     }
 
     @ApiParam(name = "删除客户信息管理",  required = true)
     @ApiOperation(value = "删除客户信息管理")
     @PostMapping("/delete")
     @ResponseBody
-    @RequiresRoles(value = {"super_admin","normal_admin","agency"},logical = Logical.OR)
+    @RequiresRoles(value = {"super_admin","normal_admin"},logical = Logical.OR)
     public Result update(@RequestBody @ApiParam(name = "删除请求体", value = "传入json格式 String", required = true) DeleteRequestVo requestVo) {
         if(requestVo == null || requestVo.getStrIds()==null || requestVo.getStrIds().size() == 0){
             throw new CommonBaseException(ResultCodeEnum.D017);
         }
-        return Result.success(iTmCustomerInformationService.del(requestVo));
+        return Result.success(iTmUserService.del(requestVo));
     }
 
     @ApiOperation(value = "获取用户列表")
     @GetMapping("/queryList")
     @ResponseBody
+    @RequiresRoles(value = {"super_admin","normal_admin"},logical = Logical.OR)
     public Result listWithAuth(@RequestParam(name = "searchKey") String keyword,
                                @RequestParam(name = "page_num") Long pageNum,
                                @RequestParam(name = "page_size") Long pageSize) {

+ 9 - 6
house-web/src/main/java/com/ljq/house/admin/controller/SysDeptController.java

@@ -47,7 +47,6 @@ public class SysDeptController {
     private SysDeptDao sysDeptDao;
 
 
-
     @ApiOperation(value = "新增部门数据")
     @PostMapping(value = "/add")
     @RequiresRoles(value = {"super_admin"},logical = Logical.OR)
@@ -76,7 +75,7 @@ public class SysDeptController {
 
     @ApiOperation(value = "修改部门数据")
     @PostMapping(value = "/update")
-    @RequiresRoles(value = {"super_admin", "normal_admin"},logical = Logical.OR)
+    @RequiresRoles(value = {"super_admin"},logical = Logical.OR)
     @ResponseBody
     public Result updateDept(@RequestBody @ApiParam(name = "部门信息对象", value = "传入json格式", required = true) SysDept sysDept) {
 
@@ -117,7 +116,7 @@ public class SysDeptController {
     @ApiOperation(value = "获取部门列表")
     @GetMapping(value = "/list")
     @ResponseBody
-    @RequiresRoles(value = {"super_admin" , "normal_admin"},logical = Logical.OR)
+    @RequiresRoles(value = {"super_admin"},logical = Logical.OR)
     public Result getAdminList(@RequestParam(name = "page_num") Long pageNum,
                                @RequestParam(name = "page_size") Long pageSize) {
 
@@ -128,6 +127,7 @@ public class SysDeptController {
         QueryWrapper<SysDept> queryWrapper = new QueryWrapper<>();
         IPage<SysDept> page = new Page<>(pageNum , pageSize);
         queryWrapper.eq("del_flag" , 0);
+        queryWrapper.orderByDesc("dept_id");
         IPage<SysDept> resultPage = new Page<>();
         resultPage = sysDeptDao.selectPage(page , queryWrapper);
         return Result.success(DataUtils.assembleResult(resultPage.getTotal() ,
@@ -137,17 +137,19 @@ public class SysDeptController {
     @ApiOperation(value = "通过鉴权获取部门列表")
     @GetMapping(value = "/listWithAuth")
     @ResponseBody
-    @RequiresRoles(value = {"super_admin","normal_admin"},logical = Logical.OR)
+    @RequiresRoles(value = {"super_admin"},logical = Logical.OR)
     public Result getAdminListWithAuth(@RequestParam(name = "page_num") Long pageNum,
                                        @RequestParam(name = "page_size") Long pageSize) {
 
         if(null == pageNum || null == pageSize){
             throw new CommonBaseException(ResultCodeEnum.D101 , "页码或者页面大小不能为空");
         }
+
+        TmAdmin user = ShiroUtils.getAdmin();
         QueryWrapper<SysDept> queryWrapper = new QueryWrapper<>();
-        if(!ShiroUtils.getSubject().hasRole("super_admin")){
+        if(null != user.getType() && user.getType().compareTo(0) != 0){
             //非超级管理员,则需要过滤数据
-            TmAdmin user = ShiroUtils.getAdmin();
+//            TmAdmin user = ShiroUtils.getAdmin();
             if(user == null){
                 log.error("用户未登录,登录");
                 throw new CommonBaseException(ResultCodeEnum.D101 , "未登录,请登录");
@@ -162,6 +164,7 @@ public class SysDeptController {
 
         IPage<SysDept> page = new Page<>(pageNum , pageSize);
         queryWrapper.eq("del_flag" , 0);
+        queryWrapper.orderByDesc("dept_id");
         IPage<SysDept> resultPage = new Page<>();
         resultPage = sysDeptDao.selectPage(page , queryWrapper);
         return Result.success(DataUtils.assembleResult(resultPage.getTotal() ,

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

@@ -215,10 +215,8 @@ public class AppAgencyController {
     @ApiImplicitParam(name = "user_id", value = "客源用户唯一标识ID(32位)", paramType = "query", required = true, dataType = "String")})
     @RequestMapping(value = "/customer/detail", method = RequestMethod.GET)
     @ResponseBody
-    public Result getAgencyCustomer(HttpServletRequest req) {
-        String agencyUserId = req.getParameter("agency_user_id");
-        String userId = req.getParameter("user_id");
-        TmAgencyUserRelation agencyUserRelation = agencyUserRelationDao.getAgencyUserDetail(agencyUserId.trim(), userId.trim());
+    public Result getAgencyCustomer(TmAgencyUserRelation tmAgencyUserRelation) {
+        TmAgencyUserRelation agencyUserRelation = agencyUserRelationDao.getAgencyUserDetail2(tmAgencyUserRelation.getId());
         return Result.success(agencyUserRelation);
     }
 

+ 9 - 1
house-web/src/main/java/com/ljq/house/app/controller/AppTmHouseController.java

@@ -483,6 +483,9 @@ public class AppTmHouseController {
             String orientation = request.getParameter("orientation");
             String elevator = request.getParameter("elevator");
             String title = request.getParameter("title");
+            log.info("----title:", title);
+            System.out.println("----title:"+ title);
+            String title2 = request.getParameter("title");
             String roomsRange = request.getParameter("room_s");
             String priceRange = request.getParameter("price_s");
             Integer saleState = DataUtils.getInteger(request.getParameter("saleState"));
@@ -565,9 +568,14 @@ public class AppTmHouseController {
                 }
             }
 
+            //支持街道、地区、房屋名称
             if(StringUtils.isNotBlank(title)){
                 //TODO:加索引
-                queryWrapper.like(tableAlias +"title" , title);
+//                queryWrapper.like("title" , title);
+                queryWrapper.and(wrapper -> wrapper
+                        .or().like("address", title)
+                        .or().like("title", title)
+                        .or().like("district", title));
             }
 
             if (StringUtils.isNotBlank(houseType)) {

+ 24 - 27
house-web/src/main/java/com/ljq/house/app/controller/AppTmUserController.java

@@ -355,35 +355,32 @@ public class AppTmUserController {
             throw new CommonBaseException(ResultCodeEnum.D017);
         }
 
-//        Map<String, Object> wxResult =  WxOpUtils.tryLoginWx(delegationVo.getWxCode() , userWxAppId, userWxAppSecret);
-//        String wxSessionKey = (String) wxResult.get(WxOpUtils.SESSION_KEY);
-//        String wxOpenId = (String) wxResult.get(WxOpUtils.WX_OPEN_ID_KEY);
-//        String decryptPhoneNum = null;
-        String wxOpenId = "122";
-        String decryptPhoneNum = "12";
-
-//        try {
-//            JSONObject resultJson = WXCore.decrypt(wxOpenId, delegationVo.getEncryptedData(), wxSessionKey, delegationVo.getIv());
-//            decryptPhoneNum = null != resultJson ? resultJson.getString(CommonConstants.WxConstant.WX_PHONE_NUMBER) : "";
-//            log.info("解密出来的手机号码为:{}", decryptPhoneNum);
-//        } catch (Exception e) {
-//            log.error("解密手机号出现异常:{}", e);
-//            throw new CommonBaseException(ResultCodeEnum.D039);
-//        }
-//        if(StringUtils.isBlank(decryptPhoneNum)){
-//            throw new CommonBaseException(ResultCodeEnum.D039);
-//        }
-//        log.info("上送的userId={}" , delegationVo.getUserId());
-//        //TODO这里获取的地方要改
+        Map<String, Object> wxResult =  WxOpUtils.tryLoginWx(delegationVo.getWxCode() , userWxAppId, userWxAppSecret);
+        String wxSessionKey = (String) wxResult.get(WxOpUtils.SESSION_KEY);
+        String wxOpenId = (String) wxResult.get(WxOpUtils.WX_OPEN_ID_KEY);
+        String decryptPhoneNum = null;
+        try {
+            JSONObject resultJson = WXCore.decrypt(wxOpenId, delegationVo.getEncryptedData(), wxSessionKey, delegationVo.getIv());
+            decryptPhoneNum = null != resultJson ? resultJson.getString(CommonConstants.WxConstant.WX_PHONE_NUMBER) : "";
+            log.info("解密出来的手机号码为:{}", decryptPhoneNum);
+        } catch (Exception e) {
+            log.error("解密手机号出现异常:{}", e);
+            throw new CommonBaseException(ResultCodeEnum.D039);
+        }
+        if(StringUtils.isBlank(decryptPhoneNum)){
+            throw new CommonBaseException(ResultCodeEnum.D039);
+        }
+        log.info("上送的userId={}" , delegationVo.getUserId());
+        //TODO这里获取的地方要改
         TmUser tmUser = tmUserDao.selectTmUsers(delegationVo.getUserId());
         TmAgency tmAgency = tmAgencyDao.selectTmAgencyById(delegationVo.getAgencyUserId());
-//        if(null == tmUser || null == tmAgency){
-//            throw new CommonBaseException(ResultCodeEnum.D101 , "用户或者经纪人数据缺失");
-//        }
-//        if(StringUtils.isNotBlank(tmUser.getWxOpenId()) && !StringUtils.equals(tmUser.getWxOpenId() , wxOpenId)){
-//            log.info("上送的wxOpenId={}, 数据库中的是openId={}" , wxOpenId , tmUser.getWxOpenId());
-//            throw new CommonBaseException(ResultCodeEnum.D101 , "上送的openId和数据中的不一致");
-//        }
+        if(null == tmUser || null == tmAgency){
+            throw new CommonBaseException(ResultCodeEnum.D101 , "用户或者经纪人数据缺失");
+        }
+        if(StringUtils.isNotBlank(tmUser.getWxOpenId()) && !StringUtils.equals(tmUser.getWxOpenId() , wxOpenId)){
+            log.info("上送的wxOpenId={}, 数据库中的是openId={}" , wxOpenId , tmUser.getWxOpenId());
+            throw new CommonBaseException(ResultCodeEnum.D101 , "上送的openId和数据中的不一致");
+        }
 
         if(StringUtils.isBlank(tmUser.getWxOpenId())){
             tmUser.setWxOpenId(wxOpenId);