Commit 21f181fc by zhouhaibao

[+]订阅问题处理,新增群名过滤

1 parent 31303490
...@@ -19,7 +19,7 @@ public interface ReportSubscribeRemote { ...@@ -19,7 +19,7 @@ public interface ReportSubscribeRemote {
@ApiParam(name = "userPhone", notes = "用户手机号", dataType = ApiParam.DataTypeEnum.STRING, required = true), @ApiParam(name = "userPhone", notes = "用户手机号", dataType = ApiParam.DataTypeEnum.STRING, required = true),
@ApiParam(name = "subscribeStatus", notes = "订阅状态:0:未订阅,1:已订阅", dataType = ApiParam.DataTypeEnum.INTEGER, required = true) @ApiParam(name = "subscribeStatus", notes = "订阅状态:0:未订阅,1:已订阅", dataType = ApiParam.DataTypeEnum.INTEGER, required = true)
}) })
RpcResponse<Boolean> updateWeeklyReportSubscribe(Integer userId, String userName, String userPhone, Integer subscribeStatus); RpcResponse<Boolean> updateWeeklyReportSubscribe(String userId, String userName, String userPhone, Integer subscribeStatus);
@ApiMethod("更新展业月报订阅状态") @ApiMethod("更新展业月报订阅状态")
@ApiResponse("更新结果") @ApiResponse("更新结果")
...@@ -29,12 +29,12 @@ public interface ReportSubscribeRemote { ...@@ -29,12 +29,12 @@ public interface ReportSubscribeRemote {
@ApiParam(name = "userPhone", notes = "用户手机号", dataType = ApiParam.DataTypeEnum.STRING, required = true), @ApiParam(name = "userPhone", notes = "用户手机号", dataType = ApiParam.DataTypeEnum.STRING, required = true),
@ApiParam(name = "subscribeStatus", notes = "订阅状态:0:未订阅,1:已订阅", dataType = ApiParam.DataTypeEnum.INTEGER, required = true) @ApiParam(name = "subscribeStatus", notes = "订阅状态:0:未订阅,1:已订阅", dataType = ApiParam.DataTypeEnum.INTEGER, required = true)
}) })
RpcResponse<Boolean> updateMonthlyReportSubscribe(Integer userId, String userName, String userPhone, Integer subscribeStatus); RpcResponse<Boolean> updateMonthlyReportSubscribe(String userId, String userName, String userPhone, Integer subscribeStatus);
@ApiMethod("查询用户订阅配置") @ApiMethod("查询用户订阅配置")
@ApiResponse("订阅配置") @ApiResponse("订阅配置")
@ApiParams({ @ApiParams({
@ApiParam(name = "userId", notes = "用户ID", dataType = ApiParam.DataTypeEnum.INTEGER, required = true) @ApiParam(name = "userId", notes = "用户ID", dataType = ApiParam.DataTypeEnum.INTEGER, required = true)
}) })
RpcResponse<DjReportSubscribeConfig> getSubscribeConfig(Integer userId); RpcResponse<DjReportSubscribeConfig> getSubscribeConfig(String userId);
} }
\ No newline at end of file \ No newline at end of file
...@@ -11,7 +11,7 @@ public interface DjReportSubscribeConfigMapper { ...@@ -11,7 +11,7 @@ public interface DjReportSubscribeConfigMapper {
* @param userId 用户ID * @param userId 用户ID
* @return 订阅配置 * @return 订阅配置
*/ */
DjReportSubscribeConfig selectByUserId(@Param("userId") Integer userId); DjReportSubscribeConfig selectByUserId(@Param("userId") String userId);
/** /**
* 插入订阅配置 * 插入订阅配置
......
package cn.com.glsx.dj.peanalysis.model; package cn.com.glsx.dj.peanalysis.model;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import javax.persistence.*; import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.Data;
@Data @Data
@Table(name = "dj_report_subscribe_config") @Table(name = "dj_report_subscribe_config")
...@@ -21,7 +23,7 @@ public class DjReportSubscribeConfig implements Serializable { ...@@ -21,7 +23,7 @@ public class DjReportSubscribeConfig implements Serializable {
* 用户ID * 用户ID
*/ */
@Column(name = "user_id") @Column(name = "user_id")
private Integer userId; private String userId;
/** /**
* 用户名称 * 用户名称
......
...@@ -15,7 +15,7 @@ public class ReportSubscribeRemoteImpl implements ReportSubscribeRemote { ...@@ -15,7 +15,7 @@ public class ReportSubscribeRemoteImpl implements ReportSubscribeRemote {
private ReportSubscribeService reportSubscribeService; private ReportSubscribeService reportSubscribeService;
@Override @Override
public RpcResponse<Boolean> updateWeeklyReportSubscribe(Integer userId, String userName, String userPhone, Integer subscribeStatus) { public RpcResponse<Boolean> updateWeeklyReportSubscribe(String userId, String userName, String userPhone, Integer subscribeStatus) {
try { try {
boolean result = reportSubscribeService.updateWeeklyReportSubscribe(userId, userName, userPhone, subscribeStatus); boolean result = reportSubscribeService.updateWeeklyReportSubscribe(userId, userName, userPhone, subscribeStatus);
return RpcResponse.success(result); return RpcResponse.success(result);
...@@ -26,7 +26,7 @@ public class ReportSubscribeRemoteImpl implements ReportSubscribeRemote { ...@@ -26,7 +26,7 @@ public class ReportSubscribeRemoteImpl implements ReportSubscribeRemote {
} }
@Override @Override
public RpcResponse<Boolean> updateMonthlyReportSubscribe(Integer userId, String userName, String userPhone, Integer subscribeStatus) { public RpcResponse<Boolean> updateMonthlyReportSubscribe(String userId, String userName, String userPhone, Integer subscribeStatus) {
try { try {
boolean result = reportSubscribeService.updateMonthlyReportSubscribe(userId, userName, userPhone, subscribeStatus); boolean result = reportSubscribeService.updateMonthlyReportSubscribe(userId, userName, userPhone, subscribeStatus);
return RpcResponse.success(result); return RpcResponse.success(result);
...@@ -37,7 +37,7 @@ public class ReportSubscribeRemoteImpl implements ReportSubscribeRemote { ...@@ -37,7 +37,7 @@ public class ReportSubscribeRemoteImpl implements ReportSubscribeRemote {
} }
@Override @Override
public RpcResponse<DjReportSubscribeConfig> getSubscribeConfig(Integer userId) { public RpcResponse<DjReportSubscribeConfig> getSubscribeConfig(String userId) {
try { try {
DjReportSubscribeConfig config = reportSubscribeService.getSubscribeConfig(userId); DjReportSubscribeConfig config = reportSubscribeService.getSubscribeConfig(userId);
return RpcResponse.success(config); return RpcResponse.success(config);
......
...@@ -22,7 +22,7 @@ public class ReportSubscribeService { ...@@ -22,7 +22,7 @@ public class ReportSubscribeService {
* @param subscribeStatus 订阅状态:0:未订阅,1:已订阅 * @param subscribeStatus 订阅状态:0:未订阅,1:已订阅
* @return 更新结果 * @return 更新结果
*/ */
public boolean updateWeeklyReportSubscribe(Integer userId, String userName, String userPhone, Integer subscribeStatus) { public boolean updateWeeklyReportSubscribe(String userId, String userName, String userPhone, Integer subscribeStatus) {
try { try {
// 查找用户的订阅配置 // 查找用户的订阅配置
DjReportSubscribeConfig config = djReportSubscribeConfigMapper.selectByUserId(userId); DjReportSubscribeConfig config = djReportSubscribeConfigMapper.selectByUserId(userId);
...@@ -57,7 +57,7 @@ public class ReportSubscribeService { ...@@ -57,7 +57,7 @@ public class ReportSubscribeService {
* @param subscribeStatus 订阅状态:0:未订阅,1:已订阅 * @param subscribeStatus 订阅状态:0:未订阅,1:已订阅
* @return 更新结果 * @return 更新结果
*/ */
public boolean updateMonthlyReportSubscribe(Integer userId, String userName, String userPhone, Integer subscribeStatus) { public boolean updateMonthlyReportSubscribe(String userId, String userName, String userPhone, Integer subscribeStatus) {
try { try {
// 查找用户的订阅配置 // 查找用户的订阅配置
DjReportSubscribeConfig config = djReportSubscribeConfigMapper.selectByUserId(userId); DjReportSubscribeConfig config = djReportSubscribeConfigMapper.selectByUserId(userId);
...@@ -89,7 +89,7 @@ public class ReportSubscribeService { ...@@ -89,7 +89,7 @@ public class ReportSubscribeService {
* @param userId 用户ID * @param userId 用户ID
* @return 订阅配置 * @return 订阅配置
*/ */
public DjReportSubscribeConfig getSubscribeConfig(Integer userId) { public DjReportSubscribeConfig getSubscribeConfig(String userId) {
try { try {
return djReportSubscribeConfigMapper.selectByUserId(userId); return djReportSubscribeConfigMapper.selectByUserId(userId);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<mapper namespace="cn.com.glsx.dj.peanalysis.mapper.DjReportSubscribeConfigMapper" > <mapper namespace="cn.com.glsx.dj.peanalysis.mapper.DjReportSubscribeConfigMapper" >
<resultMap id="BaseResultMap" type="cn.com.glsx.dj.peanalysis.model.DjReportSubscribeConfig" > <resultMap id="BaseResultMap" type="cn.com.glsx.dj.peanalysis.model.DjReportSubscribeConfig" >
<id column="id" property="id" jdbcType="INTEGER" /> <id column="id" property="id" jdbcType="INTEGER" />
<result column="user_id" property="userId" jdbcType="INTEGER" /> <result column="user_id" property="userId" jdbcType="VARCHAR" />
<result column="user_name" property="userName" jdbcType="VARCHAR" /> <result column="user_name" property="userName" jdbcType="VARCHAR" />
<result column="user_phone" property="userPhone" jdbcType="VARCHAR" /> <result column="user_phone" property="userPhone" jdbcType="VARCHAR" />
<result column="weekly_report_subscribe" property="weeklyReportSubscribe" jdbcType="INTEGER" /> <result column="weekly_report_subscribe" property="weeklyReportSubscribe" jdbcType="INTEGER" />
...@@ -12,15 +12,15 @@ ...@@ -12,15 +12,15 @@
<result column="updated_time" property="updatedTime" jdbcType="TIMESTAMP" /> <result column="updated_time" property="updatedTime" jdbcType="TIMESTAMP" />
</resultMap> </resultMap>
<select id="selectByUserId" resultMap="BaseResultMap" parameterType="java.lang.Integer" > <select id="selectByUserId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select id, user_id, user_name, user_phone, weekly_report_subscribe, monthly_report_subscribe, created_time, updated_time select id, user_id, user_name, user_phone, weekly_report_subscribe, monthly_report_subscribe, created_time, updated_time
from dj_report_subscribe_config from dj_report_subscribe_config
where user_id = #{userId, jdbcType=INTEGER} where user_id = #{userId, jdbcType=VARCHAR}
</select> </select>
<insert id="insert" parameterType="cn.com.glsx.dj.peanalysis.model.DjReportSubscribeConfig" > <insert id="insert" parameterType="cn.com.glsx.dj.peanalysis.model.DjReportSubscribeConfig" >
insert into dj_report_subscribe_config (user_id, user_name, user_phone, weekly_report_subscribe, monthly_report_subscribe, created_time, updated_time) insert into dj_report_subscribe_config (user_id, user_name, user_phone, weekly_report_subscribe, monthly_report_subscribe, created_time, updated_time)
values (#{userId, jdbcType=INTEGER}, #{userName, jdbcType=VARCHAR}, #{userPhone, jdbcType=VARCHAR}, #{weeklyReportSubscribe, jdbcType=INTEGER}, #{monthlyReportSubscribe, jdbcType=INTEGER}, now(), now()) values (#{userId, jdbcType=VARCHAR}, #{userName, jdbcType=VARCHAR}, #{userPhone, jdbcType=VARCHAR}, #{weeklyReportSubscribe, jdbcType=INTEGER}, #{monthlyReportSubscribe, jdbcType=INTEGER}, now(), now())
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.com.glsx.dj.peanalysis.model.DjReportSubscribeConfig" > <update id="updateByPrimaryKeySelective" parameterType="cn.com.glsx.dj.peanalysis.model.DjReportSubscribeConfig" >
......
...@@ -17,25 +17,25 @@ public class ReportSubscribeServiceTest extends BaseRemoteTest { ...@@ -17,25 +17,25 @@ public class ReportSubscribeServiceTest extends BaseRemoteTest {
@Test @Test
public void testUpdateWeeklyReportSubscribe() { public void testUpdateWeeklyReportSubscribe() {
boolean result = reportSubscribeService.updateWeeklyReportSubscribe(1001, "张三", "13476670746", 1); boolean result = reportSubscribeService.updateWeeklyReportSubscribe("1001", "张三", "13476670746", 1);
System.out.println("更新展业周报订阅状态(订阅): " + result); System.out.println("更新展业周报订阅状态(订阅): " + result);
result = reportSubscribeService.updateWeeklyReportSubscribe(1001, "张三", "13476670746", 0); result = reportSubscribeService.updateWeeklyReportSubscribe("1001", "张三", "13476670746", 0);
System.out.println("更新展业周报订阅状态(取消订阅): " + result); System.out.println("更新展业周报订阅状态(取消订阅): " + result);
} }
@Test @Test
public void testUpdateMonthlyReportSubscribe() { public void testUpdateMonthlyReportSubscribe() {
boolean result = reportSubscribeService.updateMonthlyReportSubscribe(1002, "李四", "13800138002", 1); boolean result = reportSubscribeService.updateMonthlyReportSubscribe("1001", "李四", "13800138002", 1);
System.out.println("更新展业月报订阅状态(订阅): " + result); System.out.println("更新展业月报订阅状态(订阅): " + result);
result = reportSubscribeService.updateMonthlyReportSubscribe(1002, "李四", "13800138002", 0); result = reportSubscribeService.updateMonthlyReportSubscribe("1001", "李四", "13800138002", 0);
System.out.println("更新展业月报订阅状态(取消订阅): " + result); System.out.println("更新展业月报订阅状态(取消订阅): " + result);
} }
@Test @Test
public void testGetSubscribeConfig() { public void testGetSubscribeConfig() {
DjReportSubscribeConfig config = reportSubscribeService.getSubscribeConfig(1001); DjReportSubscribeConfig config = reportSubscribeService.getSubscribeConfig("1001");
System.out.println("查询用户订阅配置: " + JSON.toJSONString(config)); System.out.println("查询用户订阅配置: " + JSON.toJSONString(config));
} }
...@@ -53,9 +53,9 @@ public class ReportSubscribeServiceTest extends BaseRemoteTest { ...@@ -53,9 +53,9 @@ public class ReportSubscribeServiceTest extends BaseRemoteTest {
@Test @Test
public void testBatchSubscribe() { public void testBatchSubscribe() {
reportSubscribeService.updateWeeklyReportSubscribe(1003, "王五", "13800138003", 1); reportSubscribeService.updateWeeklyReportSubscribe("12121", "王五", "13800138003", 1);
reportSubscribeService.updateWeeklyReportSubscribe(1004, "赵六", "13800138004", 1); reportSubscribeService.updateWeeklyReportSubscribe("121212", "赵六", "13800138004", 1);
reportSubscribeService.updateWeeklyReportSubscribe(1005, "孙七", "13800138005", 1); reportSubscribeService.updateWeeklyReportSubscribe("121213", "孙七", "13800138005", 1);
List<DjReportSubscribeConfig> subscribers = reportSubscribeService.getWeeklySubscribers(); List<DjReportSubscribeConfig> subscribers = reportSubscribeService.getWeeklySubscribers();
System.out.println("批量订阅后查询已订阅周报的用户列表: " + JSON.toJSONString(subscribers)); System.out.println("批量订阅后查询已订阅周报的用户列表: " + JSON.toJSONString(subscribers));
...@@ -63,10 +63,10 @@ public class ReportSubscribeServiceTest extends BaseRemoteTest { ...@@ -63,10 +63,10 @@ public class ReportSubscribeServiceTest extends BaseRemoteTest {
@Test @Test
public void testUpdateExistingUser() { public void testUpdateExistingUser() {
reportSubscribeService.updateWeeklyReportSubscribe(1001, "张三", "13800138001", 1); reportSubscribeService.updateWeeklyReportSubscribe("1001", "张三", "13800138001", 1);
reportSubscribeService.updateMonthlyReportSubscribe(1001, "张三", "13800138001", 1); reportSubscribeService.updateMonthlyReportSubscribe("1001", "张三", "13800138001", 1);
DjReportSubscribeConfig config = reportSubscribeService.getSubscribeConfig(1001); DjReportSubscribeConfig config = reportSubscribeService.getSubscribeConfig("1001");
System.out.println("更新已有用户订阅配置后查询: " + JSON.toJSONString(config)); System.out.println("更新已有用户订阅配置后查询: " + JSON.toJSONString(config));
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -22,14 +22,14 @@ public class WeComMessageServiceTest extends BaseRemoteTest { ...@@ -22,14 +22,14 @@ public class WeComMessageServiceTest extends BaseRemoteTest {
List<DjReportSubscribeConfig> subscribers = Lists.newArrayList(); List<DjReportSubscribeConfig> subscribers = Lists.newArrayList();
DjReportSubscribeConfig config1 = new DjReportSubscribeConfig(); DjReportSubscribeConfig config1 = new DjReportSubscribeConfig();
config1.setUserId(1001); config1.setUserId("1001");
config1.setUserName("张三"); config1.setUserName("张三");
config1.setUserPhone("13800138001"); config1.setUserPhone("13800138001");
config1.setWeeklyReportSubscribe(1); config1.setWeeklyReportSubscribe(1);
subscribers.add(config1); subscribers.add(config1);
DjReportSubscribeConfig config2 = new DjReportSubscribeConfig(); DjReportSubscribeConfig config2 = new DjReportSubscribeConfig();
config2.setUserId(1002); config2.setUserId("1002");
config2.setUserName("李四"); config2.setUserName("李四");
config2.setUserPhone("13476670746"); config2.setUserPhone("13476670746");
config2.setWeeklyReportSubscribe(1); config2.setWeeklyReportSubscribe(1);
...@@ -50,14 +50,14 @@ public class WeComMessageServiceTest extends BaseRemoteTest { ...@@ -50,14 +50,14 @@ public class WeComMessageServiceTest extends BaseRemoteTest {
List<DjReportSubscribeConfig> subscribers = Lists.newArrayList(); List<DjReportSubscribeConfig> subscribers = Lists.newArrayList();
DjReportSubscribeConfig config1 = new DjReportSubscribeConfig(); DjReportSubscribeConfig config1 = new DjReportSubscribeConfig();
config1.setUserId(1001); config1.setUserId("1001");
config1.setUserName("张三"); config1.setUserName("张三");
config1.setUserPhone("13800138001"); config1.setUserPhone("13800138001");
config1.setMonthlyReportSubscribe(1); config1.setMonthlyReportSubscribe(1);
subscribers.add(config1); subscribers.add(config1);
DjReportSubscribeConfig config2 = new DjReportSubscribeConfig(); DjReportSubscribeConfig config2 = new DjReportSubscribeConfig();
config2.setUserId(1002); config2.setUserId("1002");
config2.setUserName("李四"); config2.setUserName("李四");
config2.setUserPhone("13476670746"); config2.setUserPhone("13476670746");
config2.setMonthlyReportSubscribe(1); config2.setMonthlyReportSubscribe(1);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!