Merge branch 'development'

# Conflicts:
#	xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcSmsController.java
This commit is contained in:
ZZ 2022-01-04 13:44:42 +08:00
commit adc48e81f7
47 changed files with 1321 additions and 1718 deletions

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -27,7 +27,7 @@ public class TokenService {
@Autowired
private RedisService redisService;
private final static long EXPIRE_TIME = Constants.TOKEN_EXPIRE * 60;
private final static long EXPIRE_TIME = Constants.TOKEN_EXPIRE * 6000;
private final static String ACCESS_TOKEN = CacheConstants.LOGIN_TOKEN_KEY;

View File

@ -34,6 +34,7 @@ import javax.annotation.Resource;
*/
@Component
public class AuthFilter implements GlobalFilter, Ordered {
private static final Logger log = LoggerFactory.getLogger(AuthFilter.class);
private final static long EXPIRE_TIME = Constants.TOKEN_EXPIRE * 60;
@ -50,6 +51,7 @@ public class AuthFilter implements GlobalFilter, Ordered {
@Override
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
String url = exchange.getRequest().getURI().getPath();
// 跳过不需要验证的路径
if (StringUtils.matches(url, ignoreWhite.getWhites())) {
@ -80,7 +82,7 @@ public class AuthFilter implements GlobalFilter, Ordered {
.header(CacheConstants.DETAILS_USERNAME, ServletUtils.urlEncode(username)).build();
ServerWebExchange mutableExchange = exchange.mutate().request(mutableReq).build();
return chain.filter(mutableExchange);
return chain.filter(exchange);
}
private Mono<Void> setUnauthorizedResponse(ServerWebExchange exchange, String msg) {

View File

@ -16,10 +16,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置
@ -35,7 +35,7 @@ spring:
datasource:
ds1:
nacos:
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
dataId: sentinel-ruoyi-gateway
groupId: DEFAULT_GROUP
data-type: json

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -193,10 +193,10 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService {
if (xhpc.getSerialNumber() != xhpc.getSerialNumber()) {
return AjaxResult.error("桩编号不能编辑");
}
if(xhpcChargingPile.getGunNumber() ==null || xhpcChargingPile.getGunNumber()>26){
if (xhpcChargingPile.getGunNumber() == null || xhpcChargingPile.getGunNumber() > 26) {
return AjaxResult.error("终端数量不能大于26");
}
if (!xhpcChargingPile.getGunNumber().equals(xhpc.getGunNumber())) {
if (!xhpcChargingPile.getGunNumber().equals(xhpc.getGunNumber()) || !xhpcChargingPile.getSerialNumber().equals(xhpc.getSerialNumber())) {
//删除之前的终端
xhpcChargingPileMapper.updateXhpcTerminal(chargingPileId);
int number = xhpcChargingPileMapper.countXhpcTerminal(xhpcChargingPile.getChargingStationId());

View File

@ -0,0 +1,17 @@
package com.xhpc.general.constant;
/**
* 阿里云短信服务发送结果常量类
*
* @author WH
* @date 2021/12/30 14:56
* @since version-1.0
*/
public class AliyunSendResult {
/**
* 短信发送成功
*/
public static final String SUCCESS = "OK";
}

View File

@ -0,0 +1,42 @@
package com.xhpc.general.constant;
/**
* 阿里云短信模板常量类
*
* @author WH
* @date 2021/12/30 14:40
* @since version-1.0
*/
public class AliyunTemplate {
/**
* 阿里云短信签名
*/
public static final String SIGNATURE_NAME = "小华充电";
/**
* 电量充满
*/
public static final String CHARGE_FULL = "SMS_227005968";
/**
* 充电金额不足
*/
public static final String CHARGE_MONEY_INSUFFICIENT = "SMS_226935795";
/**
* 直流桩停止充电
*/
public static final String DIRECT_STREAM_PILE_STOP_CHARGE = "SMS_226945037";
/**
* 直流桩停止充电
*/
public static final String INTERFLOW_STREAM_PILE_STOP_CHARGE = "SMS_226786374";
/**
* 验证码
*/
public static final String VALIDATE_CODE = "SMS_226786362";
/**
* 退款失败
*/
public static final String REFUND_FAIL = "SMS_231445428";
}

View File

@ -0,0 +1,38 @@
package com.xhpc.general.constant;
/**
* 阿里云模板内容关键字常量类
* 根据模板话语判断该调用哪个模板id
*
* @author WH
* @date 2021/12/30 15:59
* @since version-1.0
*/
public class AliyunTemplateKeyWord {
/**
* 电量充满
*/
public static final String CHARGE_FULL = "设定的SOC";
/**
* 充电金额不足
*/
public static final String CHARGE_MONEY_INSUFFICIENT = "余额小于";
/**
* 直流桩停止充电
*/
public static final String DIRECT_STREAM_PILE_STOP_CHARGE = "电量为";
/**
* 直流桩停止充电
*/
public static final String INTERFLOW_STREAM_PILE_STOP_CHARGE = "总费用为";
/**
* 验证码
*/
public static final String VALIDATE_CODE = "SMS_226786362";
/**
* 退款失败
*/
public static final String REFUND_FAIL = "退款-尊敬的用户";
}

View File

@ -1,11 +1,10 @@
package com.xhpc.general.controller;
import com.xhpc.common.api.UserTypeService;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.general.constant.AliyunTemplate;
import com.xhpc.general.constant.AliyunTemplateKeyWord;
import com.xhpc.general.service.IXhpcSmsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -23,13 +22,12 @@ public class XhpcSmsController extends BaseController {
@Autowired
private IXhpcSmsService xhpcSmsService;
@Autowired
private UserTypeService userTypeService;
/**
* 注册获取手机号验证码
*/
@GetMapping(value = "/getLogonPhoneCode")
public AjaxResult getLogonPhoneCode(@RequestParam("phone") String phone,@RequestParam("tenantId")String tenantId) {
public AjaxResult getLogonPhoneCode(@RequestParam("phone") String phone) {
String signatureName = null;
String templateId = null;
@ -37,20 +35,7 @@ public class XhpcSmsController extends BaseController {
signatureName = "小华充电";
templateId = "SMS_226786362";
if(phone !=null || "".equals(phone)){
if(!UserTypeUtil.COMMUNIT.equals(phone.substring(0,2)) && !UserTypeUtil.CUSTOMERS.equals(phone.substring(0,2))){
//C端用户
return xhpcSmsService.getLogonPhoneCode(phone, signatureName, templateId,null);
}else if (UserTypeUtil.COMMUNIT.equals(phone.substring(0,2)) || UserTypeUtil.CUSTOMERS.equals(phone.substring(0,2))){
R user = userTypeService.getUser(phone, null, null, null,tenantId);
if(user !=null && user.getData() !=null){
Map<String, Object> map = (Map<String, Object>)user.getData();
return xhpcSmsService.getLogonPhoneCode(map.get("phone").toString(), signatureName, templateId,map.get("account").toString());
}
}
}
return AjaxResult.error("1003", "请输入正确的手机号或账号");
return xhpcSmsService.getLogonPhoneCode(phone, signatureName, templateId);
}
@GetMapping(value = "/getList")
@ -75,21 +60,21 @@ public class XhpcSmsController extends BaseController {
paramMap.remove("phone");
paramMap.remove("content");
//判断内容是什么调用相应的模板
if (content.contains("电量为")) {
signatureName = "小华充电";
templateId = "SMS_226945037";
} else if (content.contains("总费用为")) {
signatureName = "小华充电";
templateId = "SMS_226786374";
} else if (content.contains("余额小于")) {
signatureName = "小华充电";
templateId = "SMS_226935795";
} else if (content.contains("设定的SOC")) {
signatureName = "小华充电";
templateId = "SMS_227005968";
}else if (content.contains("退款-尊敬的用户")) {
signatureName = "小华充电";
templateId = "SMS_231445428";
if (content.contains(AliyunTemplateKeyWord.DIRECT_STREAM_PILE_STOP_CHARGE)) {
signatureName = AliyunTemplate.SIGNATURE_NAME;
templateId = AliyunTemplate.DIRECT_STREAM_PILE_STOP_CHARGE;
} else if (content.contains(AliyunTemplateKeyWord.INTERFLOW_STREAM_PILE_STOP_CHARGE)) {
signatureName = AliyunTemplate.SIGNATURE_NAME;
templateId = AliyunTemplate.INTERFLOW_STREAM_PILE_STOP_CHARGE;
} else if (content.contains(AliyunTemplateKeyWord.CHARGE_MONEY_INSUFFICIENT)) {
signatureName = AliyunTemplate.SIGNATURE_NAME;
templateId = AliyunTemplate.CHARGE_MONEY_INSUFFICIENT;
} else if (content.contains(AliyunTemplateKeyWord.CHARGE_FULL)) {
signatureName = AliyunTemplate.SIGNATURE_NAME;
templateId = AliyunTemplate.CHARGE_FULL;
} else if (content.contains(AliyunTemplateKeyWord.REFUND_FAIL)) {
signatureName = AliyunTemplate.SIGNATURE_NAME;
templateId = AliyunTemplate.REFUND_FAIL;
}
xhpcSmsService.sendNotice(phone, signatureName, templateId, paramMap);
@ -100,9 +85,4 @@ public class XhpcSmsController extends BaseController {
Object messageInfo = xhpcSmsService.getAliyunShortMessageInfo();
return AjaxResult.success(messageInfo);
}
public static void main(String[] args) {
String phone="ST18123374";
System.out.println(phone.substring(0,2));
}
}

View File

@ -7,6 +7,8 @@ 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.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;
@ -115,7 +117,7 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService {
//判断发送结果
String statusCode = neededParam.get("statusCode");
if (statusCode.equals("OK")) {
if (statusCode.equals(AliyunSendResult.SUCCESS)) {
REDIS.setCacheObject(pvToken, random, 300L, TimeUnit.SECONDS);
//1分钟有效时间设置防止用户频繁调用
REDIS.setCacheObject(token, random, 60L, TimeUnit.SECONDS);
@ -164,7 +166,7 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService {
//判断发送结果
String statusCode = neededParam.get("statusCode");
if ("OK".equals(statusCode)) {
if (AliyunSendResult.SUCCESS.equals(statusCode)) {
xhpcSms.setStatus(0);
} else {
xhpcSms.setStatus(1);
@ -229,40 +231,30 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService {
private String getTemplateContent(String templateId, Map<String, String> paramMap) throws Exception {
if (templateId == "SMS_227005968") {
if (AliyunTemplate.CHARGE_FULL.equals(templateId)) {
String battery = paramMap.get("battery");
String templateContent = "尊敬的用户你的车辆已充电达至设定的SOC:" + battery + "%并停止充电,请您尽快将车辆挪走以方便他人使用充电桩,谢谢合作。";
return templateContent;
return "尊敬的用户你的车辆已充电达至设定的SOC:" + battery + "%并停止充电,请您尽快将车辆挪走以方便他人使用充电桩,谢谢合作。";
}
if (templateId == "SMS_226935795") {
if (AliyunTemplate.CHARGE_MONEY_INSUFFICIENT.equals(templateId)) {
String money = paramMap.get("money");
String templateContent = "尊敬的用户,你的账户余额小于" + money + "元,为不影响您的正常充电,请您尽快充值交费,谢谢。";
return templateContent;
return "尊敬的用户,你的账户余额小于" + money + "元,为不影响您的正常充电,请您尽快充值交费,谢谢。";
}
if (templateId == "SMS_226786374") {
String sumMoney = paramMap.get("sumMoney");
String templateContent = "尊敬的用户,你的爱车已停止充电,请尽快挪车。总费用为:" + sumMoney + "元,充电费用明细,请查询小华充电小程序,谢谢。";
return templateContent;
}
if (templateId == "SMS_227005968") {
if (AliyunTemplate.DIRECT_STREAM_PILE_STOP_CHARGE.equals(templateId)) {
String elec = paramMap.get("elec");
String sumMoney = paramMap.get("sumMoney");
String templateContent = "尊敬的用户,你的爱车已停止充电,请尽快挪车。电量为:" + elec + ",总费用为:" + sumMoney + "元,充电费用明细,请查询小华充电小程序,谢谢。";
return templateContent;
return "尊敬的用户,你的爱车已停止充电,请尽快挪车。电量为:" + elec + ",总费用为:" + sumMoney + "元,充电费用明细,请查询小华充电小程序,谢谢。";
}
if (templateId == "SMS_226786362") {
if (AliyunTemplate.INTERFLOW_STREAM_PILE_STOP_CHARGE.equals(templateId)) {
String sumMoney = paramMap.get("sumMoney");
return "尊敬的用户,你的爱车已停止充电,请尽快挪车。总费用为:" + sumMoney + "元,充电费用明细,请查询小华充电小程序,谢谢。";
}
if (AliyunTemplate.VALIDATE_CODE.equals(templateId)) {
String code = paramMap.get("code");
String templateContent = "您的验证码是:" + code + "有效期为5分钟。如非本人操作可不用理会。";
return templateContent;
return "您的验证码是:" + code + "有效期为5分钟。如非本人操作可不用理会。";
}
if (templateId == "SMS_231445428") {
String templateContent = "【小华充电】退款-尊敬的用户,当前退款人数较多,申请退款失败,请您重新提交申请!";
return templateContent;
if (AliyunTemplate.REFUND_FAIL.equals(templateId)) {
return "【小华充电】退款-尊敬的用户,当前退款人数较多,申请退款失败,请您重新提交申请!";
}
throw new Exception("没有对应的模板id");
}
}

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -109,6 +109,12 @@
<version>3.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>3.10.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

View File

@ -2,6 +2,8 @@ package com.xhpc.invoice.api;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.invoice.domain.*;
import com.xhpc.invoice.service.XhpcInvoiceService;
import org.springframework.web.bind.annotation.*;
@ -22,6 +24,35 @@ public class XhpcInvoiceApiController extends BaseController {
@Resource
XhpcInvoiceService xhpcInvoiceService;
/**
* 查询用户显示小红点即查询用户有几个未读的已开发票
*
* @author WH
* @date 2021/12/28 18:51
* @since version-1.0
*/
@GetMapping("/user/no-read")
public AjaxResult findNotReadCount(@RequestParam Long creatorId, @RequestParam Integer creatorType) {
Long notRead = xhpcInvoiceService.findNotReadCount(creatorId, creatorType);
return AjaxResult.success(notRead);
}
/**
* 保存用户提交的开发票的信息
*
* @author WH
* @date 2021/12/28 14:54
* @since version-1.0
*/
@Log(title = "用户要开发票", businessType = BusinessType.INSERT)
@PostMapping("/user/commit")
public AjaxResult saveInvoiceInfo(@RequestBody SaveInvoiceInfoRequest saveInvoiceInfoRequest) throws Exception {
xhpcInvoiceService.saveInvoiceInfo(saveInvoiceInfoRequest);
return AjaxResult.success();
}
/**
* 查询用户开发票的历史记录
*
@ -29,15 +60,15 @@ public class XhpcInvoiceApiController extends BaseController {
* @date 2021/12/27 12:23
* @since version-1.0
*/
@PostMapping(value = "/selectInvoiceHistoryRecords")
public AjaxResult selectInvoiceHistoryRecords(@RequestBody InvoiceHistoryRecordsRequest invoiceHistoryRecordsRequest) {
@GetMapping(value = "/user/history")
public AjaxResult findInvoiceHistoryRecords(@RequestBody InvoiceHistoryRecordsRequest invoiceHistoryRecordsRequest) {
InvoiceHistoryRecordsResponse invoiceHistoryRecordsResponse = xhpcInvoiceService.selectInvoiceHistoryRecords(invoiceHistoryRecordsRequest);
InvoiceHistoryRecordsResponse invoiceHistoryRecordsResponse = xhpcInvoiceService.findInvoiceHistoryRecords(invoiceHistoryRecordsRequest);
return AjaxResult.success(invoiceHistoryRecordsResponse);
}
/**
* 回显已经处理的开的的电子发票详情信息
* 回显电子发票详情信息
*
* @param invoiceId 要回显的发票id
* @return 返回包含了指定数据的AjaxResult
@ -45,28 +76,28 @@ public class XhpcInvoiceApiController extends BaseController {
* @date 2021/12/27 13:11
* @since version-1.0
*/
@GetMapping(value = "/selectSpecificInvoiced")
public AjaxResult selectSpecificInvoiced(@RequestParam Long invoiceId) {
@GetMapping(value = "/specific-info")
public AjaxResult findSpecificInvoicedInfo(@RequestParam Long invoiceId) {
SpecificInvoicedResponse specificInvoicedResponse = xhpcInvoiceService.selectSpecificInvoiced(invoiceId);
SpecificInvoicedResponse specificInvoicedResponse = xhpcInvoiceService.findSpecificInvoicedInfo(invoiceId);
return AjaxResult.success(specificInvoicedResponse);
}
/**
* 根据用户id用户类型要查询的当前时间的年月日查询该用户3个月内可以开发票的订单
* 根据用户id用户类型要查询的当前时间的年月日查询该用户3个月内可以开发票的历史订单
*
* @author WH
* @date 2021/12/24 14:10
* @since version-1.0
*/
@PostMapping(value = "/selectInvoicedOrders")
public AjaxResult selectInvoicedOrders(@RequestBody InvoicedOrdersRequest invoicedOrdersRequest) {
@GetMapping(value = "/user/history-orders")
public AjaxResult findUserHistoryOrders(@RequestBody InvoicedOrdersRequest invoicedOrdersRequest) {
if (invoicedOrdersRequest.getCurrentPage() == null || invoicedOrdersRequest.getItems() == null) {
return AjaxResult.error("分页参数不能为空:当前页数参数或当页要显示的条数为空");
}
InvoiceOrdersResponse invoiceOrdersResponse = xhpcInvoiceService.selectInvoicedOrders(invoicedOrdersRequest);
InvoiceOrdersResponse invoiceOrdersResponse = xhpcInvoiceService.findUserHistoryOrders(invoicedOrdersRequest);
return AjaxResult.success(invoiceOrdersResponse);
@ -79,24 +110,24 @@ public class XhpcInvoiceApiController extends BaseController {
* @date 2021/12/23 15:07
* @since version-1.0
*/
@GetMapping(value = "/selectInvoiceTitleInfo")
public AjaxResult selectInvoiceTitleInfo(@RequestParam(value = "firmName") String firmName) {
@GetMapping(value = "/title-info")
public AjaxResult findTitleInfo(@RequestParam(value = "firmName") String firmName) {
InvoiceTitleResponse invoiceTitleResponse = xhpcInvoiceService.selectInvoiceTitleInfo(firmName);
InvoiceTitleResponse invoiceTitleResponse = xhpcInvoiceService.findTitleInfo(firmName);
return AjaxResult.success(invoiceTitleResponse);
}
/**
* 查询用户最后一次输入的发票信息
* 查询用户最后一次所提交的发票信息
*
* @author WH
* @date 2021/12/23 15:07
* @since version-1.0
*/
@GetMapping(value = "/selectUserInputInvoiceInfo")
public AjaxResult selectUserInputInvoiceInfo(@RequestParam(value = "creatorId") Long creatorId, @RequestParam("creatorType") Integer creatorType) {
@GetMapping(value = "/user/last-info")
public AjaxResult findUserLastInputInfo(@RequestParam(value = "creatorId") Long creatorId, @RequestParam("creatorType") Integer creatorType) {
TitleResponse titleResponse = xhpcInvoiceService.selectUserInputInvoiceInfo(creatorId, creatorType);
TitleResponse titleResponse = xhpcInvoiceService.findUserLastInputInfo(creatorId, creatorType);
return AjaxResult.success(titleResponse);
}

View File

@ -0,0 +1,27 @@
package com.xhpc.invoice.constant;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 发票所包含的订单状态的常量类
*
* @author WH
* @date 2021/12/29 10:34
* @since version-1.0
*/
@Data
@NoArgsConstructor
public class InvoiceMapHistoryOrderStatusConst {
/**
* 已被发票包含即锁定
*/
public static final Integer LOCK = 0;
/**
* 解除发票包含关系即解锁
*/
public static final Integer UNLOCK = 0;
}

View File

@ -1,4 +1,4 @@
package com.xhpc.invoice.constPackage;
package com.xhpc.invoice.constant;
import lombok.Data;
import lombok.NoArgsConstructor;

View File

@ -1,19 +1,26 @@
package com.xhpc.invoice.controller;
import com.aliyun.oss.OSSClient;
import com.xhpc.common.core.utils.DateUtils;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.invoice.constPackage.InvoiceStatusConst;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.invoice.constant.InvoiceStatusConst;
import com.xhpc.invoice.domain.AllInvoiceOrdersRequest;
import com.xhpc.invoice.domain.AllInvoiceOrdersResponse;
import com.xhpc.invoice.domain.InvoiceToUserRequest;
import com.xhpc.invoice.domain.SpecificInvoiceWrap;
import com.xhpc.invoice.service.XhpcInvoiceService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
@ -29,6 +36,51 @@ public class XhpcInvoiceController extends BaseController {
@Resource
XhpcInvoiceService xhpcInvoiceService;
@Resource
Environment environment;
/**
* 导出发票Excel接口
*
* @author WH
* @date 2021/12/29 16:45
* @since version-1.0
*/
@GetMapping("/excel")
public AjaxResult exportExcel(@RequestParam("invoiceIds") String invoiceIds, HttpServletResponse response) throws IOException {
//处理字符串转换成数组
String[] ids = invoiceIds.split(",");
List<String> resultList = Arrays.asList(ids);
xhpcInvoiceService.exportExcel(resultList, response);
return AjaxResult.success();
}
/**
* 上传图片到阿里云接口
*
* @param invoicePdf 文件二进制对象
* @return 该文件在阿里云中的地址
*
* @author WH
* @date 2021/12/29 16:40
* @since version-1.0
*/
@Log(title = "电子发票上传", businessType = BusinessType.INSERT)
@PostMapping("/pdf")
public AjaxResult uploadPdf(MultipartFile invoicePdf) throws IOException {
String filename = "electricInvoice" + DateUtils.dateTimeNow() + ".pdf";
// 上传文件到阿里云
OSSClient ossClient = new OSSClient(environment.getProperty("oss.endpoint"), environment.getProperty("oss.access-key"), environment.getProperty("oss.secret-key"));
// 放置到哪个块中去key为目录file为文件
ossClient.putObject(environment.getProperty("oss.bucket-name"), environment.getProperty("file.aliyunPath") + filename, invoicePdf.getInputStream());
ossClient.shutdown();
// 返回上传到阿里云中的文件的uri地址
String fileAddress = "/" + environment.getProperty("file.aliyunPath") + filename;
return AjaxResult.success(fileAddress);
}
/**
* 给指定用户开发票开票完成之后将开出的电子发票发送至用户的接收邮箱
@ -38,7 +90,8 @@ public class XhpcInvoiceController extends BaseController {
* @date 2021/12/22 12:03
* @since version-1.0
*/
@PostMapping("/invoiceToUser")
@Log(title = "用户提交发票状态", businessType = BusinessType.UPDATE)
@PatchMapping()
public AjaxResult invoiceToUser(@RequestBody InvoiceToUserRequest requestData) {
//前置条件
if (requestData.getInvoiceId() == null) {
@ -79,13 +132,13 @@ public class XhpcInvoiceController extends BaseController {
* @date 2021/12/21 11:33
* @since version-1.0
*/
@PostMapping("/selectAllInvoiceOrders")
public AjaxResult selectAllInvoiceOrders(@RequestBody AllInvoiceOrdersRequest requestData) {
@GetMapping("/all-info")
public AjaxResult findAllInvoiceOrders(@RequestBody AllInvoiceOrdersRequest requestData) {
if (requestData.getCurrentPage() == null || requestData.getItems() == null) {
return AjaxResult.error("当前页数、每页要显示的条数为必传递项");
}
AllInvoiceOrdersResponse allInvoiceOrdersResponse = xhpcInvoiceService.selectAllInvoiceOrders(requestData);
AllInvoiceOrdersResponse allInvoiceOrdersResponse = xhpcInvoiceService.findAllInvoiceOrders(requestData);
return AjaxResult.success(allInvoiceOrdersResponse);
}
@ -98,11 +151,11 @@ public class XhpcInvoiceController extends BaseController {
* @date 2021/12/20 10:48
* @since version-1.0
*/
@PostMapping("/selectSpecificInvoice")
public AjaxResult selectSpecificInvoice(@RequestBody Map<String, Object> invoiceIdMap) {
@GetMapping("/detail")
public AjaxResult findSpecificInvoice(@RequestBody Map<String, Object> invoiceIdMap) {
Long invoiceId = Long.valueOf(String.valueOf(invoiceIdMap.get("invoiceId")));
SpecificInvoiceWrap specificInvoiceWrap = xhpcInvoiceService.selectSpecificInvoice(invoiceId);
SpecificInvoiceWrap specificInvoiceWrap = xhpcInvoiceService.findSpecificInvoice(invoiceId);
if (specificInvoiceWrap == null) {
return AjaxResult.error("要回显的订单发票id有误");
}

View File

@ -25,6 +25,11 @@ public class AllInvoiceOrdersRequest {
*/
@JsonProperty("creatorType")
private Integer creatorType;
/**
* 发票类型 0为普票1为专票
*/
@JsonProperty("invoiceType")
private Integer invoiceType;
/**
* 发票状态0表示未开票1表示已经开票2表示开票失败
*/

View File

@ -58,6 +58,11 @@ public class AllInvoiceOrdersResponse {
*/
@JsonProperty("creatorType")
private Integer creatorType;
/**
* 发票类型 0为普票1为专票
*/
@JsonProperty("invoiceType")
private Integer invoiceType;
/**
* 发票金额
*/

View File

@ -0,0 +1,47 @@
package com.xhpc.invoice.domain;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 用于存储导出发票的一行记录的Bean类
*
* @author WH
* @date 2021/12/30 14:13
* @since version-1.0
*/
@Data
@NoArgsConstructor
public class ExcelInvoiceRow {
private Integer rowsNumber;
private String invoiceType;
private String receiveEmail;
private String titleType;
private String titleContent;
private String dutyNumber;
private String invoiceContent;
private String invoiceOrderElectricTotalMoney;
private String invoiceOrderServiceTotalMoney;
private String firmAddress;
private String firmPhone;
private String firmBank;
private String firmBankAccount;
private String isShowDate;
private String userNotes;
private String creatorType;
private String iCreateTime;
private String invoicingTime;
private String drawer;
private String financeNotes;
private String electricInvoiceUrl;
private String isRead;
private String historySerialNumber;
private String powerPriceTotal;
private String servicePriceTotal;
private String promotionDiscount;
private String historyActPrice;
private String hCreateTime;
private String chargingMode;
}

View File

@ -35,6 +35,8 @@ public class InvoiceHistoryRecordsResponse {
private Integer status;
@JsonProperty("invoicingMoney")
private BigDecimal invoicingMoney;
@JsonProperty("isRead")
private Integer isRead;
}

View File

@ -0,0 +1,57 @@
package com.xhpc.invoice.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.List;
/**
* POST /invoice/接口的请求包装类
*
* @author WH
* @date 2021/12/28 14:29
* @since version-1.0
*/
@NoArgsConstructor
@Data
public class SaveInvoiceInfoRequest {
@JsonProperty("receiveEmail")
private String receiveEmail;
@JsonProperty("titleType")
private Integer titleType;
@JsonProperty("titleContent")
private String titleContent;
@JsonProperty("dutyNumber")
private String dutyNumber;
@JsonProperty("invoiceContent")
private String invoiceContent;
@JsonProperty("invoiceMoney")
private BigDecimal invoiceMoney;
@JsonProperty("firmAddress")
private String firmAddress;
@JsonProperty("firmPhone")
private String firmPhone;
@JsonProperty("firmBank")
private String firmBank;
@JsonProperty("firmBankAccount")
private String firmBankAccount;
@JsonProperty("isShowDate")
private Integer isShowDate;
@JsonProperty("userNotes")
private String userNotes;
@JsonProperty("creatorId")
private Long creatorId;
@JsonProperty("creatorType")
private Integer creatorType;
@JsonProperty("creator")
private String creator;
@JsonProperty("createTime")
private String createTime;
@JsonProperty("historyOrderIds")
private List<Integer> historyOrderIds;
}

View File

@ -1,14 +1,6 @@
package com.xhpc.invoice.mapper;
import com.xhpc.common.domain.XhpcChargingStation;
import com.xhpc.common.domain.XhpcRate;
import com.xhpc.common.domain.XhpcRateModel;
import com.xhpc.common.domain.XhpcRateTime;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 电站Mapper接口
@ -26,245 +18,4 @@ public interface XhpcChargingStationMapper {
*/
XhpcChargingStation selectXhpcChargingStationById(Long chargingStationId);
/**
* 查询电站
*
* @param chargingStationName 电站名称
* @return 电站
*/
XhpcChargingStation selectXhpcChargingStationByName(String chargingStationName);
/**
* 查询电站列表
*
* @param name 电站名称
* @param operatorName 运营商名称
* @return 电站集合
*/
List<Map<String, Object>> selectXhpcChargingStationList(@Param("name") String name, @Param("operatorName") String operatorName, @Param("operatorId") Long operatorId, @Param("type") Integer type);
/**
* 新增电站
*
* @param xhpcChargingStation 电站
* @return 结果
*/
int insertXhpcChargingStation(XhpcChargingStation xhpcChargingStation);
/**
* 修改电站
*
* @param xhpcChargingStation 电站
* @return 结果
*/
int updateXhpcChargingStation(XhpcChargingStation xhpcChargingStation);
/**
* 删除电站
*
* @param chargingStationId 电站ID
* @return 结果
*/
int updateXhpcChargingStationById(Long chargingStationId);
/**
* 批量删除电站
*
* @param chargingStationIds 需要删除的数据ID
* @return 结果
*/
int updateXhpcChargingStationByIds(Long[] chargingStationIds);
/**
* 状态0启用 1停用
*
* @param status 0启用 1停用
* @return 结果
*/
void status(@Param("status") Integer status, @Param("chargingStationId") Long chargingStationId);
/**
* APP端小程序是否可见
*
* @param clientVisible app可见值
* @param chargingStationId 场站id
* @return 结果
*/
void clientVisible(@Param("clientVisible") String clientVisible, @Param("chargingStationId") Long chargingStationId);
/**
* 合作的电站
*
* @param chargingStationId 电站ID
* @return 电站
*/
List<Map<String, Object>> stationInternetBlackList(Long chargingStationId);
/**
* 电站详情信息
*
* @param chargingStationId 电站ID
* @return 电站
*/
Map<String, Object> getXhpcChargingStationMessage(@Param("chargingStationId") Long chargingStationId);
/**
* 微信小程序电站列表
*
* @param name 电站名称
* @param serviceFacilities 标签集合服务设施
* @param code 城市id
* @param longitude 经度
* @param latitude 维度
* @param clientVisible 微信小程序是否可见 2可见
* @return
*/
List<Map<String, Object>> getWXList(@Param("name") String name, @Param("serviceFacilities") List<String> serviceFacilities, @Param("code") Integer code, @Param("longitude") String longitude, @Param("latitude") String latitude, @Param("clientVisible") Integer clientVisible, @Param("date") String date);
/**
* 根据code获取数据
*
* @param code 字典code
* @param serviceFacilities 筛选条件
* @return 电站
*/
List<Map<String, Object>> getCode(@Param("code") String code, @Param("serviceFacilities") List<String> serviceFacilities);
/**
* 电站详情站点详情
*
* @param chargingStationId 电站ID
* @return 电站
*/
Map<String, Object> getWXXhpcChargingStationMessage(@Param("chargingStationId") Long chargingStationId, @Param("longitude") String longitude, @Param("latitude") String latitude);
/**
* 获取图片信息
*
* @param imgIds
* @return
*/
List<Map<String, Object>> getImageList(@Param("imgIds") List<String> imgIds);
/**
* 电站详情---价格详情
*
* @param chargingStationId 电站ID
* @return 电站
*/
List<Map<String, Object>> getWXXhpcRateTimeMassage(@Param("chargingStationId") Long chargingStationId);
/**
* 电站详情---终端列表
*
* @param chargingStationId 电站ID
* @return 电站
*/
List<Map<String, Object>> getWXXhpcTerminalMassage(@Param("chargingStationId") Long chargingStationId);
/**
* 添加费率模型
*/
int addXhpcRateModel(XhpcRateModel xhpcRateModel);
/**
* 添加场站信息
*/
int addXhpcChargingStation(XhpcChargingStation xhpcChargingStation);
/**
* 添加费率
*/
int addXhpcRate(XhpcRate xhpcRate);
/**
* 添加费率时段
*/
int addXhpcRateTime(XhpcRateTime xhpcRateTime);
/**
* 返回费率
*/
List<Map<String, Object>> getXhpcRateList(@Param("chargingStationId") Long chargingStationId);
/**
* 返回费率时段设置时段
*/
List<Map<String, Object>> getXhpcRateTimeTypeList(@Param("chargingStationId") Long chargingStationId, @Param("type") Integer type);
/**
* 今日充电量今日充电用户今日充电次数
*/
Map<String, Object> getXhpcRateTimeOrderStatistics(@Param("chargingStationId") Long chargingStationId, @Param("createTime") String createTime);
/**
* 删除之前的费率
*
* @param chargingStationId
* @return
*/
int updateXhpcRate(@Param("chargingStationId") Long chargingStationId);
/**
* 删除之前的费率时段
*
* @param chargingStationId
* @return
*/
int updateXhpcRateTime(@Param("chargingStationId") Long chargingStationId);
/**
* 根据场站id获取桩编号
*
* @param chargingStationId
* @return
*/
Set<String> getXchargingPileList(@Param("chargingStationId") Long chargingStationId);
/**
* 按照没30分钟为一段进行分组
*
* @param chargingStationId
* @return
*/
List<Map<String, Object>> getXhpcRateTimeNumber(@Param("chargingStationId") Long chargingStationId);
/**
* 修改桩的计费模型id
*
* @param chargingStationId
*/
void updateXhpcChargingPile(@Param("chargingStationId") Long chargingStationId, @Param("rateModelId") Long rateModelId);
/**
* 修改终端的计费模型id
*
* @param chargingStationId
*/
void updateXhpcTerminal(@Param("chargingStationId") Long chargingStationId, @Param("rateModelId") Long rateModelId);
/**
* 获取登陆用户信息
*/
Map<String, Object> getLandUser(@Param("userId") Long userId);
/**
* 添加场站数据权限
*/
void addXhpcUserPrivilege(@Param("userId") Long userId, @Param("chargingStationId") Long chargingStationId);
}

View File

@ -39,4 +39,15 @@ public interface XhpcHistoryOrderMapper {
*/
Long findAllOrdersByCondition(@Param("invoicedOrdersRequest") InvoicedOrdersRequest invoicedOrdersRequest, @Param("lockOrderNumberList") List<Integer> lockOrderNumberList);
/**
* 查询指定id的历史订单
*
* @param historyOrderIds 历史订单id集合
* @return 历史订单
* @author WH
* @date 2021/12/28 17:47
* @since version-1.0
*/
List<XhpcHistoryOrder> findById(List<Integer> historyOrderIds);
}

View File

@ -62,4 +62,25 @@ public interface XhpcInvoiceMapHistoryOrderMapper {
*/
List<Integer> findLockOrdersByUserIdAndUserType(InvoicedOrdersRequest invoicedOrdersRequest);
/**
* 解除锁定的用户历史订单
*
* @param invoiceId 发票id
* @author WH
* @date 2021/12/29 11:00
* @since version-1.0
*/
void updateUnlockHistoryOrdersByInvoiceId(Long invoiceId);
/**
* 查询该发票关联表中该历史订单是否已经被存储且被锁定
*
* @param historyOrderIds 历史订单id集合
* @return 返回被某发票包含且已经锁定的历史订单记录
* @author WH
* @date 2021/12/29 14:30
* @since version-1.0
*/
List<XhpcInvoiceMapHistoryOrder> getLockedOnesByHistoryOrderId(List<Integer> historyOrderIds);
}

View File

@ -1,6 +1,7 @@
package com.xhpc.invoice.mapper;
import com.xhpc.invoice.domain.AllInvoiceOrdersRequest;
import com.xhpc.invoice.domain.ExcelInvoiceRow;
import com.xhpc.invoice.domain.InvoiceHistoryRecordsRequest;
import com.xhpc.invoice.domain.InvoiceToUserRequest;
import com.xhpc.invoice.pojo.XhpcInvoice;
@ -75,7 +76,7 @@ public interface XhpcInvoiceMapper {
BigDecimal allNotInvoicedMoney();
/**
* 更新指定发票状态让其成为已开发票状态
* 更新指定发票状态让其成为已开发票状态并设置用户未阅读标签
*
* @param requestData 更新数据的来源
* @return Long 返回更新受影响的条数
@ -83,7 +84,7 @@ public interface XhpcInvoiceMapper {
* @date 2021/12/22 15:07
* @since version-1.0
*/
Long invoiceToUser(InvoiceToUserRequest requestData);
Long updateInvoiceToUser(InvoiceToUserRequest requestData);
/**
* 更新指定发票状态让其成为开发票失败状态
@ -94,7 +95,7 @@ public interface XhpcInvoiceMapper {
* @date 2021/12/23 13:30
* @since version-1.0
*/
Long failInvoiceToUser(InvoiceToUserRequest requestData);
Long updateFailInvoiceToUser(InvoiceToUserRequest requestData);
/**
* 模糊查询指定公司名称和税号
@ -136,6 +137,7 @@ public interface XhpcInvoiceMapper {
*
* @param creatorId 用户id
* @param creatorType 用户类型
*
* @return 用户发票条数
* @author WH
* @date 2021/12/27 16:47
@ -143,5 +145,57 @@ public interface XhpcInvoiceMapper {
*/
Long getUserInvoiceItemsByCreatorIdAndCreatorType(@Param("creatorId") Long creatorId, @Param("creatorType") Integer creatorType);
/**
* 插入发票记录获取所插入的发票记录的发票id会被放置到实体类id属性中
*
* @param xhpcInvoice 发票记录
* @author WH
* @date 2021/12/28 15:09
* @since version-1.0
*/
void insertSelectiveAndReturnId(XhpcInvoice xhpcInvoice);
/**
* 查找指定用户开了的发票未读的数量
*
* @param creatorId 用户id
* @param creatorType 用户类型
* @return 返回发票未读的数量
* @author WH
* @date 2021/12/28 20:31
* @since version-1.0
*/
Long findNotReadCount(@Param("creatorId") Long creatorId, @Param("creatorType") Integer creatorType);
/**
* 更新发票状态从未读变成已读
*
* @param invoiceId 要更新的发票id
* @author WH
* @date 2021/12/29 17:26
* @since version-1.0
*/
void updateByInvoiceId(Long invoiceId);
/**
* 获取发票内容
*
* @param invoiceId 发票id
* @return 专门用于放置到Excel中Map
* @author WH
* @date 2021/12/30 18:08
* @since version-1.0
*/
List<ExcelInvoiceRow> selectExcelInvoiceById(Long invoiceId);
/**
* 更新发票所包含的电量总金额服务费总金额
*
* @param xhpcInvoice 存放要更新数据的实体类
* @author WH
* @date 2022/1/3 17:06
* @since version-1.0
*/
void updateElectricAndServiceById(XhpcInvoice xhpcInvoice);
}

View File

@ -1,10 +1,7 @@
package com.xhpc.invoice.mapper;
import com.xhpc.invoice.pojo.XhpcOperator;
import com.xhpc.system.api.domain.SysUser;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
@ -14,101 +11,12 @@ import java.util.Map;
*/
public interface XhpcOperatorMapper {
/**
* 修改运营商信息
*
* @param xhpcOperator 运营商信息
* @return 结果
*/
public int update(XhpcOperator xhpcOperator);
/**
* 新增运营商信息
*
* @param xhpcOperator 运营商信息
* @return 结果
*/
public int insert(XhpcOperator xhpcOperator);
/**
* 批量删除运营商信息
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteByIds(String[] ids);
/**
* 校验账号是否唯一
*
* @param phone 用户手机号
* @return 结果
*/
public XhpcOperator checkAccountUnique(@Param("phone") String phone);
/**
* 查询运营商详情
*
* @param operatorId 运营商id
* @return 结果
*/
public Map<String, Object> info(@Param("operatorId") Long operatorId);
/**
* 获取运营商分页列表
*
* @param name 运营商名称
* @param contactName 联系人
* @param contactPhone 联系人电话
* @return 结果
*/
public List<Map<String, Object>> selectOperatorList(@Param("name") String name, @Param("contactName") String contactName, @Param("contactPhone") String contactPhone, @Param("createTimeStart") String createTimeStart, @Param("createTimeEnd") String createTimeEnd);
/**
* 通过用户ID删除用户和角色关联
*
* @param userId 用户ID
* @return 结果
*/
public int deleteUserRoleByUserId(@Param("userId") Long userId);
/**
* 通过用户ID删除用户和岗位关联
*
* @param userId 用户ID
* @return 结果
*/
public int deleteUserPostByUserId(@Param("userId") Long userId);
/**
* 删除角色信息
*
* @param roleName 角色名称
* @return 结果
*/
public int deleteRoleByName(@Param("roleName") String roleName);
/**
* 通过用户ID删除用户
*
* @param sysUser 用户
* @return 结果
*/
public int deleteUserById(SysUser sysUser);
/**
* 通过运营商ID查询用户
*
* @param operatorId 运营商ID
* @return 结果
*/
public SysUser getUserByOperatorId(@Param("operatorId") Long operatorId);
/**
* 查询运营商列表
*
* @return 结果
*/
public List<Map<String, Object>> getOperatorId();
Map<String, Object> info(@Param("operatorId") Long operatorId);
}

View File

@ -9,7 +9,7 @@ import java.util.Date;
/**
* xhpc_invoice
*
* @author
* @author WH
*/
@Data
public class XhpcInvoice implements Serializable {
@ -19,6 +19,11 @@ public class XhpcInvoice implements Serializable {
*/
private Long invoiceId;
/**
* 发票类型(默认0普票1为专票)
*/
private Integer invoiceType;
/**
* 接收邮箱
*/
@ -145,7 +150,7 @@ public class XhpcInvoice implements Serializable {
private Date updateTime;
/**
* 是否已经阅读(默认0表示没有阅读1表示已经阅读)
* 是否已经阅读(默认未空0表示没有阅读1表示已经阅读)
*/
private Integer isRead;

View File

@ -1,6 +1,7 @@
package com.xhpc.invoice.pojo;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
@ -9,8 +10,9 @@ import java.util.Date;
/**
* xhpc_invoice_map_history_order
*
* @author
* @author WH
*/
@NoArgsConstructor
@Data
public class XhpcInvoiceMapHistoryOrder implements Serializable {
@ -37,7 +39,7 @@ public class XhpcInvoiceMapHistoryOrder implements Serializable {
/**
* 该发票所选中的历史订单订单编号
*/
private String hisotrySerialNumber;
private String historySerialNumber;
/**
* 该发票所选中的历史订单电费
@ -82,7 +84,7 @@ public class XhpcInvoiceMapHistoryOrder implements Serializable {
/**
* 该发票所选中的历史订单是否被锁定
*/
private Integer delLock;
private Integer lockFlag;
/**
* 逻辑删除字段

View File

@ -2,6 +2,10 @@ package com.xhpc.invoice.service;
import com.xhpc.invoice.domain.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
/**
* 用于处理发票相关请求的Service
*
@ -20,7 +24,7 @@ public interface XhpcInvoiceService {
* @date 2021/12/20 14:10
* @since version-1.0
*/
SpecificInvoiceWrap selectSpecificInvoice(Long invoiceId);
SpecificInvoiceWrap findSpecificInvoice(Long invoiceId);
/**
* 通过requestData中的申请人申请人类型发票状态发票起始时间发票申请终止时间开票起始时间开票终点时间当前所在页数当前页所要显示几行来查询发票列表信息
@ -31,7 +35,7 @@ public interface XhpcInvoiceService {
* @date 2021/12/21 16:02
* @since version-1.0
*/
AllInvoiceOrdersResponse selectAllInvoiceOrders(AllInvoiceOrdersRequest requestData);
AllInvoiceOrdersResponse findAllInvoiceOrders(AllInvoiceOrdersRequest requestData);
/**
* 存储开发票的状态将开票信息入库并向指定用户的邮箱发送短信
@ -63,7 +67,7 @@ public interface XhpcInvoiceService {
* @date 2021/12/23 15:29
* @since version-1.0
*/
InvoiceTitleResponse selectInvoiceTitleInfo(String firmName);
InvoiceTitleResponse findTitleInfo(String firmName);
/**
* 查询用户输入的最后一次的开发票所填写的信息
@ -75,7 +79,7 @@ public interface XhpcInvoiceService {
* @date 2021/12/23 17:23
* @since version-1.0
*/
TitleResponse selectUserInputInvoiceInfo(Long creatorId, Integer creatorType);
TitleResponse findUserLastInputInfo(Long creatorId, Integer creatorType);
/**
* 根据用户id用户类型要查询的当前时间的年月日查询该用户3个月内可以开发票的订单
@ -86,7 +90,7 @@ public interface XhpcInvoiceService {
* @date 2021/12/24 10:42
* @since version-1.0
*/
InvoiceOrdersResponse selectInvoicedOrders(InvoicedOrdersRequest invoicedOrdersRequest);
InvoiceOrdersResponse findUserHistoryOrders(InvoicedOrdersRequest invoicedOrdersRequest);
/**
* 根据发票id查询回显发票所需要的数据
@ -97,7 +101,7 @@ public interface XhpcInvoiceService {
* @date 2021/12/27 13:12
* @since version-1.0
*/
SpecificInvoicedResponse selectSpecificInvoiced(Long invoiceId);
SpecificInvoicedResponse findSpecificInvoicedInfo(Long invoiceId);
/**
* 根据前端传递过来的请求参数查询所需要的开发票历史记录
@ -108,6 +112,41 @@ public interface XhpcInvoiceService {
* @date 2021/12/27 14:49
* @since version-1.0
*/
InvoiceHistoryRecordsResponse selectInvoiceHistoryRecords(InvoiceHistoryRecordsRequest invoiceHistoryRecordsRequest);
InvoiceHistoryRecordsResponse findInvoiceHistoryRecords(InvoiceHistoryRecordsRequest invoiceHistoryRecordsRequest);
/**
* 将用户申请的发票信息保存到数据库中
*
* @param saveInvoiceInfoRequest 发票信息
* @throws Exception 传入发票金额参数与内部该发票所包含的所有订单金额参数不一致出现出现此异常
* @author WH
* @date 2021/12/28 14:33
* @since version-1.0
*/
void saveInvoiceInfo(SaveInvoiceInfoRequest saveInvoiceInfoRequest) throws Exception;
/**
* 查询指定用户没有查看的已开的发票的数量即该用户有几个未读发票
*
* @param creatorId 用户id
* @param creatorType 用户类型
* @return 未读发票数量
* @author WH
* @date 2021/12/28 19:01
* @since version-1.0
*/
Long findNotReadCount(Long creatorId, Integer creatorType);
/**
* 导出所有发票记录已开与未开到Excel中
*
* @param invoiceIds 发票id
* @param response 响应的response
* @throws IOException 该Response对象不存在时抛出该异常对象
* @author WH
* @date 2021/12/30 10:16
* @since version-1.0
*/
void exportExcel(List<String> invoiceIds, HttpServletResponse response) throws IOException;
}

View File

@ -1,9 +1,15 @@
package com.xhpc.invoice.service.impl;
import cn.hutool.extra.mail.MailUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;
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.invoice.constant.InvoiceMapHistoryOrderStatusConst;
import com.xhpc.invoice.constant.InvoiceStatusConst;
import com.xhpc.invoice.domain.*;
import com.xhpc.invoice.mapper.*;
import com.xhpc.invoice.pojo.XhpcInvoice;
@ -11,11 +17,14 @@ 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 org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@ -43,9 +52,13 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
SysUserMapper sysUserMapper;
@Resource
XhpcHistoryOrderMapper xhpcHistoryOrderMapper;
@Resource
Environment environment;
@Resource
RedisService redisService;
/**
* 通过requestData中的申请人申请人类型发票状态发票起始时间发票申请终止时间开票起始时间开票终点时间当前所在页数当前页所要显示几行来查询发票列表信息
* 通过requestData中的申请人申请人类型发票类型发票状态发票起始时间发票申请终止时间开票起始时间开票终点时间当前所在页数当前页所要显示几行来查询发票列表信息
*
* @param requestData 传递过来的查询参数
* @return AllInvoiceOrdersResponse 发票列表对象
@ -54,22 +67,25 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
* @since version-1.0
*/
@Override
public AllInvoiceOrdersResponse selectAllInvoiceOrders(AllInvoiceOrdersRequest requestData) {
public AllInvoiceOrdersResponse findAllInvoiceOrders(AllInvoiceOrdersRequest requestData) {
//计算分页索引
requestData.setCurrentPage((requestData.getCurrentPage() - 1) * requestData.getItems());
//获取每个历史订单信息
//获取每张发票信息
List<XhpcInvoice> xhpcInvoiceList = xhpcInvoiceMapper.selectAllInvoiceOrdersByCondition(requestData);
//对拷放置到itemsDTO中,然后将itemsDTO存放到itemsDTOList中
ArrayList<AllInvoiceOrdersResponse.ItemsDTO> itemsDTOList = new ArrayList<>();
for (XhpcInvoice xhpcInvoice : xhpcInvoiceList) {
AllInvoiceOrdersResponse.ItemsDTO itemsDTO = new AllInvoiceOrdersResponse.ItemsDTO();
itemsDTO.setInvoiceId(xhpcInvoice.getInvoiceId());
itemsDTO.setInvoiceType(xhpcInvoice.getInvoiceType());
itemsDTO.setCreator(xhpcInvoice.getCreator());
itemsDTO.setCreatorType(xhpcInvoice.getCreatorType());
itemsDTO.setInvoiceMoney(xhpcInvoice.getInvoiceMoney());
itemsDTO.setStatus(xhpcInvoice.getStatus());
itemsDTO.setCreateTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, xhpcInvoice.getCreateTime()));
itemsDTO.setInvoicingTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, xhpcInvoice.getInvoicingTime()));
if (xhpcInvoice.getInvoicingTime() != null) {
itemsDTO.setInvoicingTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, xhpcInvoice.getInvoicingTime()));
}
itemsDTO.setDrawer(xhpcInvoice.getDrawer());
itemsDTOList.add(itemsDTO);
}
@ -87,6 +103,10 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
allInvoiceOrdersResponse.setInvoicedSumMoney(allInvoicedMoney);
//查询所有未开发票总金额
BigDecimal allNotInvoicedMoney = xhpcInvoiceMapper.allNotInvoicedMoney();
if (allNotInvoicedMoney == null) {
//如果没有任何未开发票那么总金额就设置成0.00
allNotInvoicedMoney = new BigDecimal("0.00");
}
allInvoiceOrdersResponse.setNotInvoiceSumMoney(allNotInvoicedMoney);
return allInvoiceOrdersResponse;
}
@ -109,19 +129,27 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
//发送电子发票pdf到接收者邮箱
XhpcInvoice xhpcInvoice = xhpcInvoiceMapper.selectByPrimaryKey(requestData.getInvoiceId());
String receiveEmail = xhpcInvoice.getReceiveEmail();
//todo 从阿里云上下载下来电子发票
File electricInvoiceFile = new File("D:\\Enterprise_Resources\\ElectricInvoice\\ElectricInvoice.pdf");
//从阿里云上下载下来电子发票
String fileUrl = requestData.getEletricInvoiceUrl();
File electricInvoiceFile = new File(environment.getProperty("file.serverStoreDisposableFileLocation") + "ElectricInvoice.pdf");
HttpUtil.downloadFile(fileUrl, electricInvoiceFile);
try {
MailUtil.send(receiveEmail, "【小华充电】电子发票", "邮件来自小华充电", false, electricInvoiceFile);
} catch (Exception e) {
System.out.println(e.getMessage());
return Boolean.FALSE;
} finally {
if (electricInvoiceFile.exists()) {
electricInvoiceFile.delete();
}
}
//更新发票数据
Long successFlag = xhpcInvoiceMapper.invoiceToUser(requestData);
//更新发票数据,并设置用户未阅读状态
Long successFlag = xhpcInvoiceMapper.updateInvoiceToUser(requestData);
if (successFlag == 0) {
throw new RuntimeException("无法更新指定发票,传入的数据有问题");
}
//将该用户未阅读的数量放入到redis中
putNoReadInvoiceCountIntoRedis(requestData);
return Boolean.TRUE;
}
@ -131,12 +159,36 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
//根据操作人的id查询操作人的名字
SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(requestData.getDrawer()));
requestData.setDrawer(sysUser.getNickName());
//入库更新
xhpcInvoiceMapper.failInvoiceToUser(requestData);
//更新发票状态
xhpcInvoiceMapper.updateFailInvoiceToUser(requestData);
//解除锁定
xhpcInvoiceMapHistoryOrderMapper.updateUnlockHistoryOrdersByInvoiceId(requestData.getInvoiceId());
//将该用户未阅读的数量放入到redis中
putNoReadInvoiceCountIntoRedis(requestData);
}
/**
* 将该用户没有阅读的发票的数量放入到Redis中保存供别人调用
*
* @author WH
* @date 2021/12/30 13:54
* @since version-1.0
*/
private void putNoReadInvoiceCountIntoRedis(InvoiceToUserRequest requestData) {
XhpcInvoice xhpcInvoice = xhpcInvoiceMapper.selectByPrimaryKey(requestData.getInvoiceId());
String redisKey = generateRedisKey(xhpcInvoice);
if (redisService.getCacheObject(redisKey) == null) {
redisService.setCacheObject(redisKey, 1);
} else {
Integer noReadCount = redisService.getCacheObject(redisKey);
noReadCount = noReadCount + 1;
redisService.setCacheObject(redisKey, noReadCount);
}
}
@Override
public InvoiceTitleResponse selectInvoiceTitleInfo(String firmName) {
public InvoiceTitleResponse findTitleInfo(String firmName) {
List<XhpcInvoice> xhpcInvoiceList = xhpcInvoiceMapper.selectInvoiceTitleInfo(firmName);
ArrayList<InvoiceTitleResponse.DataDTO> dataDTOList = new ArrayList<>();
@ -162,7 +214,7 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
* @since version-1.0
*/
@Override
public TitleResponse selectUserInputInvoiceInfo(Long creatorId, Integer creatorType) {
public TitleResponse findUserLastInputInfo(Long creatorId, Integer creatorType) {
XhpcInvoice xhpcInvoice = xhpcInvoiceMapper.selectUserLastInputInvoiceInfo(creatorId, creatorType);
TitleResponse titleResponse = new TitleResponse();
@ -181,7 +233,7 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
* @since version-1.0
*/
@Override
public InvoiceOrdersResponse selectInvoicedOrders(InvoicedOrdersRequest invoicedOrdersRequest) {
public InvoiceOrdersResponse findUserHistoryOrders(InvoicedOrdersRequest invoicedOrdersRequest) {
//计算分页索引,放置到currentPage属性中
int startIndex = (invoicedOrdersRequest.getCurrentPage() - 1) * invoicedOrdersRequest.getItems();
invoicedOrdersRequest.setCurrentPage(startIndex);
@ -216,7 +268,8 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
* @since version-1.0
*/
@Override
public SpecificInvoicedResponse selectSpecificInvoiced(Long invoiceId) {
@Transactional(rollbackFor = Exception.class)
public SpecificInvoicedResponse findSpecificInvoicedInfo(Long invoiceId) {
//对拷发票部分数据
XhpcInvoice xhpcInvoice = xhpcInvoiceMapper.selectByPrimaryKey(invoiceId);
@ -238,7 +291,7 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
SpecificInvoicedResponse.HistoryOrdersDTO.HistoryOrdersDataDTO historyOrdersDataDTO = new SpecificInvoicedResponse.HistoryOrdersDTO.HistoryOrdersDataDTO();
historyOrdersDataDTO.setHistoryOrderId(xhpcInvoiceMapHistoryOrder.getHistoryOrderId());
historyOrdersDataDTO.setActPrice(xhpcInvoiceMapHistoryOrder.getHistoryActPrice());
historyOrdersDataDTO.setHistorySerialNumber(xhpcInvoiceMapHistoryOrder.getHisotrySerialNumber());
historyOrdersDataDTO.setHistorySerialNumber(xhpcInvoiceMapHistoryOrder.getHistorySerialNumber());
historyOrdersDataDTO.setOrderCreateTime(DateUtils.parseDateToStr(xhpcInvoiceMapHistoryOrder.getCreateTime()));
historyOrdersDataDTOS.add(historyOrdersDataDTO);
}
@ -246,9 +299,68 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
historyOrdersDTO.setHistoryOrdersData(historyOrdersDataDTOS);
historyOrdersDTO.setTotalItems(historyOrdersList.size());
specificInvoicedResponse.setHistoryOrders(historyOrdersDTO);
//如果用户在该发票还没有被处理时点击查看该发票详情那么就直接返回数据
if (xhpcInvoice.getStatus().equals(InvoiceStatusConst.INVOICING)) {
return specificInvoicedResponse;
}
//一旦调了详情接口就去掉该已开发票的未读状态同时redis中的未读数量数据-1
xhpcInvoiceMapper.updateByInvoiceId(invoiceId);
reduceNoReadInvoiceCount(xhpcInvoice);
return specificInvoicedResponse;
}
/**
* 将用户未读的发票数量-1
*
* @param xhpcInvoice 用户查看的发票
* @author WH
* @date 2021/12/30 13:55
* @since version-1.0
*/
private void reduceNoReadInvoiceCount(XhpcInvoice xhpcInvoice) {
String redisKey = generateRedisKey(xhpcInvoice);
if (redisService.getCacheObject(redisKey).equals(1)) {
redisService.deleteObject(redisKey);
} else {
Integer noReadCount = redisService.getCacheObject(redisKey);
noReadCount = noReadCount - 1;
redisService.setCacheObject(redisKey, noReadCount);
}
}
/**
* 生成该用户在Redis中的唯一表示key
*
* @param xhpcInvoice 用户查看的发票
* @author WH
* @date 2021/12/30 13:52
* @since version-1.0
*/
private String generateRedisKey(XhpcInvoice xhpcInvoice) {
String redisKey = "global:invoice:";
switch (xhpcInvoice.getCreatorType()) {
case 0:
redisKey = redisKey + "C" + xhpcInvoice.getCreatorId();
break;
case 1:
redisKey = redisKey + "L" + xhpcInvoice.getCreatorId();
break;
case 2:
redisKey = redisKey + "ST" + xhpcInvoice.getCreatorId();
break;
case 3:
redisKey = redisKey + "BE" + xhpcInvoice.getCreatorId();
break;
default:
break;
}
return redisKey;
}
/**
* 根据前端传递过来的请求参数查询所需要的开发票历史记录
*
@ -259,7 +371,7 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
* @since version-1.0
*/
@Override
public InvoiceHistoryRecordsResponse selectInvoiceHistoryRecords(InvoiceHistoryRecordsRequest invoiceHistoryRecordsRequest) {
public InvoiceHistoryRecordsResponse findInvoiceHistoryRecords(InvoiceHistoryRecordsRequest invoiceHistoryRecordsRequest) {
//计算分页索引
int startIndex = (int) ((invoiceHistoryRecordsRequest.getCurrentPage() - 1) * invoiceHistoryRecordsRequest.getItems());
if (startIndex < 0) {
@ -276,6 +388,7 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
itemsDTO.setCreateTime(DateUtils.parseDateToStr(xhpcInvoice.getCreateTime()));
itemsDTO.setStatus(xhpcInvoice.getStatus());
itemsDTO.setInvoicingMoney(xhpcInvoice.getInvoiceMoney());
itemsDTO.setIsRead(xhpcInvoice.getIsRead());
itemsDTOS.add(itemsDTO);
}
InvoiceHistoryRecordsResponse invoiceHistoryRecordsResponse = new InvoiceHistoryRecordsResponse();
@ -285,6 +398,194 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
return invoiceHistoryRecordsResponse;
}
/**
* 将用户申请的发票信息保存到数据库中
*
* @param saveInvoiceInfoRequest 发票信息
* @throws Exception 传入发票金额参数与内部该发票所包含的所有订单金额参数不一致出现出现此异常
* @author WH
* @date 2021/12/28 14:33
* @since version-1.0
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void saveInvoiceInfo(SaveInvoiceInfoRequest saveInvoiceInfoRequest) throws Exception {
//判断传入的历史订单是否被其他发票包含
List<Integer> historyOrderIds = saveInvoiceInfoRequest.getHistoryOrderIds();
List<XhpcInvoiceMapHistoryOrder> lockOrderList = xhpcInvoiceMapHistoryOrderMapper.getLockedOnesByHistoryOrderId(historyOrderIds);
if (lockOrderList.size() > 0) {
throw new Exception("该历史订单已被其他发票包含");
}
//将该发票记录放入数据库生成发票记录,除了所包含的历史订单的总电费总服务费
XhpcInvoice xhpcInvoice = new XhpcInvoice();
xhpcInvoice.setReceiveEmail(saveInvoiceInfoRequest.getReceiveEmail());
xhpcInvoice.setTitleType(saveInvoiceInfoRequest.getTitleType());
xhpcInvoice.setTitleContent(saveInvoiceInfoRequest.getTitleContent());
xhpcInvoice.setDutyNumber(saveInvoiceInfoRequest.getDutyNumber());
xhpcInvoice.setInvoiceContent(saveInvoiceInfoRequest.getInvoiceContent());
xhpcInvoice.setInvoiceMoney(saveInvoiceInfoRequest.getInvoiceMoney());
xhpcInvoice.setFirmAddress(saveInvoiceInfoRequest.getFirmAddress());
xhpcInvoice.setFirmPhone(saveInvoiceInfoRequest.getFirmPhone());
xhpcInvoice.setFirmBank(saveInvoiceInfoRequest.getFirmBank());
xhpcInvoice.setFirmBankAccount(saveInvoiceInfoRequest.getFirmBankAccount());
xhpcInvoice.setIsShowDate(saveInvoiceInfoRequest.getIsShowDate());
xhpcInvoice.setUserNotes(saveInvoiceInfoRequest.getUserNotes());
xhpcInvoice.setCreatorId(saveInvoiceInfoRequest.getCreatorId());
xhpcInvoice.setCreatorType(saveInvoiceInfoRequest.getCreatorType());
xhpcInvoice.setCreator(saveInvoiceInfoRequest.getCreator());
xhpcInvoice.setCreateTime(DateUtils.parseDate(saveInvoiceInfoRequest.getCreateTime()));
xhpcInvoice.setStatus(0);
xhpcInvoiceMapper.insertSelectiveAndReturnId(xhpcInvoice);
//建立订单与发票之间的关联
List<XhpcHistoryOrder> xhpcHistoryOrderList = xhpcHistoryOrderMapper.findById(historyOrderIds);
//获取所插入的发票id
Long invoiceId = xhpcInvoice.getInvoiceId();
//存储该发票所包含的所有历史订单总电量
double totalPowerPrice = 0;
//存储该发票所包含的所有历史订单总服务费
double totalServicePrice = 0;
//该变量是用来计算内部存储的历史订单金额是否与传入的一致
double totalActPrice = 0;
for (XhpcHistoryOrder xhpcHistoryOrder : xhpcHistoryOrderList) {
XhpcInvoiceMapHistoryOrder xhpcInvoiceMapHistoryOrder = new XhpcInvoiceMapHistoryOrder();
xhpcInvoiceMapHistoryOrder.setInvoiceId(invoiceId);
xhpcInvoiceMapHistoryOrder.setHistoryOrderId(xhpcHistoryOrder.getHistoryOrderId());
xhpcInvoiceMapHistoryOrder.setHistoryUserId(xhpcHistoryOrder.getUserId());
xhpcInvoiceMapHistoryOrder.setHistoryUserType(Long.valueOf(xhpcHistoryOrder.getSource()));
xhpcInvoiceMapHistoryOrder.setHistorySerialNumber(xhpcHistoryOrder.getSerialNumber());
xhpcInvoiceMapHistoryOrder.setPowerPriceTotal(xhpcHistoryOrder.getPowerPriceTotal());
xhpcInvoiceMapHistoryOrder.setServicePriceTotal(BigDecimal.valueOf(xhpcHistoryOrder.getServicePriceTotal().doubleValue() - xhpcHistoryOrder.getPromotionDiscount().doubleValue()));
xhpcInvoiceMapHistoryOrder.setPromotionDiscount(xhpcHistoryOrder.getPromotionDiscount());
xhpcInvoiceMapHistoryOrder.setHistoryActPrice(xhpcHistoryOrder.getActPrice());
xhpcInvoiceMapHistoryOrder.setCreateTime(xhpcHistoryOrder.getCreateTime());
xhpcInvoiceMapHistoryOrder.setChargingMode(xhpcHistoryOrder.getChargingMode());
xhpcInvoiceMapHistoryOrder.setChargingStationId(xhpcHistoryOrder.getChargingStationId());
xhpcInvoiceMapHistoryOrder.setTerminalId(xhpcHistoryOrder.getTerminalId());
xhpcInvoiceMapHistoryOrder.setLockFlag(InvoiceMapHistoryOrderStatusConst.LOCK);
xhpcInvoiceMapHistoryOrderMapper.insertSelective(xhpcInvoiceMapHistoryOrder);
totalPowerPrice += xhpcHistoryOrder.getPowerPriceTotal().doubleValue();
totalServicePrice += (xhpcHistoryOrder.getServicePriceTotal().doubleValue() - xhpcHistoryOrder.getPromotionDiscount().doubleValue());
totalActPrice += xhpcHistoryOrder.getTotalPrice().doubleValue();
}
if (!BigDecimal.valueOf(totalActPrice).equals(saveInvoiceInfoRequest.getInvoiceMoney())) {
throw new Exception("传入的发票金额与实际包含的历史订单总金额参数不匹配");
}
xhpcInvoice.setInvoiceOrderEletricTotalMoney(BigDecimal.valueOf(totalPowerPrice));
xhpcInvoice.setInvoiceOrderServiceTotalMoney(BigDecimal.valueOf(totalServicePrice));
xhpcInvoiceMapper.updateElectricAndServiceById(xhpcInvoice);
}
/**
* 查询指定用户没有查看的已开的发票的数量即该用户有几个未读发票
*
* @param creatorId 用户id
* @param creatorType 用户类型
* @return 未读发票数量
* @author WH
* @date 2021/12/28 19:01
* @since version-1.0
*/
@Override
public Long findNotReadCount(Long creatorId, Integer creatorType) {
return xhpcInvoiceMapper.findNotReadCount(creatorId, creatorType);
}
/**
* 导出所有发票记录已开与未开到Excel中
*
* @param invoiceIds 发票id
* @param response 响应对象
* @author WH
* @date 2021/12/30 10:16
* @since version-1.0
*/
@Override
public void exportExcel(List<String> invoiceIds, HttpServletResponse response) throws IOException {
//创建Excel写入对象
ExcelWriter writer = ExcelUtil.getWriter("record.xlsx");
//设置单元格标题别名
setExcelCellName(writer);
//定义每一行的行号1234...
int rowsNumber = 1;
//设定初始合并行参数即第一行该从哪行开始合并合并几行
int rowStart = 1;
int lastRow = 0;
for (String invoiceId : invoiceIds) {
List<ExcelInvoiceRow> excelInvoiceRows = xhpcInvoiceMapper.selectExcelInvoiceById(Long.valueOf(invoiceId));
//往记录中塞入行号
for (ExcelInvoiceRow excelInvoiceRow : excelInvoiceRows) {
excelInvoiceRow.setRowsNumber(rowsNumber);
}
//写入记录
writer.write(excelInvoiceRows);
int invoiceCount = excelInvoiceRows.size();
//如果写入的发票记录只有一个就不合并单元格增加合并行索引为下面需要合并的行做准备
if (invoiceCount == 1) {
lastRow = lastRow + 1;
rowStart = rowStart + 1;
} else {
//计算每条要合并发票记录的行的最后一个行号
lastRow = lastRow + invoiceCount;
//合并单元格
for (int columnIndex = 0; columnIndex <= 21; columnIndex++) {
writer.merge(rowStart, lastRow, columnIndex, columnIndex, null, false);
}
//计算每条要合并发票记录的行的第一个行号
rowStart = rowStart + invoiceCount;
}
rowsNumber++;
}
//设置文件类型
response.setContentType(ExcelUtil.XLSX_CONTENT_TYPE);
//让浏览器下载
response.addHeader("Content-Disposition", "attachment;filename=" + "invoiceRecord.xlsx"); //设置返回的文件名称
//写入到Response中
writer.flush(response.getOutputStream(), true);
}
/**
* 设置生成的Excel表格单元格标题
*
* @param writer Excel写入器
* @author WH
* @date 2021/12/31 11:10
* @since version-1.0
*/
private void setExcelCellName(ExcelWriter writer) {
writer.addHeaderAlias("rowsNumber", "序号");
writer.addHeaderAlias("invoiceType", "发票类型");
writer.addHeaderAlias("receiveEmail", "接收邮箱");
writer.addHeaderAlias("titleType", "抬头类型");
writer.addHeaderAlias("titleContent", "抬头内容");
writer.addHeaderAlias("dutyNumber", "税号");
writer.addHeaderAlias("invoiceContent", "发票内容");
writer.addHeaderAlias("invoiceMoney", "发票总金额");
writer.addHeaderAlias("invoiceOrderServiceTotalMoney", "总服务费金额");
writer.addHeaderAlias("firmAddress", "地址");
writer.addHeaderAlias("firmPhone", "电话号码");
writer.addHeaderAlias("firmBank", "开户行");
writer.addHeaderAlias("firmBankAccount", "银行开户账号");
writer.addHeaderAlias("isShowDate", "用户是否要求展示交易日期");
writer.addHeaderAlias("userNotes", "用户备注");
writer.addHeaderAlias("creatorType", "用户类型");
writer.addHeaderAlias("iCreateTime", "发票申请时间");
writer.addHeaderAlias("invoicingTime", "发票开票时间");
writer.addHeaderAlias("drawer", "开票人");
writer.addHeaderAlias("financeNotes", "财物备注");
writer.addHeaderAlias("electricInvoiceUrl", "电子发票地址");
writer.addHeaderAlias("isRead", "用户是否阅读发票信息");
writer.addHeaderAlias("historySerialNumber", "订单编号");
writer.addHeaderAlias("powerPriceTotal", "订单电费");
writer.addHeaderAlias("servicePriceTotal", "订单服务费");
writer.addHeaderAlias("promotionDiscount", "折扣费用");
writer.addHeaderAlias("historyActPrice", "用户实际支付金额");
writer.addHeaderAlias("hCreateTime", "订单创建时间");
writer.addHeaderAlias("chargingMode", "订单来源");
}
/**
* 通过发票id查找对应的发票数据
*
@ -293,7 +594,7 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
* @since version-1.0
*/
@Override
public SpecificInvoiceWrap selectSpecificInvoice(Long invoiceId) {
public SpecificInvoiceWrap findSpecificInvoice(Long invoiceId) {
//处理包装类外层数据
XhpcInvoice xhpcInvoice = xhpcInvoiceMapper.selectByPrimaryKey(invoiceId);
@ -303,7 +604,9 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
specificInvoiceWrap.setInvoiceMoney(xhpcInvoice.getInvoiceMoney());
specificInvoiceWrap.setInvoiceTotalEletricMoney(xhpcInvoice.getInvoiceOrderEletricTotalMoney());
specificInvoiceWrap.setInvoiceTotalServiceMoney(xhpcInvoice.getInvoiceOrderServiceTotalMoney());
specificInvoiceWrap.setInvoicingTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, xhpcInvoice.getInvoicingTime()));
if (xhpcInvoice.getInvoicingTime() != null) {
specificInvoiceWrap.setInvoicingTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, xhpcInvoice.getInvoicingTime()));
}
//处理包装类内层数据
specificInvoiceWrap.setHistoryOrders(new SpecificInvoiceWrap.HistoryOrdersDTO());
SpecificInvoiceWrap.HistoryOrdersDTO historyOrdersDTO = specificInvoiceWrap.getHistoryOrders();
@ -320,7 +623,7 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
historyOrdersDataDTO.setHistoryCreateTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, xhpcInvoiceMapHistoryOrder.getCreateTime()));
historyOrdersDataDTO.setServiceMoney(xhpcInvoiceMapHistoryOrder.getServicePriceTotal());
historyOrdersDataDTO.setEletricMoney(xhpcInvoiceMapHistoryOrder.getPowerPriceTotal());
historyOrdersDataDTO.setHistorySerialNumber(xhpcInvoiceMapHistoryOrder.getHisotrySerialNumber());
historyOrdersDataDTO.setHistorySerialNumber(xhpcInvoiceMapHistoryOrder.getHistorySerialNumber());
XhpcChargingStation xhpcChargingStation = xhpcChargingStationMapper.selectXhpcChargingStationById(xhpcInvoiceMapHistoryOrder.getChargingStationId());
Map<String, Object> operatorInfo = xhpcOperatorMapper.info(xhpcChargingStation.getOperatorId());
String operatorName = (String) operatorInfo.get("name");

View File

@ -22,4 +22,19 @@ spring:
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
#oss默认配置
oss:
enabled: true
name: qiniu
tenant-mode: true
endpoint: oss-accelerate.aliyuncs.com
access-key: LTAI5tBWjnuQGxGicnThwMF1
secret-key: b0WNtFYtWyTEkZzcr2WOAPoZg6w2Xu
bucket-name: xhpc-bucket1
#文件路径
file:
aliyunPath: invoicePdf/
serverStoreDisposableFileLocation: /www/wwwroot/xhpc.scxhua.com/disposableFiles/

View File

@ -63,860 +63,9 @@
from xhpc_charging_station
</sql>
<select id="selectXhpcChargingStationList" resultType="java.util.Map">
select
cs.charging_station_id as chargingStationId,
cs.name as name,
ope.name as operatorName,
cs.address as address,
(select url from xhpc_img where img_id = cs.img_id and del_flag =0 limit 1) as url,
cs.client_visible as clientVisible,
cs.status as status
from xhpc_charging_station as cs
left join xhpc_operator as ope on cs.operator_id = ope.operator_id
where cs.del_flag =0
<if test="name !=null and name !=''">
and cs.name like CONCAT('%',#{name},'%')
</if>
<if test="operatorName !=null and operatorName !=''">
and ope.name like CONCAT('%',#{operatorName},'%')
</if>
<if test="type ==1">
and cs.charging_station_id in(select charging_station_id from xhpc_charging_station where
operator_id=#{operatorId})
</if>
<if test="type ==2">
and cs.charging_station_id in(select charging_station_id from xhpc_user_privilege where
user_id=#{operatorId})
</if>
</select>
<select id="selectXhpcChargingStationById" resultMap="BaseResultMap">
<include refid="selectXhpcChargingStationVo"/>
where charging_station_id = #{chargingStationId}
</select>
<select id="selectXhpcChargingStationByName" resultMap="BaseResultMap">
<include refid="selectXhpcChargingStationVo"/>
where name = #{chargingStationName}
</select>
<insert id="insertXhpcChargingStation" parameterType="com.xhpc.common.domain.XhpcChargingStation">
insert into xhpc_charging_station
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="chargingStationId != null">charging_station_id,</if>
<if test="name != null">name,</if>
<if test="operatorId != null">operator_id,</if>
<if test="type != null">type,</if>
<if test="constructionSite != null">construction_site,</if>
<if test="serviceFacilities != null">service_facilities,</if>
<if test="peripheryFacilities != null">periphery_facilities,</if>
<if test="areaCode != null">area_code,</if>
<if test="address != null">address,</if>
<if test="detailedAddress != null">detailed_address,</if>
<if test="longitude != null">longitude,</if>
<if test="latitude != null">latitude,</if>
<if test="parkingInstructions != null">parking_instructions,</if>
<if test="serialNumber != null">serial_number,</if>
<if test="clientVisible != null">client_visible,</if>
<if test="status != null">status,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="remark != null">remark,</if>
<if test="rateModelId != null">rate_model_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="chargingStationId != null">#{chargingStationId},</if>
<if test="name != null">#{name},</if>
<if test="operatorId != null">#{operatorId},</if>
<if test="type != null">#{type},</if>
<if test="constructionSite != null">#{constructionSite},</if>
<if test="serviceFacilities != null">#{serviceFacilities},</if>
<if test="peripheryFacilities != null">#{peripheryFacilities},</if>
<if test="areaCode != null">#{areaCode},</if>
<if test="address != null">#{address},</if>
<if test="detailedAddress != null">#{detailedAddress},</if>
<if test="longitude != null">#{longitude},</if>
<if test="latitude != null">#{latitude},</if>
<if test="parkingInstructions != null">#{parkingInstructions},</if>
<if test="serialNumber != null">#{serialNumber},</if>
<if test="clientVisible != null">#{clientVisible},</if>
<if test="status != null">#{status},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="remark != null">#{remark},</if>
<if test="rateModelId != null">#{rateModelId},</if>
</trim>
</insert>
<update id="updateXhpcChargingStation" parameterType="com.xhpc.common.domain.XhpcChargingStation">
update xhpc_charging_station
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="operatorId != null">operator_id = #{operatorId},</if>
<if test="type != null">type = #{type},</if>
<if test="constructionSite != null">construction_site = #{constructionSite},</if>
<if test="serviceFacilities != null">service_facilities = #{serviceFacilities},</if>
<if test="peripheryFacilities != null">periphery_facilities = #{peripheryFacilities},</if>
<if test="areaCode != null">area_code = #{areaCode},</if>
<if test="address != null">address = #{address},</if>
<if test="detailedAddress != null">detailed_address = #{detailedAddress},</if>
<if test="longitude != null">longitude = #{longitude},</if>
<if test="latitude != null">latitude = #{latitude},</if>
<if test="parkingInstructions != null">parking_instructions = #{parkingInstructions},</if>
<if test="serialNumber != null">serial_number = #{serialNumber},</if>
<if test="clientVisible != null">client_visible = #{clientVisible},</if>
<if test="status != null">status = #{status},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="rateModelId != null">rate_model_id = #{rateModelId},</if>
<if test="businessInstructions != null">business_instructions = #{businessInstructions},</if>
<if test="reminderInstructions != null">reminder_instructions = #{reminderInstructions},</if>
<if test="imgId != null">img_id = #{imgId},</if>
<if test="stationType != null">station_type = #{stationType},</if>
<if test="operatorIdEvcs != null">operator_id_evcs = #{operatorIdEvcs},</if>
<if test="serviceTel != null">service_tel = #{serviceTel},</if>
<if test="parkNums != null">park_nums = #{parkNums}</if>
</trim>
where charging_station_id = #{chargingStationId}
</update>
<update id="updateXhpcChargingStationById" parameterType="Long">
update xhpc_charging_station
set del_flag =1
where charging_station_id = #{chargingStationId}
</update>
<update id="updateXhpcChargingStationByIds" parameterType="java.lang.String">
update xhpc_charging_station set del_flag =1 where charging_station_id in
<foreach item="chargingStationId" collection="array" open="(" separator="," close=")">
#{chargingStationId}
</foreach>
</update>
<update id="status">
update xhpc_charging_station
set status =#{status}
where charging_station_id = #{chargingStationId}
and del_flag = 0
</update>
<update id="clientVisible">
update xhpc_charging_station
set client_visible =#{clientVisible}
where charging_station_id = #{chargingStationId}
and del_flag = 0
</update>
<select id="stationInternetBlackList" resultType="java.util.Map">
select name
from xhpc_internet_user
where del_flag = 0
and internet_user_id not in (select internet_user_id
from xhpc_station_internet_blacklist
where charging_station_id = #{chargingStationId})
</select>
<select id="getXhpcChargingStationMessage" resultType="java.util.Map">
select ct.charging_station_id as chargingStationId,
ct.name as name,
ct.operator_id as operatorId,
ct.operator_id_evcs as operatorIdEvcs,
ct.station_type as stationType,
op.name as operatorName,
ct.type as type,
(select dict_value
from xhpc_dict_biz
where code = 'charging_station_type'
and dict_key = ct.station_type) as stationTypeName,
ct.serial_number as serialNumber,
ct.construction_site as constructionSite,
(select dict_value
from xhpc_dict_biz
where code = 'charging_construction_site'
and dict_key = ct.construction_site) as constructionSiteName,
ct.address as address,
ct.remark as remark,
ct.detailed_address as detailedAddress,
ct.periphery_facilities as peripheryFacilities,
ct.service_facilities as serviceFacilities,
ct.parking_instructions as parkingInstructions,
ct.business_instructions as businessInstructions,
ct.reminder_instructions as reminderInstructions,
ct.client_visible as clientVisible,
ct.img_id as imgId,
ct.service_tel as serviceTel,
ct.park_nums as parkNums,
GROUP_CONCAT(DISTINCT xdbs.dict_value ORDER BY xdbs.create_time ASC separator ',' ) serviceFacilitiesName,
GROUP_CONCAT(DISTINCT xdbp.dict_value ORDER BY xdbp.create_time ASC separator ',' ) peripheryFacilitiesName
from xhpc_charging_station as ct
left join xhpc_operator as op on op.operator_id = ct.operator_id
left JOIN xhpc_dict_biz as xdbs on xdbs.code = 'service_facilities' and xdbs.dict_key !=-1 and xdbs.del_flag=0
left JOIN xhpc_dict_biz as xdbp
on xdbp.code='charging_periphery_facilities' and xdbp.dict_key !=-1 and xdbp.del_flag=0
where ct.charging_station_id = #{chargingStationId}
and ct.del_flag = 0
</select>
<select id="getWXList" resultType="map">
select
cs.charging_station_id as chargingStationId,
cs.name as name,
cs.longitude as longitude,
cs.latitude as latitude,
cs.parking_instructions as parkingInstructions,
cs.detailed_address as detailedAddress,
cs.service_facilities as serviceFacilities,
(select count(terminal_id) from xhpc_terminal where status=0 and del_flag =0 and
charging_station_id=cs.charging_station_id) as common,
(select GROUP_CONCAT(serial_number) from xhpc_terminal where status=0 and del_flag =0 and
charging_station_id=cs.charging_station_id) as serialNumbers,
(select (ra.power_fee+ra.service_fee) as serviceFee
from xhpc_rate as ra
where ra.status = 0
and ra.del_flag = 0
and ra.rate_id = (
select rate_id from xhpc_rate_time
where charging_station_id = cs.charging_station_id
and cs.rate_model_id = rate_model_id
and start_time &lt;= #{date}
and replace(end_time, '00:00:00', '24:00:00') &gt;= #{date}
and status = 0
and del_flag = 0)) money,
(select GROUP_CONCAT(dict_value) from xhpc_dict_biz where FIND_IN_SET(dict_key,cs.service_facilities ) and code
= 'service_facilities' and parent_id > 0 and del_flag = 0) as serviceFacilitiesName,
ROUND(ACOS(SIN((#{latitude} * 3.141593) / 180 ) *SIN((cs.latitude * 3.141593) / 180 ) +
COS((#{latitude} * 3.141593) / 180 ) * COS((cs.latitude * 3.141593) / 180 ) *
COS((#{longitude} * 3.141593) / 180 - (cs.longitude * 3.141593) / 180 ) ) * 6370.9968,2)AS distance
from xhpc_charging_station as cs
where cs.del_flag =0 and cs.status =0
and FIND_IN_SET(#{clientVisible},cs.client_visible)>0
<if test="name !=null and name !=''">
and cs.name like CONCAT('%',#{name},'%')
</if>
<if test="serviceFacilities !=null and serviceFacilities.size()>0 ">
and
<foreach collection="serviceFacilities" item="item" index="index" open="(" close=")" separator="or">
cs.service_facilities like CONCAT('%',#{item},'%')
</foreach>
</if>
<if test="code !=null and code !=''">
and cs.area_code in (select code from xhpc_area where pcode=#{code}) or cs.area_code=#{code}
</if>
ORDER BY distance asc
</select>
<select id="getCode" resultType="java.util.Map">
select code, dict_key, dict_value
from xhpc_dict_biz
where code = #{code} and parent_id > 0 and del_flag = 0
<if test="serviceFacilities !=null and serviceFacilities.size()>0 ">
and
<foreach collection="serviceFacilities" item="item" index="index" open="(" close=")" separator="or">
dict_biz_id like CONCAT('%',#{item},'%')
</foreach>
</if>
</select>
<select id="getWXXhpcChargingStationMessage" resultType="java.util.Map">
select charging_station_id as chargingStationId,
longitude,
latitude,
(select type
from xhpc_charging_pile
where charging_station_id = charging_station_id
and del_flag = 0
and status = 0 limit 1) as type,
(select count(terminal_id) from xhpc_terminal where status=0 and del_flag =0 and charging_station_id=#{chargingStationId}) as common,
(select GROUP_CONCAT(serial_number) from xhpc_terminal where status=0 and del_flag =0 and charging_station_id=charging_station_id) as serialNumbers,
(select GROUP_CONCAT(dict_value) from xhpc_dict_biz where FIND_IN_SET(dict_key, service_facilities ) and code= 'service_facilities' and parent_id > 0 and del_flag = 0) as serviceFacilitiesName,
name as name,
reminder_instructions as reminderInstructions,
detailed_address as detailedAddress,
parking_instructions as parkingInstructions,
business_instructions as businessInstructions,
service_facilities as serviceFacilities,
img_id as imgId,
remark as remark,
ROUND(ACOS(SIN((
#{latitude} * 3.141593) / 180) * SIN((latitude * 3.141593) / 180) + COS((#{latitude} * 3.141593) / 180) * COS((latitude * 3.141593) / 180) * COS((#{longitude} * 3.141593) / 180 - (longitude * 3.141593) / 180)) * 6370.9968,
2) AS distance
from xhpc_charging_station
where charging_station_id = #{chargingStationId}
and del_flag = 0
and status = 0
</select>
<select id="getImageList" resultType="java.util.Map">
select
img_id as imgId,
url as url
from xhpc_img where del_flag=0 and status=0
<if test="imgIds !=null and imgIds.size()>0 ">
and img_id in
<foreach collection="imgIds" item="chargingStationId" open="(" separator="," close=")">
#{chargingStationId}
</foreach>
</if>
</select>
<select id="getWXXhpcRateTimeMassage" resultType="java.util.Map">
select xrt.start_time as startTime,
xrt.end_time as endTime,
xr.power_fee as powerFee,
xr.service_fee as serviceFee
from xhpc_rate_time as xrt
left join xhpc_rate as xr on xr.rate_id = xrt.rate_id
where xrt.charging_station_id = #{chargingStationId}
and xrt.status = 0
and xrt.del_flag = 0
order by xrt.sort asc
</select>
<select id="getWXXhpcTerminalMassage" resultType="java.util.Map">
select te.name as name,
cp.power as power,
cp.auxiliary_power_supply as auxiliaryPowerSupply,
te.serial_number as serialNumber,
cp.input_voltage as inputVoltage
from xhpc_terminal as te
left join xhpc_charging_pile as cp on cp.charging_pile_id = te.charging_pile_id
where te.charging_station_id = #{chargingStationId}
and te.status = 0
and te.del_flag = 0
</select>
<insert id="addXhpcRateModel" parameterType="com.xhpc.common.domain.XhpcRateModel" useGeneratedKeys="true"
keyProperty="rateModelId">
insert into xhpc_rate_model
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != status ">
status,
</if>
<if test="null != delFlag ">
del_flag,
</if>
<if test="null != createTime ">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime ">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != remark and '' != remark">
remark
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != status ">
#{status},
</if>
<if test="null != delFlag ">
#{delFlag},
</if>
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime ">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != remark and '' != remark">
#{remark}
</if>
</trim>
</insert>
<insert id="addXhpcChargingStation" parameterType="com.xhpc.common.domain.XhpcChargingStation"
useGeneratedKeys="true" keyProperty="chargingStationId">
insert into xhpc_charging_station
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != name and '' != name">
name,
</if>
<if test="null != operatorId ">
operator_id,
</if>
<if test="null != type ">
type,
</if>
<if test="null != constructionSite and '' != constructionSite">
construction_site,
</if>
<if test="null != serviceFacilities and '' != serviceFacilities">
service_facilities,
</if>
<if test="null != peripheryFacilities and '' != peripheryFacilities">
periphery_facilities,
</if>
<if test="null != areaCode ">
area_code,
</if>
<if test="null != address and '' != address">
address,
</if>
<if test="null != detailedAddress and '' != detailedAddress">
detailed_address,
</if>
<if test="null != longitude and '' != longitude">
longitude,
</if>
<if test="null != latitude and '' != latitude">
latitude,
</if>
<if test="null != parkingInstructions and '' != parkingInstructions">
parking_instructions,
</if>
<if test="null != serialNumber and '' != serialNumber">
serial_number,
</if>
<if test="null != clientVisible and '' != clientVisible">
client_visible,
</if>
<if test="null != rateModelId and '' != rateModelId">
rate_model_id,
</if>
<if test="null != imgId and '' != imgId">
img_id,
</if>
<if test="null != businessInstructions and '' != businessInstructions">
business_instructions,
</if>
<if test="null != reminderInstructions and '' != reminderInstructions">
reminder_instructions,
</if>
<if test="null != status ">
status,
</if>
<if test="null != delFlag ">
del_flag,
</if>
<if test="null != createTime ">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime ">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != remark and '' != remark">
remark,
</if>
<if test="null != stationType">
station_type,
</if>
<if test="null != operatorIdEvcs and '' != operatorIdEvcs">
operator_id_evcs,
</if>
<if test="null != serviceTel and '' != serviceTel">
service_tel,
</if>
<if test="null != parkNums and '' != parkNums">
park_nums
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != name and '' != name">
#{name},
</if>
<if test="null != operatorId ">
#{operatorId},
</if>
<if test="null != type ">
#{type},
</if>
<if test="null != constructionSite and '' != constructionSite">
#{constructionSite},
</if>
<if test="null != serviceFacilities and '' != serviceFacilities">
#{serviceFacilities},
</if>
<if test="null != peripheryFacilities and '' != peripheryFacilities">
#{peripheryFacilities},
</if>
<if test="null != areaCode ">
#{areaCode},
</if>
<if test="null != address and '' != address">
#{address},
</if>
<if test="null != detailedAddress and '' != detailedAddress">
#{detailedAddress},
</if>
<if test="null != longitude and '' != longitude">
#{longitude},
</if>
<if test="null != latitude and '' != latitude">
#{latitude},
</if>
<if test="null != parkingInstructions and '' != parkingInstructions">
#{parkingInstructions},
</if>
<if test="null != serialNumber and '' != serialNumber">
#{serialNumber},
</if>
<if test="null != clientVisible and '' != clientVisible">
#{clientVisible},
</if>
<if test="null != rateModelId and '' != rateModelId">
#{rateModelId},
</if>
<if test="null != imgId and '' != imgId">
#{imgId},
</if>
<if test="null != businessInstructions and '' != businessInstructions">
#{businessInstructions},
</if>
<if test="null != reminderInstructions and '' != reminderInstructions">
#{reminderInstructions},
</if>
<if test="null != status ">
#{status},
</if>
<if test="null != delFlag ">
#{delFlag},
</if>
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime ">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != remark and '' != remark">
#{remark},
</if>
<if test="null != stationType">
#{stationType},
</if>
<if test="null != operatorIdEvcs and '' != operatorIdEvcs">
#{operatorIdEvcs},
</if>
<if test="null != serviceTel and '' != serviceTel">
#{serviceTel},
</if>
<if test="null != parkNums and '' != parkNums">
#{parkNums}
</if>
</trim>
</insert>
<insert id="addXhpcRate" parameterType="com.xhpc.common.domain.XhpcRate" useGeneratedKeys="true"
keyProperty="rateId">
insert into xhpc_rate
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != chargingStationId ">
charging_station_id,
</if>
<if test="null != powerFee ">
power_fee,
</if>
<if test="null != serviceFee ">
service_fee,
</if>
<if test="null != name and '' != name">
name,
</if>
<if test="null != delFlag ">
del_flag,
</if>
<if test="null != createTime ">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime ">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != remark and '' != remark">
remark,
</if>
<if test="null != rateValue">
rate_value,
</if>
<if test="null != rateModelId">
rate_model_id
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != chargingStationId ">
#{chargingStationId},
</if>
<if test="null != powerFee ">
#{powerFee},
</if>
<if test="null != serviceFee ">
#{serviceFee},
</if>
<if test="null != name and '' != name">
#{name},
</if>
<if test="null != status ">
#{status},
</if>
<if test="null != delFlag ">
#{delFlag},
</if>
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime ">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != remark and '' != remark">
#{remark},
</if>
<if test="null != rateValue">
#{rateValue},
</if>
<if test="null != rateModelId">
#{rateModelId}
</if>
</trim>
</insert>
<insert id="addXhpcRateTime" parameterType="com.xhpc.common.domain.XhpcRateTime" useGeneratedKeys="true"
keyProperty="rateId">
insert into xhpc_rate_time
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != chargingStationId ">
charging_station_id,
</if>
<if test="null != rateId ">
rate_id,
</if>
<if test="null != startTime ">
start_time,
</if>
<if test="null != endTime ">
end_time,
</if>
<if test="null != rateModelId ">
rate_model_id,
</if>
<if test="null != sort ">
sort,
</if>
<if test="null != status ">
status,
</if>
<if test="null != delFlag ">
del_flag,
</if>
<if test="null != createTime ">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime ">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != remark and '' != remark">
remark,
</if>
<if test="null != type ">
type,
</if>
<if test="null != rateValue ">
rate_value
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != chargingStationId ">
#{chargingStationId},
</if>
<if test="null != rateId ">
#{rateId},
</if>
<if test="null != startTime ">
#{startTime},
</if>
<if test="null != endTime ">
#{endTime},
</if>
<if test="null != rateModelId ">
#{rateModelId},
</if>
<if test="null != sort ">
#{sort},
</if>
<if test="null != status ">
#{status},
</if>
<if test="null != delFlag ">
#{delFlag},
</if>
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime ">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != remark and '' != remark">
#{remark},
</if>
<if test="null != type ">
#{type},
</if>
<if test="null != rateValue ">
#{rateValue}
</if>
</trim>
</insert>
<select id="getXhpcRateList" resultType="java.util.Map">
select power_fee as powerFee,
service_fee as serviceFee,
name as name,
rate_value as id
from xhpc_rate
where charging_station_id = #{chargingStationId}
and del_flag = 0
GROUP BY rate_value
</select>
<select id="getXhpcRateTimeTypeList" resultType="java.util.Map">
select rt.start_time as startTime,
replace(rt.end_time, '00:00:00', '24:00:00') AS endTime,
rt.rate_id as rateId,
rt.rate_value as id,
ra.name as rateName,
ra.power_fee as powerFee,
ra.service_fee as serviceFee
from xhpc_rate_time as rt
left join xhpc_rate as ra on ra.rate_id = rt.rate_id
where rt.charging_station_id = #{chargingStationId}
and rt.del_flag = 0
</select>
<select id="getXhpcRateTimeOrderStatistics" resultType="java.util.Map">
select IF(SUM(total_power) IS NULL, 0, SUM(total_power)) as chargingDegreeSum,
COUNT(history_order_id) as realTimeOrderIdCount,
COUNT(DISTINCT user_id) as userIdCount
from xhpc_history_order
where charging_station_id = #{chargingStationId}
and create_time &gt;= #{createTime}
</select>
<update id="updateXhpcRate">
update xhpc_rate
set del_flag =1
where charging_station_id = #{chargingStationId}
and del_flag = 0
</update>
<update id="updateXhpcRateTime">
update xhpc_rate_time
set del_flag =1
where charging_station_id = #{chargingStationId}
and del_flag = 0
</update>
<select id="getXchargingPileList" resultType="java.lang.String">
select serial_number as pileNo
from xhpc_charging_pile
where charging_station_id = #{chargingStationId}
and del_flag = 0
and status = 0
</select>
<select id="getXhpcRateTimeNumber" resultType="java.util.Map">
SELECT CAST(((UNIX_TIMESTAMP(end_time) - UNIX_TIMESTAMP(start_time)) / 1800) AS SIGNED) as number,
rate_value as rateValue
FROM xhpc_rate_time
where charging_station_id = #{chargingStationId}
order by sort
</select>
<update id="updateXhpcChargingPile">
update xhpc_charging_pile
set rate_model_id=#{rateModelId}
WHERE charging_station_id = #{chargingStationId}
</update>
<update id="updateXhpcTerminal">
update xhpc_terminal
set rate_model_id=#{rateModelId}
WHERE charging_station_id = #{chargingStationId}
</update>
<select id="getLandUser" resultType="map">
select user_id as userId, user_type as userType, operator_id as operatorId
from sys_user
where user_id = #{userId}
</select>
<insert id="addXhpcUserPrivilege">
insert into xhpc_user_privilege(
<if test="null != userId and '' != userId">
user_id,
</if>
<if test="null != chargingStationId and '' != chargingStationId">
charging_station_id
</if>
)values(
<if test="null != userId and '' != userId">
#{userId},
</if>
<if test="null != chargingStationId and '' != chargingStationId">
#{chargingStationId}
</if>
)
</insert>
</mapper>

View File

@ -53,21 +53,67 @@
<result column="total_power" jdbcType="DOUBLE" property="totalPower"/>
<result column="user_name_evcs" jdbcType="VARCHAR" property="userNameEvcs"/>
<result column="phone" jdbcType="VARCHAR" property="phone"/>
<result column="charging_mode" jdbcType="VARCHAR" property="chargingMode"/>
<result column="internet_degree_commission" jdbcType="DECIMAL" property="internetDegreeCommission"/>
<result column="source" jdbcType="INTEGER" property="source"/>
</resultMap>
<sql id="Base_Column_List">
history_order_id
, charging_station_id, charge_order_id, user_id, terminal_id, serial_number,
internet_serial_number, power_price_total, service_price_total, total_price, promotion_discount,
act_price, act_power_price, act_service_price, internet_commission, internet_svc_commission,
platform_commission, platform_svc_commisssion, operation_commission, operation_svc_commission,
start_soc, end_soc, reconciliation_status, sorting_status, `type`, `status`, del_flag,
create_time, create_by, update_time, update_by, remark, `state`, vin_normal, search_value,
operator_id_evcs, charge_model_evcs, connector_power_evcs, meter_value_end_evcs,
meter_value_start_evcs, operator_id3rdpty_evcs, start_time, stop_reason_evcs, total_power,
user_name_evcs, phone, rate_model_id
,
charging_station_id,
charge_order_id,
user_id,
terminal_id,
serial_number,
internet_serial_number,
power_price_total,
service_price_total,
total_price,
promotion_discount,
act_price,
act_power_price,
act_service_price,
internet_commission,
internet_svc_commission,
platform_commission,
platform_svc_commisssion,
operation_commission,
operation_svc_commission,
start_soc,
end_soc,
reconciliation_status,
sorting_status,
type,
status,
del_flag,
create_time,
create_by,
update_time,
update_by,
remark,
state,
vin_normal,
search_value,
operator_id_evcs,
charge_model_evcs,
connector_power_evcs,
meter_value_end_evcs,
meter_value_start_evcs,
operator_id3rdpty_evcs,
start_time,
end_time,
stop_reason_evcs,
total_power,
user_name_evcs,
phone,
evcs_order_no,
confirm_Result,
rate_model_id,
charging_mode,
internet_degree_commission,
source,
tenant_id
</sql>
<select id="findByCondition" resultMap="XhpcHistoryOrderResult">
@ -108,5 +154,19 @@
</foreach>
</if>
</select>
<select id="findById" resultMap="XhpcHistoryOrderResult">
SELECT
<include refid="Base_Column_List"/>
FROM
xhpc_history_order
WHERE
del_flag = 0
<if test="collection!=null">
AND history_order_id IN
<foreach collection="collection" open="(" close=")" item="historyOrderId" separator=",">
#{historyOrderId}
</foreach>
</if>
</select>
</mapper>

View File

@ -6,7 +6,7 @@
<result column="history_order_id" jdbcType="BIGINT" property="historyOrderId"/>
<result column="history_user_id" jdbcType="BIGINT" property="historyUserId"/>
<result column="history_user_type" jdbcType="BIGINT" property="historyUserType"/>
<result column="hisotry_serial_number" jdbcType="VARCHAR" property="hisotrySerialNumber"/>
<result column="history_serial_number" jdbcType="VARCHAR" property="historySerialNumber"/>
<result column="power_price_total" jdbcType="DECIMAL" property="powerPriceTotal"/>
<result column="service_price_total" jdbcType="DECIMAL" property="servicePriceTotal"/>
<result column="promotion_discount" jdbcType="DECIMAL" property="promotionDiscount"/>
@ -15,10 +15,29 @@
<result column="charging_mode" jdbcType="VARCHAR" property="chargingMode"/>
<result column="charging_station_id" jdbcType="BIGINT" property="chargingStationId"/>
<result column="terminal_id" jdbcType="BIGINT" property="terminalId"/>
<result column="del_lock" jdbcType="TINYINT" property="delLock"/> <!--他自己生成的方法没加这个字段,用到了的时候在加-->
<result column="lock_flag" jdbcType="TINYINT" property="lockFlag"/> <!--他自己生成的方法没加这个字段,用到了的时候在加-->
<result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
</resultMap>
<sql id="Base_Column_List">
`invoice_id`
,
`history_order_id`,
`history_user_id`,
`history_user_type`,
`history_serial_number`,
`power_price_total`,
`service_price_total`,
`promotion_discount`,
`history_act_price`,
`create_time`,
`charging_mode`,
`charging_station_id`,
`terminal_id`,
`lock_flag`,
`del_flag`
</sql>
<insert id="insert" parameterType="com.xhpc.invoice.pojo.XhpcInvoiceMapHistoryOrder">
insert into xhpc_invoice_map_history_order (invoice_id, history_order_id, history_user_id,
history_user_type, hisotry_serial_number, power_price_total,
@ -49,8 +68,8 @@
<if test="historyUserType != null">
history_user_type,
</if>
<if test="hisotrySerialNumber != null">
hisotry_serial_number,
<if test="historySerialNumber != null">
history_serial_number,
</if>
<if test="powerPriceTotal != null">
power_price_total,
@ -76,6 +95,9 @@
<if test="terminalId != null">
terminal_id,
</if>
<if test="lockFlag!=null">
lock_flag,
</if>
<if test="delFlag != null">
del_flag,
</if>
@ -93,8 +115,8 @@
<if test="historyUserType != null">
#{historyUserType,jdbcType=BIGINT},
</if>
<if test="hisotrySerialNumber != null">
#{hisotrySerialNumber,jdbcType=VARCHAR},
<if test="historySerialNumber != null">
#{historySerialNumber,jdbcType=VARCHAR},
</if>
<if test="powerPriceTotal != null">
#{powerPriceTotal,jdbcType=DECIMAL},
@ -120,6 +142,9 @@
<if test="terminalId != null">
#{terminalId,jdbcType=BIGINT},
</if>
<if test="lockFlag!=null">
#{lockFlag,jdbcType=INTEGER},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=INTEGER},
</if>
@ -136,11 +161,17 @@
)
)
</update>
<update id="updateUnlockHistoryOrdersByInvoiceId">
UPDATE xhpc_invoice_map_history_order
SET lock_flag = NULL
WHERE invoice_id = #{invoiceId}
</update>
<select id="findOrdersByInvoiceId" resultMap="BaseResultMap">
SELECT *
SELECT
<include refid="Base_Column_List"/>
FROM `xhpc_invoice_map_history_order`
WHERE invoice_id = #{invoiceId}
AND del_flag IS NULL;
AND del_flag IS NULL;
</select>
<select id="getHistoryOrderScopeByInvoiceId" resultType="java.lang.String">
SELECT MIN(create_time)
@ -161,4 +192,16 @@
AND history_user_id = #{userId}
AND history_user_type = #{userType};
</select>
<select id="getLockedOnesByHistoryOrderId" resultType="com.xhpc.invoice.pojo.XhpcInvoiceMapHistoryOrder">
SELECT
<include refid="Base_Column_List"/>
FROM
xhpc_invoice_map_history_order
WHERE
history_order_id IN
<foreach collection="collection" open="(" close=")" separator="," item="historyOrderId">
#{historyOrderId}
</foreach>
AND lock_flag = 0;
</select>
</mapper>

View File

@ -3,6 +3,7 @@
<mapper namespace="com.xhpc.invoice.mapper.XhpcInvoiceMapper">
<resultMap id="BaseResultMap" type="com.xhpc.invoice.pojo.XhpcInvoice">
<id column="invoice_id" jdbcType="BIGINT" property="invoiceId"/>
<result column="invoice_type" jdbcType="INTEGER" property="invoiceType"/>
<result column="receive_email" jdbcType="VARCHAR" property="receiveEmail"/>
<result column="title_type" jdbcType="INTEGER" property="titleType"/>
<result column="title_content" jdbcType="VARCHAR" property="titleContent"/>
@ -30,14 +31,39 @@
<result column="update_time" jdbcType="DATE" property="updateTime"/>
<result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
</resultMap>
<sql id="Base_Column_List">
invoice_id
, receive_email, title_type, title_content, duty_number, invoice_content,
invoice_money, invoice_order_eletric_total_money, invoice_order_service_total_money,
firm_address, firm_phone, firm_bank, firm_bank_account, is_show_date, user_notes,
creator_id, creator_type, creator, create_time, `status`, invoicing_time, drawer,
finance_notes, electric_invoice_url, updator, update_time, del_flag
`invoice_id`
,
`receive_email`,
`title_type`,
`title_content`,
`duty_number`,
`invoice_content`,
`invoice_money`,
`invoice_order_eletric_total_money`,
`invoice_order_service_total_money`,
`firm_address`,
`firm_phone`,
`firm_bank`,
`firm_bank_account`,
`is_show_date`,
`user_notes`,
`creator_id`,
`creator_type`,
`creator`,
`create_time`,
`status`,
`invoicing_time`,
`drawer`,
`finance_notes`,
`electric_invoice_url`,
`updator`,
`update_time`,
`is_read`,
`del_flag`
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
@ -47,6 +73,7 @@
<select id="selectAllInvoiceOrdersByCondition" resultMap="BaseResultMap">
SELECT
invoice_id,
invoice_type,
creator,
creator_type,
invoice_money,
@ -62,7 +89,10 @@
and creator = #{creator}
</if>
<if test="creatorType!=null">
and creatorType = #{creatorType}
and creator_type = #{creatorType}
</if>
<if test="invoiceType!=null">
and invoice_type = #{invoiceType}
</if>
<if test="status!=null">
and status = #{status}
@ -93,7 +123,10 @@
and creator = #{creator}
</if>
<if test="creatorType!=null">
and creatorType = #{creatorType}
and creator_type = #{creatorType}
</if>
<if test="invoiceType!=null">
and invoice_type = #{invoiceType}
</if>
<if test="status!=null">
and status = #{status}
@ -132,19 +165,21 @@
GROUP BY title_content LIMIT 0,3
</select>
<select id="selectUserLastInputInvoiceInfo" resultMap="BaseResultMap">
SELECT *
SELECT
<include refid="Base_Column_List"/>
FROM `xhpc_invoice`
WHERE creator_id = #{creatorId}
AND creator_type = #{creatorType}
AND creator_type = #{creatorType}
ORDER BY invoice_id DESC LIMIT 0,1
</select>
<select id="findInvoicesByCreatorIdAndCreatorType" resultMap="BaseResultMap">
SELECT *
SELECT
<include refid="Base_Column_List"/>
FROM xhpc_invoice
WHERE del_flag IS NULL
AND creator_id = #{creatorId}
AND creator_type = #{creatorType} LIMIT #{currentPage}
, #{items}
AND creator_id = #{creatorId}
AND creator_type = #{creatorType}
LIMIT #{currentPage}, #{items}
</select>
<select id="getUserInvoiceItemsByCreatorIdAndCreatorType" resultType="java.lang.Long">
SELECT count(invoice_id)
@ -153,6 +188,56 @@
AND creator_id = #{creatorId}
AND creator_type = #{creatorType}
</select>
<select id="findNotReadCount" resultType="java.lang.Long">
SELECT count(invoice_id)
FROM xhpc_invoice
WHERE del_flag IS NULL
AND is_read = 0
AND creator_id = #{creatorId}
AND creator_type = #{creatorType}
</select>
<select id="selectExcelInvoiceById" resultType="com.xhpc.invoice.domain.ExcelInvoiceRow">
SELECT case i.invoice_type when 0 then '普票' when 1 then '专票' end as invoiceType,
i.receive_email as receiveEmail,
case i.title_type when 0 THEN '企业' ELSE '个人/非企业' END as titleType,
i.title_content as titleContent,
i.duty_number as dutyNumber,
i.invoice_content as invoiceContent,
i.invoice_money as invoiceMoney,
i.invoice_order_service_total_money as invoiceOrderServiceTotalMoney,
i.firm_address as firmAddress,
i.firm_phone as firmPhone,
i.firm_bank as firmBank,
i.firm_bank_account as firmBankAccount,
case i.is_show_date when 0 then '开票者要求展示交易日期' ELSE '开票者不要求展示交易日期' END as isShowDate,
i.user_notes as userNotes,
case i.creator_type
when 0 then 'C端用户'
when 1 then '流量方'
when 2 then '社区用户'
when 3
then '企业用户' END as creatorType,
i.creator as creator,
i.create_time as iCreateTime,
case i.status when 0 then '未开票' when 1 then '已开票' when 2 then '开票失败' END as status,
i.invoicing_time as invoicingTime,
i.drawer,
i.finance_notes as financeNotes,
i.electric_invoice_url as electricInvoiceUrl,
case i.is_read when 1 then '已阅读' when 0 then '未阅读' else '该发票还未处理' END as isRead,
h.history_serial_number as historySerialNumber,
h.power_price_total as powerPriceTotal,
h.service_price_total as servicePriceTotal,
h.promotion_discount as promotionDiscount,
history_act_price as historyActPrice,
h.create_time as hCreateTime,
h.charging_mode as chargingMode
FROM xhpc_invoice AS i
INNER JOIN xhpc_invoice_map_history_order AS h ON i.invoice_id = h.invoice_id
WHERE i.invoice_id = #{invoiceId}
AND i.del_flag IS NULL
AND h.del_flag IS NULL
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete
from xhpc_invoice
@ -343,6 +428,170 @@
</if>
</trim>
</insert>
<insert id="insertSelectiveAndReturnId" parameterType="com.xhpc.invoice.pojo.XhpcInvoice"
keyProperty="invoiceId" useGeneratedKeys="true">
insert into xhpc_invoice
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="receiveEmail != null">
receive_email,
</if>
<if test="titleType != null">
title_type,
</if>
<if test="titleContent != null">
title_content,
</if>
<if test="dutyNumber != null">
duty_number,
</if>
<if test="invoiceContent != null">
invoice_content,
</if>
<if test="invoiceMoney != null">
invoice_money,
</if>
<if test="invoiceOrderEletricTotalMoney != null">
invoice_order_eletric_total_money,
</if>
<if test="invoiceOrderServiceTotalMoney != null">
invoice_order_service_total_money,
</if>
<if test="firmAddress != null">
firm_address,
</if>
<if test="firmPhone != null">
firm_phone,
</if>
<if test="firmBank != null">
firm_bank,
</if>
<if test="firmBankAccount != null">
firm_bank_account,
</if>
<if test="isShowDate != null">
is_show_date,
</if>
<if test="userNotes != null">
user_notes,
</if>
<if test="creatorId != null">
creator_id,
</if>
<if test="creatorType != null">
creator_type,
</if>
<if test="creator != null">
creator,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="status != null">
`status`,
</if>
<if test="invoicingTime != null">
invoicing_time,
</if>
<if test="drawer != null">
drawer,
</if>
<if test="financeNotes != null">
finance_notes,
</if>
<if test="electricInvoiceUrl != null">
electric_invoice_url,
</if>
<if test="updator != null">
updator,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="delFlag != null">
del_flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="receiveEmail != null">
#{receiveEmail,jdbcType=VARCHAR},
</if>
<if test="titleType != null">
#{titleType,jdbcType=INTEGER},
</if>
<if test="titleContent != null">
#{titleContent,jdbcType=VARCHAR},
</if>
<if test="dutyNumber != null">
#{dutyNumber,jdbcType=VARCHAR},
</if>
<if test="invoiceContent != null">
#{invoiceContent,jdbcType=VARCHAR},
</if>
<if test="invoiceMoney != null">
#{invoiceMoney,jdbcType=DECIMAL},
</if>
<if test="invoiceOrderEletricTotalMoney != null">
#{invoiceOrderEletricTotalMoney,jdbcType=DECIMAL},
</if>
<if test="invoiceOrderServiceTotalMoney != null">
#{invoiceOrderServiceTotalMoney,jdbcType=DECIMAL},
</if>
<if test="firmAddress != null">
#{firmAddress,jdbcType=VARCHAR},
</if>
<if test="firmPhone != null">
#{firmPhone,jdbcType=VARCHAR},
</if>
<if test="firmBank != null">
#{firmBank,jdbcType=VARCHAR},
</if>
<if test="firmBankAccount != null">
#{firmBankAccount,jdbcType=VARCHAR},
</if>
<if test="isShowDate != null">
#{isShowDate,jdbcType=INTEGER},
</if>
<if test="userNotes != null">
#{userNotes,jdbcType=VARCHAR},
</if>
<if test="creatorId != null">
#{creatorId,jdbcType=BIGINT},
</if>
<if test="creatorType != null">
#{creatorType,jdbcType=INTEGER},
</if>
<if test="creator != null">
#{creator,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="invoicingTime != null">
#{invoicingTime,jdbcType=TIMESTAMP},
</if>
<if test="drawer != null">
#{drawer,jdbcType=VARCHAR},
</if>
<if test="financeNotes != null">
#{financeNotes,jdbcType=VARCHAR},
</if>
<if test="electricInvoiceUrl != null">
#{electricInvoiceUrl,jdbcType=VARCHAR},
</if>
<if test="updator != null">
#{updator,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=DATE},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.xhpc.invoice.pojo.XhpcInvoice">
update xhpc_invoice
<set>
@ -458,24 +707,38 @@
where invoice_id = #{invoiceId,jdbcType=BIGINT}
</update>
<update id="invoiceToUser">
<update id="updateInvoiceToUser">
UPDATE xhpc_invoice
SET finance_notes = #{financeNotes},
invoicing_time = #{invoicingTime},
electric_invoice_url = #{eletricInvoiceUrl},
`status` = #{status},
drawer = #{drawer}
drawer = #{drawer},
is_read = 0
WHERE invoice_id = #{invoiceId};
</update>
<update id="failInvoiceToUser">
<update id="updateFailInvoiceToUser">
UPDATE xhpc_invoice
SET finance_notes = #{financeNotes},
invoicing_time = #{invoicingTime},
electric_invoice_url = #{eletricInvoiceUrl},
`status` = #{status},
drawer = #{drawer}
drawer = #{drawer},
is_read = 0
WHERE invoice_id = #{invoiceId}
</update>
<update id="updateByInvoiceId">
UPDATE xhpc_invoice
SET is_read = 1
WHERE del_flag IS NULL
AND invoice_id = #{invoiceId}
</update>
<update id="updateElectricAndServiceById">
UPDATE xhpc_invoice
SET invoice_order_eletric_total_money = #{invoiceOrderEletricTotalMoney},
invoice_order_service_total_money = #{invoiceOrderServiceTotalMoney}
WHERE invoice_id = #{invoiceId};
</update>
</mapper>

View File

@ -51,236 +51,6 @@
xo.create_by createBy, xo.update_time updateTime, xo.update_by updateBy, xo.remark,
</sql>
<insert id="insert" parameterType="com.xhpc.invoice.pojo.XhpcOperator" useGeneratedKeys="true"
keyProperty="operatorId">
insert into xhpc_operator
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != name and '' != name">
name,
</if>
<if test="null != contactName and '' != contactName">
contact_name,
</if>
<if test="null != contactPhone and '' != contactPhone">
contact_phone,
</if>
<if test="null != phone and '' != phone">
phone,
</if>
<if test="null != attribute and '' != attribute">
attribute,
</if>
<if test="null != dutyParagraph and '' != dutyParagraph">
duty_paragraph,
</if>
<if test="null != detailedAddress and '' != detailedAddress">
detailed_address,
</if>
<if test="null != openBank and '' != openBank">
open_bank,
</if>
<if test="null != cardNumber and '' != cardNumber">
card_number,
</if>
<if test="null != areaCode and '' != areaCode">
area_code,
</if>
<if test="null != address and '' != address">
address,
</if>
<if test="null != longitude and '' != longitude">
longitude,
</if>
<if test="null != latitude and '' != latitude">
latitude,
</if>
<if test="null != email and '' != email">
email,
</if>
<if test="null != commissionType and '' != commissionType">
commission_type,
</if>
<if test="null != platformCommissionRate and '' != platformCommissionRate">
platform_commission_rate,
</if>
<if test="null != maintenanceCommissionRate and '' != maintenanceCommissionRate">
maintenance_commission_rate,
</if>
<if test="null != businessLicenseId and '' != businessLicenseId">
business_license_id,
</if>
<if test="null != withdrawalTime and '' != withdrawalTime">
withdrawal_time,
</if>
<if test="null != soc and '' != soc">
soc,
</if>
<if test="null != status and '' != status">
status,
</if>
<if test="null != delFlag and '' != delFlag">
del_flag,
</if>
<if test="null != createTime ">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime ">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != remark and '' != remark">
remark,
</if>
<if test="null != operatorIdEvcs and '' != operatorIdEvcs">
operator_id_evcs
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != name and '' != name">
#{name},
</if>
<if test="null != contactName and '' != contactName">
#{contactName},
</if>
<if test="null != contactPhone and '' != contactPhone">
#{contactPhone},
</if>
<if test="null != phone and '' != phone">
#{phone},
</if>
<if test="null != attribute and '' != attribute">
#{attribute},
</if>
<if test="null != dutyParagraph and '' != dutyParagraph">
#{dutyParagraph},
</if>
<if test="null != detailedAddress and '' != detailedAddress">
#{detailedAddress},
</if>
<if test="null != openBank and '' != openBank">
#{openBank},
</if>
<if test="null != cardNumber and '' != cardNumber">
#{cardNumber},
</if>
<if test="null != areaCode and '' != areaCode">
#{areaCode},
</if>
<if test="null != address and '' != address">
#{address},
</if>
<if test="null != longitude and '' != longitude">
#{longitude},
</if>
<if test="null != latitude and '' != latitude">
#{latitude},
</if>
<if test="null != email and '' != email">
#{email},
</if>
<if test="null != commissionType and '' != commissionType">
#{commissionType},
</if>
<if test="null != platformCommissionRate and '' != platformCommissionRate">
#{platformCommissionRate},
</if>
<if test="null != maintenanceCommissionRate and '' != maintenanceCommissionRate">
#{maintenanceCommissionRate},
</if>
<if test="null != businessLicenseId and '' != businessLicenseId">
#{businessLicenseId},
</if>
<if test="null != withdrawalTime and '' != withdrawalTime">
#{withdrawalTime},
</if>
<if test="null != soc and '' != soc">
#{soc},
</if>
<if test="null != status and '' != status">
#{status},
</if>
<if test="null != delFlag and '' != delFlag">
#{delFlag},
</if>
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime ">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != remark and '' != remark">
#{remark},
</if>
<if test="null != operatorIdEvcs and '' != operatorIdEvcs">
#{operatorIdEvcs}
</if>
</trim>
</insert>
<update id="update" parameterType="com.xhpc.invoice.pojo.XhpcOperator">
UPDATE xhpc_operator
<set>
<if test="null != operatorId and '' != operatorId">operator_id = #{operatorId},</if>
<if test="null != name and '' != name">name = #{name},</if>
<if test="null != contactName and '' != contactName">contact_name = #{contactName},</if>
<if test="null != contactPhone and '' != contactPhone">contact_phone = #{contactPhone},</if>
<if test="null != phone and '' != phone">phone = #{phone},</if>
<if test="null != attribute ">attribute = #{attribute},</if>
<if test="null != openBank and '' != openBank">open_bank = #{openBank},</if>
<if test="null != cardNumber">card_number = #{cardNumber},</if>
<if test="null != areaCode and '' != areaCode">area_code = #{areaCode},</if>
<if test="null != address and '' != address">address = #{address},</if>
<if test="null != longitude and '' != longitude">longitude = #{longitude},</if>
<if test="null != latitude and '' != latitude">latitude = #{latitude},</if>
<if test="null != email and '' != email">email = #{email},</if>
<if test="null != commissionType ">commission_type = #{commissionType},</if>
<if test="null != platformCommissionRate">platform_commission_rate =
#{platformCommissionRate},
</if>
<if test="null != maintenanceCommissionRate">maintenance_commission_rate
= #{maintenanceCommissionRate},
</if>
<if test="null != businessLicenseId and '' != businessLicenseId">business_license_id =
#{businessLicenseId},
</if>
<if test="null != withdrawalTime and '' != withdrawalTime">withdrawal_time = #{withdrawalTime},</if>
<if test="null != soc and '' != soc">soc = #{soc},</if>
<if test="null != status">status = #{status},</if>
<if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if>
<if test="null != createTime ">create_time = #{createTime},</if>
<if test="null != createBy and '' != createBy">create_by = #{createBy},</if>
<if test="null != updateTime">update_time = #{updateTime},</if>
<if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if>
<if test="null != remark and '' != remark">remark = #{remark},</if>
<if test="null != operatorIdEvcs and '' != operatorIdEvcs">operator_id_evcs = #{operatorIdEvcs}</if>
</set>
WHERE operator_id = #{operatorId}
</update>
<delete id="deleteByIds" parameterType="java.lang.String">
delete from xhpc_operator where operator_id in
<foreach collection="array" item="ids" open="(" separator="," close=")">
#{ids}
</foreach>
</delete>
<select id="checkAccountUnique" parameterType="java.lang.String" resultMap="XhpcOperatorResult">
select *
from xhpc_operator
where phone = #{phone} limit 1
</select>
<select id="info" parameterType="java.lang.Long" resultType="java.util.Map">
select
<include refid="Base_Column_List"/>
@ -294,99 +64,4 @@
where xo.del_flag = 0 and xo.operator_id = #{operatorId}
</select>
<select id="selectOperatorList" parameterType="java.lang.Long" resultType="java.util.Map">
select xo.operator_id operatorId, xo.name, xo.contact_name contactName, xo.duty_paragraph dutyParagraph,
xo.contact_phone contactPhone, xo.phone, xo.attribute,`xo`.create_time createTime,`xo`.status,
CASE WHEN xo.`status` = 0 THEN '正常' else '禁用' end statusName,su.user_id userId,
xdb.dict_value attributenName
from xhpc_operator xo
LEFT JOIN sys_user su on su.operator_id = xo.operator_id
LEFT JOIN xhpc_dict_biz xdb on xdb.`code` = 'operator_attribute' and xdb.dict_key = xo.attribute
where xo.del_flag = 0
<if test="name != null and name != ''">
and xo.name like concat('%', #{name}, '%')
</if>
<if test="contactName != null and contactName != ''">
and xo.contact_name like concat('%', #{contactName}, '%')
</if>
<if test="contactPhone != null and contactPhone != ''">
and xo.contact_phone like concat('%', #{contactPhone}, '%')
</if>
<if test="createTimeStart != null and createTimeStart != ''"><!-- 开始时间检索 -->
AND xo.create_time &gt;= #{createTimeStart}
</if>
<if test="createTimeEnd != null and createTimeEnd != ''"><!-- 结束时间检索 -->
AND xo.create_time &lt;= #{createTimeEnd}
</if>
group by xo.operator_id
ORDER BY xo.update_time DESC
</select>
<delete id="deleteUserRoleByUserId" parameterType="java.lang.Long">
delete
from sys_user_role
where user_id = #{userId}
</delete>
<delete id="deleteUserPostByUserId" parameterType="java.lang.Long">
delete
from sys_user_post
where user_id = #{userId}
</delete>
<update id="deleteUserById" parameterType="com.xhpc.system.api.domain.SysUser">
update sys_user
set del_flag = #{delFlag}
where user_id = #{userId}
</update>
<select id="getUserByOperatorId" parameterType="java.lang.Long" resultType="com.xhpc.system.api.domain.SysUser">
select user_id userId,
dept_id deptid,
user_name userName,
nick_name nickName,
user_type userType,
email,
phonenumber,
operator_id operatorId,
internet_user_id internetUserId,
sex,
avatar,
password,
data_power_type dataPowerType,
status,
del_flag delFlag,
login_ip loginIp,
login_date loginDate,
create_by createBy,
create_time createTime,
update_by updateBy,
update_time updateTime,
remark
from sys_user
where del_flag = 0
and operator_id = #{operatorId}
</select>
<select id="getOperatorId" resultType="java.util.Map">
select xo.operator_id operatorId,
xo.name,
xo.contact_name contactName,
xo.contact_phone contactPhone,
xo.phone,
xo.attribute,
xo.duty_paragraph dutyParagraph,
xdb.dict_value attributenName
from xhpc_operator `xo`
LEFT JOIN xhpc_dict_biz xdb on xdb.`code` = 'operator_attribute' and xdb.dict_key = xo.attribute
where xo.del_flag = 0
ORDER BY xo.create_time DESC
</select>
<delete id="deleteRoleByName" parameterType="java.lang.String">
delete
from sys_role
where role_name = #{roleName}
</delete>
</mapper>

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -18,10 +18,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -16,10 +16,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置