Browse Source

修复优惠券部分

zyj
sj 2 years ago
parent
commit
ddb28dc5c8
  1. 5
      zsw-bxg/pom.xml
  2. 55
      zsw-bxg/src/main/java/co/yixiang/app/modules/coupon/rest/CouponController.java
  3. 45
      zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/AppUploadController.java
  4. 4
      zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/LetterAppUserController.java
  5. 4
      zsw-bxg/src/main/java/co/yixiang/constant/SystemConfigConstants.java
  6. 8
      zsw-bxg/src/main/java/co/yixiang/modules/activity/domain/YxStoreCoupon.java
  7. 9
      zsw-bxg/src/main/java/co/yixiang/modules/activity/domain/YxStoreCouponUser.java
  8. 13
      zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponUserServiceImpl.java
  9. 16
      zsw-bxg/src/main/java/co/yixiang/modules/activity/vo/YxStoreCouponUserQueryVo.java
  10. 4
      zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/impl/YxEvaluationServiceImpl.java
  11. 3
      zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/mapper/YxEvaluationRelationMapper.java
  12. 9
      zsw-bxg/src/main/java/co/yixiang/modules/evaluation/vo/YxStoreEvaluationRelationQueryVo.java
  13. 12
      zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/CardAction.java
  14. 6
      zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/Jump.java
  15. 2
      zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/TemplateCard.java
  16. 36
      zsw-bxg/src/main/java/co/yixiang/modules/inform/service/impl/SendMsgServiceImpl.java
  17. 5
      zsw-bxg/src/main/java/co/yixiang/modules/order/domain/YxStoreOrder.java
  18. 6
      zsw-bxg/src/main/java/co/yixiang/modules/order/service/dto/YxStoreOrderDto.java
  19. 14
      zsw-bxg/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderServiceImpl.java
  20. 10
      zsw-bxg/src/main/java/co/yixiang/modules/sales/param/StoreAfterSalesParam.java
  21. 9
      zsw-bxg/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesServiceImpl.java
  22. 5
      zsw-bxg/src/main/java/co/yixiang/modules/store/domain/YxStoreBrand.java
  23. 6
      zsw-bxg/src/main/java/co/yixiang/modules/store/service/dto/YxStoreBrandDto.java
  24. 2
      zsw-bxg/src/main/java/co/yixiang/modules/store/service/impl/YxStoreBrandServiceImpl.java
  25. 8
      zsw-bxg/src/main/java/co/yixiang/utils/BrandDTO.java

5
zsw-bxg/pom.xml

@ -169,6 +169,11 @@
<artifactId>httpclient</artifactId> <artifactId>httpclient</artifactId>
<version>4.5.12</version> <version>4.5.12</version>
</dependency> </dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.14.2</version>
</dependency>
</dependencies> </dependencies>

55
zsw-bxg/src/main/java/co/yixiang/app/modules/coupon/rest/CouponController.java

@ -36,6 +36,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -57,7 +58,7 @@ public class CouponController {
private final YxStoreCouponUserService storeCouponUserService; private final YxStoreCouponUserService storeCouponUserService;
/** /**
* 可领取优惠券列表 * 领券中心优惠券列表
*/ */
@AuthCheck @AuthCheck
@GetMapping("/coupons") @GetMapping("/coupons")
@ -67,7 +68,7 @@ public class CouponController {
@ApiImplicitParam(name = "productId", value = "产品ID", paramType = "query", dataType = "int",dataTypeClass = Integer.class), @ApiImplicitParam(name = "productId", value = "产品ID", paramType = "query", dataType = "int",dataTypeClass = Integer.class),
@ApiImplicitParam(name = "type", value = "优惠券类型 0通用券 1商品券 2内部券", paramType = "query", dataType = "int",dataTypeClass = Integer.class) @ApiImplicitParam(name = "type", value = "优惠券类型 0通用券 1商品券 2内部券", paramType = "query", dataType = "int",dataTypeClass = Integer.class)
}) })
@ApiOperation(value = "可领取优惠券列表",notes = "可领取优惠券列表") @ApiOperation(value = "领券中心优惠券列表",notes = "领券中心优惠券列表")
public ApiResult<List<YxStoreCouponIssueQueryVo>> getList(@RequestParam(value = "page",defaultValue = "1") int page, public ApiResult<List<YxStoreCouponIssueQueryVo>> getList(@RequestParam(value = "page",defaultValue = "1") int page,
@RequestParam(value = "limit",defaultValue = "10") int limit, @RequestParam(value = "limit",defaultValue = "10") int limit,
@RequestParam(value = "productId",required = false) Long productId, @RequestParam(value = "productId",required = false) Long productId,
@ -76,6 +77,9 @@ public class CouponController {
return ApiResult.ok(couponIssueService.getCouponList(page, limit,uid,productId,type)); return ApiResult.ok(couponIssueService.getCouponList(page, limit,uid,productId,type));
} }
/** /**
* 领取优惠券 * 领取优惠券
*/ */
@ -107,6 +111,53 @@ public class CouponController {
return ApiResult.ok(list); return ApiResult.ok(list);
} }
/**
* 用户已失效优惠券
*/
@AppLog(value = "查看用户已失效优惠券", type = 1)
@AuthCheck
@GetMapping("/coupons/userFailure/{type}")
@ApiOperation(value = "用户已失效优惠券",notes = "用户已失效优惠券")
public ApiResult<List<YxStoreCouponUserQueryVo>> getUserFailureList(){
Long uid = LocalUser.getUser().getUid();
List<YxStoreCouponUserQueryVo> list = storeCouponUserService.getUserCoupon(uid);
List<YxStoreCouponUserQueryVo> list1 = new ArrayList<>();
for (YxStoreCouponUserQueryVo couponUser : list) {
if (couponUser.getIsFail() == 1){//已失效
list1.add(couponUser);
}
}
return ApiResult.ok(list1);
}
/**
* 用户可领取优惠券列表
*/
@AuthCheck
@GetMapping("/coupons/canReceive")
@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 = "productId", value = "产品ID", paramType = "query", dataType = "int",dataTypeClass = Integer.class),
@ApiImplicitParam(name = "type", value = "优惠券类型 0通用券 1商品券 2内部券", paramType = "query", dataType = "int",dataTypeClass = Integer.class)
})
@ApiOperation(value = "用户可领取优惠券列表",notes = "用户可领取优惠券列表")
public ApiResult<List<YxStoreCouponIssueQueryVo>> canReceive(@RequestParam(value = "page",defaultValue = "1") int page,
@RequestParam(value = "limit",defaultValue = "10") int limit,
@RequestParam(value = "productId",required = false) Long productId,
@RequestParam(value = "type",required = false) Integer type){
Long uid = LocalUser.getUser().getUid();
List<YxStoreCouponIssueQueryVo> list=couponIssueService.getCouponList(page, limit,uid,productId,type);
List<YxStoreCouponIssueQueryVo> list1 = new ArrayList<>();
for (YxStoreCouponIssueQueryVo couponIssue : list) {
if(!couponIssue.getIsUse()){
list1.add(couponIssue);
}
}
return ApiResult.ok(list1);
}
/** /**
* 用户已领取优惠券pc * 用户已领取优惠券pc
*/ */

45
zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/AppUploadController.java

@ -0,0 +1,45 @@
package co.yixiang.app.modules.user.rest;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import co.yixiang.modules.shop.service.YxSystemConfigService;
import co.yixiang.tools.domain.QiniuContent;
import co.yixiang.tools.service.QiNiuService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
@RestController
@RequestMapping("/api/upload")
public class AppUploadController {
@Autowired
private YxSystemConfigService systemConfigService;
@Autowired
private QiNiuService qiNiuService;
@ApiOperation("上传文件")
@PostMapping
public ApiResult<?> create(@RequestParam(defaultValue = "") String name,
@RequestParam(defaultValue = "") String type,
@RequestParam("file") MultipartFile[] files) {
StringBuilder url = new StringBuilder();
for (MultipartFile file : files) {
QiniuContent qiniuContent = qiNiuService.upload(file, qiNiuService.find());
if ("".equals(url.toString())) {
url = url.append(qiniuContent.getUrl());
System.out.println("".equals(url.toString()));
}else{
url = url.append(",").append(qiniuContent.getUrl());
}
}
return ApiResult.ok(url);
}
}

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

@ -184,7 +184,9 @@ public class LetterAppUserController {
@RequestParam(value = "limit",defaultValue = "10") int limit, @RequestParam(value = "limit",defaultValue = "10") int limit,
@RequestParam(value = "type") String type){ @RequestParam(value = "type") String type){
Long uid = LocalUser.getUser().getUid(); Long uid = LocalUser.getUser().getUid();
return ApiResult.ok(evaluationRelationService.userCollectEvaluation(page,limit,uid,type)); List list=evaluationRelationService.userCollectEvaluation(page,limit,uid,type);
// return ApiResult.ok(evaluationRelationService.userCollectEvaluation(page,limit,uid,type));
return ApiResult.ok(list);
} }
/** /**
* 用户资金统计 * 用户资金统计

4
zsw-bxg/src/main/java/co/yixiang/constant/SystemConfigConstants.java

@ -1,7 +1,11 @@
package co.yixiang.constant; package co.yixiang.constant;
public class SystemConfigConstants { public class SystemConfigConstants {
//机器人链接地址
public final static String ROBOT_URL="robotUrl"; public final static String ROBOT_URL="robotUrl";
//机器人消息跳转网址
public final static String CARD_ACTION_URL="cardActionUrl";
//地址配置 //地址配置
public final static String API="api"; public final static String API="api";
public final static String API_URL="api_url"; public final static String API_URL="api_url";

8
zsw-bxg/src/main/java/co/yixiang/modules/activity/domain/YxStoreCoupon.java

@ -72,14 +72,14 @@ public class YxStoreCoupon extends BaseDomain {
// @ApiModelProperty(value = "优惠券有效期限(单位:天;几号到几号)") // @ApiModelProperty(value = "优惠券有效期限(单位:天;几号到几号)")
// private Object useTime; // private Object useTime;
/** 优惠券开始使用期限(单位:天) */ /** 优惠券开始使用时间 */
@NotNull(message = "请输入开始期限") @NotNull(message = "请输入开始期限")
@ApiModelProperty(value = "优惠券使用期限(单位:天)") @ApiModelProperty(value = "优惠券开始使用时间")
private String useStartTime; private String useStartTime;
/** 优惠券结束使用期限(单位:天) */ /** 优惠券结束使用时间 */
@NotNull(message = "请输入有效结束期限") @NotNull(message = "请输入有效结束期限")
@ApiModelProperty(value = "优惠券失效期限(单位:天)") @ApiModelProperty(value = "优惠券结束使用时间")
private String useEndTime; private String useEndTime;
/** 排序 */ /** 排序 */

9
zsw-bxg/src/main/java/co/yixiang/modules/activity/domain/YxStoreCouponUser.java

@ -63,10 +63,13 @@ public class YxStoreCouponUser extends BaseDomain {
private BigDecimal useMinPrice; private BigDecimal useMinPrice;
/** 优惠券结束时间 */ /** 优惠券有效期结束时间 */
@ApiModelProperty(value = "优惠券结束时间") @ApiModelProperty(value = "优惠券有效期结束时间")
private Date endTime; private Date useEndTime;
/** 优惠券有效期开始时间 */
@ApiModelProperty(value = "优惠券有效期开始时间")
private Date useStartTime;
// /** 使用时间 */ // /** 使用时间 */
// @ApiModelProperty(value = "使用时间") // @ApiModelProperty(value = "使用时间")

13
zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponUserServiceImpl.java

@ -194,7 +194,7 @@ public class YxStoreCouponUserServiceImpl extends BaseServiceImpl<YxStoreCouponU
}else if (couponUser.getStatus() == 2){ }else if (couponUser.getStatus() == 2){
queryVo.set_type(CouponEnum.USE_0.getValue()); queryVo.set_type(CouponEnum.USE_0.getValue());
queryVo.set_msg("已过期"); queryVo.set_msg("已过期");
}else if(couponUser.getCreateTime().getTime() > nowTime || couponUser.getEndTime().getTime() < nowTime){ }else if(couponUser.getCreateTime().getTime() > nowTime || couponUser.getUseEndTime().getTime() < nowTime){
queryVo.set_type(CouponEnum.USE_0.getValue()); queryVo.set_type(CouponEnum.USE_0.getValue());
queryVo.set_msg("已过期"); queryVo.set_msg("已过期");
}else{ }else{
@ -222,16 +222,15 @@ public class YxStoreCouponUserServiceImpl extends BaseServiceImpl<YxStoreCouponU
// Date now = new Date(); // Date now = new Date();
// Date endTime = DateUtil.offsetDay(now,storeCoupon.getCouponTime()); // Date endTime = DateUtil.offsetDay(now,storeCoupon.getCouponTime());
// //有效期改为时间段,不需要偏移,切割开始日期和截止日期 DateTime endTime =new DateTime(storeCoupon.getUseEndTime());
// DateTime endTime = new DateTime(time[1]);
DateTime endTime =new DateTime(storeCoupon.getUseEndTime().toString());
YxStoreCouponUser storeCouponUser = YxStoreCouponUser.builder() YxStoreCouponUser storeCouponUser = YxStoreCouponUser.builder()
.cid(storeCoupon.getId()) .cid(storeCoupon.getId())
.uid(uid) .uid(uid)
.couponPrice(storeCoupon.getCouponPrice()) .couponPrice(storeCoupon.getCouponPrice())
.couponTitle(storeCoupon.getTitle()) .couponTitle(storeCoupon.getTitle())
.useMinPrice(storeCoupon.getUseMinPrice()) .useMinPrice(storeCoupon.getUseMinPrice())
.endTime(endTime) .useStartTime(new Date(storeCoupon.getUseStartTime()))
.useEndTime(new Date(storeCoupon.getUseEndTime()))
.type(CouponGetEnum.GET.getValue()) .type(CouponGetEnum.GET.getValue())
.build(); .build();
@ -270,7 +269,7 @@ public class YxStoreCouponUserServiceImpl extends BaseServiceImpl<YxStoreCouponU
private void checkInvalidCoupon() { private void checkInvalidCoupon() {
Date nowTime = new Date(); Date nowTime = new Date();
LambdaQueryWrapper<YxStoreCouponUser> wrapper= new LambdaQueryWrapper<>(); LambdaQueryWrapper<YxStoreCouponUser> wrapper= new LambdaQueryWrapper<>();
wrapper.lt(YxStoreCouponUser::getEndTime,nowTime) wrapper.lt(YxStoreCouponUser::getUseEndTime,nowTime)
.eq(YxStoreCouponUser::getStatus,CouponEnum.STATUS_0.getValue()); .eq(YxStoreCouponUser::getStatus,CouponEnum.STATUS_0.getValue());
YxStoreCouponUser couponUser = new YxStoreCouponUser(); YxStoreCouponUser couponUser = new YxStoreCouponUser();
couponUser.setStatus(CouponEnum.STATUS_2.getValue()); couponUser.setStatus(CouponEnum.STATUS_2.getValue());
@ -344,7 +343,7 @@ public class YxStoreCouponUserServiceImpl extends BaseServiceImpl<YxStoreCouponU
}else if (couponUser.getStatus() == 2){ }else if (couponUser.getStatus() == 2){
queryVo.set_type(CouponEnum.USE_0.getValue()); queryVo.set_type(CouponEnum.USE_0.getValue());
queryVo.set_msg("已过期"); queryVo.set_msg("已过期");
}else if(couponUser.getCreateTime().getTime() > nowTime || couponUser.getEndTime().getTime() < nowTime){ }else if(couponUser.getCreateTime().getTime() > nowTime || couponUser.getUseEndTime().getTime() < nowTime){
queryVo.set_type(CouponEnum.USE_0.getValue()); queryVo.set_type(CouponEnum.USE_0.getValue());
queryVo.set_msg("已过期"); queryVo.set_msg("已过期");
}else{ }else{

16
zsw-bxg/src/main/java/co/yixiang/modules/activity/vo/YxStoreCouponUserQueryVo.java

@ -44,12 +44,20 @@ public class YxStoreCouponUserQueryVo implements Serializable {
@ApiModelProperty(value = "优惠券创建时间") @ApiModelProperty(value = "优惠券创建时间")
private Date createTime; private Date createTime;
@ApiModelProperty(value = "优惠券结束时间") @ApiModelProperty(value = "优惠券有效期开始时间")
@JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8") @JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8")
private Date endTime; private Date useStartTime;
@ApiModelProperty(value = "使用时间") // @ApiModelProperty(value = "优惠券结束时间")
private Date useTime; // @JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8")
// private Date endTime;
@ApiModelProperty(value = "优惠券有效期结束时间")
@JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8")
private Date useEndTime;
// @ApiModelProperty(value = "使用时间")
// private Date useTime;
@ApiModelProperty(value = "获取方式") @ApiModelProperty(value = "获取方式")
private String type; private String type;

4
zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/impl/YxEvaluationServiceImpl.java

@ -55,8 +55,8 @@ import java.util.*;
* @date 2022-10-21 * @date 2022-10-21
*/ */
@Service @Service
//@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) //@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class YxEvaluationServiceImpl extends BaseServiceImpl<YxEvaluationMapper, YxEvaluation> implements YxEvaluationService { public class YxEvaluationServiceImpl extends BaseServiceImpl<YxEvaluationMapper, YxEvaluation> implements YxEvaluationService {
@Autowired @Autowired

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

@ -23,7 +23,8 @@ import java.util.List;
public interface YxEvaluationRelationMapper extends CoreMapper<YxStoreEvaluationRelation> { public interface YxEvaluationRelationMapper extends CoreMapper<YxStoreEvaluationRelation> {
@Select("select B.id,B.home_image as homeImage" + @Select("select B.id evaluation_id,B.home_image as homeImage,A.id id," +
"B.is_show as isShow"+
" from yx_store_evaluation_relation A left join yx_evaluation B " + " from yx_store_evaluation_relation A left join yx_evaluation B " +
"on A.evaluation_id = B.id where A.uid=#{uid} and A.is_del = 0 and B.is_del = 0 order by A.create_time desc") "on A.evaluation_id = B.id where 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); List<YxStoreEvaluationRelationQueryVo> selectRelationList(Page page, @Param("uid") Long uid);

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

@ -1,9 +1,12 @@
package co.yixiang.modules.evaluation.vo; package co.yixiang.modules.evaluation.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date; import java.util.Date;
@Data
@ApiModel(value = "YxStoreEvaluationRelationQueryVo对象", description = "评测收藏表查询参数")
public class YxStoreEvaluationRelationQueryVo { public class YxStoreEvaluationRelationQueryVo {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -13,8 +16,8 @@ public class YxStoreEvaluationRelationQueryVo {
@ApiModelProperty(value = "用户ID") @ApiModelProperty(value = "用户ID")
private Long uid; private Long uid;
@ApiModelProperty(value = "商品ID") @ApiModelProperty(value = "评测ID")
private Long productId; private Long evaluationId;
@ApiModelProperty(value = "类型(收藏(collect") @ApiModelProperty(value = "类型(收藏(collect")
private String type; private String type;

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

@ -2,11 +2,23 @@ package co.yixiang.modules.inform.domin;
import lombok.Data; import lombok.Data;
/****整体卡片的点击跳转事件text_notice模版卡片中该字段为必填项
* 卡片跳转类型1 代表跳转url2 代表打开小程序text_notice模版卡片中该字段取值范围为[1,2]
*/
@Data @Data
public class CardAction { public class CardAction {
/**代表跳转url,2 代表打开小程序*/
private Integer type; private Integer type;
/**跳转事件的url,card_action.type是1时必填*/
private String url; private String url;
/**跳转事件的小程序的appid,card_action.type是2时必填*/
private String appid; private String appid;
/**跳转事件的小程序的pagepath,card_action.type是2时选填*/
private String pagepath; private String pagepath;
} }

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

@ -16,10 +16,16 @@ import lombok.Data;
}*/ }*/
@Data @Data
public class Jump { public class Jump {
/***0或不填代表不是链接1 代表跳转url2 代表跳转小程序
*/
private Integer type; private Integer type;
private String appid; private String appid;
private String url; private String url;
private String title; private String title;
private String pagepath; private String pagepath;

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

@ -9,8 +9,6 @@ import java.util.ArrayList;
@Service @Service
public class TemplateCard { public class TemplateCard {
// /**消息类型*/
// private String msgtype ;
/** 模板卡片的模板类型*/ /** 模板卡片的模板类型*/
private String card_type; private String card_type;

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

@ -18,14 +18,18 @@ import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
import org.jsoup.nodes.Element;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Node;
import org.jsoup.nodes.TextNode;
@Service @Service
public class SendMsgServiceImpl implements SendMsgService { public class SendMsgServiceImpl implements SendMsgService {
@ -75,27 +79,41 @@ public class SendMsgServiceImpl implements SendMsgService {
public TemplateCard creatTemplatecard(long orderId,int type){ public TemplateCard creatTemplatecard(long orderId,int type){
YxStoreOrderDto yxStoreOrderDto=yxStoreOrderService.getOrderDetailByOrderId(orderId); YxStoreOrderDto yxStoreOrderDto=yxStoreOrderService.getOrderDetailByOrderId(orderId);
String mainTitle; String mainTitle;
ArrayList<HorizontalContent> arrayList=new ArrayList<>();
arrayList.add(new HorizontalContent().setKeyname("会员名称").setValue(yxStoreOrderDto.getRealName()));
arrayList.add(new HorizontalContent().setKeyname("会员手机号").setValue(yxStoreOrderDto.getUserPhone()));
if (type==0){//支付时候 if (type==0){//支付时候
mainTitle="有新的在线订单来啦"; mainTitle="有新的在线订单来啦";
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())));
}else { }else {
mainTitle="有新的退款申请"; mainTitle="有新的退款申请";
//获取Document模型
Document docDesc = Jsoup.parse(yxStoreOrderDto.getStatusName());
//获取span节点
ArrayList<Element> list=docDesc.getElementsByTag("span");
//获取文本内容,并且截取只需要标题后面的
arrayList.add(new HorizontalContent().setKeyname("退款原因").setValue(list.get(0).text().substring(5)));
arrayList.add(new HorizontalContent().setKeyname("备注说明").setValue(list.get(1).text().substring(5).length()==0?list.get(1).text().substring(5):"本次退款无备注"));
arrayList.add(new HorizontalContent().setKeyname("申请时间").setValue(list.get(2).text().substring(5)));
} }
templateCard.setHorizontal_content_list(arrayList);
templateCard.setCard_type("text_notice"); 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.setSource(new Souce().setDesc("眼界甄选").setIcon_url("https://wework.qpic.cn/wwpic/252813_jOfDHtcISzuodLa_1629280209/0").setDesc_color(0));
templateCard.setMain_title(new MainTitle().setTitle(mainTitle).setDesc("订单号:"+orderId)); templateCard.setMain_title(new MainTitle().setTitle(mainTitle).setDesc("订单号:"+orderId));
templateCard.setEmphasis_content(new EmphasisContent().setTitle(yxStoreOrderDto.getPayPrice().toString()).setDesc("订单总金额")); 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.setQuote_area(new QuoteArea().setType(0).setUrl("").setAppid("APPID").setTitle("订单详情").setQuote_text("眼镜*1 0.01"));
templateCard.setSub_title_text("订单类型:"+yxStoreOrderDto.getPinkName());//订单类型 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<>(); ArrayList<Jump> arrayList1=new ArrayList<>();
arrayList1.add(new Jump().setType(1).setUrl("https://work.weixin.qq.com/?from=openApi").setTitle("前去处理订单")); //机器人消息跳转地址
String cardActionUrl = systemConfigService.getData(SystemConfigConstants.CARD_ACTION_URL);
if(StrUtil.isBlank(cardActionUrl)){
// throw new YshopException("未配置企业微信群机器人跳转地址");
cardActionUrl="未配置跳转网址";
}
arrayList1.add(new Jump().setType(1).setUrl(cardActionUrl).setTitle("前去处理订单"));
templateCard.setJump_list(arrayList1); templateCard.setJump_list(arrayList1);
templateCard.setCard_action(new CardAction().setType(1).setUrl("https://work.weixin.qq.com/?from=openApi")); templateCard.setCard_action(new CardAction().setType(1).setUrl(cardActionUrl));
return templateCard; return templateCard;
} }

5
zsw-bxg/src/main/java/co/yixiang/modules/order/domain/YxStoreOrder.java

@ -133,6 +133,11 @@ public class YxStoreOrder extends BaseDomain {
/** 退款时间 */ /** 退款时间 */
private Date refundReasonTime; private Date refundReasonTime;
/** 退款联系人 */
private String refundName;
/** 退款联系电话 */
private String refundPhone;
/** 前台退款原因 */ /** 前台退款原因 */
private String refundReasonWap; private String refundReasonWap;

6
zsw-bxg/src/main/java/co/yixiang/modules/order/service/dto/YxStoreOrderDto.java

@ -112,6 +112,12 @@ public class YxStoreOrderDto implements Serializable {
// 退款用户说明 // 退款用户说明
private String refundReasonWapExplain; private String refundReasonWapExplain;
/** 退款联系人 */
private String refundName;
/** 退款联系电话 */
private String refundPhone;
// 退款时间 // 退款时间
private Date refundReasonTime; private Date refundReasonTime;

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

@ -75,6 +75,7 @@ import co.yixiang.modules.user.service.YxUserBillService;
import co.yixiang.modules.user.service.YxUserLevelService; import co.yixiang.modules.user.service.YxUserLevelService;
import co.yixiang.modules.user.service.YxUserService; import co.yixiang.modules.user.service.YxUserService;
import co.yixiang.modules.user.service.dto.YxUserDto; import co.yixiang.modules.user.service.dto.YxUserDto;
import co.yixiang.modules.user.service.mapper.BxgUserMapper;
import co.yixiang.modules.user.vo.YxUserQueryVo; import co.yixiang.modules.user.vo.YxUserQueryVo;
import co.yixiang.tools.domain.AlipayConfig; import co.yixiang.tools.domain.AlipayConfig;
import co.yixiang.tools.domain.vo.TradeVo; import co.yixiang.tools.domain.vo.TradeVo;
@ -122,6 +123,8 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
@Autowired @Autowired
private IGenerator generator; private IGenerator generator;
@Autowired
private StoreOrderMapper storeOrderMapper;
@Autowired @Autowired
private YxStorePinkService storePinkService; private YxStorePinkService storePinkService;
@Autowired @Autowired
@ -130,6 +133,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
private YxStoreCartService storeCartService; private YxStoreCartService storeCartService;
@Autowired @Autowired
private YxUserAddressService userAddressService; private YxUserAddressService userAddressService;
@Autowired
private BxgUserMapper bxgUserMapper;
@Autowired @Autowired
private YxStoreOrderCartInfoService orderCartInfoService; private YxStoreOrderCartInfoService orderCartInfoService;
@Autowired @Autowired
@ -1082,7 +1088,6 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
throw new YshopException("订单当前无法退款"); throw new YshopException("订单当前无法退款");
} }
YxStoreOrder storeOrder = new YxStoreOrder(); YxStoreOrder storeOrder = new YxStoreOrder();
storeOrder.setRefundStatus(OrderInfoEnum.REFUND_STATUS_1.getValue()); storeOrder.setRefundStatus(OrderInfoEnum.REFUND_STATUS_1.getValue());
storeOrder.setRefundReasonTime(new Date()); storeOrder.setRefundReasonTime(new Date());
@ -1096,8 +1101,6 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
orderStatusService.create(order.getId(), orderStatusService.create(order.getId(),
OrderLogEnum.REFUND_ORDER_APPLY.getValue(), OrderLogEnum.REFUND_ORDER_APPLY.getValue(),
"用户申请退款,原因:" + text); "用户申请退款,原因:" + text);
//申请退款企业微信
sendMsgService.inform(Long.valueOf(orderId),1);
//模板消息发布事件 //模板消息发布事件
TemplateBean templateBean = TemplateBean.builder() TemplateBean templateBean = TemplateBean.builder()
.orderId(order.getOrderId()) .orderId(order.getOrderId())
@ -1536,6 +1539,11 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
//增加用户购买次数 //增加用户购买次数
userService.incPayCount(orderInfo.getUid()); userService.incPayCount(orderInfo.getUid());
//用户累计消费
double sumPrice=storeOrderMapper.sumPrice(orderInfo.getUid());
//修改用户当前成长值
bxgUserMapper.selectById(orderInfo.getUid()).setGrowth((int) Math.round(sumPrice));
//增加状态 //增加状态
orderStatusService.create(orderInfo.getId(), OrderLogEnum.PAY_ORDER_SUCCESS.getValue(), orderStatusService.create(orderInfo.getId(), OrderLogEnum.PAY_ORDER_SUCCESS.getValue(),
OrderLogEnum.PAY_ORDER_SUCCESS.getDesc()); OrderLogEnum.PAY_ORDER_SUCCESS.getDesc());

10
zsw-bxg/src/main/java/co/yixiang/modules/sales/param/StoreAfterSalesParam.java

@ -34,6 +34,16 @@ public class StoreAfterSalesParam {
*/ */
private String applicationInstructions; private String applicationInstructions;
/**
* 申请退款联系人
*/
private String applicationName;
/**
* 申请申请退款联系电话
*/
private String applicationPhone;
/** /**
* 申请说明图片 * 申请说明图片
*/ */

9
zsw-bxg/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesServiceImpl.java

@ -10,6 +10,7 @@ import co.yixiang.enums.OrderInfoEnum;
import co.yixiang.enums.ShopCommonEnum; import co.yixiang.enums.ShopCommonEnum;
import co.yixiang.exception.ErrorRequestException; import co.yixiang.exception.ErrorRequestException;
import co.yixiang.modules.cart.vo.YxStoreCartQueryVo; import co.yixiang.modules.cart.vo.YxStoreCartQueryVo;
import co.yixiang.modules.inform.service.SendMsgService;
import co.yixiang.modules.order.domain.YxStoreOrder; import co.yixiang.modules.order.domain.YxStoreOrder;
import co.yixiang.modules.order.domain.YxStoreOrderCartInfo; import co.yixiang.modules.order.domain.YxStoreOrderCartInfo;
import co.yixiang.modules.order.service.mapper.StoreOrderCartInfoMapper; import co.yixiang.modules.order.service.mapper.StoreOrderCartInfoMapper;
@ -37,6 +38,7 @@ import lombok.AllArgsConstructor;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
@ -64,6 +66,8 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
private final StoreAfterSalesStatusMapper storeAfterSalesStatusMapper; private final StoreAfterSalesStatusMapper storeAfterSalesStatusMapper;
private final IGenerator generator; private final IGenerator generator;
@Autowired
private SendMsgService sendMsgService;
@Override @Override
public void applyForAfterSales(Long userId, String nickname, StoreAfterSalesParam storeAfterSalesParam) { public void applyForAfterSales(Long userId, String nickname, StoreAfterSalesParam storeAfterSalesParam) {
@ -94,6 +98,8 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
yxStoreOrder.setRefundStatus(OrderInfoEnum.REFUND_STATUS_1.getValue()); yxStoreOrder.setRefundStatus(OrderInfoEnum.REFUND_STATUS_1.getValue());
yxStoreOrder.setRefundReasonWap(storeAfterSalesParam.getReasonForApplication()); yxStoreOrder.setRefundReasonWap(storeAfterSalesParam.getReasonForApplication());
yxStoreOrder.setRefundReasonWapExplain(storeAfterSalesParam.getApplicationInstructions()); yxStoreOrder.setRefundReasonWapExplain(storeAfterSalesParam.getApplicationInstructions());
yxStoreOrder.setRefundName(storeAfterSalesParam.getApplicationName());
yxStoreOrder.setRefundPhone(storeAfterSalesParam.getApplicationPhone());
yxStoreOrder.setRefundReasonTime(new Date()); yxStoreOrder.setRefundReasonTime(new Date());
storeOrderMapper.updateById(yxStoreOrder); storeOrderMapper.updateById(yxStoreOrder);
//生成售后订单 //生成售后订单
@ -121,6 +127,8 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
storeAfterSalesItemMapper.insert(storeAfterSalesItem); storeAfterSalesItemMapper.insert(storeAfterSalesItem);
} }
//申请退款企业微信
sendMsgService.inform(Long.valueOf(yxStoreOrder.getOrderId()),1);
//操作记录 //操作记录
StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus(); StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus();
storeAfterSalesStatus.setStoreAfterSalesId(storeAfterSales.getId()); storeAfterSalesStatus.setStoreAfterSalesId(storeAfterSales.getId());
@ -129,7 +137,6 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
storeAfterSalesStatus.setChangeTime(Timestamp.valueOf(LocalDateTime.now())); storeAfterSalesStatus.setChangeTime(Timestamp.valueOf(LocalDateTime.now()));
storeAfterSalesStatus.setOperator(nickname); storeAfterSalesStatus.setOperator(nickname);
storeAfterSalesStatusMapper.insert(storeAfterSalesStatus); storeAfterSalesStatusMapper.insert(storeAfterSalesStatus);
} }
@Override @Override

5
zsw-bxg/src/main/java/co/yixiang/modules/store/domain/YxStoreBrand.java

@ -49,6 +49,11 @@ public class YxStoreBrand implements Serializable {
/** 是否展示 */ /** 是否展示 */
private Integer isShow; private Integer isShow;
/** 商品种类虚拟总数 */
private Integer goodsNumber;
/** 虚拟总销量(单位w) */
private Integer sellNumber;
/** 添加时间 */ /** 添加时间 */
@TableField(fill= FieldFill.INSERT) @TableField(fill= FieldFill.INSERT)

6
zsw-bxg/src/main/java/co/yixiang/modules/store/service/dto/YxStoreBrandDto.java

@ -31,6 +31,12 @@ public class YxStoreBrandDto implements Serializable {
/** 排序 */ /** 排序 */
private Integer sort; private Integer sort;
/** 商品种类虚拟总数 */
private Integer goodsNumber;
/** 虚拟总销量(单位w) */
private Integer sellNumber;
/** 图标 */ /** 图标 */
private String pic; private String pic;

2
zsw-bxg/src/main/java/co/yixiang/modules/store/service/impl/YxStoreBrandServiceImpl.java

@ -90,6 +90,8 @@ public class YxStoreBrandServiceImpl extends BaseServiceImpl<YxStoreBrandMapper,
map.put("品牌名称", yxStoreBrand.getBrandName()); map.put("品牌名称", yxStoreBrand.getBrandName());
map.put("排序", yxStoreBrand.getSort()); map.put("排序", yxStoreBrand.getSort());
map.put("图标", yxStoreBrand.getPic()); map.put("图标", yxStoreBrand.getPic());
map.put("虚拟商品种类总数",yxStoreBrand.getGoodsNumber());
map.put("虚拟销售量",yxStoreBrand.getSellNumber());
map.put("背景图", yxStoreBrand.getBackgroundImage()); map.put("背景图", yxStoreBrand.getBackgroundImage());
map.put("是否推荐", yxStoreBrand.getIsShow()); map.put("是否推荐", yxStoreBrand.getIsShow());
map.put("添加时间", yxStoreBrand.getCreateTime()); map.put("添加时间", yxStoreBrand.getCreateTime());

8
zsw-bxg/src/main/java/co/yixiang/utils/BrandDTO.java

@ -22,7 +22,7 @@ public class BrandDTO implements Serializable {
private Long id; private Long id;
/** /**
* 商品分类名称 * 商品品牌名称
*/ */
private String brandName; private String brandName;
@ -31,6 +31,12 @@ public class BrandDTO implements Serializable {
*/ */
private String pic; private String pic;
/** 商品虚拟总数 */
private Integer goodsNumber;
/** 虚拟总销量(单位w) */
private Integer sellNumber;
/** /**
* 背景图url * 背景图url
*/ */

Loading…
Cancel
Save