Commit f93ea65e by 吕明尚

Merge branch 'test'

parents aec3c8bc 5ab69429
......@@ -10,10 +10,13 @@ import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType;
import share.common.utils.poi.ExcelUtil;
import share.system.domain.DurationLog;
import share.system.domain.SConsumer;
import share.system.domain.vo.DurationLogVo;
import share.system.domain.vo.FrontTokenComponent;
import share.system.service.DurationLogService;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.List;
/**
......
package share.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import share.common.annotation.Log;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType;
import share.common.utils.poi.ExcelUtil;
import share.system.domain.Device;
import share.system.domain.SRoom;
import share.system.domain.vo.SRoomVo;
import share.system.service.ISRoomService;
import share.common.utils.poi.ExcelUtil;
import share.common.core.page.TableDataInfo;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 房间Controller
......@@ -43,9 +36,7 @@ public class SRoomController extends BaseController
@GetMapping("/list")
public TableDataInfo list(SRoom sRoom)
{
startPage();
List<SRoom> list = sRoomService.selectSRoomList(sRoom);
return getDataTable(list);
return sRoomService.pageList(sRoom);
}
/**
......
......@@ -5,6 +5,7 @@ public enum DurationTypeEnum {
ORDER(1,"订单消费"),
SHARE(2, "分享赠送"),
ORDER_REFUND(3,"订单消费退款"),
GIVE(4, "赠送"),
;
......
package share.web.controller.system;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.core.domain.R;
import share.common.core.page.TableDataInfo;
import share.common.utils.JsonConvertUtil;
import share.system.domain.vo.ConsumerMonthlyCardVo;
import share.system.request.MonthlyCardRequest;
import share.system.response.MonthlyCardResponse;
import share.system.service.ConsumerMonthlyCardService;
import java.util.List;
......@@ -18,6 +22,7 @@ import java.util.List;
* @author wuwenlong
* @date 2024-08-27
*/
@Slf4j
@RestController
@RequestMapping("/consumerMonthlyCard")
public class ConsumerMonthlyCardController extends BaseController {
......@@ -43,7 +48,10 @@ public class ConsumerMonthlyCardController extends BaseController {
//查询可用卡类
@PostMapping("/queryCardType")
public AjaxResult queryCardType(@RequestBody @Validated MonthlyCardRequest monthlyCardRequest) {
return success(consumerMonthlyCardService.queryCardType(monthlyCardRequest));
public R<MonthlyCardResponse> queryCardType(@RequestBody @Validated MonthlyCardRequest monthlyCardRequest) {
log.debug("ConsumerMonthlyCardController method queryCardType 入参 {}", JsonConvertUtil.write2JsonStr(monthlyCardRequest));
MonthlyCardResponse monthlyCardResponse = consumerMonthlyCardService.queryCardType(monthlyCardRequest);
log.debug("ConsumerMonthlyCardController method queryCardType 出参 {}", JsonConvertUtil.write2JsonStr(monthlyCardResponse));
return R.ok(monthlyCardResponse);
}
}
......@@ -56,4 +56,15 @@ public class DurationLogController extends BaseController {
BigDecimal sumVariableDuration = durationLogService.sumVariableDuration(durationLog);
return success(sumVariableDuration);
}
@GetMapping("/shareList")
public TableDataInfo shareList(DurationLogVo durationLog) {
startPage();
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
durationLog.setConsumerId(user.getId());
durationLog.setDurationType(DurationTypeEnum.SHARE.getCode());
List<DurationLogVo> list = durationLogService.selectDurationLogList(durationLog);
return getDataTable(list);
}
}
......@@ -35,6 +35,7 @@ import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
......@@ -554,20 +555,10 @@ public class RedisTask {
Long consumerId = jsonObject.getLong("consumerId");
if (expirationTime.getTime() < new Date().getTime()) {
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, consumerId));
consumerMember.setIsRights(YesNoEnum.no.getIndex());
if (ObjectUtil.isNotEmpty(consumerMember)) {
consumerMember.setIsRights(YesNoEnum.no.getIndex());
String rechargeMembershipExpirationTime = sysConfigService.selectConfigByKey("rechargeMembershipExpirationTime");
if (consumerMember.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
consumerMember.setExpirationDate(DateUtils.addYears(new Date(), Integer.parseInt(rechargeMembershipExpirationTime)));
} else {
consumerMember.setExpirationDate(DateUtils.addYears(new Date(), Integer.parseInt(rechargeMembershipExpirationTime)));
}
// MemberConfig memberConfigServiceOne = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
//// .eq(MemberConfig::getMemberType, consumerMember.getMemberType())
// .eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel())
// );
// consumerMember.setMemberConfigId(memberConfigServiceOne.getId());
// consumerMember.setExpirationDate(DateUtils.addYears(new Date(), memberConfigServiceOne.getValidityPeriod().intValue()));
consumerMemberService.updateConsumerMember(consumerMember);
}
redisUtil.delete(key);
......@@ -594,22 +585,19 @@ public class RedisTask {
List<Long> consumerIds = list.stream().map(MemberProgressLog::getConsumerId).distinct().collect(Collectors.toList());
Map<Long, ConsumerMember> consumerMemberMap = consumerMemberService.list(new LambdaQueryWrapper<ConsumerMember>().in(ConsumerMember::getConsumerId, consumerIds))
.stream().collect(Collectors.toMap(ConsumerMember::getConsumerId, item -> item));
//按照consumerId进行分组
Map<Long, List<MemberProgressLog>> collect = list.stream().collect(Collectors.groupingBy(MemberProgressLog::getConsumerId));
Map<Long, MemberConfig> memberConfigMap = memberConfigService.list().stream().collect(Collectors.toMap(MemberConfig::getMembershipLevel, item -> item));
List<ConsumerMember> updateList = new ArrayList<>();
consumerIds.stream().forEach(item -> {
List<MemberProgressLog> memberProgressLogs = collect.get(item);
if (memberProgressLogs.size() > 0) {
//查询会员
ConsumerMember consumerMember = consumerMemberMap.get(item);
;
if (consumerMember.getMembershipProgress().equals(BigDecimal.ZERO)) {
//结束此次循环
return;
}
//查询会员配置
MemberConfig memberConfig = memberConfigMap.get(consumerMember.getMembershipLevel());
final BigDecimal[] sum = {BigDecimal.ZERO};
//计算扣除进度
memberProgressLogs.stream().forEach(log -> {
......@@ -627,17 +615,36 @@ public class RedisTask {
//判断会员进度是否大于扣除进度
} else if (consumerMember.getMembershipProgress().compareTo(sum[0].abs()) >= 0) {
//会员进度减去扣除进度
BigDecimal subtract = BigDecimal.ZERO;
if (sum[0].compareTo(BigDecimal.ZERO) < 0) {
subtract = consumerMember.getMembershipProgress().add(sum[0]);
} else if (sum[0].compareTo(BigDecimal.ZERO) > 0) {
subtract = consumerMember.getMembershipProgress().subtract(sum[0]);
}
consumerMember.setMembershipProgress(subtract);
if (consumerMember.getMembershipProgress().compareTo(BigDecimal.valueOf(memberConfig.getLimitRequirements())) < 0) {
BigDecimal subtract = consumerMember.getMembershipProgress().subtract(sum[0]);
// consumerMember.setMembershipProgress(subtract);
// if (consumerMember.getMembershipProgress().compareTo(BigDecimal.valueOf(memberConfig.getLimitRequirements())) < 0) {
//等级降一级
if (consumerMember.getMembershipLevel() > 0L) {
consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() - 1);
// if (consumerMember.getMembershipLevel() > 0L) {
// consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() - 1);
// }
//转Map limitRequirements,MemberConfig
Map<Long, MemberConfig> configMap = memberConfigService.list(new LambdaQueryWrapper<MemberConfig>()
.orderByDesc(MemberConfig::getMembershipLevel)).stream().collect(Collectors.toMap(MemberConfig::getMembershipLevel, Function.identity()));
//Map根
//判断subtract小于当前等级的积分,并大于下一等级的积分
for (Map.Entry<Long, MemberConfig> entry : configMap.entrySet()) {
if (subtract.compareTo(BigDecimal.valueOf(entry.getValue().getLimitRequirements())) > 0 &&
subtract.compareTo(BigDecimal.valueOf(configMap.get(entry.getKey() + 1).getLimitRequirements())) <= 0
&& entry.getKey().compareTo(Collections.min(configMap.keySet())) > 0) {
consumerMember.setMembershipLevel(entry.getKey());
consumerMember.setMembershipProgress(subtract);
updateList.add(consumerMember);
return;
} else if (subtract.compareTo(BigDecimal.valueOf(configMap.get(Collections.min(configMap.keySet())).getLimitRequirements())) <= 0) {
consumerMember.setMembershipLevel(Collections.min(configMap.keySet()));
consumerMember.setMembershipProgress(subtract);
updateList.add(consumerMember);
return;
} else if (subtract.compareTo(BigDecimal.valueOf(configMap.get(Collections.max(configMap.keySet())).getLimitRequirements())) >= 0) {
consumerMember.setMembershipLevel(Collections.max(configMap.keySet()));
consumerMember.setMembershipProgress(subtract);
updateList.add(consumerMember);
return;
}
}
}
......@@ -802,6 +809,31 @@ public class RedisTask {
logger.debug("AutomaticallyMonthlyCard:自动结束月卡结束");
}
//每日00:00:00增加时长
@XxlJob("AutoMonthlyCardTime")
public void AutoMonthlyCardTime() {
logger.debug("AutoMonthlyCardTime:自动增加月卡时长开始");
Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.MONTHLY_CARD.getValue() + "*");
if (keys.size() == 0) return;
List<ConsumerMonthlyCard> consumerMonthlyCards = new ArrayList<>();
String monthlyCardTime = sysConfigService.selectConfigByKey("monthlyCardTime");
keys.stream().forEach(key -> {
String value = redisUtil.get(String.valueOf(key));
JSONObject jsonObject = new JSONObject(value);
Date expirationTime = jsonObject.getDate("expirationTime");
Long consumerMonthlyCardId = jsonObject.getLong("consumerMonthlyCardId");
if (expirationTime.getTime() > new Date().getTime()) {
ConsumerMonthlyCard consumerMonthlyCard = new ConsumerMonthlyCard();
consumerMonthlyCard.setFreeDuration(new BigDecimal(monthlyCardTime));
consumerMonthlyCard.setId(consumerMonthlyCardId);
consumerMonthlyCards.add(consumerMonthlyCard);
}
});
if (!CollectionUtils.isEmpty(consumerMonthlyCards))
consumerMonthlyCardService.updateBatchById(consumerMonthlyCards);
logger.debug("AutoMonthlyCardTime:自动增加月卡时长结束");
}
@XxlJob("AutomaticallySecondaryCard")
public void AutomaticallySecondaryCard() {
logger.debug("AutomaticallySecondaryCard:自动结束次卡开始");
......
......@@ -34,6 +34,14 @@ public class ConsumerMonthlyCard extends BaseEntity {
@Excel(name = "月卡配置表id")
private Long monthlyCardConfId;
//配置名称
@Excel(name = "月卡配置名称")
private String confName;
//月卡金额
@Excel(name = "月卡金额")
private BigDecimal confAmount;
/**
* 用户ID
*/
......
......@@ -32,6 +32,14 @@ public class ConsumerSecondaryCard extends BaseEntity {
@Excel(name = "次卡配置表id")
private Long secondaryCardConfId;
//配置名称
@Excel(name = "次卡配置名称")
private String confName;
//月卡金额
@Excel(name = "次卡金额")
private BigDecimal confAmount;
/**
* 用户ID
*/
......
......@@ -70,6 +70,9 @@ public class DurationLog extends BaseEntity {
@Excel(name = "时长类型0-充值赠送,1-订单消费,2-分享赠送,3-订单退款")
private Integer durationType;
@Excel(name = "下级用户ID")
private Long newId;
@Override
public String toString() {
......
package share.system.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
......@@ -25,6 +23,7 @@ public class MonthlyCardConf extends BaseEntity {
/**
* 主键
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
......
package share.system.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
......@@ -27,6 +25,7 @@ public class MonthlyCardLog extends BaseEntity {
/**
* 主键
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
......
package share.system.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
......@@ -23,6 +21,7 @@ public class SecondaryCardConf extends BaseEntity {
/**
* 主键
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
......
package share.system.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
......@@ -26,6 +24,7 @@ public class SecondaryCardLog extends BaseEntity {
/**
* 主键
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
......
......@@ -3,16 +3,10 @@ package share.system.domain.vo;
import lombok.Data;
import share.system.domain.ConsumerMonthlyCard;
import java.math.BigDecimal;
@Data
public class ConsumerMonthlyCardVo extends ConsumerMonthlyCard {
//用户昵称
private String nickName;
//用户头像
private String avatar;
//配置名称
private String confName;
//月卡金额
private BigDecimal confAmount;
}
......@@ -3,18 +3,12 @@ package share.system.domain.vo;
import lombok.Data;
import share.system.domain.ConsumerSecondaryCard;
import java.math.BigDecimal;
@Data
public class ConsumerSecondaryCardVo extends ConsumerSecondaryCard {
//用户昵称
private String nickName;
//用户头像
private String avatar;
//配置名称
private String confName;
//次卡金额
private BigDecimal confAmount;
//是否适用当前套餐
private Integer isUse;
//原因
......
......@@ -10,4 +10,10 @@ public class DurationLogVo extends DurationLog {
private String avatar;
private String phone;
private String newNickName;
private String newAvatar;
private String newPhone;
}
......@@ -103,6 +103,24 @@ public class SOrderVo
@Excel(name = "优惠卷促销价")
private BigDecimal couponPayPrice;
@Excel(name = "次卡ID")
private Long secondaryCardId;
@Excel(name = "次卡名称")
private String secondaryCardName;
@Excel(name = "次卡金额")
private BigDecimal secondaryCardAmount;
@Excel(name = "月卡ID")
private Long monthlyCardId;
@Excel(name = "月卡名称")
private String monthlyCardName;
@Excel(name = "月卡金额")
private BigDecimal monthlyCardAmount;
@ApiModelProperty(value = "订单总价")
@Excel(name = "订单总价")
private BigDecimal totalPrice;
......@@ -283,11 +301,7 @@ public class SOrderVo
@ApiModelProperty(name = "是否可以申请退款")
private Boolean isRefund;
@Excel(name = "次卡ID")
private Long secondaryCardId;
@Excel(name = "月卡ID")
private Long monthlyCardId;
@Excel(name = "历史订单号")
private String historicalOrderNo;
......
package share.system.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import share.system.domain.ConsumerMonthlyCard;
import share.system.domain.ConsumerSecondaryCard;
import java.util.List;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "MonthlyCardResponse", description = "卡包响应对象")
public class MonthlyCardResponse {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "月卡")
private List<ConsumerMonthlyCard> consumerMonthlyCard;
@ApiModelProperty(value = "次卡")
private List<ConsumerSecondaryCard> consumerSecondaryCard;
}
......@@ -4,9 +4,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.ConsumerMonthlyCard;
import share.system.domain.vo.ConsumerMonthlyCardVo;
import share.system.request.MonthlyCardRequest;
import share.system.response.MonthlyCardResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 用户月卡Service接口
......@@ -65,5 +66,7 @@ public interface ConsumerMonthlyCardService extends IService<ConsumerMonthlyCard
List<ConsumerMonthlyCardVo> selectByConsumerId();
Map<String, List<Long>> queryCardType(MonthlyCardRequest monthlyCardRequest);
MonthlyCardResponse queryCardType(MonthlyCardRequest monthlyCardRequest);
List<ConsumerMonthlyCard> confNameByIds(ArrayList<Long> longs);
}
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.ConsumerSecondaryCard;
import share.system.domain.vo.ConsumerSecondaryCardVo;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -64,4 +65,6 @@ public interface ConsumerSecondaryCardService extends IService<ConsumerSecondary
List<ConsumerSecondaryCardVo> selectByConsumerId();
List<ConsumerSecondaryCardVo> selectByPaclId(Long packId);
List<ConsumerSecondaryCard> confNameByIds(ArrayList<Long> longs);
}
......@@ -66,5 +66,5 @@ public interface IPackService extends IService<SPack> {
List<SPack> pageList(SPack sPack);
List<SPack> storeNameByIds(List<Long> longs);
List<SPack> packNameByIds(List<Long> longs);
}
......@@ -90,7 +90,7 @@ public interface ISConsumerCouponService extends IService<SConsumerCoupon>
SConsumerCoupon selectSConsumerCouponByCode(String code);
List<SConsumerCoupon> storeNameByIds(List<Long> longs);
List<SConsumerCoupon> couponNameByIds(List<Long> longs);
List<SConsumerCoupon> selectOrderList();
......
package share.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import share.common.core.page.TableDataInfo;
import share.system.domain.Device;
import share.system.domain.SPack;
import share.system.domain.SRoom;
......@@ -109,5 +110,7 @@ public interface ISRoomService extends IService<SRoom>
List<SRoomVo> convertDoListToVoList(List<SRoom> roomList);
List<SRoom> storeNameByIds(List<Long> longs);
List<SRoom> roomNameByIds(List<Long> longs);
TableDataInfo pageList(SRoom sRoom);
}
package share.system.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.exception.base.BaseException;
......@@ -15,6 +17,7 @@ import share.system.service.ConsumerSecondaryCardService;
import share.system.service.IPackService;
import share.system.service.SConsumerService;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
......@@ -134,4 +137,14 @@ public class ConsumerSecondaryCardServiceImpl extends ServiceImpl<ConsumerSecond
// });
return consumerSecondaryCardVos;
}
@Override
public List<ConsumerSecondaryCard> confNameByIds(ArrayList<Long> longs) {
LambdaQueryWrapper<ConsumerSecondaryCard> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.select(ConsumerSecondaryCard::getId, ConsumerSecondaryCard::getConfName, ConsumerSecondaryCard::getConfAmount);
if (CollectionUtils.isNotEmpty(longs)) {
queryWrapper.in(ConsumerSecondaryCard::getId, longs);
}
return list(queryWrapper);
}
}
......@@ -485,6 +485,7 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
durationLog.setVariableDuration(consumerWallet.getRemainingDuration());
durationLog.setOperationType(YesNoEnum.yes.getIndex());
durationLog.setOperationTime(new Date());
durationLog.setDurationType(DurationTypeEnum.GIVE.getCode());
durationLog.setCreateTime(new Date());
oldConsumerWallet.setRemainingDuration(oldConsumerWallet.getRemainingDuration().add(consumerWallet.getRemainingDuration()));
durationLogService.save(durationLog);
......@@ -505,6 +506,7 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
durationLog.setOperationType(YesNoEnum.yes.getIndex());
durationLog.setOperationTime(new Date());
durationLog.setCreateTime(new Date());
durationLog.setDurationType(DurationTypeEnum.GIVE.getCode());
newConsumerWallet.setRemainingDuration(newConsumerWallet.getRemainingDuration().add(consumerWallet.getRemainingDuration()));
newConsumerWallet.setRemainingIntegral(BigDecimal.ZERO);
......
package share.system.service.impl;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import share.common.core.page.PageDomain;
import share.common.core.page.TableDataInfo;
import share.common.core.page.TableSupport;
import share.common.enums.DeviceStatusEnum;
import share.common.enums.YesNoEnum;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.system.domain.*;
import share.system.domain.DeviceGateway;
import share.system.domain.DeviceGatewayDto;
import share.system.domain.SStore;
import share.system.domain.vo.DeviceGatewayVo;
import share.system.domain.vo.DeviceVo;
import share.system.mapper.DeviceGatewayMapper;
import share.system.mapper.SStoreMapper;
import share.system.service.DeviceGatewayService;
import share.system.service.ISysConfigService;
import share.system.service.SmsService;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
/**
* 设备网关信息Service业务层处理
*
......@@ -159,7 +158,13 @@ public class DeviceGatewayServiceImpl extends ServiceImpl<DeviceGatewayMapper, D
@Override
public TableDataInfo deviceGatewayPage(DeviceGatewayDto deviceGatewayDto) {
List<DeviceGateway> deviceGateways = deviceGatewayMapper.selectDeviceGatewayList(deviceGatewayDto);
List<DeviceGatewayVo> deviceGatewayVoList = convertDosToVos(deviceGateways);
TableDataInfo tableDataInfo = new TableDataInfo();
tableDataInfo.setTotal(deviceGateways.size());
PageDomain pageDomain = TableSupport.buildPageRequest();
int start = (pageDomain.getPageNum() - 1) * pageDomain.getPageSize();
int end = Math.min(start + pageDomain.getPageSize(), deviceGateways.size());
List<DeviceGateway> deviceGatewayVos = deviceGateways.subList(start, end);
List<DeviceGatewayVo> deviceGatewayVoList = convertDosToVos(deviceGatewayVos);
if (CollectionUtils.isNotEmpty(deviceGatewayVoList)) {
List<SStore> sStoreList = storeMapper.selectList(new LambdaQueryWrapper<>());
deviceGatewayVoList.stream().forEach(item -> {
......@@ -172,13 +177,7 @@ public class DeviceGatewayServiceImpl extends ServiceImpl<DeviceGatewayMapper, D
});
}
deviceGatewayVoList.sort(Comparator.comparing(DeviceGatewayVo::getCreateTime).reversed());
PageDomain pageDomain = TableSupport.buildPageRequest();
int start = (pageDomain.getPageNum() - 1) * pageDomain.getPageSize();
int end = Math.min(start + pageDomain.getPageSize(), deviceGatewayVoList.size());
List<DeviceGatewayVo> deviceGatewayVos = deviceGatewayVoList.subList(start, end);
TableDataInfo tableDataInfo = new TableDataInfo();
tableDataInfo.setRows(deviceGatewayVos);
tableDataInfo.setTotal(deviceGatewayVoList.size());
tableDataInfo.setRows(deviceGatewayVoList);
tableDataInfo.setCode(200);
tableDataInfo.setMsg("查询成功");
return tableDataInfo;
......
package share.system.service.impl;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.utils.SecurityUtils;
import share.system.domain.*;
import share.common.utils.DateUtils;
import share.system.domain.DeviceLog;
import share.system.domain.vo.MqttxVo;
import share.system.mapper.DeviceLogMapper;
import share.system.mapper.DeviceMapper;
......@@ -18,6 +12,8 @@ import share.system.mapper.SRoomMapper;
import share.system.mapper.SStoreMapper;
import share.system.service.DeviceLogService;
import java.util.List;
/**
* 设备操作日志Service业务层处理
*
......@@ -58,34 +54,34 @@ public class DeviceLogServiceImpl extends ServiceImpl<DeviceLogMapper, DeviceLog
public List<DeviceLog> selectDeviceLogList(DeviceLog deviceLog)
{
List<DeviceLog> list = deviceLogMapper.selectDeviceLogList(deviceLog);
if (list.size() > 0) {
List<String> devIds = list.stream().map(DeviceLog::getDevId).collect(Collectors.toList());
// 设备信息查询
LambdaQueryWrapper<Device> queryDeviceWrapper = new LambdaQueryWrapper();
queryDeviceWrapper.in(Device::getDevId, devIds);
List<Device> deviceList = deviceMapper.selectList(queryDeviceWrapper);
// 提取roomId,方便批量查询
List<Long> roomIds = deviceList.stream().map(Device::getRoomId).collect(Collectors.toList());
Map<String, Long> deviceRoomMap = deviceList.stream().collect(Collectors.toMap(Device::getDevId, Device::getRoomId));
if (roomIds != null && roomIds.size() > 0) {
// 房间信息查询
LambdaQueryWrapper<SRoom> queryWrapper = new LambdaQueryWrapper();
queryWrapper.in(SRoom::getId, roomIds);
List<SRoom> roomList = roomMapper.selectList(queryWrapper);
Map<Long, String> roomMap = roomList.stream().collect(Collectors.toMap(SRoom::getId, SRoom::getName));
Map<Long, Long> roomStoreMap = roomList.stream().collect(Collectors.toMap(SRoom::getId, SRoom::getStoreId));
// 门店信息查询
List<Long> storeIds = roomList.stream().map(SRoom::getStoreId).collect(Collectors.toList());
LambdaQueryWrapper<SStore> queryStoreWrapper = new LambdaQueryWrapper();
queryStoreWrapper.in(SStore::getId, storeIds);
List<SStore> storeList = storeMapper.selectList(queryStoreWrapper);
Map<Long, String> storeMap = storeList.stream().collect(Collectors.toMap(SStore::getId, SStore::getName));
list.stream().forEach(log -> {
log.setRoomName(roomMap.get(deviceRoomMap.get(log.getDevId())));
log.setStoreName(storeMap.get(roomStoreMap.get(deviceRoomMap.get(log.getDevId()))));
});
}
}
// if (list.size() > 0) {
// List<String> devIds = list.stream().map(DeviceLog::getDevId).collect(Collectors.toList());
// // 设备信息查询
// LambdaQueryWrapper<Device> queryDeviceWrapper = new LambdaQueryWrapper();
// queryDeviceWrapper.in(Device::getDevId, devIds);
// List<Device> deviceList = deviceMapper.selectList(queryDeviceWrapper);
// // 提取roomId,方便批量查询
// List<Long> roomIds = deviceList.stream().map(Device::getRoomId).collect(Collectors.toList());
// Map<String, Long> deviceRoomMap = deviceList.stream().collect(Collectors.toMap(Device::getDevId, Device::getRoomId));
// if (roomIds != null && roomIds.size() > 0) {
// // 房间信息查询
// LambdaQueryWrapper<SRoom> queryWrapper = new LambdaQueryWrapper();
// queryWrapper.in(SRoom::getId, roomIds);
// List<SRoom> roomList = roomMapper.selectList(queryWrapper);
// Map<Long, String> roomMap = roomList.stream().collect(Collectors.toMap(SRoom::getId, SRoom::getName));
// Map<Long, Long> roomStoreMap = roomList.stream().collect(Collectors.toMap(SRoom::getId, SRoom::getStoreId));
// // 门店信息查询
// List<Long> storeIds = roomList.stream().map(SRoom::getStoreId).collect(Collectors.toList());
// LambdaQueryWrapper<SStore> queryStoreWrapper = new LambdaQueryWrapper();
// queryStoreWrapper.in(SStore::getId, storeIds);
// List<SStore> storeList = storeMapper.selectList(queryStoreWrapper);
// Map<Long, String> storeMap = storeList.stream().collect(Collectors.toMap(SStore::getId, SStore::getName));
// list.stream().forEach(log -> {
// log.setRoomName(roomMap.get(deviceRoomMap.get(log.getDevId())));
// log.setStoreName(storeMap.get(roomStoreMap.get(deviceRoomMap.get(log.getDevId()))));
// });
// }
// }
return list;
}
......
......@@ -36,6 +36,7 @@ import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 设备信息Service业务层处理
......@@ -170,10 +171,16 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
@Override
public TableDataInfo devicePage(DeviceDto device) {
List<Device> devices = deviceMapper.selectDeviceList(device);
List<DeviceVo> deviceVoList = convertDosToVos(devices);
TableDataInfo tableDataInfo = new TableDataInfo();
PageDomain pageDomain = TableSupport.buildPageRequest();
tableDataInfo.setTotal(devices.size());
int start = (pageDomain.getPageNum() - 1) * pageDomain.getPageSize();
int end = Math.min(start + pageDomain.getPageSize(), devices.size());
List<Device> deviceVos = devices.subList(start, end);
List<DeviceVo> deviceVoList = convertDosToVos(deviceVos);
if (CollectionUtils.isNotEmpty(deviceVoList)) {
List<SStore> sStoreList = storeMapper.selectList(new LambdaQueryWrapper<>());
List<SRoom> sRoomList = roomMapper.selectList(new LambdaQueryWrapper<>());
List<SRoom> sRoomList = roomMapper.selectList(new LambdaQueryWrapper<SRoom>().in(SRoom::getId, deviceVoList.stream().map(DeviceVo::getRoomId).collect(Collectors.toList())));
List<SStore> sStoreList = storeMapper.selectList(new LambdaQueryWrapper<SStore>().in(SStore::getId, sRoomList.stream().map(SRoom::getStoreId).collect(Collectors.toList())));
deviceVoList.stream().forEach(item -> {
if (ObjectUtil.isNotEmpty(item.getRoomId())) {
SRoom sRoom = sRoomList.stream().filter(room -> room.getId().equals(item.getRoomId())).findFirst().orElse(null);
......@@ -188,13 +195,7 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
});
}
deviceVoList.sort(Comparator.comparing(DeviceVo::getCreateTime).reversed());
PageDomain pageDomain = TableSupport.buildPageRequest();
int start = (pageDomain.getPageNum() - 1) * pageDomain.getPageSize();
int end = Math.min(start + pageDomain.getPageSize(), deviceVoList.size());
List<DeviceVo> deviceVos = deviceVoList.subList(start, end);
TableDataInfo tableDataInfo = new TableDataInfo();
tableDataInfo.setRows(deviceVos);
tableDataInfo.setTotal(deviceVoList.size());
tableDataInfo.setRows(deviceVoList);
tableDataInfo.setCode(200);
tableDataInfo.setMsg("查询成功");
return tableDataInfo;
......
......@@ -110,4 +110,9 @@ public class DurationLogServiceImpl extends ServiceImpl<DurationLogMapper, Durat
.stream().map(DurationLog::getVariableDuration)
.reduce(BigDecimal.ZERO, BigDecimal::add);
}
}
......@@ -264,6 +264,7 @@ public class EquityFundExcessServiceImpl extends ServiceImpl<EquityFundExcessMap
consumerWallet.setUpdateTime(DateUtils.getNowDate());
DurationLog durationLog = new DurationLog();
durationLog.setConsumerId(consumerWallet.getConsumerId());
durationLog.setNewId(sOrder.getConsumerId());
durationLog.setVariableDuration(anHour);
durationLog.setCurrentDuration(accumulateEquityFund);
durationLog.setOperationType(YesNoEnum.yes.getIndex());
......@@ -287,6 +288,7 @@ public class EquityFundExcessServiceImpl extends ServiceImpl<EquityFundExcessMap
consumerWalletService.insertConsumerWallet(newConsumerWallet);
DurationLog newDurationLog = new DurationLog();
newDurationLog.setConsumerId(consumerWallet.getConsumerId());
newDurationLog.setNewId(sOrder.getConsumerId());
newDurationLog.setVariableDuration(anHour);
newDurationLog.setCurrentDuration(consumerWallet.getRemainingDuration());
newDurationLog.setOperationType(YesNoEnum.yes.getIndex());
......
......@@ -135,6 +135,10 @@ public class MonthlyCardOrderServiceImpl extends ServiceImpl<MonthlyCardOrderMap
throw new BaseException("请绑定手机号");
}
}
ConsumerMonthlyCard one = consumerMonthlyCardService.getOne(new LambdaQueryWrapper<ConsumerMonthlyCard>().eq(ConsumerMonthlyCard::getConsumerId, user.getId()));
if (ObjectUtil.isNotEmpty(one)) {
throw new BaseException("月卡一个月只能购买一次");
}
MonthlyCardOrder monthlyCardOrder = generatMonthlyCarddOrder(request, user);
monthlyCardOrder.setCreateTime(new Date());
save(monthlyCardOrder);
......@@ -175,6 +179,8 @@ public class MonthlyCardOrderServiceImpl extends ServiceImpl<MonthlyCardOrderMap
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, monthlyCardOrder.getConsumerId()));
MonthlyCardConf byId = monthlyCardConfService.getById(monthlyCardOrder.getMonthlyCardConfId());
consumerMonthlyCard.setMonthlyCardConfId(byId.getId());
consumerMonthlyCard.setConfName(byId.getName());
consumerMonthlyCard.setConfAmount(byId.getMonthlyCardAmount());
consumerMonthlyCard.setConsumerId(monthlyCardOrder.getConsumerId());
consumerMonthlyCard.setPhone(monthlyCardOrder.getPhone());
consumerMonthlyCard.setExpirationDate(DateUtils.addDays(new Date(), byId.getMonthlyCardDays().intValue()));
......
......@@ -471,7 +471,7 @@ public class OrderPayServiceImpl implements OrderPayService {
vo.setAttach(JSONObject.toJSONString(attachVo));
vo.setTerminal_trace(BaseUtil.getOrderNo("WXNO"));
vo.setTerminal_time(DateUtil.nowDate(Constants.DATE_TIME_FORMAT_NUM));
vo.setOrder_body(StrUtil.concat(true, "购买" + byId.getSecondaryCardAmount() + "元" + byId.getName() + "次卡"));
vo.setOrder_body(StrUtil.concat(true, "购买" + byId.getSecondaryCardAmount() + "元" + byId.getName()));
// 订单中使用的是BigDecimal,这里要转为Integer类型
vo.setTotal_fee(String.valueOf(secondaryCardOrder.getSecondaryCardAmount().multiply(BigDecimal.TEN).multiply(BigDecimal.TEN).intValue()));
vo.setNotify_url(apiDomain + PayConstants.SAOBEI_PAY_NOTIFY_API_URI);
......@@ -544,7 +544,7 @@ public class OrderPayServiceImpl implements OrderPayService {
vo.setAttach(JSONObject.toJSONString(attachVo));
vo.setTerminal_trace(BaseUtil.getOrderNo("WXNO"));
vo.setTerminal_time(DateUtil.nowDate(Constants.DATE_TIME_FORMAT_NUM));
vo.setOrder_body(StrUtil.concat(true, "购买" + byId.getMonthlyCardAmount() + "元" + byId.getName() + "月卡"));
vo.setOrder_body(StrUtil.concat(true, "购买" + byId.getMonthlyCardAmount() + "元" + byId.getMonthlyCardDays() + "天月卡"));
// 订单中使用的是BigDecimal,这里要转为Integer类型
vo.setTotal_fee(String.valueOf(monthlyCardOrder.getMonthlyCardAmount().multiply(BigDecimal.TEN).multiply(BigDecimal.TEN).intValue()));
vo.setNotify_url(apiDomain + PayConstants.SAOBEI_PAY_NOTIFY_API_URI);
......
......@@ -159,7 +159,7 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, SPack> implements I
}
@Override
public List<SPack> storeNameByIds(List<Long> longs) {
public List<SPack> packNameByIds(List<Long> longs) {
LambdaQueryWrapper<SPack> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.select(SPack::getId, SPack::getName);
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(longs)) {
......
......@@ -158,17 +158,16 @@ public class RoomLabelServiceImpl extends ServiceImpl<RoomLabelMapper, RoomLabel
@Override
public TableDataInfo pageList(RoomLabelDto roomLabel) {
List<RoomLabel> roomLabels = roomLabelMapper.pageList(roomLabel);
List<RoomLabelVo> voList = doListToVoList(roomLabels);
TableDataInfo tableDataInfo = new TableDataInfo();
tableDataInfo.setTotal(roomLabels.size());
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
int start = (pageNum - 1) * pageSize;
int end = Math.min(start + pageSize, voList.size());
List<RoomLabelVo> pagedList = voList.subList(start, end);
TableDataInfo tableDataInfo = new TableDataInfo();
tableDataInfo.setRows(pagedList);
tableDataInfo.setTotal(roomLabels.size());
int end = Math.min(start + pageSize, roomLabels.size());
List<RoomLabel> pagedList = roomLabels.subList(start, end);
List<RoomLabelVo> voList = doListToVoList(pagedList);
tableDataInfo.setRows(voList);
tableDataInfo.setCode(200);
tableDataInfo.setMsg("查询成功");
return tableDataInfo;
......
......@@ -591,7 +591,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
}
@Override
public List<SConsumerCoupon> storeNameByIds(List<Long> longs) {
public List<SConsumerCoupon> couponNameByIds(List<Long> longs) {
LambdaQueryWrapper<SConsumerCoupon> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.select(SConsumerCoupon::getId, SConsumerCoupon::getName);
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(longs)) {
......
......@@ -7,6 +7,9 @@ import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.core.page.PageDomain;
import share.common.core.page.TableDataInfo;
import share.common.core.page.TableSupport;
import share.common.enums.*;
import share.common.exception.base.BaseException;
import share.common.utils.DateUtils;
......@@ -81,11 +84,19 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
return new ArrayList<>();
}
List<Long> storeIds = roomList.stream().map(SRoom::getStoreId).collect(Collectors.toList());
List<Long> roomIds = roomList.stream().map(SRoom::getId).collect(Collectors.toList());
List<Map> storeList = sStoreService.optionList(storeIds);
List<SRoomPack> list = roomPackService.list(new LambdaQueryWrapper<SRoomPack>().in(SRoomPack::getRoomId, roomIds));
Map<Long, List<Long>> listMap = list.stream().collect(Collectors.groupingBy(SRoomPack::getRoomId, Collectors.mapping(SRoomPack::getPackId, Collectors.toList())));
List<SPack> packList = packService.list(new LambdaQueryWrapper<SPack>().eq(SPack::getType, YesNoEnum.yes.getIndex()));
Map<Long, List<SPack>> packMap = new HashMap<>();
//循环listMap
for (Map.Entry<Long, List<Long>> entry : listMap.entrySet()) {
packMap.put(entry.getKey(), packList.stream().filter(o -> entry.getValue().contains(o.getId())).collect(Collectors.toList()));
}
roomList.forEach(o -> {
List<Long> roomId = roomPackService.selectPackListByRoomId(o.getId());
o.setPackIds(roomId.stream().map(String::valueOf).collect(Collectors.joining(",")));
o.setPackList(packService.selectPackListByIds(roomId));
o.setPackIds(CollectionUtils.isNotEmpty(listMap.get(o.getId())) ? listMap.get(o.getId()).stream().map(String::valueOf).collect(Collectors.joining(",")) : "");
o.setPackList(CollectionUtils.isNotEmpty(packMap.get(o.getId())) ? packMap.get(o.getId()) : new ArrayList<>());
storeList.stream().forEach(store -> {
if (o.getStoreId().compareTo(Long.parseLong(store.get("id").toString())) == 0) {
o.setStoreName(store.getOrDefault("name", "").toString());
......@@ -476,7 +487,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
}
@Override
public List<SRoom> storeNameByIds(List<Long> longs) {
public List<SRoom> roomNameByIds(List<Long> longs) {
LambdaQueryWrapper<SRoom> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.select(SRoom::getId, SRoom::getName, SRoom::getImages, SRoom::getRoomType);
if (CollectionUtils.isNotEmpty(longs)) {
......@@ -485,4 +496,41 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
return this.list(queryWrapper);
}
@Override
public TableDataInfo pageList(SRoom sRoom) {
List<SRoom> roomList = baseMapper.selectSRoomList(sRoom);
TableDataInfo tableDataInfo = new TableDataInfo();
tableDataInfo.setTotal(roomList.size());
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
int start = (pageNum - 1) * pageSize;
int end = Math.min(start + pageSize, roomList.size());
List<SRoom> pagedList = roomList.subList(start, end);
List<Long> storeIds = pagedList.stream().map(SRoom::getStoreId).collect(Collectors.toList());
List<Long> roomIds = pagedList.stream().map(SRoom::getId).collect(Collectors.toList());
List<Map> storeList = sStoreService.optionList(storeIds);
List<SRoomPack> list = roomPackService.list(new LambdaQueryWrapper<SRoomPack>().in(SRoomPack::getRoomId, roomIds));
Map<Long, List<Long>> listMap = list.stream().collect(Collectors.groupingBy(SRoomPack::getRoomId, Collectors.mapping(SRoomPack::getPackId, Collectors.toList())));
List<SPack> packList = packService.list(new LambdaQueryWrapper<SPack>().eq(SPack::getType, YesNoEnum.yes.getIndex()));
Map<Long, List<SPack>> packMap = new HashMap<>();
//循环listMap
for (Map.Entry<Long, List<Long>> entry : listMap.entrySet()) {
packMap.put(entry.getKey(), packList.stream().filter(o -> entry.getValue().contains(o.getId())).collect(Collectors.toList()));
}
roomList.forEach(o -> {
o.setPackIds(CollectionUtils.isNotEmpty(listMap.get(o.getId())) ? listMap.get(o.getId()).stream().map(String::valueOf).collect(Collectors.joining(",")) : "");
o.setPackList(CollectionUtils.isNotEmpty(packMap.get(o.getId())) ? packMap.get(o.getId()) : new ArrayList<>());
storeList.stream().forEach(store -> {
if (o.getStoreId().compareTo(Long.parseLong(store.get("id").toString())) == 0) {
o.setStoreName(store.getOrDefault("name", "").toString());
}
});
});
tableDataInfo.setRows(pagedList);
tableDataInfo.setCode(200);
tableDataInfo.setMsg("查询成功");
return tableDataInfo;
}
}
......@@ -285,7 +285,7 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
LambdaQueryWrapper<SStore> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.ne(SStore::getStatus, StoreStatusEnum.STOP.getIndex());
if (StringUtils.isNotEmpty(request.getName())) {
queryWrapper.eq(SStore::getName, request.getName());
queryWrapper.like(SStore::getName, request.getName());
}
List<SStore> storeList = baseMapper.selectList(queryWrapper);
List<SStoreVo> voList = new ArrayList<>();
......
......@@ -165,6 +165,8 @@ public class SecondaryCardOrderServiceImpl extends ServiceImpl<SecondaryCardOrde
ConsumerSecondaryCard consumerSecondaryCard = new ConsumerSecondaryCard();
SecondaryCardConf secondaryCardConf = secondaryCardConfService.getById(secondaryCardOrder.getSecondaryCardConfId());
consumerSecondaryCard.setSecondaryCardConfId(secondaryCardOrder.getSecondaryCardConfId());
consumerSecondaryCard.setConfName(secondaryCardConf.getName());
consumerSecondaryCard.setConfAmount(secondaryCardConf.getSecondaryCardAmount());
consumerSecondaryCard.setConsumerId(secondaryCardOrder.getConsumerId());
consumerSecondaryCard.setPhone(secondaryCardOrder.getPhone());
consumerSecondaryCard.setSingleAmount(secondaryCardConf.getSingleAmount());
......
......@@ -27,6 +27,8 @@
<sql id="selectConsumerMonthlyCardVo">
select id,
monthly_card_conf_id,
conf_name,
conf_amount,
consumer_id,
phone,
free_duration,
......@@ -45,8 +47,8 @@
resultMap="ConsumerMonthlyCardResult">
select c.id,
c.monthly_card_conf_id,
c1.name as 'conf_name',
c1.monthly_card_amount as 'conf_amount',
c.conf_name,
c.conf_amount,
c.consumer_id,
c2.nick_name,
c2.avatar,
......@@ -60,7 +62,7 @@
c.update_by,
c.update_time,
c.remark
from s_consumer_monthly_card c join s_monthly_card_conf c1 on c.monthly_card_conf_id = c1.id
from s_consumer_monthly_card c
join s_consumer c2 on c.consumer_id = c2.id
where c.is_delete = 0
<if test="monthlyCardConfId != null ">and c.monthly_card_conf_id = #{monthlyCardConfId}</if>
......@@ -78,7 +80,8 @@
<select id="selectByConsumerId" resultMap="ConsumerMonthlyCardResult">
select c.id,
c.monthly_card_conf_id,
c1.name as 'conf_name', c1.monthly_card_amount as 'conf_amount',
c.conf_name,
c.conf_amount,
c.consumer_id,
c2.nick_name,
c2.avatar,
......@@ -94,7 +97,6 @@
c.remark
from s_consumer_monthly_card c
join s_consumer c2 on c.consumer_id = c2.id
join s_monthly_card_conf c1 on c.monthly_card_conf_id = c1.id
where c.is_delete = 0
and c.consumer_id = #{consumerId}
</select>
......
......@@ -28,6 +28,8 @@
<sql id="selectConsumerSecondaryCardVo">
select id,
secondary_card_conf_id,
conf_name,
conf_amount,
consumer_id,
phone,
single_duration,
......@@ -51,8 +53,8 @@
c.phone,
m.nick_name,
m.avatar,
c2.name as 'conf_name',
c2.secondary_card_amount as 'conf_amount',
c.conf_name,
c.conf_amount,
c.single_duration,
c.single_amount,
c.expiration_date,
......@@ -64,7 +66,6 @@
c.update_time,
c. remark
from s_consumer_secondary_card c join s_consumer m on c.consumer_id = m.id
join s_secondary_card_conf c2 on c.secondary_card_conf_id = c2.id
where
c.is_delete = 0
<if test="secondaryCardConfId != null ">and c.secondary_card_conf_id = #{secondaryCardConfId}</if>
......@@ -87,7 +88,8 @@
c.phone,
m.nick_name,
m.avatar,
s.name as 'conf_name', s.secondary_card_amount as 'conf_amount',
c.conf_name,
c.conf_amount,
c.single_duration,
c.single_amount,
c.expiration_date,
......@@ -100,8 +102,8 @@
c.remark
from s_consumer_secondary_card c
join s_consumer m on c.consumer_id = m.id
join s_secondary_card_conf s on c.secondary_card_conf_id = s.id
where c.is_delete = 0
and c.number > 0
and c.consumer_id = #{consumerId}
</select>
......
......@@ -22,6 +22,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="description" column="description" />
<result property="afreshNum" column="afresh_num" />
<result property="source" column="source" />
<result property="roomName" column="room_name"/>
<result property="storeName" column="store_name"/>
</resultMap>
<sql id="selectDeviceLogVo">
......@@ -40,6 +42,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
t1.dev_mac,
t1.dev_id,
t1.seq,
t3.name as 'room_name',
t4.name as 'store_name',
t1.mqtt_type,
t1.mqtt_describe,
t1.payload,
......
......@@ -21,6 +21,10 @@
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
<result property="durationType" column="duration_type"/>
<result property="newNickName" column="new_nick_name"/>
<result property="newPhone" column="new_phone"/>
<result property="newAvatar" column="new_avatar"/>
<result property="newId" column="new_id"/>
</resultMap>
<sql id="selectDurationLogVo">
......@@ -56,8 +60,13 @@
d.update_by,
d.update_time,
d.remark,
d.duration_type
d.duration_type,
e.nick_name as new_nick_name,
e.phone as new_phone,
e.avatar as new_avatar,
e.id as new_id
from s_duration_log d join s_consumer c on d.consumer_id = c.id
left join s_consumer e on d.new_id = e.id
<where>
<if test="nickName != null and nickName != ''">and c.nick_name like concat('%', #{nickName},'%')
</if>
......
......@@ -71,7 +71,7 @@
<if test="phone != null and phone != ''">and l.phone = #{phone}</if>
<if test="useDuration != null ">and l.use_duration = #{useDuration}</if>
<if test="residueDuration != null ">and l.residue_duration = #{residueDuration}</if>
order by l.create_time
order by l.create_time desc
</select>
<select id="selectMonthlyCardLogById" parameterType="Long" resultMap="MonthlyCardLogResult">
......
......@@ -98,6 +98,7 @@
<if test="endDate != null">
and DATE_FORMAT(o.create_time, '%Y-%m-%d') &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
</if>
order by o.create_time desc
</select>
<select id="selectMonthlyCardOrderById" parameterType="Long" resultMap="MonthlyCardOrderResult">
......
......@@ -97,6 +97,7 @@
<if test="endDate != null">
and DATE_FORMAT(o.create_time, '%Y-%m-%d') &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
</if>
order by o.create_time desc
</select>
<select id="selectSecondaryCardOrderById" parameterType="Long" resultMap="SecondaryCardOrderResult">
......
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