Преглед на файлове

fix 添加订单状态修改接口;添加固定客服发放优惠券

zoujiajian преди 3 години
родител
ревизия
00aa17f2d2

+ 5 - 0
netflix-common/src/main/java/com/cyksj/common/constant/Constant.java

@@ -47,4 +47,9 @@ public interface Constant {
 	String LOTTERY_SPECIFIC_ORDER_EFFECTIVE_TIME = "lottery_specific_order_effective_time";
 
 	String CORP_POPULARIZE_CUSTOMER = "corp_popularize_customer";
+
+	/**
+	 * 固定客服key
+	 */
+	String CORP_FIXED_CUSTOMER = "corp_fixed_customer";
 }

+ 3 - 0
netflix-dao/src/main/java/com/cyksj/model/manage/views/GroupsRelationView.java

@@ -57,6 +57,9 @@ public class GroupsRelationView {
     @DbField("gr.user_id")
     private Long userId;
 
+    @DbField("gr.start_time")
+    private Date startTime;
+
     @DbField("gr.expiry_time")
     private Date expiryTime;
 

+ 26 - 0
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpEventActionServiceImpl.java

@@ -25,6 +25,7 @@ import com.cyksj.model.response.ExternalContact;
 import com.cyksj.model.response.FollowedUser;
 import com.cyksj.service.corp.WxCorpOps;
 import com.cyksj.service.corp.msg.CorpEventActionService;
+import com.cyksj.service.mange.coupon.CouponCommonService;
 import com.cyksj.service.market.MarketFrontService;
 import com.cyksj.service.relation.GroupRelationFrontService;
 import com.cyksj.service.sys.SysConfigService;
@@ -78,6 +79,8 @@ public class CorpEventActionServiceImpl implements CorpEventActionService {
 
 	private final GlobalThreadPoolTaskExecutor THREAD_POOL;
 
+	private final CouponCommonService couponCommonService;
+
 	private static final String DEFAULT_MSG = "您好,欢迎加入银河录像局";
 
 	/**
@@ -114,6 +117,8 @@ public class CorpEventActionServiceImpl implements CorpEventActionService {
 				groupRelationFrontService.isJoinCorpWx(user.getId(), true, false);
 				//发放抽奖机会
 				sendSpecificChanceNum(user.getId());
+				//添加固定客服发放优惠券
+				isJoinFixedCustomer(user.getId(), userId);
 			}
 			corpUserMapper.insert(corpUser);
 		} else {
@@ -145,6 +150,27 @@ public class CorpEventActionServiceImpl implements CorpEventActionService {
 		return null;
 	}
 
+	private void isJoinFixedCustomer(Long userId, String followId) {
+		SysConfig corpConfig = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
+				.eq(SysConfig::getSysKey, Constant.CORP_FIXED_CUSTOMER)
+				.eq(SysConfig::getSysValue, followId)
+				.last("limit 1"));
+		if (corpConfig != null) {
+			Optional.ofNullable(corpConfig.getSysValue()).ifPresent(value -> {
+				try {
+					if (StrUtil.isNotBlank(value)) {
+						List<String> followIds = Jsons.parseList(value, String.class);
+						if (followIds.contains(followId)) {
+							//发放添加固定客服优惠券
+							couponCommonService.sendCouponToUser(userId, 38l, 0l, 0l, 0l, CouponUser.Channel.wxCorp);
+						}
+					}
+				} catch (Exception e) {
+				}
+			});
+		}
+	}
+
 	private void sendSpecificChanceNum(Long userId) throws Exception {
 		SysConfig lottery_specific_goods = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class).eq(SysConfig::getSysKey, Constant.LOTTERY_SPECIFIC_GOODS).last("limit 1"));
 		if (lottery_specific_goods == null) {

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationFrontServiceImpl.java

@@ -120,7 +120,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 				.field(RenewalView::getStatus, List.of("validity", "overdue")).op(Operator.InList)
 				.build());
 		if (number.intValue() > 0 && !noCoupon) {
-			couponCommonService.sendCouponToUser(userId, 34l, 0l, 0l, 0l, CouponUser.Channel.manual);
+			couponCommonService.sendCouponToUser(userId, 34l, 0l, 0l, 0l, CouponUser.Channel.wxCorp);
 		}
 		return true;
 	}

+ 2 - 1
netflix-web/src/main/java/com/cyksj/config/SaTokenConfigure.java

@@ -28,7 +28,8 @@ public class SaTokenConfigure implements WebMvcConfigurer {
 						"/manage/register/wx/refund/notify",
 						"/manage/register/unLimit",
 						"/manage/gzh/msg/notify",
-						"/manage/admin/send/template"));
+						"/manage/admin/send/template",
+						"/manage/order/put/status/*"));
 	}
 }
 

+ 20 - 0
netflix-web/src/main/java/com/cyksj/web/controller/manage/CmsOrderController.java

@@ -196,6 +196,26 @@ public class CmsOrderController {
 		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
 	}
 
+	/**
+	 * 修改订单状态
+	 */
+	@PutMapping("/put/status/{orderId}")
+	public Result<String> updateOrderStatus(@PathVariable Long orderId) {
+		OrderDon orderDon = cmsOrderDonService.getById(orderId);
+		if (orderDon == null) {
+			throw BusinessRuntimeException.getInstance("该订单不存在");
+		}
+		if (orderDon.getStatus() == OrderDon.Status.complete) {
+			throw BusinessRuntimeException.getInstance("该订单已是已完成状态");
+		}
+		if (orderDon.getStatus() != OrderDon.Status.hasPayment) {
+			throw BusinessRuntimeException.getInstance("该订单不是未支付状态");
+		}
+		orderDon.setStatus(OrderDon.Status.complete);
+		cmsOrderDonService.updateById(orderDon);
+		return GatewayResponse.SUCCESS.newBuilder().toResult("修改订单状态成功");
+	}
+
     /**
      * 修改购买意愿记录
      */