Browse Source

增加评测收藏及订单支付成功群机器人

zyj
sj 2 years ago
parent
commit
a22fa10cb8
  1. 2
      yudao-server/src/main/resources/application-local.yaml
  2. 5
      zsw-bxg/pom.xml
  3. 26
      zsw-bxg/src/main/java/co/yixiang/app/modules/evaluation/param/YxStoreEvaluationRelationQueryParam.java
  4. 51
      zsw-bxg/src/main/java/co/yixiang/app/modules/evaluation/rest/AppStoreEvaluationController.java
  5. 12
      zsw-bxg/src/main/java/co/yixiang/app/modules/order/rest/AppStoreOrderController.java
  6. 4
      zsw-bxg/src/main/java/co/yixiang/app/modules/services/OrderSupplyService.java
  7. 21
      zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/LetterAppUserController.java
  8. 40
      zsw-bxg/src/main/java/co/yixiang/modules/evaluation/domain/YxStoreEvaluationRelation.java
  9. 69
      zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/YxEvaluationRelationService.java
  10. 41
      zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/dto/YxStoreEvaluationRelationDto.java
  11. 131
      zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/impl/YxEvaluationRelationServiceImpl.java
  12. 33
      zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/mapper/YxEvaluationRelationMapper.java
  13. 34
      zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/vo/YxStoreEvaluationRelationQueryVo.java
  14. 12
      zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/CardAction.java
  15. 11
      zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/EmphasisContent.java
  16. 18
      zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/HorizontalContent.java
  17. 26
      zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/Jump.java
  18. 11
      zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/MainTitle.java
  19. 22
      zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/QuoteArea.java
  20. 14
      zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/Souce.java
  21. 62
      zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/TemplateCard.java
  22. 5
      zsw-bxg/src/main/java/co/yixiang/modules/inform/service/SendMsgService.java
  23. 85
      zsw-bxg/src/main/java/co/yixiang/modules/inform/service/impl/SendMsgServiceImpl.java
  24. 3
      zsw-bxg/src/main/java/co/yixiang/modules/order/service/YxStoreOrderService.java
  25. 24
      zsw-bxg/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderServiceImpl.java
  26. 4
      zsw-bxg/src/main/java/co/yixiang/modules/order/service/mapper/StoreOrderMapper.java

2
yudao-server/src/main/resources/application-local.yaml

@ -244,7 +244,7 @@ dubbo:
bxg:
shop:
# API_URL: http://192.168.10.113:48080/bxgApp
API_URL: https://2b36-27-19-79-216.ap.ngrok.io
API_URL: https://8d9e-27-19-79-216.jp.ngrok.io
SITE_URL: http://192.168.10.113:48080/bxgApp
UNI_SITE_URL: http://192.168.10.113:48080/bxgApp
ADMIN_API_URL: http://192.168.10.113:48080/bxg

5
zsw-bxg/pom.xml

@ -27,6 +27,11 @@
<artifactId>yudao-module-system-impl</artifactId>
<version>1.6.2-snapshot</version>
</dependency>
<dependency>
<groupId>com.dtflys.forest</groupId>
<artifactId>forest-spring-boot-starter</artifactId>
<version>1.5.14</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>

26
zsw-bxg/src/main/java/co/yixiang/app/modules/evaluation/param/YxStoreEvaluationRelationQueryParam.java

@ -0,0 +1,26 @@
package co.yixiang.app.modules.evaluation.param;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
/**
* <p>
* 评测点赞和收藏表 查询参数对象
* </p>
*
* @author sj
* @date 2022-10-19
*/
@Getter
@Setter
@ApiModel("查询参数对象")
public class YxStoreEvaluationRelationQueryParam {
@NotBlank(message = "参数有误")
@ApiModelProperty(value = "商品id",required=true)
private String id;
}

51
zsw-bxg/src/main/java/co/yixiang/app/modules/evaluation/rest/AppStoreEvaluationController.java

@ -8,8 +8,17 @@
*/
package co.yixiang.app.modules.evaluation.rest;
import cn.hutool.core.util.NumberUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import cn.iocoder.yudao.framework.security.core.annotations.AuthCheck;
import co.yixiang.annotation.AnonymousAccess;
import co.yixiang.app.common.aop.NoRepeatSubmit;
import co.yixiang.app.common.bean.LocalUser;
import co.yixiang.app.modules.evaluation.param.YxStoreEvaluationRelationQueryParam;
import co.yixiang.app.modules.product.param.YxStoreProductRelationQueryParam;
import co.yixiang.logging.aop.log.AppLog;
import co.yixiang.modules.evaluation.service.YxEvaluationRelationService;
import co.yixiang.modules.evaluation.service.YxEvaluationService;
import co.yixiang.utils.EntryDTO;
import co.yixiang.utils.EvaluationDTO;
@ -18,9 +27,8 @@ import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -40,7 +48,7 @@ public class AppStoreEvaluationController {
private final YxEvaluationService yxEvaluationService;
private final YxEvaluationRelationService yxEvaluationRelationService;
/**
* 评测列表
*/
@ -61,5 +69,40 @@ public class AppStoreEvaluationController {
EvaluationDTO evaluationDTO=yxEvaluationService.getEvaluationById(id);
return ApiResult.ok(evaluationDTO);
}
/**
* 添加收藏
*/
@AppLog(value = "添加收藏", type = 1)
@NoRepeatSubmit
@AuthCheck
@PostMapping("/collectEvaluation/add")
@ApiOperation(value = "添加收藏",notes = "添加收藏")
public ApiResult<Boolean> collectAdd(@Validated @RequestBody YxStoreEvaluationRelationQueryParam param){
long uid = LocalUser.getUser().getUid();
if(!NumberUtil.isNumber(param.getId())) {
throw new YshopException("参数错误哦");
}
yxEvaluationRelationService.addEvaluationRelation(Long.valueOf(param.getId()),uid);
return ApiResult.ok();
}
/**
* 取消收藏
*/
@AppLog(value = "取消收藏", type = 1)
@NoRepeatSubmit
@AuthCheck
@PostMapping("/collectEvaluation/del")
@ApiOperation(value = "取消收藏",notes = "取消收藏")
public ApiResult<Boolean> collectDel(@Validated @RequestBody YxStoreEvaluationRelationQueryParam param){
long uid = LocalUser.getUser().getUid();
if(!NumberUtil.isNumber(param.getId())) {
throw new YshopException("参数错误哦");
}
yxEvaluationRelationService.delEvaluationRelation(Long.valueOf(param.getId()),
uid);
return ApiResult.ok();
}
}

12
zsw-bxg/src/main/java/co/yixiang/app/modules/order/rest/AppStoreOrderController.java

@ -22,6 +22,7 @@ import co.yixiang.app.modules.services.OrderSupplyService;
import cn.iocoder.yudao.framework.security.core.annotations.AuthCheck;
import co.yixiang.enums.*;
import co.yixiang.logging.aop.log.AppLog;
import co.yixiang.modules.inform.service.SendMsgService;
import co.yixiang.modules.mp.domain.YxWechatTemplate;
import co.yixiang.modules.mp.service.WeixinPayService;
import co.yixiang.modules.mp.service.YxWechatTemplateService;
@ -52,6 +53,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.LinkedHashMap;
@ -82,6 +84,8 @@ public class AppStoreOrderController {
private final YxStoreOrderCartInfoService storeOrderCartInfoService;
private final WeixinPayService weixinPayService;
private final SendMsgService sendMsgService;
/**
* 订单确认
*/
@ -135,7 +139,7 @@ public class AppStoreOrderController {
@PostMapping("/order/create/{key}")
@ApiOperation(value = "订单创建", notes = "订单创建")
public ApiResult<Map<String, Object>> create(@Valid @RequestBody OrderParam param,
@PathVariable String key) {
@PathVariable String key) throws IOException {
YxUser yxUser = LocalUser.getUser();
ComputeOrderParam computeOrderParam = new ComputeOrderParam();
BeanUtil.copyProperties(param, computeOrderParam);
@ -184,7 +188,7 @@ public class AppStoreOrderController {
@AuthCheck
@PostMapping("/order/pay")
@ApiOperation(value = "订单支付", notes = "订单支付")
public ApiResult<Map<String, Object>> pay(@Valid @RequestBody PayParam param) {
public ApiResult<Map<String, Object>> pay(@Valid @RequestBody PayParam param) throws IOException {
Map<String, Object> map = new LinkedHashMap<>();
Long uid = LocalUser.getUser().getUid();
YxStoreOrderQueryVo storeOrder = storeOrderService
@ -218,6 +222,10 @@ public class AppStoreOrderController {
orderSupplyService.goPay(map, orderId, uid, param.getPaytype(), param.getFrom(), orderDTO);
//这里判断是否支付成功
if (map!=null){
sendMsgService.inform(Long.valueOf(orderId));
}
return ApiResult.ok(map);
}

4
zsw-bxg/src/main/java/co/yixiang/app/modules/services/OrderSupplyService.java

@ -42,6 +42,7 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@ -174,14 +175,13 @@ public class OrderSupplyService {
* @return map
*/
public Map<String, Object> goPay(Map<String, Object> map, String orderId, Long uid, String payType,
String from, OrderExtendDto orderDTO){
String from, OrderExtendDto orderDTO) throws IOException {
switch (PayTypeEnum.toType(payType)){
case WEIXIN:
Map<String,String> jsConfig = new HashMap<>();
if(AppFromEnum.WEIXIN_H5.getValue().equals(from)){
WxPayMwebOrderResult wxPayMwebOrderResult = (WxPayMwebOrderResult)weixinPayService
.unifyPay(orderId,from, BillDetailEnum.TYPE_3.getValue(),"H5商品购买");
log.info("wxPayMwebOrderResult:{}",wxPayMwebOrderResult);
jsConfig.put("mweb_url",wxPayMwebOrderResult.getMwebUrl());
orderDTO.setJsConfig(jsConfig);

21
zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/LetterAppUserController.java

@ -17,6 +17,8 @@ import co.yixiang.app.modules.user.param.UserEditParam;
import co.yixiang.logging.aop.log.AppLog;
import co.yixiang.constant.ShopConstants;
import co.yixiang.enums.BillInfoEnum;
import co.yixiang.modules.evaluation.service.YxEvaluationRelationService;
import co.yixiang.modules.evaluation.service.vo.YxStoreEvaluationRelationQueryVo;
import co.yixiang.modules.order.service.YxStoreOrderService;
import co.yixiang.modules.order.vo.UserOrderCountVo;
import co.yixiang.modules.product.service.YxStoreProductRelationService;
@ -68,6 +70,7 @@ public class LetterAppUserController {
private final YxSystemGroupDataService systemGroupDataService;
private final YxStoreOrderService orderService;
private final YxStoreProductRelationService relationService;
private final YxEvaluationRelationService evaluationRelationService;
private final YxUserSignService userSignService;
private final YxUserBillService userBillService;
private final YxSystemConfigService systemConfigService;
@ -127,6 +130,24 @@ public class LetterAppUserController {
return ApiResult.ok(relationService.userCollectProduct(page,limit,uid,type));
}
/**
* 获取收藏评测
*/
@AuthCheck
@GetMapping("/collectEvaluation/user")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int",dataTypeClass = Integer.class),
@ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int",dataTypeClass = Integer.class),
@ApiImplicitParam(name = "type", value = "collect为收藏", paramType = "query", dataType = "String",dataTypeClass = String.class)
})
@ApiOperation(value = "获取收藏的评测",notes = "获取收藏的评测")
public ApiResult<List<YxStoreEvaluationRelationQueryVo>> collectEvaluationUser(@RequestParam(value = "page",defaultValue = "1") int page,
@RequestParam(value = "limit",defaultValue = "10") int limit,
@RequestParam(value = "type") String type){
Long uid = LocalUser.getUser().getUid();
return ApiResult.ok(evaluationRelationService.userCollectEvaluation(page,limit,uid,type));
}
/**
* 用户资金统计
*/

40
zsw-bxg/src/main/java/co/yixiang/modules/evaluation/domain/YxStoreEvaluationRelation.java

@ -0,0 +1,40 @@
package co.yixiang.modules.evaluation.domain;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDomain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
/**
* <p>
* 评测点赞和收藏表
* </p>
*
* @author sj
* @since 2022-10-19
*/
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class YxStoreEvaluationRelation extends BaseDomain {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ApiModelProperty(value = "用户ID")
private Long uid;
@ApiModelProperty(value = "评测ID")
private Long evaluationId;
@ApiModelProperty(value = "类型(收藏(collect)、点赞(like)、足迹(foot))")
private String type;
}

69
zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/YxEvaluationRelationService.java

@ -0,0 +1,69 @@
package co.yixiang.modules.evaluation.service;
import co.yixiang.domain.PageResult;
import co.yixiang.modules.evaluation.domain.YxStoreEvaluationRelation;
import co.yixiang.modules.evaluation.service.dto.YxStoreEvaluationRelationDto;
import co.yixiang.modules.evaluation.service.vo.YxStoreEvaluationRelationQueryVo;
import co.yixiang.modules.product.service.dto.YxStoreProductRelationQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.List;
/**
* <p>
* 评测收藏表 服务类
* </p>
*
* @author hupeng
* @since 2019-10-23
*/
public interface YxEvaluationRelationService {
/**
* 是否收藏
* @param evaluationId 评测ID
* @param uid 用户ID
* @return Boolean
*/
Boolean isEvaluationRelation(long evaluationId, long uid);
/**
*添加收藏
* @param evaluationId 评测id
* @param uid 用户id
*/
void addEvaluationRelation(long evaluationId,long uid);
/**
* 取消收藏
* @param evaluationId 评测id
* @param uid 用户id
*/
void delEvaluationRelation(long evaluationId,long uid);
/**
* 获取用户收藏列表
* @param page page
* @param limit limit
* @param uid 用户id
* @return list
*/
List<YxStoreEvaluationRelationQueryVo> userCollectEvaluation(int page, int limit, Long uid, String type);
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
PageResult<YxStoreEvaluationRelationDto> queryAll(YxStoreProductRelationQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<YxStoreProductRelationDto>
*/
List<YxStoreEvaluationRelation> queryAll(YxStoreProductRelationQueryCriteria criteria);
}

41
zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/dto/YxStoreEvaluationRelationDto.java

@ -0,0 +1,41 @@
package co.yixiang.modules.evaluation.service.dto;
import co.yixiang.modules.evaluation.domain.YxEvaluation;
import co.yixiang.modules.product.domain.YxStoreProduct;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.sql.Timestamp;
@Data
public class YxStoreEvaluationRelationDto implements Serializable {
private Long id;
/** 用户ID */
private Long uid;
private String userName;
/** 评测ID */
private Long evaluationId;
private YxEvaluation evaluation;
private YxStoreProduct product;
/** 类型(收藏(collect)、点赞(like)) */
private String type;
/** 添加时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Timestamp createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Timestamp updateTime;
private Integer isDel;
}

131
zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/impl/YxEvaluationRelationServiceImpl.java

@ -0,0 +1,131 @@
package co.yixiang.modules.evaluation.service.impl;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.domain.PageResult;
import co.yixiang.dozer.service.IGenerator;
import co.yixiang.modules.evaluation.domain.YxStoreEvaluationRelation;
import co.yixiang.modules.evaluation.service.YxEvaluationRelationService;
import co.yixiang.modules.evaluation.service.YxEvaluationService;
import co.yixiang.modules.evaluation.service.dto.YxStoreEvaluationRelationDto;
import co.yixiang.modules.evaluation.service.mapper.YxEvaluationRelationMapper;
import co.yixiang.modules.evaluation.service.vo.YxStoreEvaluationRelationQueryVo;
import co.yixiang.modules.product.service.dto.YxStoreProductRelationQueryCriteria;
import co.yixiang.modules.user.service.YxUserService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageInfo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* <p>
* 评测点赞和收藏表 服务实现类
* </p>
*
* @author sj
* @since 2022-10-19
*/
@Slf4j
@Service
@AllArgsConstructor
@Transactional(rollbackFor = Exception.class)
public class YxEvaluationRelationServiceImpl extends BaseServiceImpl<YxEvaluationRelationMapper, YxStoreEvaluationRelation> implements YxEvaluationRelationService {
private final YxEvaluationRelationMapper yxEvaluationRelationMapper;
private final YxEvaluationService yxEvaluationService;
private final YxUserService userService;
private final IGenerator generator;
/**
* 是否收藏
* @param evaluationId 评测ID
* @param uid 用户ID
* @return Boolean
*/
@Override
public Boolean isEvaluationRelation(long evaluationId, long uid) {
Long count = yxEvaluationRelationMapper
.selectCount(Wrappers.<YxStoreEvaluationRelation>lambdaQuery()
.eq(YxStoreEvaluationRelation::getUid,uid)
.eq(YxStoreEvaluationRelation::getType,"collect")
.eq(YxStoreEvaluationRelation::getEvaluationId,evaluationId));
if(count > 0) {
return true;
}
return false;
}
/**
* 添加收藏
* @param evaluationId 评测id
* @param uid 用户id
*/
@Override
public void addEvaluationRelation(long evaluationId, long uid) {
if(isEvaluationRelation(evaluationId,uid)){
throw new YshopException("已收藏");
}
YxStoreEvaluationRelation storeEvaluationRelation=YxStoreEvaluationRelation.builder()
.evaluationId(evaluationId)
.uid(uid)
.build();
yxEvaluationRelationMapper.insert(storeEvaluationRelation);
}
/**
* 取消收藏
* @param evaluationId 评测id
* @param uid 用户id
*/
@Override
public void delEvaluationRelation(long evaluationId, long uid) {
YxStoreEvaluationRelation evaluationRelation =this.lambdaQuery()
.eq(YxStoreEvaluationRelation::getEvaluationId,evaluationId)
.eq(YxStoreEvaluationRelation::getUid,uid)
.one();
if (evaluationRelation == null){
throw new YshopException("已取消");
}
}
/**
* 获取用户收藏列表
* @param page page
* @param limit limit
* @param uid 用户id
* @return list
*/
@Override
public List<YxStoreEvaluationRelationQueryVo> userCollectEvaluation(int page, int limit, Long uid, String type) {
Page<YxStoreEvaluationRelation> pageModel = new Page<>(page, limit);
List<YxStoreEvaluationRelationQueryVo> list = yxEvaluationRelationMapper.selectRelationList(pageModel,uid,type);
return list;
}
@Override
public PageResult<YxStoreEvaluationRelationDto> queryAll(YxStoreProductRelationQueryCriteria criteria, Pageable pageable) {
getPage(pageable);
PageInfo<YxStoreEvaluationRelation> page = new PageInfo<>(queryAll(criteria));
PageResult<YxStoreEvaluationRelationDto> relationDtoPageResult = generator.convertPageInfo(page, YxStoreEvaluationRelationDto.class);
relationDtoPageResult.getContent().forEach(i ->{
i.setEvaluation(yxEvaluationService.getById(i.getEvaluationId()));
i.setUserName(userService.getYxUserById(i.getUid()).getNickname());
});
return relationDtoPageResult;
}
@Override
public List<YxStoreEvaluationRelation> queryAll(YxStoreProductRelationQueryCriteria criteria) {
return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreEvaluationRelation.class, criteria));
}
}

33
zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/mapper/YxEvaluationRelationMapper.java

@ -0,0 +1,33 @@
package co.yixiang.modules.evaluation.service.mapper;
import co.yixiang.common.mapper.CoreMapper;
import co.yixiang.modules.evaluation.domain.YxStoreEvaluationRelation;
import co.yixiang.modules.evaluation.service.vo.YxStoreEvaluationRelationQueryVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* 评测点赞和收藏表 Mapper 接口
* </p>
*
* @author sj
* @since 2022-10-19
*/
@Repository
public interface YxEvaluationRelationMapper extends CoreMapper<YxStoreEvaluationRelation> {
@Select("select B.id pid,A.type as category,B.home_image as homeImage,A.id id," +
"B.is_show as isShow" +
" from yx_evaluation_relation A left join yx_evaluation B " +
"on A.evaluation_id = B.id where A.type=#{type} and A.uid=#{uid} and A.is_del = 0 and B.is_del = 0 order by A.create_time desc")
List<YxStoreEvaluationRelationQueryVo> selectRelationList(Page page, @Param("uid") Long uid, @Param("type") String type);
}

34
zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/vo/YxStoreEvaluationRelationQueryVo.java

@ -0,0 +1,34 @@
package co.yixiang.modules.evaluation.service.vo;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
public class YxStoreEvaluationRelationQueryVo {
private static final long serialVersionUID = 1L;
private Long id;
@ApiModelProperty(value = "用户ID")
private Long uid;
@ApiModelProperty(value = "商品ID")
private Long productId;
@ApiModelProperty(value = "类型(收藏(collect")
private String type;
@ApiModelProperty(value = "添加时间")
private Date createTime;
@ApiModelProperty(value = "首页图片")
private String homeImage;
@ApiModelProperty(value = "是否显示")
private Integer isShow;
}

12
zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/CardAction.java

@ -0,0 +1,12 @@
package co.yixiang.modules.inform.domin;
import lombok.Data;
@Data
public class CardAction {
private Integer type;
private String url;
private String appid;
private String pagepath;
}

11
zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/EmphasisContent.java

@ -0,0 +1,11 @@
package co.yixiang.modules.inform.domin;
import lombok.Data;
@Data
public class EmphasisContent {
/** 关键数据样式 "title":"100",
"desc":"数据含义"*/
private String title;
private String desc;
}

18
zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/HorizontalContent.java

@ -0,0 +1,18 @@
package co.yixiang.modules.inform.domin;
import lombok.Data;
/** 二级标题+文本列表 type:0或不填代表是普通文本1 代表跳转url2 代表下载附件3 代表@员工
keyname:二级标题value:内容url链接
* */
@Data
public class HorizontalContent {
private String type;
private String keyname;
private String value;
private String url;
private String media_id;
}

26
zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/Jump.java

@ -0,0 +1,26 @@
package co.yixiang.modules.inform.domin;
import lombok.Data;
/** {
"type":1,
"url":"https://work.weixin.qq.com/?from=openApi",
"title":"企业微信官网"
},
{
"type":2,
"appid":"APPID",
"pagepath":"PAGEPATH",
"title":"跳转小程序"
}*/
@Data
public class Jump {
private Integer type;
private String appid;
private String url;
private String title;
private String pagepath;
}

11
zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/MainTitle.java

@ -0,0 +1,11 @@
package co.yixiang.modules.inform.domin;
import lombok.Data;
@Data
public class MainTitle {
/** 模版卡片的主要内容 title:一级标题、desc:标题辅助信息*/
private String title;
private String desc;
}

22
zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/QuoteArea.java

@ -0,0 +1,22 @@
package co.yixiang.modules.inform.domin;
import lombok.Data;
/** 引用文献样式
* "type":1,
"url":"https://work.weixin.qq.com/?from=openApi",
"appid":"APPID",
"pagepath":"PAGEPATH",
"title":"引用文本标题",
"quote_text":"Jack:企业微信真的很好用~\nBalian:超级好的一款软件!"*/
@Data
public class QuoteArea {
private Integer type;
private String url;
private String appid;
private String pagepath;
private String title;
private String quote_text;
}

14
zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/Souce.java

@ -0,0 +1,14 @@
package co.yixiang.modules.inform.domin;
import io.swagger.models.auth.In;
import lombok.Data;
@Data
public class Souce {
/**卡片来源信息模板 icon_url:来源图片url、desc:描述、desc_color:颜色 0(默认) 灰色,1 黑色,2 红色,3 绿色 */
private String icon_url;
private String desc;
private Integer desc_color;
}

62
zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/TemplateCard.java

@ -0,0 +1,62 @@
package co.yixiang.modules.inform.domin;
import co.yixiang.modules.inform.domin.*;
import lombok.Data;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@Data
@Service
public class TemplateCard {
// /**消息类型*/
// private String msgtype ;
/** 模板卡片的模板类型*/
private String card_type;
/**卡片来源信息模板 icon_url:来源图片url、desc:描述、desc_color:颜色 0(默认) 灰色,1 黑色,2 红色,3 绿色 */
private Souce source;
/** 模版卡片的主要内容 title:一级标题、desc:标题辅助信息*/
private MainTitle main_title;
/** 关键数据样式 "title":"100",
"desc":"数据含义"*/
private EmphasisContent emphasis_content;
/** 引用文献样式
* "type":1,
"url":"https://work.weixin.qq.com/?from=openApi",
"appid":"APPID",
"pagepath":"PAGEPATH",
"title":"引用文本标题",
"quote_text":"Jack:企业微信真的很好用~\nBalian:超级好的一款软件!"*/
private QuoteArea quote_area;
private String sub_title_text;
/** 二级标题+文本列表 type:0或不填代表是普通文本1 代表跳转url2 代表下载附件3 代表@员工
keyname:二级标题value:内容url链接
* */
private ArrayList<HorizontalContent> horizontal_content_list;
/** {
"type":1,
"url":"https://work.weixin.qq.com/?from=openApi",
"title":"企业微信官网"
},
{
"type":2,
"appid":"APPID",
"pagepath":"PAGEPATH",
"title":"跳转小程序"
}*/
private ArrayList<Jump> jump_list;
/** 0 = 未购买 1 = 已购买 "type":1,
"url":"https://work.weixin.qq.com/?from=openApi",
"appid":"APPID",
"pagepath":"PAGEPATH"*/
private CardAction card_action;
}

5
zsw-bxg/src/main/java/co/yixiang/modules/inform/service/SendMsgService.java

@ -0,0 +1,5 @@
package co.yixiang.modules.inform.service;
public interface SendMsgService {
String inform(long orderId);
}

85
zsw-bxg/src/main/java/co/yixiang/modules/inform/service/impl/SendMsgServiceImpl.java

@ -0,0 +1,85 @@
package co.yixiang.modules.inform.service.impl;
import cn.hutool.json.JSONUtil;
import co.yixiang.modules.inform.domin.*;
import co.yixiang.modules.inform.service.SendMsgService;
import co.yixiang.modules.order.service.YxStoreOrderService;
import co.yixiang.modules.order.service.dto.YxStoreOrderDto;
import com.alibaba.fastjson.JSONObject;
import lombok.SneakyThrows;
import org.apache.http.HttpStatus;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
@Service
public class SendMsgServiceImpl implements SendMsgService {
@Autowired
private YxStoreOrderService yxStoreOrderService;
@Autowired
private TemplateCard templateCard;
@SneakyThrows
@Override
public String inform(long orderId) {
CloseableHttpClient httpClient = HttpClients.createDefault();//实例化对象
String webhook_url="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=a2f0f8c9-e406-4f6b-86e4-d6ac9e4df88e";
HttpPost httpPost=new HttpPost(webhook_url);
httpPost.addHeader("Content-Type", "application/json; charset=utf-8");
TemplateCard templateCard=this.creatTemplatecard(orderId);
Map<String, Object> param = new HashMap<>();
param.put("msgtype", "template_card");
param.put("template_card", JSONObject.parseObject(JSONUtil.toJsonStr(templateCard)));
String jsonParam = JSONObject.toJSONString(param);
StringEntity stringEntity=new StringEntity(jsonParam, "utf-8");
httpPost.setEntity(stringEntity);
CloseableHttpResponse response=httpClient.execute(httpPost);
// 发送成功接收返回值
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
String result = EntityUtils.toString(response.getEntity(), "utf-8");
System.out.println("发送微信机器人消息成功 " + result);
return result;
} else {
System.out.println("发送微信机器人消息失败");
}
// 关闭
httpClient.close();
response.close();
return "发送微信机器人消息失败";
}
public TemplateCard creatTemplatecard(long orderId){
YxStoreOrderDto yxStoreOrderDto=yxStoreOrderService.getOrderDetailByOrderId(orderId);
templateCard.setCard_type("text_notice");
templateCard.setSource(new Souce().setDesc("眼界甄选").setIcon_url("https://wework.qpic.cn/wwpic/252813_jOfDHtcISzuodLa_1629280209/0").setDesc_color(0));
templateCard.setMain_title(new MainTitle().setTitle("有新的在线订单来啦").setDesc("订单号:"+orderId));
templateCard.setEmphasis_content(new EmphasisContent().setTitle(yxStoreOrderDto.getPayPrice().toString()).setDesc("订单总金额"));
// templateCard.setQuote_area(new QuoteArea().setType(0).setUrl("").setAppid("APPID").setTitle("订单详情").setQuote_text("眼镜*1 0.01"));
templateCard.setSub_title_text("订单类型:"+yxStoreOrderDto.getPinkName());//订单类型
ArrayList<HorizontalContent> arrayList=new ArrayList<>();
arrayList.add(new HorizontalContent().setKeyname("下单地址").setValue(yxStoreOrderDto.getUserAddress()));
arrayList.add(new HorizontalContent().setKeyname("下单时间").setValue(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(yxStoreOrderDto.getCreateTime())));
arrayList.add(new HorizontalContent().setKeyname("会员名称").setValue(yxStoreOrderDto.getRealName()));
arrayList.add(new HorizontalContent().setKeyname("会员手机号").setValue(yxStoreOrderDto.getUserPhone()));
templateCard.setHorizontal_content_list(arrayList);
ArrayList<Jump> arrayList1=new ArrayList<>();
arrayList1.add(new Jump().setType(1).setUrl("https://work.weixin.qq.com/?from=openApi").setTitle("前去处理订单"));
templateCard.setJump_list(arrayList1);
templateCard.setCard_action(new CardAction().setType(1).setUrl("https://work.weixin.qq.com/?from=openApi"));
return templateCard;
}
}

3
zsw-bxg/src/main/java/co/yixiang/modules/order/service/YxStoreOrderService.java

@ -299,4 +299,7 @@ public interface YxStoreOrderService extends BaseService<YxStoreOrder>{
void retrunStock(String orderId);
YxStoreOrderDto getOrderDetailByOrderId(Long orderId);
}

24
zsw-bxg/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderServiceImpl.java

@ -121,7 +121,6 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
@Autowired
private IGenerator generator;
@Autowired
private YxStorePinkService storePinkService;
@Autowired
@ -171,7 +170,6 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
@Autowired
private YxUserLevelService userLevelService;
@Autowired
private StoreOrderMapper yxStoreOrderMapper;
@Autowired
@ -191,6 +189,8 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
@Autowired
private StoreAfterSalesService storeAfterSalesService;
@Autowired
private YxStoreOrderService yxStoreOrderService;
/**
* 返回订单确认数据
@ -2379,18 +2379,32 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
FileUtil.downloadExcel(list, response);
}
/**
* 获取订单详情
*
* @param orderId
* @return
*/
@Override
public YxStoreOrderDto getOrderDetail(Long orderId) {
// YxStoreOrder yxStoreOrder = this.getById(orderId);
public YxStoreOrderDto getOrderDetailByOrderId(Long orderId) {
LambdaQueryWrapper<YxStoreOrder> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(YxStoreOrder::getOrderId, orderId);
YxStoreOrder yxStoreOrder=yxStoreOrderMapper.selectOne(wrapper);
return this.getOrderDetail(yxStoreOrder.getId());
};
/**
* 获取订单详情
*
* @param id
* @return
*/
@Override
public YxStoreOrderDto getOrderDetail(Long id) {
YxStoreOrder yxStoreOrder = this.getById(id);
if (ObjectUtil.isEmpty(yxStoreOrder)) {
throw new BadRequestException("订单详情不存在");
}

4
zsw-bxg/src/main/java/co/yixiang/modules/order/service/mapper/StoreOrderMapper.java

@ -49,6 +49,10 @@ public interface StoreOrderMapper extends CoreMapper<YxStoreOrder> {
double sumPrice(@Param("uid") Long uid);
// @Select("select * from yx_store_order " +
// "where orderId=#{orderId}")
// YxStoreOrder SelectOne(@Param("orderId") Long orderId);
@Select("SELECT COUNT(*) FROM yx_store_order WHERE pay_time >= ${today}")
Integer countByPayTimeGreaterThanEqual(@Param("today")int today);

Loading…
Cancel
Save