完成开发票回显数据接口

This commit is contained in:
wen 2021-12-21 11:49:15 +08:00
parent b0e9684017
commit 441faa10a5
23 changed files with 3741 additions and 0 deletions

View File

@ -17,6 +17,7 @@
<module>xhpc-payment</module>
<module>xhpc-order</module>
<module>xhpc-wxma</module>
<module>xhpc-invoice</module>
</modules>
<artifactId>xhpc-modules</artifactId>

View File

@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>xhpc-modules</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>xhpc-invoice</artifactId>
<description>
发票服务
</description>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<!--单元测试依赖-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Swagger UI -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.fox.version}</version>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- RuoYi Common DataSource -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datasource</artifactId>
</dependency>
<!-- RuoYi Common DataScope -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datascope</artifactId>
</dependency>
<!-- RuoYi Common Log -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-log</artifactId>
</dependency>
<!-- RuoYi Common Swagger -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-swagger</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-core</artifactId>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>xhpc-common</artifactId>
<version>3.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,37 @@
package com.xhpc.invoice;
import com.xhpc.common.security.annotation.EnableCustomConfig;
import com.xhpc.common.security.annotation.EnableRyFeignClients;
import com.xhpc.common.swagger.annotation.EnableCustomSwagger2;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author WH
* @date 2021/12/7 14:55
* @since version-1.0
*/
@EnableCustomConfig
@EnableCustomSwagger2
@EnableRyFeignClients
@SpringBootApplication
@MapperScan("com.xhpc.invoice.mapper")
public class XhpcInvoiceApplication {
public static void main(String[] args) {
SpringApplication.run(XhpcInvoiceApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 发票模块启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" +
" | ( ' ) | \\ _. / ' \n" +
" |(_ o _) / _( )_ .' \n" +
" | (_,_).' __ ___(_ o _)' \n" +
" | |\\ \\ | || |(_,_)' \n" +
" | | \\ `' /| `-' / \n" +
" | | \\ / \\ / \n" +
" ''-' `'-' `-..-' ");
}
}

View File

@ -0,0 +1,65 @@
package com.xhpc.invoice.controller;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.invoice.domain.AllInvoiceOrdersRequest;
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 javax.annotation.Resource;
import java.util.Map;
/**
* 关于后台处理发票的接口
*
* @author WH
* @date 2021/12/20 10:47
* @since version-1.0
*/
@RestController
@RequestMapping("/invoice")
public class XhpcInvoiceController extends BaseController {
@Resource
XhpcInvoiceService xhpcInvoiceService;
/**
* 用于在财务点击开票时回显开票数据
*
* @param invoiceIdMap 一个存储着invoiceId的Map集合
* @return specificInvoiceWrap 装着回显数据的包装类
* @author WH
* @date 2021/12/20 10:48
* @since version-1.0
*/
@PostMapping("/selectSpecificInvoice")
public AjaxResult selectSpecificInvoice(@RequestBody Map<String, Object> invoiceIdMap) {
Long invoiceId = Long.valueOf(String.valueOf(invoiceIdMap.get("invoiceId")));
SpecificInvoiceWrap specificInvoiceWrap = xhpcInvoiceService.selectSpecificInvoice(invoiceId);
if (specificInvoiceWrap == null) {
AjaxResult.error("要回显的订单发票id有误");
}
return AjaxResult.success(specificInvoiceWrap);
}
/**
* 用于在后台显示所有发票信息包括待开发票和已开发票的信息
*
* @param requestData 前端传递过来的要查询的参数
* @return AllInvoiceOrdersResponse 装着回显数据的包装类
* @author WH
* @date 2021/12/21 11:33
* @since version-1.0
*/
@PostMapping("/selectAllInvoiceOrders")
public AjaxResult selectAllInvoiceOrders(@RequestBody AllInvoiceOrdersRequest requestData) {
return null;
}
}

View File

@ -0,0 +1,64 @@
package com.xhpc.invoice.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* /selectAllInvoiceOrders接口接收请求的数据的包装类对象
*
* @author WH
* @date 2021/12/21 10:51
* @since version-1.0
*/
@NoArgsConstructor
@Data
public class AllInvoiceOrdersRequest {
/**
* 申请人手机号
*/
@JsonProperty("creator")
private String creator;
/**
* 申请人类型0为c端用户1为B端用户2为机构用户
*/
@JsonProperty("creatorType")
private Integer creatorType;
/**
* 发票状态0表示未开票1表示已经开票2表示开票失败
*/
@JsonProperty("status")
private Integer status;
/**
* 发票申请起始时间
*/
@JsonProperty("startCreatorTime")
private String startCreatorTime;
/**
* 发票申请终点时间
*/
@JsonProperty("endCreatorTime")
private String endCreatorTime;
/**
* 开票起始时间
*/
@JsonProperty("startInvoicingTime")
private String startInvoicingTime;
/**
* 开票终点时间
*/
@JsonProperty("endInvoicingTime")
private String endInvoicingTime;
/**
* 当前所在页数
*/
@JsonProperty("currentPage")
private Integer currentPage;
/**
* 当前页要显示多少条记录
*/
@JsonProperty("items")
private Integer items;
}

View File

@ -0,0 +1,89 @@
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;
/**
* <code>/selectAllInvoiceOrders</code>接口的响应包装数据类
*
* @author WH
* @date 2021/12/21 10:50
* @since version-1.0
*/
@NoArgsConstructor
@Data
public class AllInvoiceOrdersResponse {
/**
* 历史订单总记录条数
*/
@JsonProperty("totalItems")
private Long totalItems;
/**
* 已开发票的金额
*/
@JsonProperty("invoicedSumMoney")
private BigDecimal invoicedSumMoney;
/**
* 未开发票的金额
*/
@JsonProperty("notInvoiceSumMoney")
private BigDecimal notInvoiceSumMoney;
/**
* 当前页的数据
*/
@JsonProperty("items")
private List<ItemsDTO> items;
@NoArgsConstructor
@Data
public static class ItemsDTO {
/**
* 发票id
*/
@JsonProperty("invoiceId")
private Long invoiceId;
/**
* 申请人手机号
*/
@JsonProperty("creator")
private String creator;
/**
* 申请人类型0为c端用户1为B端用户2为机构用户
*/
@JsonProperty("creatorType")
private Integer creatorType;
/**
* 发票金额
*/
@JsonProperty("invoiceMoney")
private BigDecimal invoiceMoney;
/**
* 发票状态0为未开票1为已经开发票2为开票失败
*/
@JsonProperty("status")
private Integer status;
/**
* 发票申请时间
*/
@JsonProperty("createTime")
private String createTime;
/**
* 开票时间
*/
@JsonProperty("invoicingTime")
private String invoicingTime;
/**
* 开票人
*/
@JsonProperty("drawer")
private String drawer;
}
}

View File

@ -0,0 +1,211 @@
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;
/**
* 用于保存指定发票回显数据的DTO
*
* @author WH
* @date 2021/12/20 10:58
* @since version-1.0
*/
@NoArgsConstructor
@Data
public class SpecificInvoiceWrap {
/**
* 申请人
*/
@JsonProperty("creator")
private String creator;
/**
* 申请人类型0为c端用户1为b端用户2为机构用户
*/
@JsonProperty("creatorType")
private Integer creatorType;
/**
* 发票申请时间
*/
@JsonProperty("invoiceCreateTime")
private String invoiceCreateTime;
/**
* 发票开票状态0为未开票1为已开票2为开票失败
*/
@JsonProperty("status")
private Integer status;
/**
* 发票id
*/
@JsonProperty("invoiceId")
private Long invoiceId;
/**
* 发票接收邮箱
*/
@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("invoiceTotalEletricMoney")
private BigDecimal invoiceTotalEletricMoney;
/**
* 发票包含的订单的总服务费金额
*/
@JsonProperty("invoiceTotalServiceMoney")
private BigDecimal invoiceTotalServiceMoney;
/**
* 公司地址
*/
@JsonProperty("firmAddress")
private String firmAddress;
/**
* 公司电话
*/
@JsonProperty("firmPhone")
private String firmPhone;
/**
* 公司开户行
*/
@JsonProperty("firmBank")
private String firmBank;
/**
* 公司开户行账号
*/
@JsonProperty("firmBankAccount")
private String firmBankAccount;
/**
* 发票是否展示交易日期区间0不展示1展示
*/
@JsonProperty("isShowDate")
private Integer isShowDate;
/**
* 用户备注
*/
@JsonProperty("userNotes")
private String userNotes;
/**
* 财务备注
*/
@JsonProperty("financeNotes")
private String financeNotes;
/**
* 发票开票时间
*/
@JsonProperty("invoicingTime")
private String invoicingTime;
/**
* 电子发票上传地址
*/
@JsonProperty("electricInvoiceUrl")
private String electricInvoiceUrl;
/**
* 开票人开这个发票的人
*/
@JsonProperty("drawer")
private String drawer;
/**
* 该发票所包含的历史订单的开始时间-结束时间
*/
@JsonProperty("historyOrderScope")
private String historyOrderScope;
/**
* 该发票所包含的历史订单对象
*/
@JsonProperty("historyOrders")
private HistoryOrdersDTO historyOrders;
@NoArgsConstructor
@Data
public static class HistoryOrdersDTO {
/**
* 历史订单总条数
*/
@JsonProperty("totalItems")
private Long totalItems;
/**
* 历史订单对象集合
*/
@JsonProperty("historyOrdersData")
private List<HistoryOrdersDataDTO> historyOrdersData;
@NoArgsConstructor
@Data
public static class HistoryOrdersDataDTO {
/**
* 历史订单id
*/
@JsonProperty("historyOrderId")
private String historyOrderId;
/**
* 历史订单来源
*/
@JsonProperty("chargingMode")
private String chargingMode;
/**
* 历史订单运营商名称
*/
@JsonProperty("operatorName")
private String operatorName;
/**
* 历史订单电费金额
*/
@JsonProperty("eletricMoney")
private BigDecimal eletricMoney;
/**
* 历史订单服务费金额
*/
@JsonProperty("serviceMoney")
private BigDecimal serviceMoney;
/**
* 历史订单实际价格
*/
@JsonProperty("actPrice")
private BigDecimal actPrice;
/**
* 历史订单序列号
*/
@JsonProperty("historySerialNumber")
private String historySerialNumber;
/**
* 历史订单创建时间
*/
@JsonProperty("historyCreateTime")
private String historyCreateTime;
}
}
}

View File

@ -0,0 +1,270 @@
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接口
*
* @author yuyang
* @date 2021-07-19
*/
public interface XhpcChargingStationMapper {
/**
* 查询电站
*
* @param chargingStationId 电站ID
* @return 电站
*/
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

@ -0,0 +1,42 @@
package com.xhpc.invoice.mapper;
import com.xhpc.invoice.pojo.XhpcInvoiceMapHistoryOrder;
import java.util.List;
/**
* XhpcInvoiceMapHistoryOrderMapper
*
* @author WH
* @date 2021/12/20 15:47
* @since version-1.0
*/
public interface XhpcInvoiceMapHistoryOrderMapper {
int insert(XhpcInvoiceMapHistoryOrder record);
int insertSelective(XhpcInvoiceMapHistoryOrder record);
/**
* 通过发票id查询对应的发票所包含的历史订单信息
*
* @param invoiceId 发票id
* @return 装有多个历史订单集合
* @author WH
* @date 2021/12/20 15:46
* @since version-1.0
*/
List<XhpcInvoiceMapHistoryOrder> findOrdersByInvoiceId(Long invoiceId);
/**
* 通过发票id查询其所属的历史订单的生成的时间区间即最大历史订单时间与最小历史订单时间
*
* @param invoiceId 发票id
* @return 装有最大订单时间与最小订单时间的一个List<String>集合第一个参数为最小值第二个最大值
* @author WH
* @date 2021/12/21 9:51
* @since version-1.0
*/
List<String> getHistoryOrderScopeByInvoiceId(Long invoiceId);
}

View File

@ -0,0 +1,28 @@
package com.xhpc.invoice.mapper;
import com.xhpc.invoice.pojo.XhpcInvoice;
public interface XhpcInvoiceMapper {
int deleteByPrimaryKey(Long invoiceId);
int insert(XhpcInvoice record);
int insertSelective(XhpcInvoice record);
/**
* 通过发票id查询发票信息
*
* @param invoiceId 发票id
* @return 发票信息实体类
* @author WH
* @date 2021/12/20 17:18
* @since version-1.0
*/
XhpcInvoice selectByPrimaryKey(Long invoiceId);
int updateByPrimaryKeySelective(XhpcInvoice record);
int updateByPrimaryKey(XhpcInvoice record);
}

View File

@ -0,0 +1,114 @@
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;
/**
* 运营商信息 数据层
*
* @author ruoyi
*/
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();
}

View File

@ -0,0 +1,154 @@
package com.xhpc.invoice.pojo;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* xhpc_invoice
*
* @author
*/
@Data
public class XhpcInvoice implements Serializable {
/**
* 发票id
*/
private Long invoiceId;
/**
* 接收邮箱
*/
private String receiveEmail;
/**
* 0为企业抬头 1为非企业抬头
*/
private Integer titleType;
/**
* 发票抬头内容
*/
private String titleContent;
/**
* 税号
*/
private String dutyNumber;
/**
* 发票内容
*/
private String invoiceContent;
/**
* 发票金额
*/
private BigDecimal invoiceMoney;
/**
* 发票包含的订单的总电费金额
*/
private BigDecimal invoiceOrderEletricTotalMoney;
/**
* 发票包含的订单的总服务费金额
*/
private BigDecimal invoiceOrderServiceTotalMoney;
/**
* 公司地址
*/
private String firmAddress;
/**
* 公司电话
*/
private String firmPhone;
/**
* 公司开户行
*/
private String firmBank;
/**
* 公司开户行账号
*/
private String firmBankAccount;
/**
* 所开发票是否展示交易记录0为不展示1为展示
*/
private Integer isShowDate;
/**
* 用户备注
*/
private String userNotes;
/**
* 创建者id
*/
private Long creatorId;
/**
* 创建者类型0为c端用户1为B端用户2为机构用户
*/
private Integer creatorType;
/**
* 创建人用户手机号
*/
private String creator;
/**
* 创建时间
*/
private Date createTime;
/**
* 开票状态0表示未开票1表示已经开票2表示开票失败
*/
private Integer status;
/**
* 财务输入的开票时间
*/
private Date invoicingTime;
/**
* 开票人
*/
private String drawer;
/**
* 开票人(财务备注)
*/
private String financeNotes;
/**
* 开票的电子发票pdf保存地址
*/
private String electricInvoiceUrl;
/**
* 更新者
*/
private Long updator;
/**
* 更新时间
*/
private Date updateTime;
/**
* 逻辑删除字段
*/
private Integer delFlag;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,89 @@
package com.xhpc.invoice.pojo;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* xhpc_invoice_map_history_order
*
* @author
*/
@Data
public class XhpcInvoiceMapHistoryOrder implements Serializable {
/**
* 发票id
*/
private Long invoiceId;
/**
* 该发票所选中的历史订单id
*/
private Long historyOrderId;
/**
* 该发票所选中的历史订单的用户id
*/
private Long historyUserId;
/**
* 该发票所选中的历史订单的用户类型0为C端用户 1流量用户
*/
private Long historyUserType;
/**
* 该发票所选中的历史订单订单编号
*/
private String hisotrySerialNumber;
/**
* 该发票所选中的历史订单电费
*/
private BigDecimal powerPriceTotal;
/**
* 该发票所选中的历史订单服务费
*/
private BigDecimal servicePriceTotal;
/**
* 该发票所选中的历史订单电站活动抵扣
*/
private BigDecimal promotionDiscount;
/**
* 该发票所选中的历史订单实际价格(用户支付的钱)
*/
private BigDecimal historyActPrice;
/**
* 该发票所选中的历史订单创建时间
*/
private Date createTime;
/**
* 充电方式订单来源
*/
private String chargingMode;
/**
* 电站id通过它查询运营商
*/
private Long chargingStationId;
/**
* 该发票所选中的历史订单充电的终端id
*/
private Long terminalId;
/**
* 逻辑删除字段
*/
private Integer delFlag;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,408 @@
package com.xhpc.invoice.pojo;
import com.xhpc.common.core.web.domain.BaseEntity;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* 运营商表 xhpc_operator
*
* @author ruoyi
*/
public class XhpcOperator extends BaseEntity {
/**
* 运营商id
*/
private Long operatorId;
/**
* 名称
*/
@NotBlank(message = "运营商名称不能为空")
@Length(max = 12, message = "运营商名称不能超过12位")
private String name;
/**
* 联系人
*/
@NotBlank(message = "联系人不能为空")
@Length(max = 12, message = "联系人不能超过12位")
private String contactName;
/**
* 联系人电话
*/
@NotBlank(message = "联系人电话不能为空")
private String contactPhone;
/**
* 手机号(账号)
*/
@NotBlank(message = "手机号不能为空")
@Length(max = 11, message = "手机号不能超过11位")
private String phone;
/**
* 运营商属性
*/
@NotNull(message = "运营商属性不能为空")
private Integer attribute;
/**
* 税号
*/
@NotNull(message = "税号不能为空")
@Length(max = 50, message = "税号不能超过50位")
private String dutyParagraph;
/**
* 开户行
*/
@NotBlank(message = "开户行不能为空")
@Length(max = 20, message = "开户行电话不能超过20位")
private String openBank;
/**
* 卡号
*/
@NotNull(message = "卡号不能为空")
@Length(max = 20, message = "卡号不能超过20位")
private String cardNumber;
/**
* 地址code
*/
@NotBlank(message = "地址不能为空")
private String areaCode;
/**
* 地址
*/
@NotBlank(message = "地址不能为空")
@Length(max = 50, message = "地址不能超过50位")
private String address;
/**
* 详细地址
*/
@NotBlank(message = "详细地址不能为空")
@Length(max = 50, message = "详细地址不能超过50位")
private String detailedAddress;
/**
* 经度
*/
@NotNull(message = "经度不能为空")
private String longitude;
/**
* 纬度
*/
@NotBlank(message = "纬度不能为空")
private String latitude;
/**
* 邮箱
*/
@NotBlank(message = "邮箱不能为空")
@Length(max = 50, message = "邮箱不能超过50位")
private String email;
/**
* 提成类型0总金额提成 1服务费提成
*/
@NotNull(message = "提成类型不能为空")
private Integer commissionType;
/**
* 平台提成
*/
@NotNull(message = "平台提成不能为空")
private Double platformCommissionRate;
/**
* 运维提成
*/
@NotNull(message = "运维提成不能为空")
private Double maintenanceCommissionRate;
/**
* 营业执照id
*/
@NotBlank(message = "营业执照不能为空")
private String businessLicenseId;
/**
* 提现时间tn
*/
@NotNull(message = "提现时间不能为空")
private Integer withdrawalTime;
/**
* 设置充电终止的soc
*/
@NotBlank(message = "充电终止的soc不能为空")
@Length(max = 10, message = "充电终止的soc不能超过10位")
private String soc;
/**
* 状态0正常 1停用
*/
private Integer status;
/**
* 删除标志0代表存在 2代表删除
*/
private Integer delFlag;
/**
* 对接第三方平台及监管平台的operatorId
*/
private String operatorIdEvcs;
public String getOperatorIdEvcs() {
return operatorIdEvcs;
}
public void setOperatorIdEvcs(String operatorIdEvcs) {
this.operatorIdEvcs = operatorIdEvcs;
}
public Long getOperatorId() {
return operatorId;
}
public void setOperatorId(Long operatorId) {
this.operatorId = operatorId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getContactName() {
return contactName;
}
public void setContactName(String contactName) {
this.contactName = contactName;
}
public String getContactPhone() {
return contactPhone;
}
public void setContactPhone(String contactPhone) {
this.contactPhone = contactPhone;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public Integer getAttribute() {
return attribute;
}
public void setAttribute(Integer attribute) {
this.attribute = attribute;
}
public String getAreaCode() {
return areaCode;
}
public void setAreaCode(String areaCode) {
this.areaCode = areaCode;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Integer getCommissionType() {
return commissionType;
}
public void setCommissionType(Integer commissionType) {
this.commissionType = commissionType;
}
public Double getPlatformCommissionRate() {
return platformCommissionRate;
}
public void setPlatformCommissionRate(Double platformCommissionRate) {
this.platformCommissionRate = platformCommissionRate;
}
public Double getMaintenanceCommissionRate() {
return maintenanceCommissionRate;
}
public void setMaintenanceCommissionRate(Double maintenanceCommissionRate) {
this.maintenanceCommissionRate = maintenanceCommissionRate;
}
public String getBusinessLicenseId() {
return businessLicenseId;
}
public void setBusinessLicenseId(String businessLicenseId) {
this.businessLicenseId = businessLicenseId;
}
public Integer getWithdrawalTime() {
return withdrawalTime;
}
public void setWithdrawalTime(Integer withdrawalTime) {
this.withdrawalTime = withdrawalTime;
}
public String getSoc() {
return soc;
}
public void setSoc(String soc) {
this.soc = soc;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getDelFlag() {
return delFlag;
}
public void setDelFlag(Integer delFlag) {
this.delFlag = delFlag;
}
public String getOpenBank() {
return openBank;
}
public void setOpenBank(String openBank) {
this.openBank = openBank;
}
public String getCardNumber() {
return cardNumber;
}
public void setCardNumber(String cardNumber) {
this.cardNumber = cardNumber;
}
public String getDutyParagraph() {
return dutyParagraph;
}
public void setDutyParagraph(String dutyParagraph) {
this.dutyParagraph = dutyParagraph;
}
public String getDetailedAddress() {
return detailedAddress;
}
public void setDetailedAddress(String detailedAddress) {
this.detailedAddress = detailedAddress;
}
}

View File

@ -0,0 +1,25 @@
package com.xhpc.invoice.service;
import com.xhpc.invoice.domain.SpecificInvoiceWrap;
/**
* 用于处理发票相关请求的Service
*
* @author WH
* @date 2021/12/20 14:04
* @since version-1.0
*/
public interface XhpcInvoiceService {
/**
* 通过发票id查询指定发票信息用于回显
*
* @param invoiceId 指定的发票id
* @return 一个保存着所有返回需要的信息的包装类
* @author WH
* @date 2021/12/20 14:10
* @since version-1.0
*/
SpecificInvoiceWrap selectSpecificInvoice(Long invoiceId);
}

View File

@ -0,0 +1,90 @@
package com.xhpc.invoice.service.impl;
import com.xhpc.common.core.utils.DateUtils;
import com.xhpc.common.core.utils.bean.BeanUtils;
import com.xhpc.common.domain.XhpcChargingStation;
import com.xhpc.invoice.domain.SpecificInvoiceWrap;
import com.xhpc.invoice.mapper.XhpcChargingStationMapper;
import com.xhpc.invoice.mapper.XhpcInvoiceMapHistoryOrderMapper;
import com.xhpc.invoice.mapper.XhpcInvoiceMapper;
import com.xhpc.invoice.mapper.XhpcOperatorMapper;
import com.xhpc.invoice.pojo.XhpcInvoice;
import com.xhpc.invoice.pojo.XhpcInvoiceMapHistoryOrder;
import com.xhpc.invoice.service.XhpcInvoiceService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* XhpcInvoiceService的实现类
*
* @author WH
* @date 2021/12/20 14:09
* @since version-1.0
*/
@Service
public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
@Resource
XhpcInvoiceMapper xhpcInvoiceMapper;
@Resource
XhpcInvoiceMapHistoryOrderMapper xhpcInvoiceMapHistoryOrderMapper;
@Resource
XhpcOperatorMapper xhpcOperatorMapper;
@Resource
XhpcChargingStationMapper xhpcChargingStationMapper;
/**
* 通过发票id查找对应的发票数据
*
* @author WH
* @date 2021/12/20 16:44
* @since version-1.0
*/
@Override
public SpecificInvoiceWrap selectSpecificInvoice(Long invoiceId) {
//处理包装类外层数据
XhpcInvoice xhpcInvoice = xhpcInvoiceMapper.selectByPrimaryKey(invoiceId);
SpecificInvoiceWrap specificInvoiceWrap = new SpecificInvoiceWrap();
BeanUtils.copyProperties(xhpcInvoice, specificInvoiceWrap);
specificInvoiceWrap.setInvoiceCreateTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, xhpcInvoice.getCreateTime()));
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()));
//处理包装类内层数据
specificInvoiceWrap.setHistoryOrders(new SpecificInvoiceWrap.HistoryOrdersDTO());
SpecificInvoiceWrap.HistoryOrdersDTO historyOrdersDTO = specificInvoiceWrap.getHistoryOrders();
List<XhpcInvoiceMapHistoryOrder> ordersList = xhpcInvoiceMapHistoryOrderMapper.findOrdersByInvoiceId(xhpcInvoice.getInvoiceId());
historyOrdersDTO.setTotalItems(Long.valueOf(String.valueOf(ordersList.size())));
historyOrdersDTO.setHistoryOrdersData(new ArrayList<>());
List<SpecificInvoiceWrap.HistoryOrdersDTO.HistoryOrdersDataDTO> historyOrdersDataList = historyOrdersDTO.getHistoryOrdersData();
for (XhpcInvoiceMapHistoryOrder xhpcInvoiceMapHistoryOrder : ordersList) {
//创建封装历史订单记录的DTO封装数据
SpecificInvoiceWrap.HistoryOrdersDTO.HistoryOrdersDataDTO historyOrdersDataDTO = new SpecificInvoiceWrap.HistoryOrdersDTO.HistoryOrdersDataDTO();
historyOrdersDataDTO.setHistoryOrderId(String.valueOf(xhpcInvoiceMapHistoryOrder.getHistoryOrderId()));
historyOrdersDataDTO.setActPrice(xhpcInvoiceMapHistoryOrder.getHistoryActPrice());
historyOrdersDataDTO.setChargingMode(xhpcInvoiceMapHistoryOrder.getChargingMode());
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());
XhpcChargingStation xhpcChargingStation = xhpcChargingStationMapper.selectXhpcChargingStationById(xhpcInvoiceMapHistoryOrder.getChargingStationId());
Map<String, Object> operatorInfo = xhpcOperatorMapper.info(xhpcChargingStation.getOperatorId());
String operatorName = (String) operatorInfo.get("name");
historyOrdersDataDTO.setOperatorName(operatorName);
historyOrdersDataList.add(historyOrdersDataDTO);
}
//处理historyOrderScope数据
List<String> historyOrderScope = xhpcInvoiceMapHistoryOrderMapper.getHistoryOrderScopeByInvoiceId(xhpcInvoice.getInvoiceId());
String minTime = historyOrderScope.get(0);
String maxTime = historyOrderScope.get(1);
specificInvoiceWrap.setHistoryOrderScope(minTime + "," + maxTime);
return specificInvoiceWrap;
}
}

View File

@ -0,0 +1,10 @@
Spring Boot Version: ${spring-boot.version}
Spring Application Name: ${spring.application.name}
_ __ _ _
(_) / _|(_)| |
_ __ _ _ ___ _ _ _ ______ | |_ _ | | ___
| '__|| | | | / _ \ | | | || ||______|| _|| || | / _ \
| | | |_| || (_) || |_| || | | | | || || __/
|_| \__,_| \___/ \__, ||_| |_| |_||_| \___|
__/ |
|___/

View File

@ -0,0 +1,25 @@
# Tomcat
server:
port: 9804
# Spring
spring:
application:
# 应用名称
name: xhpc-invoice
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/xhpc-invoice"/>
<!-- 日志输出格式 -->
<property name="log.pattern"
value="%d{MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.xhpc" level="info"/>
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn"/>
<root level="info">
<appender-ref ref="console"/>
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info"/>
<appender-ref ref="file_error"/>
</root>
</configuration>

View File

@ -0,0 +1,922 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.invoice.mapper.XhpcChargingStationMapper">
<resultMap id="BaseResultMap" type="com.xhpc.common.domain.XhpcChargingStation">
<result property="chargingStationId" column="charging_station_id"/>
<result property="name" column="name"/>
<result property="operatorId" column="operator_id"/>
<result property="type" column="type"/>
<result property="stationType" column="station_type"/>
<result property="constructionSite" column="construction_site"/>
<result property="serviceFacilities" column="service_facilities"/>
<result property="peripheryFacilities" column="periphery_facilities"/>
<result property="areaCode" column="area_code"/>
<result property="address" column="address"/>
<result property="detailedAddress" column="detailed_address"/>
<result property="longitude" column="longitude"/>
<result property="latitude" column="latitude"/>
<result property="parkingInstructions" column="parking_instructions"/>
<result property="serialNumber" column="serial_number"/>
<result property="clientVisible" column="client_visible"/>
<result property="status" column="status"/>
<result property="delFlag" column="del_flag"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
<result property="remark" column="remark"/>
<result property="rateModelId" column="rate_model_id"/>
<result property="imgId" column="img_id"/>
<result property="businessInstructions" column="business_instructions"/>
<result property="reminderInstructions" column="reminder_instructions"/>
<result property="serviceTel" column="service_tel"/>
<result property="parkNums" column="park_nums"/>
</resultMap>
<sql id="selectXhpcChargingStationVo">
select charging_station_id,
name,
operator_id,
type,
construction_site,
service_facilities,
periphery_facilities,
area_code,
address,
detailed_address,
longitude,
latitude,
parking_instructions,
serial_number,
client_visible,
status,
del_flag,
create_time,
create_by,
update_time,
update_by,
remark,
rate_model_id
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

@ -0,0 +1,143 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.invoice.mapper.XhpcInvoiceMapHistoryOrderMapper">
<resultMap id="BaseResultMap" type="com.xhpc.invoice.pojo.XhpcInvoiceMapHistoryOrder">
<result column="invoice_id" jdbcType="BIGINT" property="invoiceId"/>
<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="power_price_total" jdbcType="DECIMAL" property="powerPriceTotal"/>
<result column="service_price_total" jdbcType="DECIMAL" property="servicePriceTotal"/>
<result column="promotion_discount" jdbcType="DECIMAL" property="promotionDiscount"/>
<result column="history_act_price" jdbcType="DECIMAL" property="historyActPrice"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<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_flag" jdbcType="INTEGER" property="delFlag"/>
</resultMap>
<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,
service_price_total, promotion_discount, history_act_price,
create_time, charging_mode, charging_station_id,
terminal_id, del_flag)
values (#{invoiceId,jdbcType=BIGINT}, #{historyOrderId,jdbcType=BIGINT}, #{historyUserId,jdbcType=BIGINT},
#{historyUserType,jdbcType=BIGINT}, #{hisotrySerialNumber,jdbcType=VARCHAR},
#{powerPriceTotal,jdbcType=DECIMAL},
#{servicePriceTotal,jdbcType=DECIMAL}, #{promotionDiscount,jdbcType=DECIMAL},
#{historyActPrice,jdbcType=DECIMAL},
#{createTime,jdbcType=TIMESTAMP}, #{chargingMode,jdbcType=VARCHAR},
#{chargingStationId,jdbcType=BIGINT},
#{terminalId,jdbcType=BIGINT}, #{delFlag,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.xhpc.invoice.pojo.XhpcInvoiceMapHistoryOrder">
insert into xhpc_invoice_map_history_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="invoiceId != null">
invoice_id,
</if>
<if test="historyOrderId != null">
history_order_id,
</if>
<if test="historyUserId != null">
history_user_id,
</if>
<if test="historyUserType != null">
history_user_type,
</if>
<if test="hisotrySerialNumber != null">
hisotry_serial_number,
</if>
<if test="powerPriceTotal != null">
power_price_total,
</if>
<if test="servicePriceTotal != null">
service_price_total,
</if>
<if test="promotionDiscount != null">
promotion_discount,
</if>
<if test="historyActPrice != null">
history_act_price,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="chargingMode != null">
charging_mode,
</if>
<if test="chargingStationId != null">
charging_station_id,
</if>
<if test="terminalId != null">
terminal_id,
</if>
<if test="delFlag != null">
del_flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="invoiceId != null">
#{invoiceId,jdbcType=BIGINT},
</if>
<if test="historyOrderId != null">
#{historyOrderId,jdbcType=BIGINT},
</if>
<if test="historyUserId != null">
#{historyUserId,jdbcType=BIGINT},
</if>
<if test="historyUserType != null">
#{historyUserType,jdbcType=BIGINT},
</if>
<if test="hisotrySerialNumber != null">
#{hisotrySerialNumber,jdbcType=VARCHAR},
</if>
<if test="powerPriceTotal != null">
#{powerPriceTotal,jdbcType=DECIMAL},
</if>
<if test="servicePriceTotal != null">
#{servicePriceTotal,jdbcType=DECIMAL},
</if>
<if test="promotionDiscount != null">
#{promotionDiscount,jdbcType=DECIMAL},
</if>
<if test="historyActPrice != null">
#{historyActPrice,jdbcType=DECIMAL},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="chargingMode != null">
#{chargingMode,jdbcType=VARCHAR},
</if>
<if test="chargingStationId != null">
#{chargingStationId,jdbcType=BIGINT},
</if>
<if test="terminalId != null">
#{terminalId,jdbcType=BIGINT},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="findOrdersByInvoiceId" resultMap="BaseResultMap">
SELECT *
FROM `xhpc_invoice_map_history_order`
WHERE invoice_id = #{invoiceId}
AND del_flag IS NULL;
</select>
<select id="getHistoryOrderScopeByInvoiceId" resultType="java.lang.String">
SELECT MIN(create_time)
FROM `xhpc_invoice_map_history_order`
WHERE invoice_id = #{invoiceId}
AND del_flag IS NULL
UNION
SELECT Max(create_time)
FROM `xhpc_invoice_map_history_order`
WHERE invoice_id = #{invoiceId}
AND del_flag IS NULL
</select>
</mapper>

View File

@ -0,0 +1,351 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<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="receive_email" jdbcType="VARCHAR" property="receiveEmail"/>
<result column="title_type" jdbcType="INTEGER" property="titleType"/>
<result column="title_content" jdbcType="VARCHAR" property="titleContent"/>
<result column="duty_number" jdbcType="VARCHAR" property="dutyNumber"/>
<result column="invoice_content" jdbcType="VARCHAR" property="invoiceContent"/>
<result column="invoice_money" jdbcType="DECIMAL" property="invoiceMoney"/>
<result column="invoice_order_eletric_total_money" jdbcType="DECIMAL" property="invoiceOrderEletricTotalMoney"/>
<result column="invoice_order_service_total_money" jdbcType="DECIMAL" property="invoiceOrderServiceTotalMoney"/>
<result column="firm_address" jdbcType="VARCHAR" property="firmAddress"/>
<result column="firm_phone" jdbcType="VARCHAR" property="firmPhone"/>
<result column="firm_bank" jdbcType="VARCHAR" property="firmBank"/>
<result column="firm_bank_account" jdbcType="VARCHAR" property="firmBankAccount"/>
<result column="is_show_date" jdbcType="INTEGER" property="isShowDate"/>
<result column="user_notes" jdbcType="VARCHAR" property="userNotes"/>
<result column="creator_id" jdbcType="BIGINT" property="creatorId"/>
<result column="creator_type" jdbcType="INTEGER" property="creatorType"/>
<result column="creator" jdbcType="VARCHAR" property="creator"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="invoicing_time" jdbcType="TIMESTAMP" property="invoicingTime"/>
<result column="drawer" jdbcType="VARCHAR" property="drawer"/>
<result column="finance_notes" jdbcType="VARCHAR" property="financeNotes"/>
<result column="electric_invoice_url" jdbcType="VARCHAR" property="electricInvoiceUrl"/>
<result column="updator" jdbcType="BIGINT" property="updator"/>
<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
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from xhpc_invoice
where invoice_id = #{invoiceId,jdbcType=BIGINT} and del_flag is null;
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete
from xhpc_invoice
where invoice_id = #{invoiceId,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="invoice_id" keyProperty="invoiceId" parameterType="com.xhpc.invoice.pojo.XhpcInvoice"
useGeneratedKeys="true">
insert into xhpc_invoice (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)
values (#{receiveEmail,jdbcType=VARCHAR}, #{titleType,jdbcType=INTEGER}, #{titleContent,jdbcType=VARCHAR},
#{dutyNumber,jdbcType=VARCHAR}, #{invoiceContent,jdbcType=VARCHAR}, #{invoiceMoney,jdbcType=DECIMAL},
#{invoiceOrderEletricTotalMoney,jdbcType=DECIMAL}, #{invoiceOrderServiceTotalMoney,jdbcType=DECIMAL},
#{firmAddress,jdbcType=VARCHAR}, #{firmPhone,jdbcType=VARCHAR}, #{firmBank,jdbcType=VARCHAR},
#{firmBankAccount,jdbcType=VARCHAR}, #{isShowDate,jdbcType=INTEGER}, #{userNotes,jdbcType=VARCHAR},
#{creatorId,jdbcType=BIGINT}, #{creatorType,jdbcType=INTEGER}, #{creator,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, #{invoicingTime,jdbcType=TIMESTAMP},
#{drawer,jdbcType=VARCHAR}, #{financeNotes,jdbcType=VARCHAR}, #{electricInvoiceUrl,jdbcType=VARCHAR},
#{updator,jdbcType=BIGINT}, #{updateTime,jdbcType=DATE}, #{delFlag,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" keyColumn="invoice_id" keyProperty="invoiceId"
parameterType="com.xhpc.invoice.pojo.XhpcInvoice" 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>
<if test="receiveEmail != null">
receive_email = #{receiveEmail,jdbcType=VARCHAR},
</if>
<if test="titleType != null">
title_type = #{titleType,jdbcType=INTEGER},
</if>
<if test="titleContent != null">
title_content = #{titleContent,jdbcType=VARCHAR},
</if>
<if test="dutyNumber != null">
duty_number = #{dutyNumber,jdbcType=VARCHAR},
</if>
<if test="invoiceContent != null">
invoice_content = #{invoiceContent,jdbcType=VARCHAR},
</if>
<if test="invoiceMoney != null">
invoice_money = #{invoiceMoney,jdbcType=DECIMAL},
</if>
<if test="invoiceOrderEletricTotalMoney != null">
invoice_order_eletric_total_money = #{invoiceOrderEletricTotalMoney,jdbcType=DECIMAL},
</if>
<if test="invoiceOrderServiceTotalMoney != null">
invoice_order_service_total_money = #{invoiceOrderServiceTotalMoney,jdbcType=DECIMAL},
</if>
<if test="firmAddress != null">
firm_address = #{firmAddress,jdbcType=VARCHAR},
</if>
<if test="firmPhone != null">
firm_phone = #{firmPhone,jdbcType=VARCHAR},
</if>
<if test="firmBank != null">
firm_bank = #{firmBank,jdbcType=VARCHAR},
</if>
<if test="firmBankAccount != null">
firm_bank_account = #{firmBankAccount,jdbcType=VARCHAR},
</if>
<if test="isShowDate != null">
is_show_date = #{isShowDate,jdbcType=INTEGER},
</if>
<if test="userNotes != null">
user_notes = #{userNotes,jdbcType=VARCHAR},
</if>
<if test="creatorId != null">
creator_id = #{creatorId,jdbcType=BIGINT},
</if>
<if test="creatorType != null">
creator_type = #{creatorType,jdbcType=INTEGER},
</if>
<if test="creator != null">
creator = #{creator,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
`status` = #{status,jdbcType=INTEGER},
</if>
<if test="invoicingTime != null">
invoicing_time = #{invoicingTime,jdbcType=TIMESTAMP},
</if>
<if test="drawer != null">
drawer = #{drawer,jdbcType=VARCHAR},
</if>
<if test="financeNotes != null">
finance_notes = #{financeNotes,jdbcType=VARCHAR},
</if>
<if test="electricInvoiceUrl != null">
electric_invoice_url = #{electricInvoiceUrl,jdbcType=VARCHAR},
</if>
<if test="updator != null">
updator = #{updator,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=DATE},
</if>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=INTEGER},
</if>
</set>
where invoice_id = #{invoiceId,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.xhpc.invoice.pojo.XhpcInvoice">
update xhpc_invoice
set receive_email = #{receiveEmail,jdbcType=VARCHAR},
title_type = #{titleType,jdbcType=INTEGER},
title_content = #{titleContent,jdbcType=VARCHAR},
duty_number = #{dutyNumber,jdbcType=VARCHAR},
invoice_content = #{invoiceContent,jdbcType=VARCHAR},
invoice_money = #{invoiceMoney,jdbcType=DECIMAL},
invoice_order_eletric_total_money = #{invoiceOrderEletricTotalMoney,jdbcType=DECIMAL},
invoice_order_service_total_money = #{invoiceOrderServiceTotalMoney,jdbcType=DECIMAL},
firm_address = #{firmAddress,jdbcType=VARCHAR},
firm_phone = #{firmPhone,jdbcType=VARCHAR},
firm_bank = #{firmBank,jdbcType=VARCHAR},
firm_bank_account = #{firmBankAccount,jdbcType=VARCHAR},
is_show_date = #{isShowDate,jdbcType=INTEGER},
user_notes = #{userNotes,jdbcType=VARCHAR},
creator_id = #{creatorId,jdbcType=BIGINT},
creator_type = #{creatorType,jdbcType=INTEGER},
creator = #{creator,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
`status` = #{status,jdbcType=INTEGER},
invoicing_time = #{invoicingTime,jdbcType=TIMESTAMP},
drawer = #{drawer,jdbcType=VARCHAR},
finance_notes = #{financeNotes,jdbcType=VARCHAR},
electric_invoice_url = #{electricInvoiceUrl,jdbcType=VARCHAR},
updator = #{updator,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=DATE},
del_flag = #{delFlag,jdbcType=INTEGER}
where invoice_id = #{invoiceId,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -0,0 +1,392 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.invoice.mapper.XhpcOperatorMapper">
<resultMap type="com.xhpc.invoice.pojo.XhpcOperator" id="XhpcOperatorResult">
<result column="operator_id" property="operatorId"/>
<result column="name" property="name"/>
<result column="contact_name" property="contactName"/>
<result column="contact_phone" property="contactPhone"/>
<result column="phone" property="phone"/>
<result column="attribute" property="attribute"/>
<result column="duty_paragraph" property="dutyParagraph"/>
<result column="open_bank" property="openBank"/>
<result column="card_number" property="cardNumber"/>
<result column="area_code" property="areaCode"/>
<result column="address" property="address"/>
<result column="detailed_address" property="detailedAddress"/>
<result column="longitude" property="longitude"/>
<result column="latitude" property="latitude"/>
<result column="email" property="email"/>
<result column="commission_type" property="commissionType"/>
<result column="platform_commission_rate" property="platformCommissionRate"/>
<result column="maintenance_commission_rate" property="maintenanceCommissionRate"/>
<result column="business_license_id" property="businessLicenseId"/>
<result column="withdrawal_time" property="withdrawalTime"/>
<result column="soc" property="soc"/>
<result column="status" property="status"/>
<result column="del_flag" property="delFlag"/>
<result column="create_time" property="createTime"/>
<result column="create_by" property="createBy"/>
<result column="update_time" property="updateTime"/>
<result column="update_by" property="updateBy"/>
<result column="remark" property="remark"/>
<result column="operator_id_evcs" property="operatorIdEvcs"/>
</resultMap>
<sql id="Base_Column_List">
xo
.
operator_id
operatorId, xo.name, xo.contact_name contactName, xo.contact_phone contactPhone,
xo.phone, xo.attribute,xo.open_bank openBank,xo.card_number cardNumber, xo.area_code areaCode, xo.address,
xo.detailed_address detailedAddress, xo.duty_paragraph dutyParagraph,
xo.longitude, xo.latitude, xo.email, xo.commission_type commissionType,
xo.platform_commission_rate platformCommissionRate,
xo.maintenance_commission_rate maintenanceCommissionRate,
xo.business_license_id businessLicenseId, xo.withdrawal_time withdrawalTime, xo.soc,
xo.status, xo.del_flag delFlag, xo.create_time createTime,
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"/>
xo.operator_id_evcs operatorIdEvcs,
xdb.dict_value attributenName,`xa`.merger_name mergerName,
GROUP_CONCAT(DISTINCT xi.`url` ORDER BY xi.create_time DESC separator ',') businessLicenseUrl
from xhpc_operator `xo`
LEFT JOIN xhpc_dict_biz xdb on xdb.`code` = 'operator_attribute' and xdb.dict_key = xo.attribute
LEFT JOIN xhpc_area `xa` on `xa`.`code` = xo.area_code
LEFT JOIN xhpc_img xi on FIND_IN_SET(xi.img_id,xo.business_license_id )
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(concat('%', #{name}), '%')
</if>
<if test="contactName != null and contactName != ''">
and xo.contact_name like concat(concat('%', #{contactName}), '%')
</if>
<if test="contactPhone != null and contactPhone != ''">
and xo.contact_phone like concat(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>