Переглянути джерело

Merge branch 'release'

tags/V1.7.0
wanghaoran 1 рік тому
джерело
коміт
a99c52eb56
55 змінених файлів з 1583 додано та 85 видалено
  1. +40
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/constants/DictConstants.java
  2. +64
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/controller/IdentityController.java
  3. +28
    -19
      tuoheng-api/src/main/java/com/tuoheng/api/controller/IndexController.java
  4. +35
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/controller/MyController.java
  5. +0
    -1
      tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamSceneryController.java
  6. +68
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamUserController.java
  7. +0
    -9
      tuoheng-api/src/main/java/com/tuoheng/api/controller/WxController.java
  8. +37
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/Identity.java
  9. +72
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/IdentityApply.java
  10. +75
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/Merchant.java
  11. +77
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/ThDict.java
  12. +87
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/ThDictData.java
  13. +82
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/UserPointsDetail.java
  14. +25
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamUser.java
  15. +5
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/entity/request/FeedbackQuery.java
  16. +19
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/entity/request/IdentityQuery.java
  17. +18
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/entity/request/MerchantQuery.java
  18. +5
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/entity/request/OnlineNumQuery.java
  19. +5
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/entity/request/StreamQuery.java
  20. +24
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/entity/request/UserPointsDetailQuery.java
  21. +5
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamActQuery.java
  22. +5
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamKnowQuery.java
  23. +5
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamSceneryQuery.java
  24. +17
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamUserQuery.java
  25. +7
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/mapper/IdentityApplyMapper.java
  26. +7
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/mapper/IdentityMapper.java
  27. +7
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/mapper/MerchantMapper.java
  28. +18
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/mapper/ThDictDataMapper.java
  29. +18
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/mapper/ThDictMapper.java
  30. +13
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/mapper/UserPointsDetailMapper.java
  31. +3
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamUserMapper.java
  32. +23
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/service/IIdentityService.java
  33. +16
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/service/IMerchantService.java
  34. +3
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/service/ITenantService.java
  35. +16
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/service/IUserPointsDetailService.java
  36. +7
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamUserService.java
  37. +0
    -1
      tuoheng-api/src/main/java/com/tuoheng/api/service/IWxService.java
  38. +38
    -9
      tuoheng-api/src/main/java/com/tuoheng/api/service/impl/FeedbackServiceImpl.java
  39. +152
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/service/impl/IdentityServiceImpl.java
  40. +70
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/service/impl/MerchantServiceImpl.java
  41. +8
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/service/impl/StreamServiceImpl.java
  42. +18
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/service/impl/TenantServiceImpl.java
  43. +75
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/service/impl/UserPointsDetailServiceImpl.java
  44. +4
    -2
      tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamActServiceImpl.java
  45. +4
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamKnowServiceImpl.java
  46. +47
    -5
      tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamSceneryServiceImpl.java
  47. +89
    -6
      tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamUserServiceImpl.java
  48. +0
    -29
      tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java
  49. +48
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/utils/SmsUtil.java
  50. +2
    -0
      tuoheng-api/src/main/resources/application-dev.yml
  51. +2
    -0
      tuoheng-api/src/main/resources/application-prod.yml
  52. +2
    -0
      tuoheng-api/src/main/resources/application-test.yml
  53. +13
    -0
      tuoheng-api/src/main/resources/mapper/WestreamUserMapper.xml
  54. +16
    -0
      tuoheng-common/src/main/java/com/tuoheng/common/config/CommonConfig.java
  55. +59
    -4
      tuoheng-common/src/main/java/com/tuoheng/common/utils/HttpUtils.java

+ 40
- 0
tuoheng-api/src/main/java/com/tuoheng/api/constants/DictConstants.java Переглянути файл

@@ -0,0 +1,40 @@
package com.tuoheng.api.constants;

/**
* @Description 字典key值常量类
* @Author douzhenjun
* @DATE 2023/4/12
**/
public class DictConstants {
//积分规则code
public static final String POINTS_RULE_CODE = "points_rule";
//积分规则name描述
public static final String POINTS_RULE_DESC = "积分规则";
//积分规则-上报问题(反馈)并通过
public static final String POINTS_RULE_FEEDBACK = "submit_feedback";
//积分规则-上传美拍并通过
public static final String POINTS_RULE_PICTURE = "submit_scenery";
//积分规则-每日上限积分
public static final String POINTS_RULE_DAILYLIMIT = "daily_limit";

//短信规则code
public static final String MSG_RULE_CODE = "msg_rule";
//短信规则name描述
public static final String MSG_RULE_DESC = "短信规则";
//短信规则-发送超时时间
public static final String MSG_RULE_TIMEOUT = "send_rule";
//短信规则-发送起始时间
public static final String MSG_RULE_STARTTIME = "start_time";
//短信规则-发送频率
public static final String MSG_RULE_SENDRATE = "send_rate";
//短信规则-发送手机号
public static final String MSG_RULE_PHONE = "question_send_phone";

//智慧河长待处理问题或申请通知
public static final String SMS_SMART_LAKE = "智慧河湖";
public static final String SMS_276426880 = "SMS_276426880";
//河湖长眼待处理工单通知
public static final String SMS_SMART_LAKE_EYE = "河湖长眼";
public static final String SMS_276360495 = "SMS_276360495";

}

+ 64
- 0
tuoheng-api/src/main/java/com/tuoheng/api/controller/IdentityController.java Переглянути файл

@@ -0,0 +1,64 @@
package com.tuoheng.api.controller;

import com.tuoheng.api.entity.domain.IdentityApply;
import com.tuoheng.api.entity.request.IdentityQuery;
import com.tuoheng.api.service.IIdentityService;
import com.tuoheng.common.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/identity")
public class IdentityController {

@Autowired
private IIdentityService identityService;

/**
* 获取身份列表(分页)
*
* @param identityQuery 查询条件
* @return
*/
@GetMapping("/index")
public JsonResult index(IdentityQuery identityQuery) {
return identityService.queryPage(identityQuery);
}


/**
* 获取身份列表
*
* @param identityQuery 查询条件
* @return
*/
@GetMapping("/getList")
public JsonResult getList(IdentityQuery identityQuery) {
return identityService.getListInfo(identityQuery);
}

/**
* 获取最新一条身份申请
*
* @param identityQuery 查询条件
* @return
*/
@GetMapping("/getApplyLast")
public JsonResult getApplyLast(IdentityQuery identityQuery) {
return identityService.getApplyLast(identityQuery);
}


/**
* 申请身份-提交
*
* @param identityApply
* @return
*/
@PostMapping("/submit")
public JsonResult submit(@RequestBody IdentityApply identityApply){
return identityService.submit(identityApply);
}


}

+ 28
- 19
tuoheng-api/src/main/java/com/tuoheng/api/controller/IndexController.java Переглянути файл

@@ -1,16 +1,8 @@
package com.tuoheng.api.controller;

import com.tuoheng.api.entity.domain.WestreamScenery;
import com.tuoheng.api.entity.domain.WestreamUser;
import com.tuoheng.api.entity.request.OnlineNumQuery;
import com.tuoheng.api.entity.request.WestreamActQuery;
import com.tuoheng.api.entity.request.WestreamKnowQuery;
import com.tuoheng.api.entity.request.WestreamSceneryQuery;
import com.tuoheng.api.service.IWestreamActService;
import com.tuoheng.api.service.IWestreamKnowService;
import com.tuoheng.api.service.IWestreamSceneryService;
import com.tuoheng.api.service.IWestreamUserService;
import com.tuoheng.common.common.OperationEnum;
import com.tuoheng.api.entity.request.*;
import com.tuoheng.api.service.*;
import com.tuoheng.common.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -37,6 +29,12 @@ public class IndexController {
@Autowired
IWestreamUserService westreamUserService;

@Autowired
ITenantService tenantService;

@Autowired
IMerchantService merchantService;


/**
* 获取全民护河公告列表(分页)
@@ -83,26 +81,37 @@ public class IndexController {
}

/**
* 获取在线人数
* 通过省市区获取租户列表
*
* @param
* @return
*/
@GetMapping("/westreamUser/onlineNum")
public JsonResult onlineNum(OnlineNumQuery query) {
return westreamUserService.onlineNum(query);
@GetMapping("/tenants/areaCode")
public JsonResult tenantsByAreaCode(OnlineNumQuery query) {
return tenantService.tenantsByAreaCode(query);
}


/**
* 编辑微信小程序用户
* 编辑微信小程序用户(由于产品V1.7.0去掉在线人数功能,暂时弃用此接口)
*
* @param westreamUser 实体对象
* @return
*/
@PutMapping("/westreamUser/edit")
public JsonResult edit(@RequestBody WestreamUser westreamUser) {
return westreamSceneryService.editInfo(westreamUser);
// @PutMapping("/westreamUser/edit")
// public JsonResult edit(@RequestBody WestreamUser westreamUser) {
// return westreamSceneryService.editInfo(westreamUser);
// }

/**
* 积分商城-商户列表
*
* @param
* @return
*/
@GetMapping("/merchant/page")
public JsonResult merchantPage(MerchantQuery merchantQuery) {
return merchantService.queryPage(merchantQuery);
}


}

+ 35
- 0
tuoheng-api/src/main/java/com/tuoheng/api/controller/MyController.java Переглянути файл

@@ -0,0 +1,35 @@
package com.tuoheng.api.controller;

import com.tuoheng.api.entity.request.UserPointsDetailQuery;
import com.tuoheng.api.service.IUserPointsDetailService;
import com.tuoheng.common.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* 我的 前端控制器
*
* @author WangHaoran
* @since 2023-05-06
*/
@RestController
@RequestMapping("/my")
public class MyController {

@Autowired
IUserPointsDetailService userPointsDetailService;


/**
* 我的兑换
*
* @param userPointsDetailQuery 查询条件
* @return
*/
@GetMapping("/exchange")
public JsonResult exchange(UserPointsDetailQuery userPointsDetailQuery) {
return userPointsDetailService.exchange(userPointsDetailQuery);
}
}

+ 0
- 1
tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamSceneryController.java Переглянути файл

@@ -1,6 +1,5 @@
package com.tuoheng.api.controller;

import com.tuoheng.api.entity.request.FeedbackQuery;
import com.tuoheng.api.entity.request.WestreamSceneryQuery;
import com.tuoheng.api.service.IWestreamSceneryService;
import com.tuoheng.common.utils.JsonResult;

+ 68
- 0
tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamUserController.java Переглянути файл

@@ -0,0 +1,68 @@
package com.tuoheng.api.controller;

import com.tuoheng.api.entity.domain.WestreamUser;
import com.tuoheng.api.entity.request.OnlineNumQuery;
import com.tuoheng.api.entity.request.WestreamUserQuery;
import com.tuoheng.api.service.IWestreamUserService;
import com.tuoheng.common.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
* 小程序用户 前端控制器
*
* @author WangHaoran
* @since 2023-04-21
*/
@RestController
@RequestMapping("/westreamUser")
public class WestreamUserController {

@Autowired
IWestreamUserService westreamUserService;

/**
* 获取累计在线人次
*
* @param
* @return
*/
@GetMapping("/onlineNum")
public JsonResult onlineNum(OnlineNumQuery query) {
return westreamUserService.onlineNum(query);
}

/**
* 进入小程序
*
* @param westreamUser
* @return
*/
@PostMapping("/login")
public JsonResult login(@RequestBody WestreamUser westreamUser){
return westreamUserService.login(westreamUser);
}

/**
* 获取用户信息
*
* @param westreamUserQuery
* @return
*/
@GetMapping("/userInfo")
public JsonResult userInfo(WestreamUserQuery westreamUserQuery){
return westreamUserService.userInfo(westreamUserQuery);
}

/**
* 编辑用户信息(头像、昵称)
*
* @param westreamUser
* @return
*/
@PutMapping("/editInfo")
public JsonResult editInfo(@RequestBody WestreamUser westreamUser){
return westreamUserService.editInfo(westreamUser);
}

}

+ 0
- 9
tuoheng-api/src/main/java/com/tuoheng/api/controller/WxController.java Переглянути файл

@@ -31,13 +31,4 @@ public class WxController {
return wxService.openid(code);
}

/**
* 通过openid获取用户信息
*
* @return
*/
@GetMapping("/westreamUser/{openid}")
public JsonResult westreamUser(@PathVariable("openid") String openid) {
return wxService.westreamUser(openid);
}
}

+ 37
- 0
tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/Identity.java Переглянути файл

@@ -0,0 +1,37 @@
package com.tuoheng.api.entity.domain;

import com.baomidou.mybatisplus.annotation.TableName;
import com.tuoheng.common.common.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
* 身份表
*
* @author WangHaoran
* @since 2023-04-21
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("th_identity")
public class Identity extends BaseEntity {

/**
* 租户ID
*/
private Integer tenantId;

/**
* 身份名称
*/
private String identityName;

/**
* 身份权益
*/
private String identityRemark;


}

+ 72
- 0
tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/IdentityApply.java Переглянути файл

@@ -0,0 +1,72 @@
package com.tuoheng.api.entity.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.tuoheng.common.common.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
* 身份申请表
*
* @author WangHaoran
* @since 2023-04-24
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("th_identity_apply")
public class IdentityApply extends BaseEntity {

/**
* 租户ID
*/
private Integer tenantId;

/**
* 申请身份ID
*/
private Integer applyIdentityId;

/**
* 申请身份名称
*/
private String applyIdentityName;

/**
* 申请姓名
*/
private String applyName;

/**
* 申请电话
*/
private String applyPhone;

/**
* 申请人opendi
*/
private String applyOpenid;

/**
* 申请人用户昵称
*/
private String applyNickname;

/**
* 申请理由
*/
private String applyRemark;

/**
* 状态:1待审核 2审核通过 3审核不通过
*/
private Integer status;

/**
* 身份权益
*/
@TableField(exist = false)
private String identityRemark;
}

+ 75
- 0
tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/Merchant.java Переглянути файл

@@ -0,0 +1,75 @@
package com.tuoheng.api.entity.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.tuoheng.common.common.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
* 商户表
*
* @author WangHaoran
* @since 2023-05-06
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("th_merchant")
public class Merchant extends BaseEntity {

/**
* 租户ID
*/
private Integer tenantId;

/**
* 用户ID
*/
private Integer userId;

/**
* 商铺图片
*/
private String shopsImage;

/**
* 商铺名称
*/
private String shopsName;

/**
* 商铺地址
*/
private String shopsAddress;

/**
* 区域名称
*/
private String areaName;

/**
* 经度
*/
private String longitude;

/**
* 纬度
*/
private String latitude;

/**
* 用户名称
*/
@TableField(exist = false)
private String realname;

/**
* 用户手机号
*/
@TableField(exist = false)
private String mobile;


}

+ 77
- 0
tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/ThDict.java Переглянути файл

@@ -0,0 +1,77 @@
package com.tuoheng.api.entity.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
* 字典类型表
* @TableName th_dict
*/
@TableName(value ="th_dict")
@Data
public class ThDict implements Serializable {
/**
* 主键ID
*/
@TableId(type = IdType.AUTO)
private Integer id;

/**
* 字典名称
*/
private String name;

/**
* 字典值
*/
private String code;

/**
* 显示顺序
*/
private Integer sort;

/**
* 字典备注
*/
private String note;

/**
* 添加人
*/
private Integer createUser;

/**
* 添加时间
*/
private Date createTime;

/**
* 更新人
*/
private Integer updateUser;

/**
* 更新时间
*/
private Date updateTime;

/**
* 有效标识
*/
private Integer mark;

/**
* 租户ID
*/
private Object tenantId;

@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

+ 87
- 0
tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/ThDictData.java Переглянути файл

@@ -0,0 +1,87 @@
package com.tuoheng.api.entity.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
* 字典项管理表
* @TableName th_dict_data
*/
@TableName(value ="th_dict_data")
@Data
public class ThDictData implements Serializable {
/**
* 主键ID
*/
@TableId(type = IdType.AUTO)
private Integer id;

/**
* 字典项名称
*/
private String name;

/**
* 字典项值
*/
private String value;

/**
* 字典类型ID
*/
private Integer dictId;

/**
* 状态:1在用 2停用
*/
private Integer status;

/**
* 备注
*/
private String note;

/**
* 显示顺序
*/
private Integer sort;

/**
* 添加人
*/
private Integer createUser;

/**
* 添加时间
*/
private Date createTime;

/**
* 更新人
*/
private Integer updateUser;

/**
* 更新时间
*/
private Date updateTime;

/**
* 有效标记
*/
private Integer mark;

/**
* 租户ID
*/
private Object tenantId;

@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

+ 82
- 0
tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/UserPointsDetail.java Переглянути файл

@@ -0,0 +1,82 @@
package com.tuoheng.api.entity.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.tuoheng.common.common.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

/**
* 用户积分明细表
*
* @author WangHaoran
* @since 2023-05-06
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("th_user_points_detail")
public class UserPointsDetail extends BaseEntity implements Serializable {

/**
* 租户ID
*/
private Integer tenantId;

/**
* 租户ID
*/
private String openid;

/**
* 用户昵称
*/
private String nickname;

/**
* 积分变动
*/
private Integer pointsChange;

/**
* 积分时间(精确到日)
*/
private Date pointsTime;

/**
* 类型,1增加 2减少
*/
private Integer type;

/**
* 操作人ID
*/
private Integer operatorId;

/**
* 操作人名称
*/
private String operatorName;

/**
* 商铺名称
*/
@TableField(exist = false)
private String shopsName;

/**
* 商铺图片
*/
@TableField(exist = false)
private String shopsImage;

/**
* 区域名称
*/
@TableField(exist = false)
private String areaName;
}

+ 25
- 0
tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamUser.java Переглянути файл

@@ -1,5 +1,6 @@
package com.tuoheng.api.entity.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.tuoheng.common.common.BaseEntity;
import lombok.Data;
@@ -68,6 +69,30 @@ public class WestreamUser extends BaseEntity implements Serializable {
*/
private Integer status;

/**
* 身份ID
*/
private Integer identityId;

/**
* 登录次数
*/
private Integer loginNum;

/**
* 商城积分
*/
private Integer mallPoints;

/**
* 身份名称
*/
@TableField(exist = false)
private String identityName;

/**
* 身份权益
*/
@TableField(exist = false)
private String identityRemark;
}

+ 5
- 0
tuoheng-api/src/main/java/com/tuoheng/api/entity/request/FeedbackQuery.java Переглянути файл

@@ -7,4 +7,9 @@ import lombok.Data;
public class FeedbackQuery extends BaseQuery {

private String openid;

/**
* 租户ID
*/
private Integer tenantId;
}

+ 19
- 0
tuoheng-api/src/main/java/com/tuoheng/api/entity/request/IdentityQuery.java Переглянути файл

@@ -0,0 +1,19 @@
package com.tuoheng.api.entity.request;

import com.tuoheng.common.common.BaseQuery;
import lombok.Data;

@Data
public class IdentityQuery extends BaseQuery {

/**
* 租户ID
*/
private Integer tenantId;

/**
* 用户openid
*/
private String openid;

}

+ 18
- 0
tuoheng-api/src/main/java/com/tuoheng/api/entity/request/MerchantQuery.java Переглянути файл

@@ -0,0 +1,18 @@
package com.tuoheng.api.entity.request;

import com.tuoheng.common.common.BaseQuery;
import lombok.Data;

@Data
public class MerchantQuery extends BaseQuery {

/**
* 租户ID
*/
private Integer tenantId;

/**
* 商品名称
*/
private String shopsName;
}

+ 5
- 0
tuoheng-api/src/main/java/com/tuoheng/api/entity/request/OnlineNumQuery.java Переглянути файл

@@ -20,4 +20,9 @@ public class OnlineNumQuery {
*/
private String districtCode;

/**
* 租户ID
*/
private Integer tenantId;

}

+ 5
- 0
tuoheng-api/src/main/java/com/tuoheng/api/entity/request/StreamQuery.java Переглянути файл

@@ -47,4 +47,9 @@ public class StreamQuery extends BaseQuery {
*/
private String villageCode;

/**
* 租户ID
*/
private Integer tenantId;

}

+ 24
- 0
tuoheng-api/src/main/java/com/tuoheng/api/entity/request/UserPointsDetailQuery.java Переглянути файл

@@ -0,0 +1,24 @@
package com.tuoheng.api.entity.request;

import com.tuoheng.common.common.BaseQuery;
import lombok.Data;

/**
* 河流查询
*
* @author WangHaoran
* @since 2021-09-06
*/
@Data
public class UserPointsDetailQuery extends BaseQuery {

/**
* 租户ID
*/
private Integer tenantId;

/**
* 用户openid
*/
private String openid;
}

+ 5
- 0
tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamActQuery.java Переглянути файл

@@ -26,4 +26,9 @@ public class WestreamActQuery extends BaseQuery {
* 区县编码
*/
private String districtCode;

/**
* 租户ID
*/
private Integer tenantId;
}

+ 5
- 0
tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamKnowQuery.java Переглянути файл

@@ -27,4 +27,9 @@ public class WestreamKnowQuery extends BaseQuery {
*/
private String districtCode;

/**
* 租户ID
*/
private Integer tenantId;

}

+ 5
- 0
tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamSceneryQuery.java Переглянути файл

@@ -32,4 +32,9 @@ public class WestreamSceneryQuery extends BaseQuery {
*/
private String openid;

/**
* 租户ID
*/
private Integer tenantId;

}

+ 17
- 0
tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamUserQuery.java Переглянути файл

@@ -0,0 +1,17 @@
package com.tuoheng.api.entity.request;

import lombok.Data;

@Data
public class WestreamUserQuery {

/**
* 租户ID
*/
private Integer tenantId;

/**
* 用户openid
*/
private String openid;
}

+ 7
- 0
tuoheng-api/src/main/java/com/tuoheng/api/mapper/IdentityApplyMapper.java Переглянути файл

@@ -0,0 +1,7 @@
package com.tuoheng.api.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tuoheng.api.entity.domain.IdentityApply;

public interface IdentityApplyMapper extends BaseMapper<IdentityApply> {
}

+ 7
- 0
tuoheng-api/src/main/java/com/tuoheng/api/mapper/IdentityMapper.java Переглянути файл

@@ -0,0 +1,7 @@
package com.tuoheng.api.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tuoheng.api.entity.domain.Identity;

public interface IdentityMapper extends BaseMapper<Identity> {
}

+ 7
- 0
tuoheng-api/src/main/java/com/tuoheng/api/mapper/MerchantMapper.java Переглянути файл

@@ -0,0 +1,7 @@
package com.tuoheng.api.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tuoheng.api.entity.domain.Merchant;

public interface MerchantMapper extends BaseMapper<Merchant> {
}

+ 18
- 0
tuoheng-api/src/main/java/com/tuoheng/api/mapper/ThDictDataMapper.java Переглянути файл

@@ -0,0 +1,18 @@
package com.tuoheng.api.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tuoheng.api.entity.domain.ThDictData;

/**
* @author 小影
* @description 针对表【th_dict_data(字典项管理表)】的数据库操作Mapper
* @createDate 2022-11-02 08:52:59
* @Entity com.tuoheng.admin.entity.domain.ThDictData
*/
public interface ThDictDataMapper extends BaseMapper<ThDictData> {

}





+ 18
- 0
tuoheng-api/src/main/java/com/tuoheng/api/mapper/ThDictMapper.java Переглянути файл

@@ -0,0 +1,18 @@
package com.tuoheng.api.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tuoheng.api.entity.domain.ThDict;

/**
* @author 小影
* @description 针对表【th_dict(字典类型表)】的数据库操作Mapper
* @createDate 2022-11-02 08:52:45
* @Entity com.tuoheng.admin.entity.domain.ThDict
*/
public interface ThDictMapper extends BaseMapper<ThDict> {

}





+ 13
- 0
tuoheng-api/src/main/java/com/tuoheng/api/mapper/UserPointsDetailMapper.java Переглянути файл

@@ -0,0 +1,13 @@
package com.tuoheng.api.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tuoheng.api.entity.domain.UserPointsDetail;

/**
* 用户积分明细表 Mapper 接口
*
* @author WangHaoran
* @since 2023-05-06
*/
public interface UserPointsDetailMapper extends BaseMapper<UserPointsDetail> {
}

+ 3
- 0
tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamUserMapper.java Переглянути файл

@@ -2,6 +2,8 @@ package com.tuoheng.api.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tuoheng.api.entity.domain.WestreamUser;
import com.tuoheng.api.entity.request.OnlineNumQuery;
import org.apache.ibatis.annotations.Param;

/**
* 全民护河用户表 Mapper 接口
@@ -10,4 +12,5 @@ import com.tuoheng.api.entity.domain.WestreamUser;
* @since 2023-03-20
*/
public interface WestreamUserMapper extends BaseMapper<WestreamUser> {
Integer selectOnlineNumSum(@Param("query") OnlineNumQuery query);
}

+ 23
- 0
tuoheng-api/src/main/java/com/tuoheng/api/service/IIdentityService.java Переглянути файл

@@ -0,0 +1,23 @@
package com.tuoheng.api.service;

import com.tuoheng.api.entity.domain.Identity;
import com.tuoheng.api.entity.domain.IdentityApply;
import com.tuoheng.api.entity.request.IdentityQuery;
import com.tuoheng.common.common.IBaseService;
import com.tuoheng.common.utils.JsonResult;

/**
* 身份表 服务类
*
* @author WangHaoran
* @since 2023-04-21
*/
public interface IIdentityService extends IBaseService<Identity> {
JsonResult getListInfo(IdentityQuery identityQuery);

JsonResult submit(IdentityApply identityApply);

JsonResult queryPage(IdentityQuery identityQuery);

JsonResult getApplyLast(IdentityQuery identityQuery);
}

+ 16
- 0
tuoheng-api/src/main/java/com/tuoheng/api/service/IMerchantService.java Переглянути файл

@@ -0,0 +1,16 @@
package com.tuoheng.api.service;

import com.tuoheng.api.entity.domain.Merchant;
import com.tuoheng.api.entity.request.MerchantQuery;
import com.tuoheng.common.common.IBaseService;
import com.tuoheng.common.utils.JsonResult;

/**
* 商户表 服务类
*
* @author WangHaoran
* @since 2023-05-06
*/
public interface IMerchantService extends IBaseService<Merchant> {
JsonResult queryPage(MerchantQuery merchantQuery);
}

+ 3
- 0
tuoheng-api/src/main/java/com/tuoheng/api/service/ITenantService.java Переглянути файл

@@ -1,7 +1,9 @@
package com.tuoheng.api.service;

import com.tuoheng.api.entity.domain.Tenant;
import com.tuoheng.api.entity.request.OnlineNumQuery;
import com.tuoheng.common.common.IBaseService;
import com.tuoheng.common.utils.JsonResult;

/**
* <p>
@@ -12,4 +14,5 @@ import com.tuoheng.common.common.IBaseService;
* @since 2022-07-15
*/
public interface ITenantService extends IBaseService<Tenant> {
JsonResult tenantsByAreaCode(OnlineNumQuery query);
}

+ 16
- 0
tuoheng-api/src/main/java/com/tuoheng/api/service/IUserPointsDetailService.java Переглянути файл

@@ -0,0 +1,16 @@
package com.tuoheng.api.service;

import com.tuoheng.api.entity.domain.UserPointsDetail;
import com.tuoheng.api.entity.request.UserPointsDetailQuery;
import com.tuoheng.common.common.IBaseService;
import com.tuoheng.common.utils.JsonResult;

/**
* 用户积分明细表 服务类
*
* @author WangHaoran
* @since 2023-05-06
*/
public interface IUserPointsDetailService extends IBaseService<UserPointsDetail> {
JsonResult exchange(UserPointsDetailQuery userPointsDetailQuery);
}

+ 7
- 0
tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamUserService.java Переглянути файл

@@ -2,9 +2,16 @@ package com.tuoheng.api.service;

import com.tuoheng.api.entity.domain.WestreamUser;
import com.tuoheng.api.entity.request.OnlineNumQuery;
import com.tuoheng.api.entity.request.WestreamUserQuery;
import com.tuoheng.common.common.IBaseService;
import com.tuoheng.common.utils.JsonResult;

public interface IWestreamUserService extends IBaseService<WestreamUser> {
JsonResult onlineNum(OnlineNumQuery query);

JsonResult login(WestreamUser westreamUser);

JsonResult userInfo(WestreamUserQuery westreamUserQuery);

JsonResult editInfo(WestreamUser westreamUser);
}

+ 0
- 1
tuoheng-api/src/main/java/com/tuoheng/api/service/IWxService.java Переглянути файл

@@ -5,5 +5,4 @@ import com.tuoheng.common.utils.JsonResult;
public interface IWxService {
JsonResult openid(String code);

JsonResult westreamUser(String openid);
}

+ 38
- 9
tuoheng-api/src/main/java/com/tuoheng/api/service/impl/FeedbackServiceImpl.java Переглянути файл

@@ -3,17 +3,14 @@ package com.tuoheng.api.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.api.entity.domain.Feedback;
import com.tuoheng.api.entity.domain.Stream;
import com.tuoheng.api.entity.domain.Tenant;
import com.tuoheng.api.entity.domain.User;
import com.tuoheng.api.constants.DictConstants;
import com.tuoheng.api.entity.domain.*;
import com.tuoheng.api.entity.request.FeedbackQuery;
import com.tuoheng.api.mapper.FeedbackMapper;
import com.tuoheng.api.mapper.StreamMapper;
import com.tuoheng.api.mapper.TenantMapper;
import com.tuoheng.api.mapper.UserMapper;
import com.tuoheng.api.mapper.*;
import com.tuoheng.api.service.IFeedbackService;
import com.tuoheng.api.utils.SmsUtil;
import com.tuoheng.common.common.BaseServiceImpl;
import com.tuoheng.common.config.CommonConfig;
import com.tuoheng.common.exception.ServiceException;
@@ -24,6 +21,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
@@ -43,9 +42,16 @@ public class FeedbackServiceImpl extends BaseServiceImpl<FeedbackMapper, Feedbac

@Autowired
private UserMapper userMapper;

@Autowired
private TenantMapper tenantMapper;

@Autowired
private ThDictMapper thDictMapper;

@Autowired
private ThDictDataMapper thDictDataMapper;


@Override
public JsonResult submit(Feedback feedback) {
@@ -63,7 +69,26 @@ public class FeedbackServiceImpl extends BaseServiceImpl<FeedbackMapper, Feedbac
} else {
return JsonResult.error("河流信息不存在");
}
return super.add(feedback);
super.add(feedback);
//发送短信
ThDict thDict = thDictMapper.selectOne(new LambdaQueryWrapper<ThDict>()
.eq(ThDict::getTenantId, stream.getTenantId())
.eq(ThDict::getCode, DictConstants.MSG_RULE_CODE)
.eq(ThDict::getMark, 1));
if(ObjectUtils.isNotNull(thDict)){
ThDictData thDictData = thDictDataMapper.selectOne(new LambdaQueryWrapper<ThDictData>()
.eq(ThDictData::getDictId, thDict.getId())
.eq(ThDictData::getName, DictConstants.MSG_RULE_PHONE));
if(ObjectUtils.isNotNull(thDictData)){
if(StringUtils.isNotEmpty(thDictData.getValue())){
List<String> phoneList = Arrays.asList(thDictData.getValue().split(","));
for (String phone : phoneList) {
SmsUtil.sendSyncSms(phone,DictConstants.SMS_276426880,DictConstants.SMS_SMART_LAKE,"{}");
}
}
}
}
return JsonResult.success();
}

@Override
@@ -74,11 +99,15 @@ public class FeedbackServiceImpl extends BaseServiceImpl<FeedbackMapper, Feedbac
if (StringUtils.isEmpty(query.getOpenid())) {
return JsonResult.error("openid为空");
}
if (null == query.getTenantId()) {
return JsonResult.error("租户ID为空!");
}

// 获取分页数据
IPage<Feedback> page = new Page<>(query.getPage(), query.getLimit());
IPage<Feedback> pageData = feedbackMapper.selectPage(page, new LambdaQueryWrapper<Feedback>()
.eq(Feedback::getMark, 1)
.eq(Feedback::getTenantId, query.getTenantId())
.eq(Feedback::getOpenid, query.getOpenid())
.eq(Feedback::getType, 1)
.orderByDesc(Feedback::getCreateTime));

+ 152
- 0
tuoheng-api/src/main/java/com/tuoheng/api/service/impl/IdentityServiceImpl.java Переглянути файл

@@ -0,0 +1,152 @@
package com.tuoheng.api.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.api.constants.DictConstants;
import com.tuoheng.api.entity.domain.*;
import com.tuoheng.api.entity.request.IdentityQuery;
import com.tuoheng.api.mapper.*;
import com.tuoheng.api.service.IIdentityService;
import com.tuoheng.api.utils.SmsUtil;
import com.tuoheng.common.common.BaseServiceImpl;
import com.tuoheng.common.utils.JsonResult;
import com.tuoheng.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Arrays;
import java.util.Date;
import java.util.List;

/**
* 身份表 服务实现类
*
* @author WangHaoran
* @since 2023-04-21
*/
@Service
public class IdentityServiceImpl extends BaseServiceImpl<IdentityMapper, Identity> implements IIdentityService {

@Autowired
private IdentityMapper identityMapper;

@Autowired
private IdentityApplyMapper identityApplyMapper;

@Autowired
private WestreamUserMapper westreamUserMapper;

@Autowired
private ThDictMapper thDictMapper;

@Autowired
private ThDictDataMapper thDictDataMapper;

@Override
public JsonResult getListInfo(IdentityQuery identityQuery) {
if(null == identityQuery.getTenantId()){
return JsonResult.error("租户ID为空!");
}
List<Identity> identityList = identityMapper.selectList(new LambdaQueryWrapper<Identity>()
.eq(Identity::getTenantId, identityQuery.getTenantId())
.eq(Identity::getMark, 1)
.orderByDesc(Identity::getCreateTime));
return JsonResult.success(identityList);
}

@Override
@Transactional
public JsonResult submit(IdentityApply identityApply) {
if(null == identityApply.getTenantId() || StringUtils.isEmpty(identityApply.getApplyOpenid())){
return JsonResult.error("登录人信息为空!");
}

//查询是否有申请中的流程,有则不允许申请
Integer count = identityApplyMapper.selectCount(new LambdaQueryWrapper<IdentityApply>()
.eq(IdentityApply::getTenantId, identityApply.getTenantId())
.eq(IdentityApply::getApplyOpenid, identityApply.getApplyOpenid())
.eq(IdentityApply::getStatus, 1)
.eq(IdentityApply::getMark, 1));
if(count>0){
return JsonResult.error("已有申请中的流程!");
}

//查询用户昵称
WestreamUser westreamUser = westreamUserMapper.selectOne(new LambdaQueryWrapper<WestreamUser>()
.eq(WestreamUser::getTenantId, identityApply.getTenantId())
.eq(WestreamUser::getOpenid, identityApply.getApplyOpenid())
.eq(WestreamUser::getMark, 1));

if(ObjectUtil.isNotNull(westreamUser)){
identityApply.setApplyNickname(westreamUser.getNickname());
}
identityApply.setCreateTime(new Date());
identityApplyMapper.insert(identityApply);


//发送短信
ThDict thDict = thDictMapper.selectOne(new LambdaQueryWrapper<ThDict>()
.eq(ThDict::getTenantId, identityApply.getTenantId())
.eq(ThDict::getCode, DictConstants.MSG_RULE_CODE)
.eq(ThDict::getMark, 1));
if(ObjectUtils.isNotNull(thDict)){
ThDictData thDictData = thDictDataMapper.selectOne(new LambdaQueryWrapper<ThDictData>()
.eq(ThDictData::getDictId, thDict.getId())
.eq(ThDictData::getName, DictConstants.MSG_RULE_PHONE));
if(ObjectUtils.isNotNull(thDictData)){
if(StringUtils.isNotEmpty(thDictData.getValue())){
List<String> phoneList = Arrays.asList(thDictData.getValue().split(","));
for (String phone : phoneList) {
SmsUtil.sendSyncSms(phone,DictConstants.SMS_276426880,DictConstants.SMS_SMART_LAKE,"{}");
}
}
}
}
return JsonResult.success();
}

@Override
public JsonResult queryPage(IdentityQuery query) {
if (null == query.getPage() || null == query.getLimit()) {
return JsonResult.error("参数为空!");
}
if (null == query.getTenantId()) {
return JsonResult.error("租户ID为空!");
}
// 获取分页数据
IPage<Identity> page = new Page<>(query.getPage(), query.getLimit());
IPage<Identity> pageData = identityMapper.selectPage(page, new LambdaQueryWrapper<Identity>()
.eq(Identity::getTenantId, query.getTenantId())
.eq(Identity::getMark, 1)
.orderByDesc(Identity::getCreateTime));

return JsonResult.success(pageData);
}

@Override
public JsonResult getApplyLast(IdentityQuery identityQuery) {
if(null == identityQuery.getTenantId() || StringUtils.isEmpty(identityQuery.getOpenid())){
return JsonResult.error("参数为空!");
}

IdentityApply identityApply = identityApplyMapper.selectOne(new LambdaQueryWrapper<IdentityApply>()
.eq(IdentityApply::getTenantId, identityQuery.getTenantId())
.eq(IdentityApply::getApplyOpenid, identityQuery.getOpenid())
.eq(IdentityApply::getMark, 1)
.orderByDesc(IdentityApply::getCreateTime)
.last("limit 1"));


if(ObjectUtil.isNotNull(identityApply)){
Identity identity = identityMapper.selectById(identityApply.getApplyIdentityId());
if(ObjectUtil.isNotNull(identity)){
identityApply.setIdentityRemark(identity.getIdentityRemark());
}
}
return JsonResult.success(identityApply);
}
}

+ 70
- 0
tuoheng-api/src/main/java/com/tuoheng/api/service/impl/MerchantServiceImpl.java Переглянути файл

@@ -0,0 +1,70 @@
package com.tuoheng.api.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.api.entity.domain.Merchant;
import com.tuoheng.api.entity.domain.User;
import com.tuoheng.api.entity.domain.WestreamAct;
import com.tuoheng.api.entity.request.MerchantQuery;
import com.tuoheng.api.mapper.IdentityMapper;
import com.tuoheng.api.mapper.MerchantMapper;
import com.tuoheng.api.mapper.UserMapper;
import com.tuoheng.api.service.IMerchantService;
import com.tuoheng.common.common.BaseServiceImpl;
import com.tuoheng.common.utils.CommonUtils;
import com.tuoheng.common.utils.JsonResult;
import com.tuoheng.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* 商户表 服务实现类
*
* @author WangHaoran
* @since 2023-05-06
*/
@Service
public class MerchantServiceImpl extends BaseServiceImpl<MerchantMapper, Merchant> implements IMerchantService {

@Autowired
private MerchantMapper merchantMapper;

@Autowired
private UserMapper userMapper;

@Override
public JsonResult queryPage(MerchantQuery query) {
if (null == query.getPage() || null == query.getLimit()) {
return JsonResult.error("参数为空!");
}

if (null == query.getTenantId()) {
return JsonResult.error("租户ID为空!");
}

// 获取分页数据
IPage<Merchant> page = new Page<>(query.getPage(), query.getLimit());
IPage<Merchant> pageData = merchantMapper.selectPage(page, new LambdaQueryWrapper<Merchant>()
.eq(Merchant::getMark, 1)
.like(StringUtils.isNotEmpty(query.getShopsName()),Merchant::getShopsName, query.getShopsName())
.eq(Merchant::getTenantId, query.getTenantId())
.orderByDesc(Merchant::getCreateTime));

for (Merchant record : pageData.getRecords()) {

User user = userMapper.selectById(record.getUserId());
if(ObjectUtil.isNotNull(user)){
record.setRealname(user.getRealname());
record.setMobile(user.getMobile());
}
if(StringUtils.isNotEmpty(record.getShopsImage())){
record.setShopsImage(CommonUtils.getMultipleUrl(record.getShopsImage()));
}
}


return JsonResult.success(pageData);
}
}

+ 8
- 0
tuoheng-api/src/main/java/com/tuoheng/api/service/impl/StreamServiceImpl.java Переглянути файл

@@ -46,10 +46,14 @@ public class StreamServiceImpl extends BaseServiceImpl<StreamMapper, Stream> imp
if (null == query.getPage() || null == query.getLimit()) {
return JsonResult.error("参数为空!");
}
if (null == query.getTenantId()) {
return JsonResult.error("租户ID为空!");
}
// 获取分页数据
IPage<Stream> page = new Page<>(query.getPage(), query.getLimit());
IPage<Stream> pageData = streamMapper.selectPage(page, new LambdaQueryWrapper<Stream>()
.eq(Stream::getMark, 1)
.eq(Stream::getTenantId, query.getTenantId())
.like(StringUtils.isNotEmpty(query.getName()), Stream::getName, query.getName())
.eq(StringUtils.isNotEmpty(query.getProvinceCode()), Stream::getProvinceCode, query.getProvinceCode())
.eq(StringUtils.isNotEmpty(query.getCityCode()), Stream::getCityCode, query.getCityCode())
@@ -95,8 +99,12 @@ public class StreamServiceImpl extends BaseServiceImpl<StreamMapper, Stream> imp

@Override
public JsonResult indexAll(StreamQuery query) {
if (null == query.getTenantId()) {
return JsonResult.error("租户ID为空!");
}
List<Stream> streamList = streamMapper.selectList(new LambdaQueryWrapper<Stream>()
.eq(Stream::getMark, 1)
.eq(Stream::getTenantId, query.getTenantId())
.eq(StringUtils.isNotEmpty(query.getProvinceCode()), Stream::getProvinceCode, query.getProvinceCode())
.eq(StringUtils.isNotEmpty(query.getCityCode()), Stream::getCityCode, query.getCityCode())
.eq(StringUtils.isNotEmpty(query.getDistrictCode()), Stream::getDistrictCode, query.getDistrictCode())

+ 18
- 0
tuoheng-api/src/main/java/com/tuoheng/api/service/impl/TenantServiceImpl.java Переглянути файл

@@ -1,11 +1,18 @@
package com.tuoheng.api.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.api.entity.domain.Tenant;
import com.tuoheng.api.entity.request.OnlineNumQuery;
import com.tuoheng.api.mapper.TenantMapper;
import com.tuoheng.api.service.ITenantService;
import com.tuoheng.common.common.BaseServiceImpl;
import com.tuoheng.common.utils.JsonResult;
import com.tuoheng.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* <p>
* 企业管理表 服务实现类
@@ -17,5 +24,16 @@ import org.springframework.stereotype.Service;
@Service
public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, Tenant> implements ITenantService {

@Autowired
TenantMapper tenantMapper;

@Override
public JsonResult tenantsByAreaCode(OnlineNumQuery query) {
List<Tenant> tenantList = tenantMapper.selectList(new LambdaQueryWrapper<Tenant>()
.eq(Tenant::getMark,1)
.eq(StringUtils.isNotEmpty(query.getProvinceCode()), Tenant::getProvinceCode, query.getProvinceCode())
.eq(StringUtils.isNotEmpty(query.getCityCode()), Tenant::getCityCode, query.getCityCode())
.eq(StringUtils.isNotEmpty(query.getDistrictCode()), Tenant::getDistrictCode, query.getDistrictCode()));
return JsonResult.success(tenantList);
}
}

+ 75
- 0
tuoheng-api/src/main/java/com/tuoheng/api/service/impl/UserPointsDetailServiceImpl.java Переглянути файл

@@ -0,0 +1,75 @@
package com.tuoheng.api.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.api.entity.domain.Merchant;
import com.tuoheng.api.entity.domain.UserPointsDetail;
import com.tuoheng.api.entity.request.UserPointsDetailQuery;
import com.tuoheng.api.mapper.MerchantMapper;
import com.tuoheng.api.mapper.UserPointsDetailMapper;
import com.tuoheng.api.service.IUserPointsDetailService;
import com.tuoheng.common.common.BaseServiceImpl;
import com.tuoheng.common.utils.CommonUtils;
import com.tuoheng.common.utils.JsonResult;
import com.tuoheng.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* 全民护河公告表 服务实现类
*
* @author WangHaoran
* @since 2023-05-06
*/
@Service
public class UserPointsDetailServiceImpl extends BaseServiceImpl<UserPointsDetailMapper, UserPointsDetail> implements IUserPointsDetailService {

@Autowired
UserPointsDetailMapper userPointsDetailMapper;

@Autowired
MerchantMapper merchantMapper;

@Override
public JsonResult exchange(UserPointsDetailQuery query) {
if (null == query.getPage() || null == query.getLimit()) {
return JsonResult.error("分页参数为空!");
}
if (null == query.getTenantId()) {
return JsonResult.error("租户ID为空!");
}
if (StringUtils.isEmpty(query.getOpenid())) {
return JsonResult.error("openid为空!");
}

// 获取分页数据
IPage<UserPointsDetail> page = new Page<>(query.getPage(), query.getLimit());
IPage<UserPointsDetail> pageData = userPointsDetailMapper.selectPage(page, new LambdaQueryWrapper<UserPointsDetail>()
.eq(UserPointsDetail::getMark, 1)
.eq(UserPointsDetail::getType, 2)
.eq(UserPointsDetail::getTenantId, query.getTenantId())
.eq(UserPointsDetail::getOpenid,query.getOpenid())
.orderByDesc(UserPointsDetail::getCreateTime));

for (UserPointsDetail record : pageData.getRecords()) {
if(null != record.getOperatorId()){
//查询商铺信息
Merchant merchant = merchantMapper.selectOne(new LambdaQueryWrapper<Merchant>()
.eq(Merchant::getMark, 1)
.eq(Merchant::getUserId, record.getOperatorId()));

if(ObjectUtil.isNotNull(merchant)){
if(StringUtils.isNotEmpty(merchant.getShopsImage())){
record.setShopsImage(CommonUtils.getMultipleUrl(merchant.getShopsImage()));
}
record.setShopsName(merchant.getShopsName());
record.setAreaName(merchant.getAreaName());
}

}
}
return JsonResult.success(pageData);
}
}

+ 4
- 2
tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamActServiceImpl.java Переглянути файл

@@ -3,10 +3,8 @@ package com.tuoheng.api.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.api.entity.domain.Stream;
import com.tuoheng.api.entity.domain.WestreamAct;
import com.tuoheng.api.entity.request.WestreamActQuery;
import com.tuoheng.api.mapper.StreamMapper;
import com.tuoheng.api.mapper.WestreamActMapper;
import com.tuoheng.api.service.IWestreamActService;
import com.tuoheng.common.common.BaseServiceImpl;
@@ -35,11 +33,15 @@ public class WestreamActServiceImpl extends BaseServiceImpl<WestreamActMapper, W
if (null == query.getPage() || null == query.getLimit()) {
return JsonResult.error("参数为空!");
}
if (null == query.getTenantId()) {
return JsonResult.error("租户ID为空!");
}

// 获取分页数据
IPage<WestreamAct> page = new Page<>(query.getPage(), query.getLimit());
IPage<WestreamAct> pageData = westreamActMapper.selectPage(page, new LambdaQueryWrapper<WestreamAct>()
.eq(WestreamAct::getMark, 1)
.eq(WestreamAct::getTenantId, query.getTenantId())
.eq(StringUtils.isNotEmpty(query.getProvinceCode()), WestreamAct::getProvinceCode, query.getProvinceCode())
.eq(StringUtils.isNotEmpty(query.getCityCode()), WestreamAct::getCityCode, query.getCityCode())
.eq(StringUtils.isNotEmpty(query.getDistrictCode()), WestreamAct::getDistrictCode, query.getDistrictCode())

+ 4
- 0
tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamKnowServiceImpl.java Переглянути файл

@@ -33,11 +33,15 @@ public class WestreamKnowServiceImpl extends BaseServiceImpl<WestreamKnowMapper,
if (null == query.getPage() || null == query.getLimit()) {
return JsonResult.error("参数为空!");
}
if (null == query.getTenantId()) {
return JsonResult.error("租户ID为空!");
}

// 获取分页数据
IPage<WestreamKnow> page = new Page<>(query.getPage(), query.getLimit());
IPage<WestreamKnow> pageData = westreamKnowMapper.selectPage(page, new LambdaQueryWrapper<WestreamKnow>()
.eq(WestreamKnow::getMark, 1)
.eq(WestreamKnow::getTenantId, query.getTenantId())
.eq(StringUtils.isNotEmpty(query.getProvinceCode()), WestreamKnow::getProvinceCode, query.getProvinceCode())
.eq(StringUtils.isNotEmpty(query.getCityCode()), WestreamKnow::getCityCode, query.getCityCode())
.eq(StringUtils.isNotEmpty(query.getDistrictCode()), WestreamKnow::getDistrictCode, query.getDistrictCode())

+ 47
- 5
tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamSceneryServiceImpl.java Переглянути файл

@@ -2,24 +2,29 @@ package com.tuoheng.api.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.api.constants.DictConstants;
import com.tuoheng.api.entity.domain.*;
import com.tuoheng.api.entity.request.WestreamSceneryQuery;
import com.tuoheng.api.mapper.StreamMapper;
import com.tuoheng.api.mapper.WestreamSceneryMapper;
import com.tuoheng.api.mapper.WestreamUserMapper;
import com.tuoheng.api.mapper.*;
import com.tuoheng.api.service.IWestreamSceneryService;
import com.tuoheng.api.utils.SmsUtil;
import com.tuoheng.common.common.BaseServiceImpl;
import com.tuoheng.common.common.OperationEnum;
import com.tuoheng.common.exception.ServiceException;
import com.tuoheng.common.utils.CommonUtils;
import com.tuoheng.common.utils.JsonResult;
import com.tuoheng.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.Date;
import java.util.List;

/**
* 全民护河美景表 服务实现类
@@ -27,6 +32,7 @@ import java.util.Date;
* @author WangHaoran
* @since 2023-03-16
*/
@Slf4j
@Service
public class WestreamSceneryServiceImpl extends BaseServiceImpl<WestreamSceneryMapper, WestreamScenery> implements IWestreamSceneryService {
@Autowired
@@ -38,17 +44,27 @@ public class WestreamSceneryServiceImpl extends BaseServiceImpl<WestreamSceneryM
@Autowired
private StreamMapper streamMapper;

@Autowired
private ThDictMapper thDictMapper;

@Autowired
private ThDictDataMapper thDictDataMapper;

@Override
public JsonResult queryPage(WestreamSceneryQuery query) {
if (null == query.getPage() || null == query.getLimit()) {
return JsonResult.error("参数为空!");
}
if (null == query.getTenantId()) {
return JsonResult.error("租户ID为空!");
}

// 获取分页数据
IPage<WestreamScenery> page = new Page<>(query.getPage(), query.getLimit());
IPage<WestreamScenery> pageData = westreamSceneryMapper.selectPage(page, new LambdaQueryWrapper<WestreamScenery>()
.eq(WestreamScenery::getMark, 1)
.eq(WestreamScenery::getStatus,2)
.eq(WestreamScenery::getTenantId, query.getTenantId())
.eq(StringUtils.isNotEmpty(query.getProvinceCode()), WestreamScenery::getProvinceCode, query.getProvinceCode())
.eq(StringUtils.isNotEmpty(query.getCityCode()), WestreamScenery::getCityCode, query.getCityCode())
.eq(StringUtils.isNotEmpty(query.getDistrictCode()), WestreamScenery::getDistrictCode, query.getDistrictCode())
@@ -58,10 +74,11 @@ public class WestreamSceneryServiceImpl extends BaseServiceImpl<WestreamSceneryM
//查询微信用户昵称和头像
WestreamUser westreamUser = westreamUserMapper.selectOne(new LambdaQueryWrapper<WestreamUser>()
.eq(WestreamUser::getOpenid, record.getOpenid())
.eq(WestreamUser::getTenantId, query.getTenantId())
.eq(WestreamUser::getMark, 1));
if(ObjectUtil.isNotNull(westreamUser)){
record.setNickname(westreamUser.getNickname());
record.setHeadimgurl(westreamUser.getHeadimgurl());
record.setHeadimgurl(CommonUtils.getMultipleUrl(westreamUser.getHeadimgurl()));
}
//拼接图片域名
if(StringUtils.isNotEmpty(record.getImage())){
@@ -74,6 +91,9 @@ public class WestreamSceneryServiceImpl extends BaseServiceImpl<WestreamSceneryM

@Override
public JsonResult submit(WestreamScenery westreamScenery) {
if(StringUtils.isEmpty(westreamScenery.getOpenid())){
return JsonResult.error("openid为空");
}
//查询河流信息
Stream stream = streamMapper.selectById(westreamScenery.getStreamId());
if(ObjectUtil.isEmpty(stream)){
@@ -85,6 +105,25 @@ public class WestreamSceneryServiceImpl extends BaseServiceImpl<WestreamSceneryM
westreamScenery.setTenantId(stream.getTenantId());
westreamScenery.setCreateTime(new Date());
westreamSceneryMapper.insert(westreamScenery);

//发送短信
ThDict thDict = thDictMapper.selectOne(new LambdaQueryWrapper<ThDict>()
.eq(ThDict::getTenantId, stream.getTenantId())
.eq(ThDict::getCode, DictConstants.MSG_RULE_CODE)
.eq(ThDict::getMark, 1));
if(ObjectUtils.isNotNull(thDict)){
ThDictData thDictData = thDictDataMapper.selectOne(new LambdaQueryWrapper<ThDictData>()
.eq(ThDictData::getDictId, thDict.getId())
.eq(ThDictData::getName, DictConstants.MSG_RULE_PHONE));
if(ObjectUtils.isNotNull(thDictData)){
if(StringUtils.isNotEmpty(thDictData.getValue())){
List<String> phoneList = Arrays.asList(thDictData.getValue().split(","));
for (String phone : phoneList) {
SmsUtil.sendSyncSms(phone,DictConstants.SMS_276426880,DictConstants.SMS_SMART_LAKE,"{}");
}
}
}
}
return JsonResult.success();
}

@@ -96,11 +135,14 @@ public class WestreamSceneryServiceImpl extends BaseServiceImpl<WestreamSceneryM
if (StringUtils.isEmpty(query.getOpenid())) {
return JsonResult.error("openid为空");
}

if (null == query.getTenantId()) {
return JsonResult.error("租户ID为空!");
}
// 获取分页数据
IPage<WestreamScenery> page = new Page<>(query.getPage(), query.getLimit());
IPage<WestreamScenery> pageData = westreamSceneryMapper.selectPage(page, new LambdaQueryWrapper<WestreamScenery>()
.eq(WestreamScenery::getMark, 1)
.eq(WestreamScenery::getTenantId, query.getTenantId())
.eq(WestreamScenery::getOpenid, query.getOpenid())
.orderByDesc(WestreamScenery::getCreateTime));


+ 89
- 6
tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamUserServiceImpl.java Переглянути файл

@@ -1,17 +1,26 @@
package com.tuoheng.api.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.api.entity.domain.WestreamScenery;
import com.tuoheng.api.entity.domain.Identity;
import com.tuoheng.api.entity.domain.WestreamUser;
import com.tuoheng.api.entity.request.OnlineNumQuery;
import com.tuoheng.api.entity.request.WestreamUserQuery;
import com.tuoheng.api.mapper.IdentityMapper;
import com.tuoheng.api.mapper.WestreamUserMapper;
import com.tuoheng.api.service.IWestreamUserService;
import com.tuoheng.common.common.BaseServiceImpl;
import com.tuoheng.common.config.CommonConfig;
import com.tuoheng.common.utils.CommonUtils;
import com.tuoheng.common.utils.JsonResult;
import com.tuoheng.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.Random;


/**
* 全民护河用户表 服务实现类
*
@@ -20,17 +29,91 @@ import org.springframework.stereotype.Service;
*/
@Service
public class WestreamUserServiceImpl extends BaseServiceImpl<WestreamUserMapper, WestreamUser> implements IWestreamUserService {

@Autowired
private WestreamUserMapper westreamUserMapper;

@Autowired
private IdentityMapper identityMapper;


@Override
public JsonResult onlineNum(OnlineNumQuery query) {
if (null == query.getTenantId()) {
return JsonResult.error("租户ID为空!");
}
//查询某个租户下用户登录总次数
Integer count = westreamUserMapper.selectOnlineNumSum(query);


return JsonResult.success(count);
}

@Override
public JsonResult login(WestreamUser westreamUser) {
if(null == westreamUser.getTenantId() || StringUtils.isEmpty(westreamUser.getOpenid())){
return JsonResult.error("参数为空!");
}
WestreamUser westreamUserQuery = westreamUserMapper.selectOne(new LambdaQueryWrapper<WestreamUser>()
.eq(WestreamUser::getMark, 1)
.eq(WestreamUser::getTenantId, westreamUser.getTenantId())
.eq(WestreamUser::getOpenid, westreamUser.getOpenid()));

if(ObjectUtil.isNull(westreamUserQuery)){
//昵称生成规则:护河行者+4位随机数
int random = (int) (Math.random()*9000+1000);//随机生成一个四位整数
westreamUser.setNickname("护河行者"+random);
String url = "qmhh/headimgurl/" + (new Random().nextInt(11) + 1) + ".jpg";
westreamUser.setHeadimgurl(url);
westreamUser.setCreateTime(new Date());
westreamUserMapper.insert(westreamUser);

westreamUser.setNickname("护河行者"+ westreamUser.getId());
westreamUserMapper.updateById(westreamUser);
}else {
westreamUserQuery.setLoginNum(westreamUserQuery.getLoginNum()+1);
westreamUserMapper.updateById(westreamUserQuery);
}

return JsonResult.success();
}

@Override
public JsonResult userInfo(WestreamUserQuery westreamUserQuery) {
if(null == westreamUserQuery.getTenantId() || StringUtils.isEmpty(westreamUserQuery.getOpenid())){
return JsonResult.error("参数为空!");
}

WestreamUser westreamUser = westreamUserMapper.selectOne(new LambdaQueryWrapper<WestreamUser>()
.eq(WestreamUser::getMark, 1)
.eq(WestreamUser::getTenantId, westreamUserQuery.getTenantId())
.eq(WestreamUser::getOpenid, westreamUserQuery.getOpenid()));
if(ObjectUtil.isNull(westreamUser)){
return JsonResult.error("用户不存在!");
}

Identity identity = identityMapper.selectById(westreamUser.getIdentityId());
if(ObjectUtil.isNotNull(identity)){
westreamUser.setIdentityName(identity.getIdentityName());
westreamUser.setIdentityRemark(identity.getIdentityRemark());
}
westreamUser.setHeadimgurl(CommonUtils.getImageURL(westreamUser.getHeadimgurl()));
return JsonResult.success(westreamUser);
}

@Override
public JsonResult editInfo(WestreamUser westreamUser) {
if(null == westreamUser.getId()){
return JsonResult.error("用户ID为空!");
}
Integer count = westreamUserMapper.selectCount(new LambdaQueryWrapper<WestreamUser>()
.eq(StringUtils.isNotEmpty(query.getProvinceCode()), WestreamUser::getProvinceCode, query.getProvinceCode())
.eq(StringUtils.isNotEmpty(query.getCityCode()), WestreamUser::getCityCode, query.getCityCode())
.eq(StringUtils.isNotEmpty(query.getDistrictCode()), WestreamUser::getDistrictCode, query.getDistrictCode())
.ne(WestreamUser::getId, westreamUser.getId())
.eq(WestreamUser::getMark, 1)
.eq(WestreamUser::getStatus, 1));
return JsonResult.success(count);
.eq(WestreamUser::getNickname, westreamUser.getNickname()));
if(count > 0){
return JsonResult.error("用户昵称已存在!");
}
westreamUserMapper.updateById(westreamUser);
return JsonResult.success();
}
}

+ 0
- 29
tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java Переглянути файл

@@ -22,11 +22,6 @@ import java.util.Random;
@Service
public class WxServiceImpl implements IWxService {

@Autowired
WestreamUserMapper westreamUserMapper;

private static String headimgurl = "https://ta-tech-image.oss-cn-shanghai.aliyuncs.com/qmhh/headimgurl/NAME.jpg";

@Override
public JsonResult openid(String code) {
String openidResult = GetOpenIdUtil.getopenid(code, CommonConfig.appId, CommonConfig.appSecret);
@@ -39,28 +34,4 @@ public class WxServiceImpl implements IWxService {
}
}

@Override
public JsonResult westreamUser(String openid) {
WestreamUser westreamUser = westreamUserMapper.selectOne(new LambdaQueryWrapper<WestreamUser>()
.eq(WestreamUser::getOpenid, openid)
.eq(WestreamUser::getMark, 1));

//需要生成用户头像和昵称
if(ObjectUtil.isNull(westreamUser)){

WestreamUser westreamUserAdd = new WestreamUser();
westreamUserAdd.setOpenid(openid);
//昵称生成规则:护河行者+4位随机数
int random = (int) (Math.random()*9000+1000);//随机生成一个四位整数
westreamUserAdd.setNickname("护河行者"+random);
String url = headimgurl.replaceAll("NAME", String.valueOf(new Random().nextInt(11) + 1));
westreamUserAdd.setHeadimgurl(url);
westreamUserAdd.setCreateTime(new Date());
westreamUserMapper.insert(westreamUserAdd);
return JsonResult.success(westreamUserAdd);
}

return JsonResult.success(westreamUser);
}

}

+ 48
- 0
tuoheng-api/src/main/java/com/tuoheng/api/utils/SmsUtil.java Переглянути файл

@@ -0,0 +1,48 @@
package com.tuoheng.api.utils;

import com.alibaba.fastjson.JSONObject;
import com.tuoheng.common.config.CommonConfig;
import com.tuoheng.common.exception.ServiceException;
import com.tuoheng.common.utils.HttpUtils;
import com.tuoheng.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpStatus;


@Slf4j
public class SmsUtil {

private static String url = "api/web/sms/sendSyncSms";

/**
*
* @param phoneNumbers 手机号码
* @param templateCode 短信模板code
* @param signName 签名名称
* @param templateParam 模板替换值
* @return
*/
public static void sendSyncSms(String phoneNumbers, String templateCode, String signName, String templateParam) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("phoneNumbers", phoneNumbers);
jsonObject.put("templateCode", templateCode);
jsonObject.put("signName", signName);
jsonObject.put("templateParam", templateParam);

String dspSmsUrl = CommonConfig.dspDomainUrl + "api/web/sms/sendSyncSms";
//发送http请求
String result = HttpUtils.doSend(dspSmsUrl, jsonObject, null,"POST");
if(StringUtils.isEmpty(result)){
log.error("发送短信接口响应空:"+result);
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "短信发送失败");
}
JSONObject resultJson = JSONObject.parseObject(result);
if(0 != resultJson.getIntValue("code")){
log.error("发送短信接口响应失败:"+result);
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "短信发送失败");
}

}

}

+ 2
- 0
tuoheng-api/src/main/resources/application-dev.yml Переглянути файл

@@ -15,6 +15,8 @@ tuoheng:
video-url: http://vod.play.t-aaron.com/
# 高德Key
gaodeKey: 5a1f63e7563cba471a9d0773e218144a
# DSP服务域名
dsp-domain-url: http://192.168.11.11:7011/
#阿里云
aliyuncsVod:
accessKeyId: LTAI5tE7KWN9fsuGU7DyfYF4

+ 2
- 0
tuoheng-api/src/main/resources/application-prod.yml Переглянути файл

@@ -15,6 +15,8 @@ tuoheng:
video-url: https://vod.play.t-aaron.com/
# 高德Key
gaodeKey: 5a1f63e7563cba471a9d0773e218144a
# DSP服务域名
dsp-domain-url: https://dsp-portal.t-aaron.com/
#阿里云
aliyuncsVod:
accessKeyId: LTAI5tE7KWN9fsuGU7DyfYF4

+ 2
- 0
tuoheng-api/src/main/resources/application-test.yml Переглянути файл

@@ -15,6 +15,8 @@ tuoheng:
video-url: http://vod.play.t-aaron.com/
# 高德Key
gaodeKey: 5a1f63e7563cba471a9d0773e218144a
# DSP服务域名
dsp-domain-url: http://172.15.1.11:7011/
#阿里云
aliyuncsVod:
accessKeyId: LTAI5tE7KWN9fsuGU7DyfYF4

+ 13
- 0
tuoheng-api/src/main/resources/mapper/WestreamUserMapper.xml Переглянути файл

@@ -0,0 +1,13 @@
<?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.tuoheng.api.mapper.WestreamUserMapper">


<select id="selectOnlineNumSum" resultType="java.lang.Integer">
SELECT SUM(login_num)
FROM th_user_member
WHERE tenant_id = #{query.tenantId}
AND mark = 1
</select>

</mapper>

+ 16
- 0
tuoheng-common/src/main/java/com/tuoheng/common/config/CommonConfig.java Переглянути файл

@@ -38,6 +38,11 @@ public class CommonConfig {
*/
public static String appSecret;

/**
* DSP服务域名
*/
public static String dspDomainUrl;

/**
* 图片域名赋值
*
@@ -98,4 +103,15 @@ public class CommonConfig {
appSecret = secret;
}

/**
* DSP服务域名赋值
*
* @param url DSP服务域名
*/
@Value("${tuoheng.dsp-domain-url}")
public void setDspDomainUrl(String url) {
dspDomainUrl = url;
}


}

+ 59
- 4
tuoheng-common/src/main/java/com/tuoheng/common/utils/HttpUtils.java Переглянути файл

@@ -1,15 +1,15 @@
package com.tuoheng.common.utils;

import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.net.ssl.*;
import java.io.*;
import java.net.ConnectException;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.net.URLConnection;
import java.net.*;
import java.nio.charset.StandardCharsets;
import java.security.cert.X509Certificate;
import java.util.Map;

/**
* 通用http发送方法
@@ -118,6 +118,61 @@ public class HttpUtils {
return result.toString();
}

/**
* 处理post请求
* @param urlStr 请求url
* @param data 请求体数据
* @param properties 请求头参数
* @return
*/
public static String doSend(String urlStr, JSONObject data, Map<String, String> properties, String method){
StringBuilder result = new StringBuilder();
try {
log.info("请求url={}", urlStr);
log.info("请求体数据data={}", data.toJSONString());
log.info("请求头参数properties={}", properties);
URL url = new URL(urlStr);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();

connection.setDoInput(true); // 设置可输入
connection.setDoOutput(true); // 设置该连接是可以输出的
//设置连接超时时间和读取超时时间
connection.setConnectTimeout(15000);
connection.setReadTimeout(60000 * 5);
//设置请求方式
connection.setRequestMethod(method);
connection.setRequestProperty("Content-Type", "application/json;charset=UTF-8");
if(null != properties && !properties.isEmpty()){
for (String key:properties.keySet()){
connection.setRequestProperty(key, properties.get(key));
}
}

PrintWriter pw = new PrintWriter(new BufferedOutputStream(connection.getOutputStream()));
pw.write(data.toJSONString());
pw.flush();
pw.close();

BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8));
String line = null;

while ((line = br.readLine()) != null) { // 读取数据
result.append(line).append("\n");
}
connection.disconnect();
log.info("recv - {}", result);
} catch (ConnectException e) {
log.error("调用HttpUtils.sendGet ConnectException, url=" + urlStr + ",param=" + data, e);
} catch (SocketTimeoutException e) {
log.error("调用HttpUtils.sendGet SocketTimeoutException, url=" + urlStr + ",param=" + data, e);
} catch (IOException e) {
log.error("调用HttpUtils.sendGet IOException, url=" + urlStr + ",param=" + data, e);
} catch (Exception e) {
log.error("调用HttpsUtil.sendGet Exception, url=" + urlStr + ",param=" + data, e);
}
return result.toString();
}

public static String sendSSLPost(String url, String param) {
StringBuilder result = new StringBuilder();
String urlNameString = url + "?" + param;

Завантаження…
Відмінити
Зберегти