增加租户

This commit is contained in:
yuyang 2022-03-02 14:19:54 +08:00
parent f6976dd77e
commit ba608fba51
9 changed files with 38 additions and 16 deletions

View File

@ -27,7 +27,6 @@ public class XhpcDownCodeController extends BaseController {
@GetMapping(value = "/listStations")
public TableDataInfo listStations(String stationName){
startPage();
return getDataTable(iXhpcDownCodeService.listStations(stationName));
}

View File

@ -14,7 +14,7 @@ import java.util.Map;
@Mapper
public interface XhpcDownCodeMapper {
List<Map<String, Object>> selectStationsBy(@Param(value = "stationName") String stationName);
List<Map<String, Object>> selectStationsBy(@Param(value = "stationName") String stationName,@Param("tenantId") String tenantId);
List<Map<String, Object>> selectPilesBy(@Param(value = "stationId") Long stationId);

View File

@ -2,6 +2,8 @@ package com.xhpc.charging.station.service;
import com.xhpc.charging.station.mapper.XhpcDownCodeMapper;
import com.xhpc.charging.station.utils.img.DownMaterialUtil;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.system.api.model.LoginUser;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
@ -31,13 +33,15 @@ public class XhpcDownCodeServiceImpl implements IXhpcDownCodeService {
@Autowired
private Environment environment;
@Autowired
private TokenService tokenService;
private static final Logger logger = LoggerFactory.getLogger(XhpcDownCodeServiceImpl.class);
@Override
public List<Map<String, Object>> listStations(String stationName) {
return xhpcDownCodeMapper.selectStationsBy(stationName);
LoginUser loginUser = tokenService.getLoginUser();
return xhpcDownCodeMapper.selectStationsBy(stationName,loginUser.getTenantId());
}
@Override

View File

@ -15,6 +15,9 @@
<if test="null != stationName and '' != stationName">
and xcs.name like concat('%',#{stationName},'%')
</if>
<if test="null != tenantId and '' != tenantId">
and xcs.tenant_id =#{tenantId}
</if>
group by xcs.charging_station_id, xcs.name, xo.name
</select>

View File

@ -14,7 +14,7 @@ public interface XhpcSmsMapper {
int addXhpcSms(XhpcSms xhpcSms);
List<Map<String, Object>> getList(@Param("status") Integer status, @Param("phone") String phone);
List<Map<String, Object>> getList(@Param("status") Integer status, @Param("phone") String phone,@Param("tenantId")String tenantId);
/**
* 查询阿里云中发送失败的短信条数
@ -24,7 +24,7 @@ public interface XhpcSmsMapper {
* @date 2021/11/29 14:11
* @since version-1.0
*/
Long querySumOfFailMessage();
Long querySumOfFailMessage(@Param("tenantId")String tenantId);
/**
* 查询阿里云中的发送成功的短信条数
@ -34,7 +34,7 @@ public interface XhpcSmsMapper {
* @date 2021/11/29
* @since version-1.0
*/
Long querySumOfSuccessMessage();
Long querySumOfSuccessMessage(@Param("tenantId")String tenantId);
/**
* 查询所有发送的短信的总记录数包括异常失败

View File

@ -7,11 +7,13 @@ import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
import com.aliyun.dysmsapi20170525.models.SendSmsResponseBody;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.redis.service.RedisService;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.general.constant.AliyunSendResult;
import com.xhpc.general.constant.AliyunTemplate;
import com.xhpc.general.domain.XhpcSms;
import com.xhpc.general.mapper.XhpcSmsMapper;
import com.xhpc.general.util.sms.SmsUtil;
import com.xhpc.system.api.model.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -41,6 +43,8 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService {
private RedisService redisService;
@Autowired
private XhpcSmsMapper xhpcSmsMapper;
@Autowired
private TokenService tokenService;
@PostConstruct
public void init() {
@ -61,8 +65,8 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService {
@Override
public List<Map<String, Object>> getList(Integer status, String phone) {
return xhpcSmsMapper.getList(status,phone);
LoginUser loginUser = tokenService.getLoginUser();
return xhpcSmsMapper.getList(status,phone,loginUser.getTenantId());
}
@Override
@ -179,9 +183,9 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService {
@Override
public Object getAliyunShortMessageInfo() {
Long successMessage = xhpcSmsMapper.querySumOfSuccessMessage();
Long failMessage = xhpcSmsMapper.querySumOfFailMessage();
LoginUser loginUser = tokenService.getLoginUser();
Long successMessage = xhpcSmsMapper.querySumOfSuccessMessage(loginUser.getTenantId());
Long failMessage = xhpcSmsMapper.querySumOfFailMessage(loginUser.getTenantId());
Long sumOfMessage = successMessage + failMessage;
Map<String, Long> messageInfoMap = new HashMap<>();
messageInfoMap.put("successMessage", successMessage);

View File

@ -104,6 +104,9 @@
<if test="null!=status">
and status=#{status}
</if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id= #{tenantId}
</if>
<if test="null!=phone and ''!=phone">
and phone like concat('%',#{phone},'%')
</if>
@ -115,16 +118,19 @@
FROM xhpc_sms
WHERE status = 1
AND del_flag = 0
<if test="tenantId !=null and tenantId !=''">
and tenant_id= #{tenantId}
</if>
</select>
<select id="querySumOfSuccessMessage" resultType="java.lang.Long">
SELECT count(sms_id)
FROM xhpc_sms
WHERE remark LIKE "%bizId%"
AND del_flag = 0
<if test="tenantId !=null and tenantId !=''">
and tenant_id= #{tenantId}
</if>
</select>
<select id="querySumOfMessage" resultType="java.lang.Long">

View File

@ -8,6 +8,7 @@ import com.xhpc.common.core.utils.DateUtils;
import com.xhpc.common.core.utils.bean.BeanUtils;
import com.xhpc.common.domain.XhpcChargingStation;
import com.xhpc.common.redis.service.RedisService;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.common.util.DateUtil;
import com.xhpc.invoice.constant.InvoiceMapHistoryOrderStatusConst;
import com.xhpc.invoice.constant.InvoiceStatusConst;
@ -21,6 +22,7 @@ import com.xhpc.invoice.pojo.XhpcInvoiceMapHistoryOrder;
import com.xhpc.invoice.service.XhpcInvoiceService;
import com.xhpc.order.domain.XhpcHistoryOrder;
import com.xhpc.system.api.domain.SysUser;
import com.xhpc.system.api.model.LoginUser;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -61,6 +63,8 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
Environment environment;
@Resource
RedisService redisService;
@Resource
TokenService tokenService;
/**
* 通过requestData中的申请人申请人类型发票类型发票状态发票起始时间发票申请终止时间开票起始时间开票终点时间当前所在页数当前页所要显示几行来查询发票列表信息
@ -76,6 +80,8 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
//计算分页索引
requestData.setCurrentPage((requestData.getCurrentPage() - 1) * requestData.getItems());
//获取每张发票信息
LoginUser loginUser = tokenService.getLoginUser();
requestData.setTenantId(loginUser.getTenantId());
List<XhpcInvoice> xhpcInvoiceList = xhpcInvoiceMapper.selectAllInvoiceOrdersByCondition(requestData);
//对拷放置到itemsDTO中,然后将itemsDTO存放到itemsDTOList中
ArrayList<AllInvoiceOrdersResponse.ItemsDTO> itemsDTOList = new ArrayList<>();

View File

@ -96,7 +96,7 @@
<if test="invoiceType!=null">
and invoice_type = #{invoiceType}
</if>
<if test="tenantId!=null">
<if test="tenantId!=null and tenantId !=''">
and tenant_id = #{tenantId}
</if>
<if test="status!=null">