puhanshu
2021-12-02 01587ec29d92f365817db286f81ac1d66298a11e
房屋租赁修改
8个文件已修改
1个文件已添加
158 ■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/LoginApi.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/RentingHousesApi.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/config/WxH5Properties.java 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/config/WxMaConfiguration.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/model/vos/LoginRequest.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/rentingHouses/RentingHouseRegisterDTO.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/RentingHousesApi.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/RentingHourseRegisterServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/RentingHourseRegisterMapper.xml 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/LoginApi.java
@@ -100,10 +100,36 @@
    @ApiOperation(value = "H5登录", response = LoginReturnVO.class)
    @PostMapping("loginH5")
    public R loginH5(@RequestBody LoginRequest loginRequest) {
        String unionId = loginRequest.getUnionId();
        if (StringUtils.isBlank(unionId)) {
            return R.fail("缺少基本信息参数");
        String code = loginRequest.getCode();
        if (ObjectUtils.isEmpty(code)) {
            return R.fail("缺少登录参数");
        }
        log.info(code);
        WxMaService maService = wxMaConfiguration.getMaH5Service();
        WxMaJscode2SessionResult sessionInfo = null;
        try {
            sessionInfo = maService.getUserService().getSessionInfo(code);
        } catch (Exception e) {
            log.error("微信登录失败【{}】", e.getMessage());
            if (code.equals("22")) {
                sessionInfo = new WxMaJscode2SessionResult();
                sessionInfo.setOpenid("88888888");
                sessionInfo.setSessionKey("9999999");
            } else {
                return R.fail("微信登录失败");
            }
        }
        log.info("微信登录成功【{}】", JSONObject.toJSONString(sessionInfo));
        log.info("loginRequest参数【{}】", JSONObject.toJSONString(loginRequest));
        // 解密用户信息
//        WxMaUserInfo wxUserInfo = maService.getUserService().getUserInfo(sessionInfo.getSessionKey(),
//                loginRequest.getEncryptedData(), loginRequest.getIv());
//        log.info("wxUserInfo信息【{}】", JSONObject.toJSONString(wxUserInfo));
//        if (null == wxUserInfo) {
//            return R.fail("获取用户信息失败");
//        }
//        String unionId = wxUserInfo.getUnionId();
        String unionId = sessionInfo.getUnionid();
        //通过unionId去匹配user
        R r1 = userService.getUserInfoByUnionId(unionId);
        if (R.isOk(r1)) {
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/RentingHousesApi.java
@@ -150,6 +150,7 @@
            registerDTO.setId(registerId);
            registerDTO.setAuthStatus(2);
            registerDTO.setDetailStatus(2);
            registerDTO.setHourseOwnerUserId(getUserId());
            return communityService.updateRentingHouse(registerDTO);
        }
        return R.fail();
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/config/WxH5Properties.java
New file
@@ -0,0 +1,58 @@
package com.panzhihua.applets.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import lombok.Data;
/**
 * @program: springcloud_k8s_panzhihuazhihuishequ
 * @description: 微信配置
 * @author: huang.hongfa weixin hhf9596 qq 959656820
 * @create: 2020-11-23 14:52
 **/
@Data
@Component
@ConfigurationProperties(prefix = "wx.h5")
public class WxH5Properties {
    /**
     * 设置微信小程序的appid
     */
    private String appid;
    /**
     * 设置微信小程序的Secret
     */
    private String secret;
    /**
     * 设置微信小程序消息服务器配置的token
     */
    private String token;
    /**
     * 设置微信小程序消息服务器配置的EncodingAESKey
     */
    private String aesKey;
    /**
     * 消息格式,XML或者JSON
     */
    private String msgDataFormat;
    /**
     * 商户号
     */
    private String mchId;
    /**
     * 微信支付密钥
     */
    private String payKey;
    /**
     * 微信支付回调地址
     */
    private String notifyUrl;
}
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/config/WxMaConfiguration.java
@@ -22,6 +22,9 @@
    @Resource
    private WxMaProperties properties;
    @Resource
    private WxH5Properties wxH5Properties;
    public WxMaService getMaService() {
        WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
        config.setAppid(properties.getAppid());
@@ -31,4 +34,14 @@
        wxMaService.setWxMaConfig(config);
        return wxMaService;
    }
    public WxMaService getMaH5Service() {
        WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
        config.setAppid(wxH5Properties.getAppid());
        config.setSecret(wxH5Properties.getSecret());
        config.setMsgDataFormat(wxH5Properties.getMsgDataFormat());
        WxMaService wxMaService = new WxMaServiceImpl();
        wxMaService.setWxMaConfig(config);
        return wxMaService;
    }
}
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/model/vos/LoginRequest.java
@@ -33,7 +33,4 @@
    @ApiModelProperty(name = "userInfo", value = "用户基本信息")
    WxMaUserInfo userInfo;
    @ApiModelProperty(name = "unionId", value = "用户平台唯一标识")
    String unionId;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/rentingHouses/RentingHouseRegisterDTO.java
@@ -166,4 +166,7 @@
    @ApiModelProperty(value = "1、待认证2、待发布3、待出租4、保留中 5出租中6、已超时7、已到期)", hidden = true)
    private Integer detailStatus;
    @ApiModelProperty(value = "房东的用户ID,用户表记录了房东的详细信息", hidden = true)
    private Long hourseOwnerUserId;
}
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/RentingHousesApi.java
@@ -3,6 +3,7 @@
import javax.annotation.Resource;
import javax.validation.Valid;
import com.panzhihua.common.model.vos.community.rentingHouses.RentingHousesConfigVO;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
@@ -91,6 +92,14 @@
        return communityService.getRentingHouse(registerId);
    }
    @ApiOperation(value = "获取房屋租赁配置",response = RentingHousesConfigVO.class)
    @GetMapping("/getConfig")
    @ApiImplicitParam(name = "type", value = "配置类型(1.房屋租赁合同 2.租赁合同变更协议 3.定金协议 4.房屋委托代理合同" +
            "5.平台须知 6.房源标签)", required = true)
    public R getRentingHouseConfig(@RequestParam("type") Integer type) {
        return communityService.getRentingHouseConfig(type);
    }
    @ApiOperation(value = "方便开发阶段手动调用批量更新小程序码")
    @GetMapping("/updateAllHouseUnionAppCode")
    public R updateAllHouseUnionAppCode() {
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/RentingHourseRegisterServiceImpl.java
@@ -320,6 +320,7 @@
                houseRegister.setDetailStatus(RentingHourseRegister.DetailStatus.drz);
            }
        }
        houseRegister.setUpdateAt(new Date());
        int result = this.baseMapper.updateById(houseRegister);
        if (result > 0) {
            return R.ok();
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/RentingHourseRegisterMapper.xml
@@ -82,7 +82,7 @@
            AND t1.construct_area >= #{pageRegisterDTO.minArea}
        </if>
        <if test="pageRegisterDTO.maxArea != null">
            AND t1.construct_area &lt;= #{pageRegisterDTO.minArea}
            AND t1.construct_area &lt;= #{pageRegisterDTO.maxArea}
        </if>
        <if test="pageRegisterDTO.minRentMoney != null">
            AND t1.monthly_rent_money &gt;= #{pageRegisterDTO.minRentMoney}
@@ -116,11 +116,14 @@
    <select id="pageRentingHouseApplet"
            resultType="com.panzhihua.common.model.vos.community.rentingHouses.RentingHouseRegisterVO">
        SELECT t.id, t.title, t.brn, t.construct_area, t.floor, t.orientation, t.decoration, t.label, t.address, t.monthly_rent_money,
        t.`status`, t.detail_status, t.auth_status,t1.url, t2.phone AS tenantTelephone
        t.`status`, t.detail_status, t.auth_status,t1.url, t2.phone AS tenantTelephone, t.update_at
        <if test="pageRegisterDTO.longitude !=null and pageRegisterDTO.longitude !=''">,(POWER(MOD(ABS(longitude - #{pageRegisterDTO.longitude}),360),2) + POWER(ABS(latitude - #{latitude}),2)) AS distance</if>
        FROM renting_hourse_register t left join renting_hourse_file t1 on t.id = t1.ref_id
        LEFT JOIN sys_user t2 ON t.tenant_user_id = t2.user_id
        WHERE t.community_id = #{pageRegisterDTO.communityId}
        <if test="pageRegisterDTO.status == null">
            AND t.`status` = 2
        </if>
        <if test="pageRegisterDTO.status != null">
            AND t.`status` = #{pageRegisterDTO.status}
        </if>
@@ -148,7 +151,7 @@
            AND t.construct_area &gt;= #{pageRegisterDTO.minArea}
        </if>
        <if test="pageRegisterDTO.maxArea != null">
            AND t.construct_area &lt;= #{pageRegisterDTO.minArea}
            AND t.construct_area &lt;= #{pageRegisterDTO.maxArea}
        </if>
        <if test="pageRegisterDTO.minRentMoney != null">
            AND t.monthly_rent_money &gt;= #{pageRegisterDTO.minRentMoney}
@@ -163,18 +166,25 @@
            )
        </if>
        group by t.id
        <if test="pageRegisterDTO.sort !=null and pageRegisterDTO.longitude !=null">
            <if test="pageRegisterDTO.sort==1">
                order by distance asc
        <if test="pageRegisterDTO.sort ==null">
            order by update_at desc
        </if>
        <if test="pageRegisterDTO.sort !=null">
            <if test="pageRegisterDTO.longitude !=null">
                <if test="pageRegisterDTO.sort==1">
                    order by distance asc
                </if>
                <if test="pageRegisterDTO.sort==2">
                    order by distance desc
                </if>
            </if>
            <if test="pageRegisterDTO.sort==2">
                order by distance desc
            </if>
            <if test="pageRegisterDTO.sort==3">
                order by monthly_rent_money asc
            </if>
            <if test="pageRegisterDTO.sort==4">
                order by monthly_rent_money desc
            <if test="pageRegisterDTO.longitude ==null">
                <if test="pageRegisterDTO.sort==3">
                    order by monthly_rent_money asc
                </if>
                <if test="pageRegisterDTO.sort==4">
                    order by monthly_rent_money desc
                </if>
            </if>
        </if>
    </select>