Commit a17c8207 authored by unset's avatar unset

Merge branch 'master-chw-bug' into master-chw

parents 0d19de01 bb3d6fbf
...@@ -32,159 +32,158 @@ import java.util.List; ...@@ -32,159 +32,158 @@ import java.util.List;
@Slf4j @Slf4j
public class IntegralUserRecordBiz extends BaseBiz<IntegralUserRecordMapper, IntegralUserRecord> { public class IntegralUserRecordBiz extends BaseBiz<IntegralUserRecordMapper, IntegralUserRecord> {
@Autowired @Autowired
UserInfoBiz userInfoBiz; UserInfoBiz userInfoBiz;
@Autowired @Autowired
IntegralUserTotalBiz integralUserTotalBiz; IntegralUserTotalBiz integralUserTotalBiz;
@Autowired @Autowired
IntegralRuleBiz integralRuleBiz; IntegralRuleBiz integralRuleBiz;
@Autowired @Autowired
IntegralUserStatusBiz integralUserStatusBiz; IntegralUserStatusBiz integralUserStatusBiz;
/** /**
* 添加用户积分记录 * 添加用户积分记录
* *
* @param integralUserRecord * @param integralUserRecord
* @return * @return
*/ */
public ObjectRestResponse add(IntegralUserRecordDto integralUserRecord) { public ObjectRestResponse add(IntegralUserRecordDto integralUserRecord) {
log.info("添加积分记录的参数:integralUserRecord = {}", integralUserRecord); log.info("添加积分记录的参数:integralUserRecord = {}", integralUserRecord);
if (integralUserRecord == null || StringUtils.isBlank(integralUserRecord.getIntegralRuleCode())) { if (integralUserRecord == null || StringUtils.isBlank(integralUserRecord.getIntegralRuleCode())) {
return ObjectRestResponse.paramIsEmpty(); return ObjectRestResponse.paramIsEmpty();
} }
//如果参数没有积分,说明是消息队列过来的参数,需要查询规则表获取积分数 //如果参数没有积分,说明是消息队列过来的参数,需要查询规则表获取积分数
IntegralRuleDto integralRule = new IntegralRuleDto(); IntegralRuleDto integralRule = new IntegralRuleDto();
integralRule.setCode(integralUserRecord.getIntegralRuleCode()); integralRule.setCode(integralUserRecord.getIntegralRuleCode());
ObjectRestResponse<IntegralRule> ruleObjectRestResponse = integralRuleBiz.getOne(integralRule); ObjectRestResponse<IntegralRule> ruleObjectRestResponse = integralRuleBiz.getOne(integralRule);
if (ruleObjectRestResponse.getData() == null) { if (ruleObjectRestResponse.getData() == null) {
return ObjectRestResponse.createFailedResult(1202, "积分规则不存在"); return ObjectRestResponse.createFailedResult(1202, "积分规则不存在");
} }
IntegralRule oldValue = ruleObjectRestResponse.getData(); IntegralRule oldValue = ruleObjectRestResponse.getData();
if (integralUserRecord.getPoint() == null) { if (integralUserRecord.getPoint() == null) {
Integer point = 0; Integer point = 0;
if (oldValue.getPoint() == 0) {//没有基础分需要计算分数 if (oldValue.getPoint() == 0) {//没有基础分需要计算分数
Integer amount = Integer.parseInt(new BigDecimal(integralUserRecord.getAmount()).divide(new BigDecimal("100"), 0, BigDecimal.ROUND_DOWN).toString()); Integer amount = new BigDecimal(integralUserRecord.getAmount()).intValue();
//Integer amount = Integer.parseInt(integralUserRecord.getAmount()); //Integer amount = Integer.parseInt(integralUserRecord.getAmount());
JSONObject jsonObject = JSONObject.parseObject(oldValue.getOtherRule()); JSONObject jsonObject = JSONObject.parseObject(oldValue.getOtherRule());
log.info("查询的其他规则json信息:jsonObject = {}", jsonObject); log.info("查询的其他规则json信息:jsonObject = {}", jsonObject);
if (jsonObject == null) { if (jsonObject == null) {
point = ruleObjectRestResponse.getData().getPoint(); point = oldValue.getPoint();
} else { } else {
point = jsonObject.getInteger("rule") == null ? 0 * amount : jsonObject.getInteger("rule") * amount; point = jsonObject.getInteger("rule") == null ? 0 * amount : jsonObject.getInteger("rule") * amount;
} }
} else {
} else { point = ruleObjectRestResponse.getData().getPoint();
point = ruleObjectRestResponse.getData().getPoint(); }
} log.info("查询的其他规则积分数:point = {}", point);
log.info("查询的其他规则积分数:point = {}", point); //把规则表中的积分数设置到参数对象中,然后进行后续操作
//把规则表中的积分数设置到参数对象中,然后进行后续操作 integralUserRecord.setPoint(point / 100);
integralUserRecord.setPoint(point); }
}
if (integralUserRecord.getType() == 0) {//获取积分 增加总积分表
if (integralUserRecord.getType() == 0) {//获取积分 增加总积分表 IntegralUserTotalDto integralUserTotalDto = new IntegralUserTotalDto();
IntegralUserTotalDto integralUserTotalDto = new IntegralUserTotalDto(); integralUserTotalDto.setUserId(integralUserRecord.getUserId());
integralUserTotalDto.setUserId(integralUserRecord.getUserId()); integralUserTotalDto.setPoint(integralUserRecord.getPoint());
integralUserTotalDto.setPoint(integralUserRecord.getPoint()); integralUserTotalBiz.update(integralUserTotalDto);
integralUserTotalBiz.update(integralUserTotalDto); } else if (integralUserRecord.getType() == 1) {//扣减积分
} else if (integralUserRecord.getType() == 1) {//扣减积分 ObjectRestResponse<IntegralUserTotal> objectRestResponse = integralUserTotalBiz.getByUser();
ObjectRestResponse<IntegralUserTotal> objectRestResponse = integralUserTotalBiz.getByUser(); if (objectRestResponse.getStatus() == RestCode.SUCCESS.getStatus() && objectRestResponse.getData() != null) {
if (objectRestResponse.getStatus() == RestCode.SUCCESS.getStatus() && objectRestResponse.getData() != null) { IntegralUserTotal integralUserTotal = objectRestResponse.getData();
IntegralUserTotal integralUserTotal = objectRestResponse.getData(); IntegralUserTotalDto integralUserTotalDto = new IntegralUserTotalDto();
IntegralUserTotalDto integralUserTotalDto = new IntegralUserTotalDto(); integralUserTotalDto.setUserId(integralUserTotal.getUserId());
integralUserTotalDto.setUserId(integralUserTotal.getUserId()); integralUserTotalDto.setPoint(-integralUserRecord.getPoint());
integralUserTotalDto.setPoint(-integralUserRecord.getPoint()); integralUserTotalBiz.update(integralUserTotalDto);
integralUserTotalBiz.update(integralUserTotalDto); } else {
} else { return ObjectRestResponse.createFailedResult(1008, "用户积分不足");
return ObjectRestResponse.createFailedResult(1008, "用户积分不足"); }
} }
} insertSelective(integralUserRecord.getIntegralUserRecord());
insertSelective(integralUserRecord.getIntegralUserRecord()); if (oldValue != null) {
if (oldValue != null) { getUserRecordStatus(integralUserRecord, oldValue.getPeriod(), oldValue.getNumber());
getUserRecordStatus(integralUserRecord, oldValue.getPeriod(), oldValue.getNumber()); }
} return ObjectRestResponse.succ();
return ObjectRestResponse.succ(); }
}
/**
/** * 删除一个用户记录
* 删除一个用户记录 *
* * @param id
* @param id * @return
* @return */
*/ public ObjectRestResponse deleteOne(Integer id) {
public ObjectRestResponse deleteOne(Integer id) { log.info("删除用户积分记录的参数:id = {}", id);
log.info("删除用户积分记录的参数:id = {}", id); if (id == null || id <= 0) {
if (id == null || id <= 0) { return ObjectRestResponse.paramIsEmpty();
return ObjectRestResponse.paramIsEmpty(); }
} IntegralUserRecord integralUserRecord = mapper.selectByPrimaryKey(id);
IntegralUserRecord integralUserRecord = mapper.selectByPrimaryKey(id); if (integralUserRecord == null) {
if (integralUserRecord == null) { log.info("删除的用户记录不存在,要删除的id ={}", id);
log.info("删除的用户记录不存在,要删除的id ={}", id); return ObjectRestResponse.createDefaultFail();
return ObjectRestResponse.createDefaultFail(); }
} integralUserRecord.setIsdel(true);
integralUserRecord.setIsdel(true); updateByIdRe(integralUserRecord);
updateByIdRe(integralUserRecord); return ObjectRestResponse.succ();
return ObjectRestResponse.succ(); }
}
/**
/** * 根据获取某个用户的列表
* 根据获取某个用户的列表 *
* * @return
* @return */
*/ public ObjectRestResponse<PageDataVO> getUserList(IntegralUserRecordDto integralUserRecordDto) {
public ObjectRestResponse<PageDataVO> getUserList(IntegralUserRecordDto integralUserRecordDto) { log.info("获取用户积分记录的参数:integralUserRecordDto = {}", integralUserRecordDto.toString());
log.info("获取用户积分记录的参数:integralUserRecordDto = {}", integralUserRecordDto.toString()); AppUserDTO appUserDTO = userInfoBiz.getUserInfo();
AppUserDTO appUserDTO = userInfoBiz.getUserInfo(); if (appUserDTO == null) {
if (appUserDTO == null) { return ObjectRestResponse.createFailedResult(508, "token is null or invalid");
return ObjectRestResponse.createFailedResult(508, "token is null or invalid"); }
} integralUserRecordDto.setUserId(appUserDTO.getUserid());
integralUserRecordDto.setUserId(appUserDTO.getUserid()); Query query = new Query(integralUserRecordDto);
Query query = new Query(integralUserRecordDto); PageDataVO pageDataVO = PageDataVO.pageInfo(query, () -> mapper.selectByUserId(appUserDTO.getUserid()));
PageDataVO pageDataVO = PageDataVO.pageInfo(query, () -> mapper.selectByUserId(appUserDTO.getUserid())); return ObjectRestResponse.succ(pageDataVO);
return ObjectRestResponse.succ(pageDataVO); }
}
public ObjectRestResponse<List<IntegralUserRecord>> getByUserAndTime(IntegralUserRecordDto integralUserRecordDto) {
public ObjectRestResponse<List<IntegralUserRecord>> getByUserAndTime(IntegralUserRecordDto integralUserRecordDto) { log.info("获取用户积分记录的参数:integralUserRecordDto = {}", integralUserRecordDto.toString());
log.info("获取用户积分记录的参数:integralUserRecordDto = {}", integralUserRecordDto.toString()); if (integralUserRecordDto == null) {
if (integralUserRecordDto == null) { return ObjectRestResponse.paramIsEmpty();
return ObjectRestResponse.paramIsEmpty(); }
} AppUserDTO appUserDTO = userInfoBiz.getUserInfo();
AppUserDTO appUserDTO = userInfoBiz.getUserInfo(); if (appUserDTO == null) {
if (appUserDTO == null) { return ObjectRestResponse.createFailedResult(508, "token is null or invalid");
return ObjectRestResponse.createFailedResult(508, "token is null or invalid"); }
} integralUserRecordDto.setUserId(appUserDTO.getUserid());
integralUserRecordDto.setUserId(appUserDTO.getUserid()); List<IntegralUserRecord> integralUserRecordList = mapper.selectByUserAndTime(integralUserRecordDto);
List<IntegralUserRecord> integralUserRecordList = mapper.selectByUserAndTime(integralUserRecordDto); return ObjectRestResponse.succ(integralUserRecordList);
return ObjectRestResponse.succ(integralUserRecordList); }
}
/**
/** * //判断用户获取积分是否达标
* //判断用户获取积分是否达标 *
* * @param integralUserRecordDto 积分记录实体
* @param integralUserRecordDto 积分记录实体 * @param period 周期
* @param period 周期 * number 周期内可获得积分的次数
* number 周期内可获得积分的次数 */
*/ public void getUserRecordStatus(IntegralUserRecordDto integralUserRecordDto, Integer period, Integer number) {
public void getUserRecordStatus(IntegralUserRecordDto integralUserRecordDto, Integer period, Integer number) {
IntegralUserStatus integralUserStatus = new IntegralUserStatus();
IntegralUserStatus integralUserStatus = new IntegralUserStatus(); integralUserStatus.setUserId(integralUserRecordDto.getUserId());
integralUserStatus.setUserId(integralUserRecordDto.getUserId()); integralUserStatus.setIntegralRuleCode(integralUserRecordDto.getIntegralRuleCode());
integralUserStatus.setIntegralRuleCode(integralUserRecordDto.getIntegralRuleCode()); if (period == IntegralRulePeriod.DAY.getCode()) {//按天
if (period == IntegralRulePeriod.DAY.getCode()) {//按天 integralUserRecordDto.setStartTime(IntegralToolsUtils.getDayStart());
integralUserRecordDto.setStartTime(IntegralToolsUtils.getDayStart()); integralUserRecordDto.setEndTime(IntegralToolsUtils.getDayStart() + 24 * 60 * 60 * 1000);
integralUserRecordDto.setEndTime(IntegralToolsUtils.getDayStart() + 24 * 60 * 60 * 1000); Integer count = mapper.countByUserAndCode(integralUserRecordDto);
Integer count = mapper.countByUserAndCode(integralUserRecordDto); integralUserStatus.setIntegralStatus(count == number);
integralUserStatus.setIntegralStatus(count == number); } else {
} else { integralUserRecordDto.setStartTime(null);
integralUserRecordDto.setStartTime(null); Integer count = mapper.countByUserAndCode(integralUserRecordDto);
Integer count = mapper.countByUserAndCode(integralUserRecordDto); integralUserStatus.setIntegralStatus(true);
integralUserStatus.setIntegralStatus(true); }
} integralUserStatusBiz.save(integralUserStatus);
integralUserStatusBiz.save(integralUserStatus); }
}
} }
...@@ -7,6 +7,7 @@ import cn.hutool.core.date.DateUtil; ...@@ -7,6 +7,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.admin.dto.UserMemberDTO; import com.github.wxiaoqi.security.admin.dto.UserMemberDTO;
...@@ -17,6 +18,7 @@ import com.github.wxiaoqi.security.admin.feign.dto.UserDTO; ...@@ -17,6 +18,7 @@ import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.admin.feign.rest.UserRestInterface; import com.github.wxiaoqi.security.admin.feign.rest.UserRestInterface;
import com.github.wxiaoqi.security.admin.vo.AppUserVo; import com.github.wxiaoqi.security.admin.vo.AppUserVo;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant;
import com.github.wxiaoqi.security.common.context.BaseContextHandler; import com.github.wxiaoqi.security.common.context.BaseContextHandler;
import com.github.wxiaoqi.security.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
...@@ -83,7 +85,6 @@ import java.util.stream.Collectors; ...@@ -83,7 +85,6 @@ import java.util.stream.Collectors;
import static com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant.*; import static com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant.*;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE; import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE; import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE;
import static com.xxfc.platform.order.entity.OrderPersonInsurance.STATUS_PAY;
import static com.xxfc.platform.order.pojo.mq.OrderMQDTO.*; import static com.xxfc.platform.order.pojo.mq.OrderMQDTO.*;
import static com.xxfc.platform.universal.constant.DictionaryKey.ILLEGAL_TYPE; import static com.xxfc.platform.universal.constant.DictionaryKey.ILLEGAL_TYPE;
...@@ -885,6 +886,13 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements ...@@ -885,6 +886,13 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
//处理后台用户提醒短信的发送 //处理后台用户提醒短信的发送
// orderMsgBiz.handelBgUserMsg4Pay(orvd, baseOrder, appUserDTO, OrderMsgBiz.RENT_PAY); // orderMsgBiz.handelBgUserMsg4Pay(orvd, baseOrder, appUserDTO, OrderMsgBiz.RENT_PAY);
sendOrderMq(orvd, otd, omd, baseOrder, ORDER_PAY); sendOrderMq(orvd, otd, omd, baseOrder, ORDER_PAY);
JSONObject jsonObject = new JSONObject();
jsonObject.put("integralRuleCode", "RENTRV");
jsonObject.put("amount", baseOrder.getGoodsAmount().multiply(new BigDecimal("100")));
jsonObject.put("userId", baseOrder.getUserId());
jsonObject.put("channelId", baseOrder.getNo());
mqSenderFeign.sendMessage(RabbitConstant.INTEGRAL_TOPIC, RabbitConstant.INTEGRAL_ROUTING_KEY, jsonObject.toJSONString());
if (OrderTypeEnum.MEMBER.getCode().equals(baseOrder.getType())) { if (OrderTypeEnum.MEMBER.getCode().equals(baseOrder.getType())) {
sendOrderMq(orvd, otd, omd, baseOrder, ORDER_FINISH); sendOrderMq(orvd, otd, omd, baseOrder, ORDER_FINISH);
//订单完成时,payway为 支付宝,则转支付 //订单完成时,payway为 支付宝,则转支付
......
package com.xxfc.platform.uccn.dto;
import com.github.wxiaoqi.security.common.vo.PageParam;
import lombok.Data;
/**
* @ClassName : BannerDto
* @Description : 轮播图信息
* @Author : jiaoruizhen
* @Date: 2020-11-23 14:29
*/
@Data
public class BannerDto extends PageParam {
}
package com.xxfc.platform.uccn.dto;
import com.github.wxiaoqi.security.common.vo.PageParam;
import lombok.Data;
/**
* @ClassName : NewsTypeDto
* @Description : 新闻类型
* @Author : jiaoruizhen
* @Date: 2020-11-23 15:14
*/
@Data
public class NewsTypeDto extends PageParam {
String name;
}
...@@ -152,4 +152,5 @@ public class Article { ...@@ -152,4 +152,5 @@ public class Article {
@ApiModelProperty("description") @ApiModelProperty("description")
private String description; private String description;
private Integer typeId;
} }
package com.xxfc.platform.uccn.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
/**
* 轮播图
*
* @author libin
* @email 18178966185@163.com
* @date 2020-11-23 13:52:29
*/
@Data
@Table(name = "banner")
public class Banner implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 首页banner图主键
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty("首页banner图主键")
private Integer id;
/**
* 标题
*/
@Column(name = "title")
@ApiModelProperty(value = "标题")
private String title;
/**
* 封面
*/
@Column(name = "cover")
@ApiModelProperty(value = "封面")
private String cover;
/**
* 排序
*/
@Column(name = "rank")
@ApiModelProperty(value = "排序")
private Integer rank;
/**
* 创建时间
*/
@Column(name = "crt_time")
@ApiModelProperty(value = "创建时间", hidden = true )
private Date crtTime;
/**
* 修改时间
*/
@Column(name = "upd_time")
@ApiModelProperty(value = "修改时间", hidden = true )
private Date updTime;
/**
* 跳转链接
*/
@Column(name = "url")
@ApiModelProperty(value = "跳转链接")
private String url;
/**
* 是否删除,0否,1是
*/
@Column(name = "is_del")
@ApiModelProperty(value = "是否删除,0否,1是")
private Integer isDel;
/**
* 状态1--上架;2--下架
*/
@Column(name = "status")
@ApiModelProperty(value = "状态1--上架;2--下架")
private Integer status;
/**
* 是否首页展示:1、展示,2、不展示
*/
@Column(name = "index_show")
@ApiModelProperty(value = "是否首页展示:1、展示,2、不展示")
private Integer indexShow;
//banner位置 0:所有 1:首页
private Integer location;
//跳转类型 0--不跳转;1--商品详情页;2--店铺主页;
private Integer jumpType;
private String jumpId;
}
package com.xxfc.platform.uccn.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
/**
* 新闻类型
*
* @author libin
* @email 18178966185@163.com
* @date 2020-11-23 13:52:29
*/
@Data
@Table(name = "news_type")
public class NewsType implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty("")
private Integer id;
/**
* 中文名称
*/
@Column(name = "name_cn")
@ApiModelProperty(value = "中文名称")
private String nameCn;
/**
* 英文名称
*/
@Column(name = "name_en")
@ApiModelProperty(value = "英文名称")
private String nameEn;
/**
* 排序
*/
@Column(name = "rank")
@ApiModelProperty(value = "排序")
private Integer rank;
/**
* 是否删除:0、否,1、是
*/
@Column(name = "is_del")
@ApiModelProperty(value = "是否删除:0、否,1、是")
private Integer isDel;
/**
* 是否启用:1、启用,2、禁用
*/
@Column(name = "status")
@ApiModelProperty(value = "是否启用:1、启用,2、禁用")
private Integer status;
/**
*
*/
@Column(name = "crt_time")
@ApiModelProperty(value = "", hidden = true )
private Date crtTime;
/**
*
*/
@Column(name = "upd_time")
@ApiModelProperty(value = "", hidden = true )
private Date updTime;
}
...@@ -3,17 +3,16 @@ package com.xxfc.platform.uccn.biz; ...@@ -3,17 +3,16 @@ package com.xxfc.platform.uccn.biz;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.xxfc.platform.uccn.comstnt.UrlType; import com.xxfc.platform.uccn.comstnt.UrlType;
import com.xxfc.platform.uccn.entity.Article; import com.xxfc.platform.uccn.entity.Article;
import com.xxfc.platform.uccn.mapper.ArticleMapper; import com.xxfc.platform.uccn.mapper.ArticleMapper;
import com.xxfc.platform.uccn.vo.ArticleQuery; import com.xxfc.platform.uccn.vo.ArticleQuery;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.weekend.WeekendSqls; import tk.mybatis.mapper.weekend.WeekendSqls;
import java.security.SecureRandom;
import java.util.*; import java.util.*;
...@@ -43,10 +42,23 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> { ...@@ -43,10 +42,23 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
* @param type * @param type
* @return * @return
*/ */
public PageInfo getArticleList(Integer page, Integer limit, Integer type,String title) { public PageInfo getArticleList(Integer page, Integer limit, Integer type,String title, Integer typeId) {
PageHelper.startPage(page, limit); PageHelper.startPage(page, limit);
List articleList = mapper.getArticleList(type,null,null,title); Example example = new Example(Article.class);
return PageInfo.of(articleList); Example.Criteria criteria = example.createCriteria();
if (type != null) {
criteria.andEqualTo("type", type);
}
if (StringUtils.isNotBlank(title)) {
criteria.andEqualTo("title", "%" + title + "%");
}
if (typeId != null) {
criteria.andEqualTo("typeId", typeId);
}
criteria.andEqualTo("isDel", 0);
criteria.andEqualTo("status", 1);
example.orderBy("weight").asc();
return PageInfo.of(mapper.selectByExample(example));
} }
/** /**
......
package com.xxfc.platform.uccn.biz;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.Query;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.uccn.dto.BannerDto;
import com.xxfc.platform.uccn.entity.Banner;
import com.xxfc.platform.uccn.mapper.BannerMapper;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import java.util.List;
/**
* 轮播图
*
* @author libin
* @email 18178966185@163.com
* @date 2020-11-23 13:52:29
*/
@Service
public class BannerBiz extends BaseBiz<BannerMapper, Banner> {
public ObjectRestResponse add(Banner banner) {
if (banner == null) {
return ObjectRestResponse.paramIsEmpty();
}
if (banner.getId() != null) {
Banner old = selectById(banner.getId());
if (old == null) {
return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, ResultCode.getMsg(ResultCode.NOTEXIST_CODE));
}
BeanUtil.copyProperties(banner, old, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
updateSelectiveByIdRe(old);
} else {
insertSelectiveRe(banner);
}
return ObjectRestResponse.succ();
}
/**
* 查询所有展示的banner信息
* @param indexShow 是否首页展示
* @return
*/
public ObjectRestResponse<List<Banner>> getAll(Integer indexShow) {
Example example = new Example(Banner.class);
if (indexShow != null) {
example.createCriteria().andEqualTo("isDel", 0).andEqualTo("status", 1).andEqualTo("indexShow",indexShow);
} else {
example.createCriteria().andEqualTo("isDel", 0).andEqualTo("status", 1);
}
example.orderBy("rank");
return ObjectRestResponse.succ(mapper.selectByExample(example));
}
/**
* 后台分页查询
* @param bannerDto
* @return
*/
public ObjectRestResponse<PageDataVO<Banner>> selectList(BannerDto bannerDto) {
Example example = new Example(Banner.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("isDel", 0);
example.orderBy("updTime").desc();
Query query = new Query(bannerDto);
PageDataVO<Banner> pageDataVO = PageDataVO.pageInfo(query, () -> mapper.selectByExample(example));
return ObjectRestResponse.succ(pageDataVO);
}
}
\ No newline at end of file
package com.xxfc.platform.uccn.biz;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.Query;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.uccn.dto.NewsTypeDto;
import com.xxfc.platform.uccn.entity.NewsType;
import com.xxfc.platform.uccn.mapper.NewsTypeMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import java.util.List;
/**
* 新闻类型
*
* @author libin
* @email 18178966185@163.com
* @date 2020-11-23 13:52:29
*/
@Service
public class NewsTypeBiz extends BaseBiz<NewsTypeMapper, NewsType> {
public ObjectRestResponse add(NewsType newsType) {
if (newsType == null) {
return ObjectRestResponse.paramIsEmpty();
}
if (newsType.getId() != null) {
NewsType old = selectById(newsType.getId());
if (old == null) {
return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, ResultCode.getMsg(ResultCode.NOTEXIST_CODE));
}
if (StringUtils.isNotBlank(newsType.getNameCn())) {
NewsType nameValue = getOneByName(newsType.getNameCn());
if (nameValue != null && !nameValue.getId().equals(newsType.getId())) {
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "新闻分类名称已存在!");
}
}
BeanUtil.copyProperties(newsType, old, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
updateSelectiveByIdRe(old);
} else {
if (StringUtils.isNotBlank(newsType.getNameCn())) {
NewsType nameValue = getOneByName(newsType.getNameCn());
if (nameValue != null) {
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "新闻分类名称已存在!");
}
}
insertSelectiveRe(newsType);
}
return ObjectRestResponse.succ();
}
public NewsType getOneByName(String newsTypeName) {
Example example = new Example(NewsType.class);
example.createCriteria().andEqualTo("isDel", 0).andEqualTo("nameCn", newsTypeName);
return mapper.selectOneByExample(example);
}
/**
* 查询所有首页展示
* @return
*/
public ObjectRestResponse<List<NewsType>> getAll() {
Example example = new Example(NewsType.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("isDel", 0).andEqualTo("status", 1);
example.orderBy("rank");
return ObjectRestResponse.succ(mapper.selectByExample(example));
}
/**
* 新闻咨询类型
* @param newsTypeDto
* @return
*/
public ObjectRestResponse<PageDataVO<NewsType>> selectList(NewsTypeDto newsTypeDto) {
Example example = new Example(NewsType.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("isDel", 0);
if (StringUtils.isNotBlank(newsTypeDto.getName())) {
criteria.andLike("nameCn", "%" + newsTypeDto.getName() + "%");
}
example.orderBy("updTime").desc();
Query query = new Query(newsTypeDto);
PageDataVO<NewsType> pageDataVO = PageDataVO.pageInfo(query, () -> mapper.selectByExample(example));
return ObjectRestResponse.succ(pageDataVO);
}
}
\ No newline at end of file
package com.xxfc.platform.uccn.mapper;
import com.xxfc.platform.uccn.entity.Banner;
import tk.mybatis.mapper.common.Mapper;
/**
* 轮播图
*
* @author libin
* @email 18178966185@163.com
* @date 2020-11-23 13:52:29
*/
public interface BannerMapper extends Mapper<Banner> {
}
package com.xxfc.platform.uccn.mapper;
import com.xxfc.platform.uccn.entity.NewsType;
import tk.mybatis.mapper.common.Mapper;
/**
* 新闻类型
*
* @author libin
* @email 18178966185@163.com
* @date 2020-11-23 13:52:29
*/
public interface NewsTypeMapper extends Mapper<NewsType> {
}
...@@ -26,8 +26,9 @@ public class ArticleController extends BaseController<ArticleBiz, Article> { ...@@ -26,8 +26,9 @@ public class ArticleController extends BaseController<ArticleBiz, Article> {
@RequestParam(name = "page", defaultValue = "1") Integer page, @RequestParam(name = "page", defaultValue = "1") Integer page,
@RequestParam(name = "limit", defaultValue = "10") Integer limit, @RequestParam(name = "limit", defaultValue = "10") Integer limit,
@RequestParam(name = "type", defaultValue = "1") Integer type, @RequestParam(name = "type", defaultValue = "1") Integer type,
@RequestParam(value = "title",required = false) String title) { @RequestParam(value = "title",required = false) String title,
return ObjectRestResponse.succ(baseBiz.getArticleList(page, limit, type,title)); @RequestParam(value = "typeId",required = false) Integer typeId) {
return ObjectRestResponse.succ(baseBiz.getArticleList(page, limit, type,title, typeId));
} }
@GetMapping("/app/unauth/one") @GetMapping("/app/unauth/one")
......
package com.xxfc.platform.uccn.rest.admin;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.uccn.biz.BannerBiz;
import com.xxfc.platform.uccn.dto.BannerDto;
import com.xxfc.platform.uccn.entity.Banner;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("banner")
public class BannerController extends BaseController<BannerBiz, Banner> {
@PostMapping(value = "addUpdate")
public ObjectRestResponse addUpdate(@RequestBody Banner banner) {
return baseBiz.add(banner);
}
@GetMapping(value = "getList")
public ObjectRestResponse getList(BannerDto bannerDto) {
return baseBiz.selectList(bannerDto);
}
@GetMapping(value = "/app/unauth/getAll")
public ObjectRestResponse getAll() {
return baseBiz.getAll(1);
}
}
\ No newline at end of file
package com.xxfc.platform.uccn.rest.admin;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.uccn.biz.NewsTypeBiz;
import com.xxfc.platform.uccn.dto.NewsTypeDto;
import com.xxfc.platform.uccn.entity.NewsType;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("newsType")
public class NewsTypeController extends BaseController<NewsTypeBiz, NewsType> {
@PostMapping(value = "addUpdate")
public ObjectRestResponse addOrUpdate(@RequestBody NewsType newsType) {
return baseBiz.add(newsType);
}
@GetMapping(value = "/app/unauth/getAll")
public ObjectRestResponse getAll() {
return baseBiz.getAll();
}
@GetMapping(value = "getList")
public ObjectRestResponse getList(NewsTypeDto newsTypeDto) {
return baseBiz.selectList(newsTypeDto);
}
}
\ No newline at end of file
<?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.xxfc.platform.uccn.mapper.BannerMapper">
</mapper>
\ No newline at end of file
<?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.xxfc.platform.uccn.mapper.NewsTypeMapper">
</mapper>
\ No newline at end of file
...@@ -11,7 +11,6 @@ import com.alipay.api.internal.util.AlipaySignature; ...@@ -11,7 +11,6 @@ import com.alipay.api.internal.util.AlipaySignature;
import com.alipay.api.request.*; import com.alipay.api.request.*;
import com.alipay.api.response.*; import com.alipay.api.response.*;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant;
import com.github.wxiaoqi.security.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.HTTPSUtils; import com.github.wxiaoqi.security.common.util.HTTPSUtils;
...@@ -21,14 +20,15 @@ import com.github.wxiaoqi.security.common.util.process.ResultCode; ...@@ -21,14 +20,15 @@ import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.util.process.SystemConfig; import com.github.wxiaoqi.security.common.util.process.SystemConfig;
import com.github.wxiaoqi.security.common.util.result.JsonResultUtil; import com.github.wxiaoqi.security.common.util.result.JsonResultUtil;
import com.xxfc.platform.universal.constant.PayWay; import com.xxfc.platform.universal.constant.PayWay;
import com.xxfc.platform.universal.constant.WxResponseProperties;
import com.xxfc.platform.universal.entity.Dictionary; import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.entity.OrderPay; import com.xxfc.platform.universal.entity.OrderPay;
import com.xxfc.platform.universal.mapper.OrderPayMapper; import com.xxfc.platform.universal.mapper.OrderPayMapper;
import com.xxfc.platform.universal.utils.SignUtils; import com.xxfc.platform.universal.utils.SignUtils;
import com.xxfc.platform.universal.vo.FundPayVo; import com.xxfc.platform.universal.vo.FundPayVo;
import com.xxfc.platform.universal.vo.OrderPayVo; import com.xxfc.platform.universal.vo.OrderPayVo;
import com.xxfc.platform.universal.weixin.api.*; import com.xxfc.platform.universal.weixin.api.WXPay;
import com.xxfc.platform.universal.constant.WxResponseProperties; import com.xxfc.platform.universal.weixin.api.WXSuppToUserPay;
import com.xxfc.platform.universal.weixin.util.HTTPUtils; import com.xxfc.platform.universal.weixin.util.HTTPUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
...@@ -40,7 +40,10 @@ import tk.mybatis.mapper.entity.Example; ...@@ -40,7 +40,10 @@ import tk.mybatis.mapper.entity.Example;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import static com.xxfc.platform.universal.constant.DictionaryKey.PAY_DEMOTION; import static com.xxfc.platform.universal.constant.DictionaryKey.PAY_DEMOTION;
import static com.xxfc.platform.universal.constant.DictionaryKey.UNIVERSAL_PAY; import static com.xxfc.platform.universal.constant.DictionaryKey.UNIVERSAL_PAY;
...@@ -183,8 +186,6 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{ ...@@ -183,8 +186,6 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{
jsonObject.put("integralRuleCode", "BUYMEMBER"); jsonObject.put("integralRuleCode", "BUYMEMBER");
} }
log.info("支付订单号:orderNo = {}, orderType = {}", newValue.getOrderNo(), newValue.getChannel()); log.info("支付订单号:orderNo = {}, orderType = {}", newValue.getOrderNo(), newValue.getChannel());
log.info("支付成功获取积分:发送消息 exchange = {}, routingKey = {}, json = {}", RabbitConstant.INTEGRAL_TOPIC, RabbitConstant.INTEGRAL_ROUTING_KEY, jsonObject.toJSONString());
mqServiceBiZ.sendMessage(RabbitConstant.INTEGRAL_TOPIC, RabbitConstant.INTEGRAL_ROUTING_KEY, jsonObject.toJSONString());
} }
if (StringUtils.isNotBlank(pay.getNotifyUrl())) { if (StringUtils.isNotBlank(pay.getNotifyUrl())) {
String url = pay.getNotifyUrl(); String url = pay.getNotifyUrl();
......
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