package com.stylefeng.guns.modular.system.service.impl;
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
import com.stylefeng.guns.core.shiro.ShiroKit;
|
import com.stylefeng.guns.core.util.DateUtil;
|
import com.stylefeng.guns.modular.system.controller.resp.TRechargeRecordUserResp;
|
import com.stylefeng.guns.modular.system.model.TBill;
|
import com.stylefeng.guns.modular.system.dao.TBillMapper;
|
import com.stylefeng.guns.modular.system.service.ITBillService;
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
import org.springframework.util.StringUtils;
|
|
import java.util.Date;
|
import java.util.List;
|
import java.util.Objects;
|
import java.util.stream.Collectors;
|
|
/**
|
* <p>
|
* 发票管理 服务实现类
|
* </p>
|
*
|
* @author stylefeng
|
* @since 2023-03-14
|
*/
|
@Service
|
public class TBillServiceImpl extends ServiceImpl<TBillMapper, TBill> implements ITBillService {
|
|
@Autowired
|
private TBillMapper tBillMapper;
|
|
@Override
|
public EntityWrapper<TBill> getPageListWrapper(String createTime, String addresseePhone, Integer state, Integer billType, Integer billHeaderType) {
|
EntityWrapper<TBill> wrapper = new EntityWrapper<>();
|
|
if(StringUtils.hasLength(createTime)){
|
String[] split = createTime.split(" - ");
|
Date startTime = DateUtil.getDate_str4(split[0]);
|
Date endTime = DateUtil.getDate_str4(split[1]);
|
wrapper.between("createTime",startTime,endTime);
|
}
|
if(StringUtils.hasLength(addresseePhone)){
|
wrapper.like("addresseePhone",addresseePhone);
|
}
|
if(Objects.nonNull(state)){
|
wrapper.eq("state",state);
|
}
|
if(Objects.nonNull(billType)){
|
wrapper.eq("billType",billType);
|
}
|
if(Objects.nonNull(billHeaderType)){
|
wrapper.eq("billHeaderType",billHeaderType);
|
}
|
return wrapper;
|
}
|
|
@Override
|
public List<TBill> getPageList(String createTime, String addresseePhone, Integer state, Integer billType, Integer billHeaderType) {
|
String startTime = null;
|
String endTime = null;
|
// 开始,结束时间
|
if(StringUtils.hasLength(createTime)){
|
String[] split = createTime.split(" - ");
|
startTime = split[0]+" 00:00:00";
|
endTime = split[1] + " 23:59:59";
|
}
|
Integer roleType = Objects.requireNonNull(ShiroKit.getUser()).getRoleType();
|
Integer objectId = Objects.requireNonNull(ShiroKit.getUser()).getObjectId();
|
return tBillMapper.getPageList(startTime, endTime, addresseePhone,state,billType,billHeaderType,roleType,objectId);
|
}
|
}
|