Commit 3a860079 by “Kongxiangkun”

增加积分商城相关代码

parent 8260b251
......@@ -25,4 +25,10 @@ public class PointDetailListVO {
@ApiModelProperty(value = "积分描述")
private String learnName;
@ApiModelProperty(value = "积分类型")
private String learnType;
@ApiModelProperty(value = "积分类型")
private String learnSource;
}
......@@ -50,7 +50,8 @@ public class PointApiController {
public List<PointDetailListVO> list(@RequestParam(name = "accountId" ,required = false ) Long accountId,
@RequestParam(name = "pageNo" ,required = false ) Integer pageNo,
@RequestParam(name = "pageSize" ,required = false ) Integer pageSize){
return pointService.getPointDetailsList(accountId, pageNo, pageSize);
Page<PointDetailListVO> page = pointService.getPointDetailsList(accountId, pageNo, pageSize);
return page.getRecords();
}
@GetMapping("/product/list")
......@@ -70,5 +71,13 @@ public class PointApiController {
@RequestParam(name = "productIds" ,required = false ) String productIds) {
return pointService.exchange(companyId, orgId, siteId, accountId, accountName, productIds);
}
@GetMapping("/read/finished")
public boolean finished(
@RequestParam(name = "accountId" ,required = false ) Long accountId,
@RequestParam(name = "infoId" ,required = false ) String infoId){
pointService.addPoint(accountId, "point_read", infoId);
return true;
}
}
......@@ -67,13 +67,35 @@ public class PointController {
return pointService.updateList(point);
}
@GetMapping("/update/after")
public void updatePointDetailsChangeAfter(
@RequestParam(name = "siteId" ,required = false ) Long siteId,
@RequestParam(name = "accountId" ,required = false ) Long accountId) {
pointDetailsService.updateChangeAfter(accountId,siteId);
}
/**
* 管理台查询指定用户,指定类型积分明细
* @param learnType
* @param accountName
* @param startTime
* @param endTime
* @param pageNo
* @param pageSize
* @param companyId
* @param siteId
* @return
*/
@GetMapping("/details/list")
Page<PointDetailsVO> getManagePointDetails(
@RequestParam(name = "activityId", required = false) Long activityId,
@RequestParam(name = "learnType", required = false) String learnType,
@RequestParam(name = "accountName", required = false) String accountName,
@RequestParam(name = "startTime", required = false) Long startTime, @RequestParam(name = "endTime", required = false) Long endTime,
@RequestParam(name = "pageNo", required = false) Integer pageNo, @RequestParam(name = "pageSize", required = false) Integer pageSize,
@RequestParam(name = "companyId", required = false) Long companyId, @RequestParam(name = "siteId", required = false) Long siteId){
@RequestParam(name = "startTime", required = false) Long startTime,
@RequestParam(name = "endTime", required = false) Long endTime,
@RequestParam(name = "pageNo", required = false) Integer pageNo,
@RequestParam(name = "pageSize", required = false) Integer pageSize,
@RequestParam(name = "companyId", required = false) Long companyId,
@RequestParam(name = "siteId", required = false) Long siteId){
List<Long> accountIds = new ArrayList<Long>();
try{
......@@ -100,7 +122,7 @@ public class PointController {
if (null != endTime) {
endDate = new Date(endTime);
}
page = pointDetailsService.getManagePointDetails(pageNo, pageSize, activityId, accountIds,
page = pointDetailsService.getManagePointDetails(pageNo, pageSize, learnType, accountIds,
startDate, endDate, companyId, siteId);
List<PointDetailsVO> dtlIds = page.getRecords();
......@@ -121,16 +143,9 @@ public class PointController {
page = new Page<PointDetailsVO>(pageNo, pageSize);
page.setTotal(0);
}
return page;
}
@GetMapping("/update/after")
public void updatePointDetailsChangeAfter(
@RequestParam(name = "siteId" ,required = false ) Long siteId,
@RequestParam(name = "accountId" ,required = false ) Long accountId) {
pointDetailsService.updateChangeAfter(accountId,siteId);
}
}
......@@ -50,6 +50,12 @@ public class PointDetailsController {
return pointDetailsService.pointList(year, type, accountId, pageNo, pageSize, companyId, siteId, orgId);
}
/**
* 小程序我的积分 首页请求接口
* @param accountId
* @param siteId
* @return
*/
@GetMapping("/getPointDetail")
public PointDetailVO getPointDetail(@RequestParam("accountId") Long accountId,
@RequestParam("siteId") Long siteId) {
......
......@@ -33,7 +33,7 @@ public interface PointDetailsMapper extends BaseMapper<PointDetails> {
Integer queryPiont(@Param("userId") Long userId, @Param("type") String type, @Param("companyId") Long companyId,
@Param("siteId") Long siteId, @Param("orgId") Long orgId);
List<PointDetailsVO> getManagePointDetails(@Param("page") Page<PointDetailsVO> page, @Param("activityId") Long activityId,
List<PointDetailsVO> getManagePointDetails(@Param("page") Page<PointDetailsVO> page, @Param("learnType") String learnType,
@Param("accountIds") List<Long> accountIds, @Param("startTime") Date startTime, @Param("endTime") Date endTime,
@Param("companyId") Long companyId, @Param("siteId") Long siteId);
......@@ -103,5 +103,5 @@ public interface PointDetailsMapper extends BaseMapper<PointDetails> {
Integer getCountToDay(@Param("accountId") Long accountId, @Param("siteId")Long siteId, @Param("type")String type,@Param("toDay")String toDay);
List<PointDetailListVO> getPointDetailsList(@Param("accountId") Long accountId, @Param("pageNo") Integer pageNo, @Param("pageSize") Integer pageSize);
List<PointDetailListVO> getPointDetailsList(@Param("page") Page<PointDetailListVO> page, @Param("accountId") Long accountId);
}
......@@ -25,4 +25,6 @@ public interface PointProductMapper extends BaseMapper<PointProduct> {
List<PointProductVo> productListExchange(@Param("page") Page<PointProductVo> page);
Integer getSumPointByProductId(@Param("productIds") List<String> productIds);
String getProductNamesByProductIds(@Param("productIds") List<String> productIds);
}
......@@ -8,6 +8,8 @@ import com.yizhi.point.application.vo.PointDetailVO;
import com.yizhi.point.application.vo.PointDetailsVO;
import com.yizhi.point.application.vo.PointImportVO;
import com.yizhi.point.application.vo.domain.PointDetailsVo;
import com.yizhi.point.application.vo.domain.PointProductVo;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
......@@ -32,7 +34,7 @@ public interface PointDetailsService extends IService<PointDetails> {
Integer queryPiont(Long userId, Long companyId, Long siteId, Long orgId);
Page<PointDetailsVO> getManagePointDetails(Integer pageNo, Integer pageSize, Long activityId,
Page<PointDetailsVO> getManagePointDetails(Integer pageNo, Integer pageSize, String learnType,
List<Long> accountIds, Date startTime, Date endTime, Long companyId, Long siteId);
boolean pointImport(List<PointImportVO> importVOList, Long companyId, Long siteId, Long orgId, Long accountId, String accountName);
......@@ -68,5 +70,5 @@ public interface PointDetailsService extends IService<PointDetails> {
void updateChangeAfter(Long accountId,Long siteId);
List<PointDetailListVO> getPointDetailsList(Long accountId, Integer pageNo, Integer pageSize);
List getPointDetailsList(@Param("page") Page<PointDetailListVO> page, Long accountId);
}
package com.yizhi.application.service;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.IService;
import com.yizhi.application.domain.Point;
import com.yizhi.core.application.context.RequestContext;
......@@ -24,5 +25,5 @@ public interface PointService extends IService<Point> {
boolean exchange(Long companyId, Long orgId, Long siteId, Long accountId, String accountName, String productIds);
List<PointDetailListVO> getPointDetailsList(Long accountId, Integer pageNo, Integer pageSize);
Page<PointDetailListVO> getPointDetailsList(Long accountId, Integer pageNo, Integer pageSize);
}
......@@ -230,10 +230,10 @@ public class PointDetailsServiceImpl extends ServiceImpl<PointDetailsMapper, com
}
@Override
public Page<PointDetailsVO> getManagePointDetails(Integer pageNo, Integer pageSize, Long activityId,
public Page<PointDetailsVO> getManagePointDetails(Integer pageNo, Integer pageSize, String learnType,
List<Long> accountIds, Date startTime, Date endTime, Long companyId, Long siteId) {
Page<PointDetailsVO> page = new Page<PointDetailsVO>(pageNo, pageSize);
List<PointDetailsVO> list = pointDetailsMapper.getManagePointDetails(page, activityId, accountIds, startTime, endTime, companyId, siteId);
List<PointDetailsVO> list = pointDetailsMapper.getManagePointDetails(page, learnType, accountIds, startTime, endTime, companyId, siteId);
page.setRecords(list);
return page;
}
......@@ -477,8 +477,8 @@ public class PointDetailsServiceImpl extends ServiceImpl<PointDetailsMapper, com
}
@Override
public List<PointDetailListVO> getPointDetailsList(Long accountId, Integer pageNo, Integer pageSize) {
return pointDetailsMapper.getPointDetailsList(accountId, pageNo, pageSize);
public List<PointDetailListVO> getPointDetailsList(Page<PointDetailListVO> page, Long accountId) {
return pointDetailsMapper.getPointDetailsList(page, accountId);
}
public static void main(String[] args) {
......
......@@ -2,6 +2,7 @@ package com.yizhi.application.service.impl;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.yizhi.application.constant.PointTypeEnum;
import com.yizhi.application.domain.Point;
......@@ -25,7 +26,6 @@ import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
* <p>
......@@ -219,10 +219,19 @@ public class PointServiceImpl extends ServiceImpl<PointMapper, Point> implements
return ret > 0;
}
public List<PointDetailListVO> getPointDetailsList(Long accountId, Integer pageNo, Integer pageSize) {
pageNo = (pageNo - 1) * pageSize;
public Page<PointDetailListVO> getPointDetailsList(Long accountId, Integer pageNo, Integer pageSize) {
Page<PointDetailListVO> page = new Page<>(pageNo, pageSize);
log.info("积分明细入参 accountId:{}, pageNo:{}, pageSize:{}", accountId, pageNo, pageSize);
return pointDetailsService.getPointDetailsList(accountId, pageNo, pageSize);
page.setRecords(pointDetailsService.getPointDetailsList(page, accountId));
for(PointDetailListVO vo : page.getRecords()) {
if("point_exchange".equals(vo.getLearnType())) {
String productNames = pointProductMapper.getProductNamesByProductIds(
Arrays.asList(vo.getLearnSource()));
String learnName = vo.getLearnName() + " 兑换商品:" + productNames;
vo.setLearnName(learnName);
}
}
return page;
}
}
......@@ -83,8 +83,8 @@
<if test="siteId!=null">
AND site_id=#{siteId}
</if>
<if test="activityId!=null">
AND activity_id=#{activityId}
<if test="learnType!=null">
AND learn_type=#{learnType}
</if>
<if test="startTime!=null">
AND <![CDATA[ DATE_FORMAT(time,'%Y-%m-%d')>=DATE_FORMAT(#{startTime},'%Y-%m-%d')]]>
......@@ -264,8 +264,8 @@
</select>
<select id="getPointDetailsList" resultType="com.yizhi.point.application.vo.PointDetailListVO">
select time, point, learn_name, change_after from point_details
where account_id = #{accountId} order by time desc limit #{pageNo},#{pageSize}
select time, point, learn_name, learn_type, learn_source, change_after from point_details
where account_id = #{accountId} order by time desc
</select>
</mapper>
......@@ -25,4 +25,11 @@
</foreach>
</select>
<select id="getProductNamesByProductIds" resultType="java.lang.String">
select GROUP_CONCAT(product_name) from point_product where id in
<foreach collection="productIds" separator="," open="(" close=")" item="item">
#{item}
</foreach>
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment