|
|
@@ -4,6 +4,7 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
import com.alibaba.excel.support.ExcelTypeEnum;
|
|
|
@@ -18,10 +19,7 @@ import com.cyksj.dto.Result;
|
|
|
import com.cyksj.enums.BusinessType;
|
|
|
import com.cyksj.enums.GatewayApiCode;
|
|
|
import com.cyksj.enums.GatewayResponse;
|
|
|
-import com.cyksj.mapper.GoodsDonSkuMapper;
|
|
|
-import com.cyksj.mapper.GroupsRelationMapper;
|
|
|
-import com.cyksj.mapper.OrderCommentMapper;
|
|
|
-import com.cyksj.mapper.RealGoodsInterestUserMapper;
|
|
|
+import com.cyksj.mapper.*;
|
|
|
import com.cyksj.mapper.channel.ChannelPopularizeMapper;
|
|
|
import com.cyksj.mapper.channel.UserPayEquipmentAvailableBenefitsMapper;
|
|
|
import com.cyksj.mapper.channel.UserPayEquipmentReceiveBenefitsRecordMapper;
|
|
|
@@ -105,10 +103,12 @@ public class CmsOrderController {
|
|
|
|
|
|
private final CmsUserMapper cmsUserMapper;
|
|
|
|
|
|
+ private final UserMapper userMapper;
|
|
|
+
|
|
|
|
|
|
@GetMapping("/get")
|
|
|
@SaCheckPermission("order:view")
|
|
|
- public Result<SearchResult<OrderDonBackView>> get(Long channelId, String account, String showId, Long acId) {
|
|
|
+ public Result<SearchResult<OrderDonBackView>> get(Long channelId, String account, String showId, Long acId, String nickname, String register, Boolean isGoogle) {
|
|
|
MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
|
|
|
if (channelId != null) {
|
|
|
List<Long> popularizeIds = channelPopularizeMapper.getPopularizeIdByChannelId(channelId);
|
|
|
@@ -130,6 +130,28 @@ public class CmsOrderController {
|
|
|
if (acId != null) {
|
|
|
conditionSql += String.format(" o.user_id in (select user_id from corp_user where ac_id = %s)", acId);
|
|
|
}
|
|
|
+ if (!ObjectUtil.isAllEmpty(nickname, register, isGoogle)) {
|
|
|
+ if (StrUtil.isNotEmpty(conditionSql)) {
|
|
|
+ conditionSql += " and ";
|
|
|
+ }
|
|
|
+ conditionSql += " exists (select u.id from user u where u.id = o.user_id";
|
|
|
+ if (StrUtil.isNotEmpty(nickname)) {
|
|
|
+ conditionSql += String.format(" and u.nickname like '%s%%'", nickname);
|
|
|
+ }
|
|
|
+ if (StrUtil.isNotEmpty(register)) {
|
|
|
+ if ("phone".equals(register)) {
|
|
|
+ conditionSql += " and u.login_phone != ''";
|
|
|
+ } else if ("email".equals(register)) {
|
|
|
+ conditionSql += " and u.email != ''";
|
|
|
+ } else if ("wechat".equals(register)) {
|
|
|
+ conditionSql += " and u.unionid != ''";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (isGoogle != null && isGoogle) {
|
|
|
+ conditionSql += String.format(" and u.is_google is %s", isGoogle);
|
|
|
+ }
|
|
|
+ conditionSql += " limit 1)";
|
|
|
+ }
|
|
|
if (StrUtil.isNotBlank(conditionSql)) {
|
|
|
builder.put("condition", conditionSql);
|
|
|
}
|
|
|
@@ -139,6 +161,7 @@ public class CmsOrderController {
|
|
|
Optional.ofNullable(channelPopularizeMapper.selectChannelByPid(data.getPopularizeId()))
|
|
|
.ifPresent(channelName -> data.setChannel(channelName));
|
|
|
}
|
|
|
+
|
|
|
if (data.getGoodsDonType() != null && Constant.realGoodsType.contains(data.getGoodsDonType())) {
|
|
|
RealGoodsOrderHandle realGoodsOrderHandle = realGoodsOrderHandleMapper.selectOne(Wrappers.lambdaQuery(RealGoodsOrderHandle.class).eq(RealGoodsOrderHandle::getOrderId, data.getId()).last("limit 1"));
|
|
|
if (realGoodsOrderHandle != null) {
|
|
|
@@ -146,32 +169,31 @@ public class CmsOrderController {
|
|
|
data.setAfterServiceName(realGoodsOrderHandle.getAfterServiceName());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
if (data.getCouponUserId() != 0) {
|
|
|
data.setCouponName(couponMapper.getCouponNameByCouponUserId(data.getCouponUserId()));
|
|
|
data.setCouponMoney(data.getCouponMoney() == null ? BigDecimal.ZERO : data.getCouponMoney());
|
|
|
}
|
|
|
- Optional.ofNullable(relationMapper.selectById(data.getRelationId()))
|
|
|
- .ifPresent(relation -> {
|
|
|
- data.setAccount(relation.getAccount());
|
|
|
- AccountView accountView = beanSearcher.searchFirst(AccountView.class, MapUtils.builder().field(AccountView::getGroupsId, relation.getGroupsId()).onlySelect(AccountView::getAccount).build());
|
|
|
- Optional.ofNullable(accountView).ifPresent(view -> data.setGtAccount(view.getAccount()));
|
|
|
- });
|
|
|
- Optional.ofNullable(skuMapper.selectById(data.getSkuId()))
|
|
|
- .ifPresent(sku -> {
|
|
|
- data.setSpecVal(sku.getSpecVal());
|
|
|
- data.setMonths(sku.getMonths());
|
|
|
- data.setDays(sku.getDays());
|
|
|
- if (sku.getIsBenefits() && !Constant.noOrderAllStatus.contains(data.getStatus())) {
|
|
|
- //是否实物权益已发放
|
|
|
- Integer count = receiveBenefitsRecordMapper.selectCount(Wrappers.lambdaQuery(UserPayEquipmentReceiveBenefitsRecord.class)
|
|
|
- .eq(UserPayEquipmentReceiveBenefitsRecord::getRealOrderId, data.getId()));
|
|
|
- if (count == 0) {
|
|
|
- count = availableBenefitsMapper.selectCount(Wrappers.lambdaQuery(UserPayEquipmentAvailableBenefits.class)
|
|
|
- .eq(UserPayEquipmentAvailableBenefits::getRealOrderId, data.getId()));
|
|
|
- }
|
|
|
- data.setIsHasBenefits(count == 0 ? true : false);
|
|
|
- }
|
|
|
- });
|
|
|
+
|
|
|
+ if (data.getRelationId() != 0) {
|
|
|
+ Optional.ofNullable(relationMapper.getGroupRelationAccountView(data.getRelationId()))
|
|
|
+ .ifPresent(e -> {
|
|
|
+ data.setGtAccount(e.getTripsAccount());
|
|
|
+ data.setAccount(e.getAccount());
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ if (data.getIsBenefits() != null && data.getIsBenefits() && !Constant.noOrderAllStatus.contains(data.getStatus())) {
|
|
|
+ //是否实物权益已发放
|
|
|
+ Integer count = receiveBenefitsRecordMapper.selectCount(Wrappers.lambdaQuery(UserPayEquipmentReceiveBenefitsRecord.class)
|
|
|
+ .eq(UserPayEquipmentReceiveBenefitsRecord::getRealOrderId, data.getId()));
|
|
|
+ if (count == 0) {
|
|
|
+ count = availableBenefitsMapper.selectCount(Wrappers.lambdaQuery(UserPayEquipmentAvailableBenefits.class)
|
|
|
+ .eq(UserPayEquipmentAvailableBenefits::getRealOrderId, data.getId()));
|
|
|
+ }
|
|
|
+ data.setIsHasBenefits(count == 0 ? true : false);
|
|
|
+ }
|
|
|
+
|
|
|
if (data.getYhsId() != 0) {
|
|
|
Optional.ofNullable(yhShopMapper.selectById(data.getYhsId()))
|
|
|
.ifPresent(e -> {
|
|
|
@@ -179,6 +201,15 @@ public class CmsOrderController {
|
|
|
data.setCustomId(e.getCustomId());
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ User user = userMapper.selectById(data.getUserId());
|
|
|
+ if (user != null) {
|
|
|
+ data.setNickname(user.getNickname());
|
|
|
+ data.setLoginPhone(user.getLoginPhone());
|
|
|
+ data.setEmail(user.getEmail());
|
|
|
+ data.setRegister(StrUtil.isNotEmpty(user.getUnionid()) ? "wechat" : StrUtil.isNotEmpty(user.getLoginPhone()) ? "phone" : "email");
|
|
|
+
|
|
|
+ }
|
|
|
});
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|
|
|
}
|