Commit a80d7bba by jscat

nyx javaapp: 功能更新

1. 添加园区query和园区活动query查询功能
parent e0b484d8
package cn.com.fun.nyxkey.api.domain;
package cn.com.fun.nyxkey.api.domain;
......@@ -17,6 +17,9 @@ public class Rockwell_keyT_activity{
private String activityId; // 活动的id, uuid format
private String activityStatus; // 活动状态: 00: 不可参与;01:可参与
private String activityType; // 活动类型
private String fairName; // 集市名称
private String communityName; // 园区名称
private String tag; // 活动的标签
private String title; // 活动的标题
private int numLike; // 针对每条activity的点赞次数,每点一次,则累加
......
package cn.com.fun.nyxkey.api.domain;
package cn.com.fun.nyxkey.api.domain;
......@@ -17,7 +17,8 @@ public class Rockwell_keyT_address{
private String addressId; // 商家的id, uuid format
private String addressStatus; // 状态
private String addressName; // 名字
private String cityName; // 城市名
private String addressName; // 地址名
private String clientId; // 商家或用户id
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date createDatetime; // 统计周期
......
package cn.com.fun.nyxkey.api.domain;
package cn.com.fun.nyxkey.api.domain;
......@@ -18,6 +18,9 @@ public class Rockwell_keyV_activity_info{
private String activityId; // 活动的id, uuid format
private String memberId; // 活动的id, uuid format
private String memberName; // 商家名称
private String activityType; // 活动类型
private String fairName; // 集市名称
private String communityName; // 园区名称
private String memberSlogan; // 商家slogan
private String memberStatus; // 用户状态: 00: 未注册用户; 01: 已注册用户
private String memberLogo; // 商家logo
......@@ -25,10 +28,11 @@ public class Rockwell_keyV_activity_info{
private String tag; // 活动的标签
private String title; // 活动的标题
private String titleAbbr; // 活动的标题.简称
private String numLike; // 针对每条activity的点赞次数,每点一次,则累加
private int numLike; // 针对每条activity的点赞次数,每点一次,则累加
private String content; // 活动内容
private String quiz; // quiz题目列表, 通过::做间隔,
private Double point; // quiz 总的积分
private String cityName; // 活动城市
private String addressName; // 活动地址
private String productId; // 活动的id, uuid format
......
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/10/08.
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Rockwell_keyV_activity_stat{
private String activityType; // 活动类型
private String cityName; // 活动城市
private String fairName; // 集市名称
private String communityName; // 园区名称
private int numEntity; //view_activity_stat only, 活动统计表中的实体个数字段(多少集市/多少园区)
private int numActivity; //view_activity_stat only, 活动统计表中的活动次数字段(一个集市/园区有多少活动)
private int numLike; // 针对每条activity的点赞次数,每点一次,则累加
}
package cn.com.fun.nyxkey.api.domain.query;
package cn.com.fun.nyxkey.api.domain.query;
......@@ -20,6 +20,8 @@ public class Rockwell_keyT_activityQuery {
private String activityId; // 活动id
private String memberId; // 商家id
private String memberName; // 商家名称
private String activityType; // 活动类型, 00-饮事;01-集市;02-园区
private String entityName; // 实体名称(fair/community)
private String city; // 城市名称
private String memberStatus; // 商家状态, 00: 未注册用户; 01: 已注册用户
......@@ -76,6 +78,18 @@ public class Rockwell_keyT_activityQuery {
}
}
public void setActivityType(String strActivityType)
{
if(strActivityType.equals("0"))
{
this.activityType = null;
}
else
{
this.activityType = strActivityType;
}
}
public void setCity(String strCity)
{
if(strCity.equals("0"))
......@@ -180,6 +194,7 @@ public class Rockwell_keyT_activityQuery {
"activityId='" + activityId + '\'' +
"memberId='" + memberId + '\'' +
"memberName='" + memberName + '\'' +
"activityType='" + activityType + '\'' +
"city='" + city + '\'' +
"memberStatus='" + memberStatus + '\'' +
"orderType='" + orderType + '\'' +
......
package cn.com.fun.nyxkey.api.repository;
package cn.com.fun.nyxkey.api.repository;
......@@ -42,6 +42,8 @@ public interface Rockwell_keyMapper {
void addT_activity(Rockwell_keyT_activity rockwell_keyT_activity);
void addT_product(Rockwell_keyT_productQuery rockwell_keyT_productQuery);
List<Rockwell_keyT_product>getT_product(Rockwell_keyT_productQuery rockwell_keyT_productQuery);
List<Rockwell_keyV_activity_stat> getV_activity_stat(Rockwell_keyT_activityQuery rockwell_keyT_activityQuery);
List<Rockwell_keyV_activity_stat> getV_activity_total(Rockwell_keyT_activityQuery rockwell_keyT_activityQuery);
/* post api */
List<Rockwell_keyV_post_info> getV_post_info(Rockwell_keyT_postQuery rockwell_keyT_postQuery);
......
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 city, String orderType, String curDate,
String memberId, String memberName, String activityType, String entityName, 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 memberStatus, String city,
JSONResult Rockwell_keyServiceGetV_activity_info_by_period(String tag, String title, String memberId, String memberName, String activityType, String entityName, 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);
......@@ -55,6 +55,7 @@ public interface Rockwell_keyService {
String startDatetime, String endDatetime,
List<String> desc, List<Double> price, List<Integer> quantity) throws UnsupportedEncodingException;
JSONResult Rockwell_keyServiceGetT_product(String productId, String activityId, int pageNum, int pageCount);
JSONResult Rockwell_keyServiceGetV_activity_stat(String activityType, String cityName);
/* post api */
JSONResult Rockwell_keyServiceGetV_post_info(String tag, String title, String top, int pageNum, int pageCount);
......
package cn.com.fun.nyxkey.api.service.impl;
package cn.com.fun.nyxkey.api.service.impl;
......@@ -304,7 +304,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 city, String orderType, String curDate,
String memberId, String memberName, String activityType, String entityName, String memberStatus, String city, String orderType, String curDate,
int pageNum, int pageCount)
{
LOGGER.debug("find Rockwell_keyServiceGetV_activity_info");
......@@ -324,6 +324,8 @@ public class Rockwell_keyServiceImpl implements Rockwell_keyService {
}
rockwell_keyT_activityQuery.setMemberId(memberId);
rockwell_keyT_activityQuery.setMemberName(memberName);
rockwell_keyT_activityQuery.setActivityType(activityType);
rockwell_keyT_activityQuery.setEntityName(entityName);
rockwell_keyT_activityQuery.setCity(city);
rockwell_keyT_activityQuery.setOrderType(orderType);
rockwell_keyT_activityQuery.setTag(tag);
......@@ -337,7 +339,7 @@ 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 memberStatus, String city,
public JSONResult Rockwell_keyServiceGetV_activity_info_by_period(String tag, String title, String memberId, String memberName, String activityType, String entityName, String memberStatus, String city,
String beginDate, String endDate, int pageNum, int pageCount)
{
LOGGER.debug("find Rockwell_keyServiceGetV_activity_info_by_period");
......@@ -357,6 +359,8 @@ public class Rockwell_keyServiceImpl implements Rockwell_keyService {
}
rockwell_keyT_activityQuery.setMemberId(memberId);
rockwell_keyT_activityQuery.setMemberName(memberName);
rockwell_keyT_activityQuery.setActivityType(activityType);
rockwell_keyT_activityQuery.setEntityName(entityName);
rockwell_keyT_activityQuery.setCity(city);
rockwell_keyT_activityQuery.setTag(tag);
rockwell_keyT_activityQuery.setTitle(title);
......@@ -563,6 +567,41 @@ public class Rockwell_keyServiceImpl implements Rockwell_keyService {
return jsonResult;
}
public JSONResult Rockwell_keyServiceGetV_activity_stat(String activityType, String cityName)
{
LOGGER.debug("find Rockwell_keyServiceGetV_activity_stat");
List<Rockwell_keyV_activity_stat> listRockwell_keyV_activity_stat = new ArrayList<>();
Rockwell_keyT_activityQuery rockwell_keyT_activityQuery = new Rockwell_keyT_activityQuery();
//判断某字符串是否为空,为空的标准是 str==null 或 str.length()==0
//默认设置memberStatus=="01"
if(StringUtils.isEmpty(activityType) || activityType.equals("0"))
{
return new JSONResult(ExceptionMsg.ParamError);
}
rockwell_keyT_activityQuery.setActivityType(activityType);
rockwell_keyT_activityQuery.setCity(cityName);
listRockwell_keyV_activity_stat = rockwell_keyMapper.getV_activity_total(rockwell_keyT_activityQuery);
if(listRockwell_keyV_activity_stat.size() > 0)
{
listRockwell_keyV_activity_stat.get(0).setActivityType(activityType);
listRockwell_keyV_activity_stat.get(0).setCityName(cityName);
listRockwell_keyV_activity_stat.get(0).setFairName("所有");
listRockwell_keyV_activity_stat.get(0).setCommunityName("所有");
}
listRockwell_keyV_activity_stat.addAll(rockwell_keyMapper.getV_activity_stat(rockwell_keyT_activityQuery));
int totalCount = listRockwell_keyV_activity_stat.size();
JSONResult jsonResult = new JSONResult(totalCount, listRockwell_keyV_activity_stat);
return jsonResult;
}
/* post api */
// getV_post_info
public JSONResult Rockwell_keyServiceGetV_post_info(String tag, String title, String top, int pageNum, int pageCount)
......
package cn.com.fun.nyxkey.api.web.controller;
package cn.com.fun.nyxkey.api.web.controller;
......@@ -277,6 +277,8 @@ public class NyxApiController {
@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 = "activityType", value = "按活动类型 查找", required = false, dataType = "String"),
@ApiImplicitParam(name = "entityName", value = "按实体名称(fair/community) 查找", required = false, dataType = "String"),
@ApiImplicitParam(name = "memberStatus", value = "按商家 状态查找", required = false, dataType = "String"),
@ApiImplicitParam(name = "city", value = "按城市 查找", required = false, dataType = "String"),
@ApiImplicitParam(name = "orderType", value = "按排序条件 查找", required = false, dataType = "String"),
......@@ -290,6 +292,8 @@ 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 = "activityType", required = false, defaultValue = "0") String activityType,
@RequestParam(value = "entityName", required = false, defaultValue = "0") String entityName,
@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,
......@@ -297,7 +301,7 @@ public class NyxApiController {
@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, city, orderType, curDate, pageNum, pageCount);
return keyService.Rockwell_keyServiceGetV_activity_info(tag, title, memberId, memberName, activityType, entityName, memberStatus, city, orderType, curDate, pageNum, pageCount);
}
// 3.2 获取 view_activity_detail 的数据 by activityId
......@@ -322,6 +326,8 @@ public class NyxApiController {
@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 = "activityType", value = "按活动类型 查找", required = false, dataType = "String"),
@ApiImplicitParam(name = "entityName", value = "按实体名称(fair/community) 查找", 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"),
......@@ -335,6 +341,8 @@ 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 = "activityType", required = false, defaultValue = "0") String activityType,
@RequestParam(value = "entityName", required = false, defaultValue = "0") String entityName,
@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,
......@@ -342,7 +350,7 @@ public class NyxApiController {
@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, memberStatus, city, beginDate, endDate, pageNum, pageCount);
return keyService.Rockwell_keyServiceGetV_activity_info_by_period(tag, title, memberId, memberName, activityType, entityName, memberStatus, city, beginDate, endDate, pageNum, pageCount);
}
// 3.4 为activity添加点赞 jscat 2020-08-25
......@@ -387,6 +395,25 @@ public class NyxApiController {
return keyService.Rockwell_keyServiceGetT_product(productId, activityId, pageNum, pageCount);
}
// 3.7 获取 view_activity_stat 的数据 limit 10
// 返回 Rockwell_keyV_activity_info
/* query param
1. acitivity_type
2. city_name
*/
@ApiOperation(value="获取activity stat统计信息", notes="获取activity stat统计信息")
@ApiImplicitParams({
@ApiImplicitParam(name = "activityType", value = "按活动类型 查找", required = false, dataType = "String"),
@ApiImplicitParam(name = "cityName", value = "按城市 查找", required = false, dataType = "String")
})
@RequestMapping(value = "/nyx/activity/stat/query", method = RequestMethod.GET)
public JSONResult RockwellQueryActivityStat(
@RequestParam(value = "activityType", required = false, defaultValue = "0") String activityType,
@RequestParam(value = "cityName", required = false, defaultValue = "0") String cityName
) {
return keyService.Rockwell_keyServiceGetV_activity_stat(activityType, cityName);
}
// 4.0 post info api
@ApiOperation(value="获取用户的post info", notes="获取用户的post info")
@ApiImplicitParams({
......
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
......@@ -237,11 +237,20 @@ limitations under the License.
<if test="memberName != null and memberName != '' ">
AND member_name=#{memberName}
</if>
<if test="activityType != null and activityType != '' ">
AND activity_type LIKE CONCAT('%', #{activityType} ,'%')
</if>
<if test="activityType != null and activityType != '' and activityType == '01-集市'.toString() and entityName != '所有'.toString()">
AND fair_name LIKE CONCAT('%', #{entityName} ,'%')
</if>
<if test="activityType != null and activityType != '' and activityType == '02-园区'.toString() and entityName != '所有'.toString()">
AND community_name LIKE CONCAT('%', #{entityName} ,'%')
</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} ,'%') )
AND ( tag LIKE CONCAT('%', #{title} ,'%') OR title LIKE CONCAT('%', #{title} ,'%') OR member_name LIKE CONCAT('%', #{title} ,'%') OR fair_name LIKE CONCAT('%', #{title} ,'%') OR community_name LIKE CONCAT('%', #{title} ,'%') OR address_name LIKE CONCAT('%', #{title} ,'%'))
</if>
<if test="curDate != null and curDate != '' ">
AND #{curDate} &gt;= DATE_FORMAT(start_datetime,'%Y-%m')
......@@ -289,6 +298,15 @@ limitations under the License.
<if test="memberName != null and memberName != '' ">
AND member_name=#{memberName}
</if>
<if test="activityType != null and activityType != '' ">
AND activity_type LIKE CONCAT('%', #{activityType} ,'%')
</if>
<if test="activityType != null and activityType != '' and activityType == '01-集市'.toString() ">
AND fair_name LIKE CONCAT('%', #{entityName} ,'%')
</if>
<if test="activityType != null and activityType != '' and activityType == '02-园区'.toString() ">
AND community_name LIKE CONCAT('%', #{entityName} ,'%')
</if>
<if test="city != null and city != '' ">
AND address_name LIKE CONCAT('%', #{city} ,'%')
</if>
......@@ -296,7 +314,7 @@ limitations under the License.
AND tag LIKE CONCAT('%', #{tag} ,'%')
</if>
<if test="title != null and title != '' ">
AND ( tag LIKE CONCAT('%', #{title} ,'%') OR title LIKE CONCAT('%', #{title} ,'%') OR member_name LIKE CONCAT('%', #{title} ,'%') )
AND ( tag LIKE CONCAT('%', #{title} ,'%') OR title LIKE CONCAT('%', #{title} ,'%') OR member_name LIKE CONCAT('%', #{title} ,'%') OR fair_name LIKE CONCAT('%', #{title} ,'%') OR community_name LIKE CONCAT('%', #{title} ,'%') OR address_name LIKE CONCAT('%', #{title} ,'%'))
</if>
<if test="beginDate != null and endDate!= null and beginDate != '' and endDate != '' ">
AND
......@@ -363,6 +381,35 @@ limitations under the License.
</if>
</select>
<!-- activity api 3-7 获取 v_activity_stat 的值 by limit update jscat 20201008 -->
<select id="getV_activity_stat" parameterType="cn.com.fun.nyxkey.api.domain.query.Rockwell_keyT_activityQuery"
resultType="cn.com.fun.nyxkey.api.domain.Rockwell_keyV_activity_stat">
select * from view_activity_stat
where 1=1
<if test="activityType != null and activityType != '' ">
AND activity_type LIKE CONCAT('%', #{activityType} ,'%')
</if>
<if test="city != null and city != '' ">
AND city_name LIKE CONCAT('%', #{city} ,'%')
</if>
limit 10
</select>
<!-- activity api 3-8 获取 v_activity_stat 全量统计的值 update jscat 20201008 -->
<select id="getV_activity_total" parameterType="cn.com.fun.nyxkey.api.domain.query.Rockwell_keyT_activityQuery"
resultType="cn.com.fun.nyxkey.api.domain.Rockwell_keyV_activity_stat">
SELECT COUNT(*) AS num_entity, IFNULL(SUM(num_activity),0) AS num_activity, IFNULL(SUM(num_like),0) AS num_like
FROM view_activity_stat
where 1=1
<if test="activityType != null and activityType != '' ">
AND activity_type LIKE CONCAT('%', #{activityType} ,'%')
</if>
<if test="city != null and city != '' ">
AND city_name LIKE CONCAT('%', #{city} ,'%')
</if>
limit 10
</select>
<!-- post api 4.1 从 view_post_info 获取 post信息
-->
<select id="getV_post_info" parameterType="cn.com.fun.nyxkey.api.domain.query.Rockwell_keyT_postQuery" resultType="cn.com.fun.nyxkey.api.domain.Rockwell_keyV_post_info">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论