Commit 9992a7e5 by jscat

nyx javaapp: 功能更新

1. 添加更新tbl_activity表like字段的功能
2. 添加更新tbl_collect表数据的功能
parent d70ab424
package cn.com.fun.nyxkey.api.domain;
package cn.com.fun.nyxkey.api.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 收藏信息 视图表
* Created by jscat on 2020/08/26.
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Rockwell_keyV_collect{
// 收藏表信息
private String collectId; // 活动的id, uuid format
private String collectStatus; // 类别说明
private String userId; // 类别说明
private String activityId; // 活动的id, uuid format
private String memberId; // 活动的id, uuid format
private String memberName; // 商家名称
private String memberSlogan; // 商家slogan
private String memberStatus; // 用户状态: 00: 未注册用户; 01: 已注册用户
private String memberLogo; // 商家logo
private String tag; // 活动的标签
private String title; // 活动的标题
private String titleAbbr; // 活动的标题.简称
private String numLike; // 针对每条activity的点赞次数,每点一次,则累加
private String content; // 活动内容
private String quiz; // quiz题目列表, 通过::做间隔,
private Double point; // quiz 总的积分
private String addressName; // 活动地址
private String productId; // 活动的id, uuid format
private String productDesc; // 类别说明
private String productStatus; // 商品状态: 00:非可售 01:可售
private String defaultStatus; // 默认标记; 00-非默认; 01-默认
private Double unitPrice; // 价格
private int stock; // 库存情况
private String noteImage; // 该条活动的image列表
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date startDatetime; // 统计周期
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date endDatetime; // 统计周期
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date createDatetime; // 统计周期
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date updateDatetime; // 更新日期
}
package cn.com.fun.nyxkey.api.domain.query;
package cn.com.fun.nyxkey.api.domain.query;
import cn.com.fun.nyxkey.api.common.Pagination;
import lombok.AllArgsConstructor;
import lombok.Data;
/**
* Created by jscat on 2020/08/26
*/
@Data
@AllArgsConstructor
public class Rockwell_keyT_collectQuery {
private String userId; // 用户 id
private String activityId; //活动 id
private String collectStatus; // 收藏状态
private Pagination pagination;
//默认返回1页4条记录
public Rockwell_keyT_collectQuery()
{
this.pagination = new Pagination(1, 4);
}
public void setActivityId(String strActivityId)
{
if(strActivityId.equals("0"))
{
this.activityId = null;
}
else
{
this.activityId = strActivityId;
}
}
public void setUserId(String strUserId)
{
if(strUserId.equals("0"))
{
this.userId = null;
}
else
{
this.userId = strUserId;
}
}
public void setCollectStatus(String strCollectStatus)
{
if(strCollectStatus.equals("0"))
{
this.collectStatus = null;
}
else
{
this.collectStatus = strCollectStatus;
}
}
@Override
public String toString() {
return "Rockwell_keyT_collectQuery{" +
"activityId='" + activityId + '\'' +
"userId='" + userId + '\'' +
"collectStatus='" + collectStatus + '\'' +
"pagination='" + pagination + '\'' +
'}';
}
}
package cn.com.fun.nyxkey.api.repository;
package cn.com.fun.nyxkey.api.repository;
......@@ -49,6 +49,10 @@ public interface Rockwell_keyMapper {
List<Rockwell_keyV_order_info> getV_order_detail_by_page(Rockwell_keyT_orderQuery rockwell_keyT_orderQuery);
List<Rockwell_keyV_order_info> getV_order_info_by_page(Rockwell_keyT_orderQuery rockwell_keyT_orderQuery);
/* collect api */
List<Rockwell_keyV_collect> getV_collect_by_page(Rockwell_keyT_collectQuery rockwell_keyT_collectQuery);
void updateT_collect(Rockwell_keyT_collectQuery rockwell_keyT_collectQuery);
/* testing */
void test(Rockwell_keyT_matchQuery rockwell_keyT_matchQuery);
......
package cn.com.fun.nyxkey.api.service;
package cn.com.fun.nyxkey.api.service;
......@@ -44,9 +44,9 @@ public interface Rockwell_keyService {
activity api
*/
JSONResult Rockwell_keyServiceGetV_activity_info(String tag, String title,
String memberId, String memberName, String memberStatus, String orderType, String curDate,
String memberId, String memberName, String memberStatus, String city, String orderType, String curDate,
int pageNum, int pageCount);
JSONResult Rockwell_keyServiceGetV_activity_info_by_period(String tag, String title, String memberId, String memberName, String city, String memberStatus,
JSONResult Rockwell_keyServiceGetV_activity_info_by_period(String tag, String title, String memberId, String memberName, String memberStatus, String city,
String beginDate, String endDate, int pageNum, int pageCount);
JSONResult Rockwell_keyServiceGetV_activity_detail_by_id(String activityId);
int Rockwell_keyServiceAddT_activityLike(String activityId);
......@@ -67,6 +67,12 @@ public interface Rockwell_keyService {
int pageNum, int pageCount);
JSONResult Rockwell_keyServiceGetV_order_detail(String userId, String orderStatus, int pageNum, int pageCount);
/*
collect api 收藏api
*/
JSONResult Rockwell_keyServiceGetV_collect(String userId, int pageNum, int pageCount);
int Rockwell_keyServiceUpdateT_collect(String userId, String activityId, String collectStatus);
// testing
void Rockwell_keyServiceTest(List<Rockwell_keyT_match> listRockwell_keyT_match);
......
package cn.com.fun.nyxkey.api.service.impl;
package cn.com.fun.nyxkey.api.service.impl;
......@@ -303,7 +303,7 @@ public class Rockwell_keyServiceImpl implements Rockwell_keyService {
public JSONResult Rockwell_keyServiceGetV_activity_info(String tag, String title,
String memberId, String memberName, String memberStatus, String orderType, String curDate,
String memberId, String memberName, String memberStatus, String city, String orderType, String curDate,
int pageNum, int pageCount)
{
LOGGER.debug("find Rockwell_keyServiceGetV_activity_info");
......@@ -323,6 +323,7 @@ public class Rockwell_keyServiceImpl implements Rockwell_keyService {
}
rockwell_keyT_activityQuery.setMemberId(memberId);
rockwell_keyT_activityQuery.setMemberName(memberName);
rockwell_keyT_activityQuery.setCity(city);
rockwell_keyT_activityQuery.setOrderType(orderType);
rockwell_keyT_activityQuery.setTag(tag);
rockwell_keyT_activityQuery.setTitle(title);
......@@ -335,10 +336,10 @@ public class Rockwell_keyServiceImpl implements Rockwell_keyService {
return jsonResult;
}
public JSONResult Rockwell_keyServiceGetV_activity_info_by_period(String tag, String title, String memberId, String memberName, String city, String memberStatus,
public JSONResult Rockwell_keyServiceGetV_activity_info_by_period(String tag, String title, String memberId, String memberName, String memberStatus, String city,
String beginDate, String endDate, int pageNum, int pageCount)
{
LOGGER.debug("find Rockwell_keyServiceGetV_activity_info");
LOGGER.debug("find Rockwell_keyServiceGetV_activity_info_by_period");
List<Rockwell_keyV_activity_info> listRockwell_keyV_activity_info = new ArrayList<>();
Rockwell_keyT_activityQuery rockwell_keyT_activityQuery = new Rockwell_keyT_activityQuery();
......@@ -527,6 +528,44 @@ public class Rockwell_keyServiceImpl implements Rockwell_keyService {
}
public JSONResult Rockwell_keyServiceGetV_collect(String userId, int pageNum, int pageCount)
{
LOGGER.debug("find Rockwell_keyServiceGetV_collect");
List<Rockwell_keyV_collect> listRockwell_keyV_collect = new ArrayList<>();
Rockwell_keyT_collectQuery rockwell_keyT_collectQuery = new Rockwell_keyT_collectQuery();
//判断某字符串是否为空,为空的标准是 str==null 或 str.length()==0
//默认设置 collectStatus == "01"
//默认设置 end_datetime >= NOW()
if(StringUtils.isEmpty(userId) || userId.equals("0"))
{
return new JSONResult(ExceptionMsg.ParamError);
}
rockwell_keyT_collectQuery.setUserId(userId);
rockwell_keyT_collectQuery.setCollectStatus("01");
rockwell_keyT_collectQuery.setPagination(new Pagination(pageNum, pageCount));
listRockwell_keyV_collect = rockwell_keyMapper.getV_collect_by_page(rockwell_keyT_collectQuery);
int totalCount = listRockwell_keyV_collect.size();
JSONResult jsonResult = new JSONResult(totalCount, listRockwell_keyV_collect);
return jsonResult;
}
public int Rockwell_keyServiceUpdateT_collect(String userId, String activityId, String collectStatus)
{
LOGGER.debug("find Rockwell_keyServiceUpdateT_collect");
Rockwell_keyT_collectQuery rockwell_keyT_collectQuery = new Rockwell_keyT_collectQuery();
rockwell_keyT_collectQuery.setActivityId(activityId);
rockwell_keyT_collectQuery.setUserId(userId);
rockwell_keyT_collectQuery.setCollectStatus(collectStatus);
rockwell_keyMapper.updateT_collect(rockwell_keyT_collectQuery);
return 0;
}
// testing
public void Rockwell_keyServiceTest(List<Rockwell_keyT_match> listRockwell_keyT_match)
{
......
package cn.com.fun.nyxkey.api.web.controller;
package cn.com.fun.nyxkey.api.web.controller;
......@@ -266,11 +266,12 @@ public class NyxApiController {
@ApiImplicitParams({
@ApiImplicitParam(name = "tag", value = "按标签查找; 饮事", required = false, dataType = "String"),
@ApiImplicitParam(name = "title", value = "按标题查找: 清新", required = false, dataType = "String"),
@ApiImplicitParam(name = "memberId", value = "按商家id查找", required = false, dataType = "String"),
@ApiImplicitParam(name = "memberName", value = "按商家名称查找", required = false, dataType = "String"),
@ApiImplicitParam(name = "memberId", value = "按商家id 查找", required = false, dataType = "String"),
@ApiImplicitParam(name = "memberName", value = "按商家名称 查找", required = false, dataType = "String"),
@ApiImplicitParam(name = "memberStatus", value = "按商家 状态查找", required = false, dataType = "String"),
@ApiImplicitParam(name = "orderType", value = "按排序条件查找", required = false, dataType = "String"),
@ApiImplicitParam(name = "curDate", value = "按月份查找", required = false, dataType = "String"),
@ApiImplicitParam(name = "city", value = "按城市 查找", required = false, dataType = "String"),
@ApiImplicitParam(name = "orderType", value = "按排序条件 查找", required = false, dataType = "String"),
@ApiImplicitParam(name = "curDate", value = "按月份 查找", required = false, dataType = "String"),
@ApiImplicitParam(name = "pageNum", value = "页码,从1开始", required = false, dataType = "String", defaultValue = "1"),
@ApiImplicitParam(name = "pageCount", value = "每页的数据个数,默认是4个", required = false, dataType = "String", defaultValue = "4")
})
......@@ -281,12 +282,13 @@ public class NyxApiController {
@RequestParam(value = "memberId", required = false, defaultValue = "0") String memberId,
@RequestParam(value = "memberName", required = false, defaultValue = "0") String memberName,
@RequestParam(value = "memberStatus", required = false, defaultValue = "0") String memberStatus,
@RequestParam(value = "city", required = false, defaultValue = "0") String city,
@RequestParam(value = "orderType", required = false, defaultValue = "0") String orderType,
@RequestParam(value = "curDate", required = false, defaultValue = "0") String curDate,
@RequestParam(value = "pageNum", required = false, defaultValue = "1") int pageNum,
@RequestParam(value = "pageCount", required = false, defaultValue = "4") int pageCount
) {
return keyService.Rockwell_keyServiceGetV_activity_info(tag, title, memberId, memberName, memberStatus, orderType, curDate, pageNum, pageCount);
return keyService.Rockwell_keyServiceGetV_activity_info(tag, title, memberId, memberName, memberStatus, city, orderType, curDate, pageNum, pageCount);
}
// 3.2 获取 view_activity_detail 的数据 by activityId
......@@ -309,9 +311,10 @@ public class NyxApiController {
@ApiImplicitParams({
@ApiImplicitParam(name = "tag", value = "按标签查找; 饮事", required = false, dataType = "String"),
@ApiImplicitParam(name = "title", value = "按标题查找: 清新", required = false, dataType = "String"),
@ApiImplicitParam(name = "memberId", value = "按商家id查找", required = false, dataType = "String"),
@ApiImplicitParam(name = "memberName", value = "按商家名称查找", required = false, dataType = "String"),
@ApiImplicitParam(name = "memberId", value = "按商家id 查找", required = false, dataType = "String"),
@ApiImplicitParam(name = "memberName", value = "按商家名称 查找", required = false, dataType = "String"),
@ApiImplicitParam(name = "memberStatus", value = "按商家 状态查找", required = false, dataType = "String"),
@ApiImplicitParam(name = "city", value = "按城市 查找", required = false, dataType = "String"),
@ApiImplicitParam(name = "beginDate", value = "按yyyy-mm-dd查找", required = true, dataType = "String"),
@ApiImplicitParam(name = "endDate", value = "按yyyy-mm-dd查找", required = true, dataType = "String"),
@ApiImplicitParam(name = "pageNum", value = "页码,从1开始", required = false, dataType = "String", defaultValue = "1"),
......@@ -323,14 +326,14 @@ public class NyxApiController {
@RequestParam(value = "title", required = false, defaultValue = "0") String title,
@RequestParam(value = "memberId", required = false, defaultValue = "0") String memberId,
@RequestParam(value = "memberName", required = false, defaultValue = "0") String memberName,
@RequestParam(value = "city", required = false, defaultValue = "0") String city,
@RequestParam(value = "memberStatus", required = false, defaultValue = "0") String memberStatus,
@RequestParam(value = "city", required = false, defaultValue = "0") String city,
@RequestParam(value = "beginDate", required = false, defaultValue = "0") String beginDate,
@RequestParam(value = "endDate", required = false, defaultValue = "0") String endDate,
@RequestParam(value = "pageNum", required = false, defaultValue = "1") int pageNum,
@RequestParam(value = "pageCount", required = false, defaultValue = "4") int pageCount
) {
return keyService.Rockwell_keyServiceGetV_activity_info_by_period(tag, title, memberId, memberName, city, memberStatus, beginDate, endDate, pageNum, pageCount);
return keyService.Rockwell_keyServiceGetV_activity_info_by_period(tag, title, memberId, memberName, memberStatus, city, beginDate, endDate, pageNum, pageCount);
}
// 3.4 为activity添加点赞 jscat 2020-08-25
......@@ -439,6 +442,56 @@ public class NyxApiController {
return keyService.Rockwell_keyServiceGetV_order_info(memberId, userId, activityId, orderStatus, pageNum, pageCount);
}
// 收藏表(tbl_collect)的相关api 获取 view_collect 的数据 by page
// 6.1 collect 查询
// 1. 按照 user_id
// collect_status == '01' && end_datetime >= NOW()
// 返回 Rockwell_keyV_collect
@ApiOperation(value="获取收藏表的信息", notes="获取收藏表的信息")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "按用户id查找", required = false, dataType = "String"),
@ApiImplicitParam(name = "pageNum", value = "页码,从1开始", required = false, dataType = "String", defaultValue = "1"),
@ApiImplicitParam(name = "pageCount", value = "每页的数据个数,默认是4个", required = false, dataType = "String", defaultValue = "4")
})
@RequestMapping(value = "/nyx/collect/query", method = RequestMethod.GET)
public JSONResult RockwellQueryCollect(
@RequestParam(value = "userId", required = false, defaultValue = "0") String userId,
@RequestParam(value = "pageNum", required = false, defaultValue = "1") int pageNum,
@RequestParam(value = "pageCount", required = false, defaultValue = "4") int pageCount
) {
return keyService.Rockwell_keyServiceGetV_collect(userId, pageNum, pageCount);
}
// 6.2 为collect添加点赞 jscat 2020-08-25
@ApiOperation(value="为collect添加点赞", notes="为collect添加点赞")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "userId", required = true, dataType = "String", defaultValue = "uid_123"),
@ApiImplicitParam(name = "activityId", value = "activityId", required = true, dataType = "String", defaultValue = "aid_123"),
})
@RequestMapping(value = "/nyx/collect/like", method = RequestMethod.GET)
public void RockwellAddKeyActivityLike(
@RequestParam(value = "userId", required = true, defaultValue = "uid_123") String userId,
@RequestParam(value = "activityId", required = true, defaultValue = "aid_123") String activityId
) {
keyService.Rockwell_keyServiceAddT_activityLike(activityId);
keyService.Rockwell_keyServiceUpdateT_collect(userId, activityId, "01");
}
// 6.3 为collect去除点赞 jscat 2020-08-25
@ApiOperation(value="为collect去除点赞", notes="为collect去除点赞")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "userIdId", required = true, dataType = "String", defaultValue = "uid_123"),
@ApiImplicitParam(name = "activityId", value = "activityId", required = true, dataType = "String", defaultValue = "aid_123"),
})
@RequestMapping(value = "/nyx/collect/like/del", method = RequestMethod.GET)
public void RockwellDelKeyCollectLike(
@RequestParam(value = "userId", required = true, defaultValue = "uid_123") String userId,
@RequestParam(value = "activityId", required = true, defaultValue = "aid_123") String activityId
) {
keyService.Rockwell_keyServiceDelT_activityLike(activityId);
keyService.Rockwell_keyServiceUpdateT_collect(userId, activityId, "00");
}
// 2.0 test
@ApiOperation(value="test", notes="test")
@ApiImplicitParams({
......
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
......@@ -237,6 +237,9 @@ limitations under the License.
<if test="memberName != null and memberName != '' ">
AND member_name=#{memberName}
</if>
<if test="city != null and city != '' ">
AND address_name LIKE CONCAT('%', #{city} ,'%')
</if>
<if test="title != null and title != '' ">
AND ( tag LIKE CONCAT('%', #{title} ,'%') OR title LIKE CONCAT('%', #{title} ,'%') OR member_name LIKE CONCAT('%', #{title} ,'%') )
</if>
......@@ -402,5 +405,30 @@ limitations under the License.
</if>
</select>
<!-- collect api 6-1 获取 v_collect 的值 by page update jscat 20200826 -->
<select id="getV_collect_by_page" parameterType="cn.com.fun.nyxkey.api.domain.query.Rockwell_keyT_collectQuery"
resultType="cn.com.fun.nyxkey.api.domain.Rockwell_keyV_collect">
select * from view_collect
where 1=1
AND DATE_FORMAT(NOW(),'%Y-%m-%d') &lt;= DATE_FORMAT(end_datetime,'%Y-%m-%d')
<if test="userId != null and userId != '' ">
<!-- todo need to fix user_id match for collection after online -->
<!-- AND user_id=#{userId} -->
</if>
<if test="collectStatus != null and collectStatus != '' ">
AND collect_status=#{collectStatus}
</if>
order by num_like desc, create_datetime desc
<if test="pagination != null ">
<include refid="pagination"/>
</if>
</select>
<!-- collect api 6-2 新增/更新一条collect记录 jscat 20200826 -->
<insert id="updateT_collect" parameterType="cn.com.fun.nyxkey.api.domain.query.Rockwell_keyT_collectQuery">
REPLACE into tbl_collect(collect_status, user_id, activity_id, create_datetime, update_datetime)
values (#{collectStatus}, #{userId}, #{activityId} , NOW(), NOW() )
</insert>
<!-- ending API interface -->
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
......@@ -11,7 +11,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!DOCTYPE mapper PUBLIC "-//mybatis.orrg//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.com.fun.nyxkey.api.repository.Rockwell_userMapper">
<sql id="pagination">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论