diff --git a/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/mapper/XhpcChargingStationMapper.java b/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/mapper/XhpcChargingStationMapper.java index 214ef059..abf61f0e 100644 --- a/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/mapper/XhpcChargingStationMapper.java +++ b/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/mapper/XhpcChargingStationMapper.java @@ -1,14 +1,6 @@ package com.xhpc.invoice.mapper; import com.xhpc.common.domain.XhpcChargingStation; -import com.xhpc.common.domain.XhpcRate; -import com.xhpc.common.domain.XhpcRateModel; -import com.xhpc.common.domain.XhpcRateTime; -import org.apache.ibatis.annotations.Param; - -import java.util.List; -import java.util.Map; -import java.util.Set; /** * 电站Mapper接口 @@ -26,245 +18,4 @@ public interface XhpcChargingStationMapper { */ XhpcChargingStation selectXhpcChargingStationById(Long chargingStationId); - - /** - * 查询电站 - * - * @param chargingStationName 电站名称 - * @return 电站 - */ - XhpcChargingStation selectXhpcChargingStationByName(String chargingStationName); - - /** - * 查询电站列表 - * - * @param name 电站名称 - * @param operatorName 运营商名称 - * @return 电站集合 - */ - List> 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> stationInternetBlackList(Long chargingStationId); - - - /** - * 电站详情信息 - * - * @param chargingStationId 电站ID - * @return 电站 - */ - Map getXhpcChargingStationMessage(@Param("chargingStationId") Long chargingStationId); - - - /** - * 微信小程序电站列表 - * - * @param name 电站名称 - * @param serviceFacilities 标签集合(服务设施) - * @param code 城市id - * @param longitude 经度 - * @param latitude 维度 - * @param clientVisible 微信小程序是否可见 2可见 - * @return - */ - List> getWXList(@Param("name") String name, @Param("serviceFacilities") List 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> getCode(@Param("code") String code, @Param("serviceFacilities") List serviceFacilities); - - /** - * 电站详情(站点详情) - * - * @param chargingStationId 电站ID - * @return 电站 - */ - Map getWXXhpcChargingStationMessage(@Param("chargingStationId") Long chargingStationId, @Param("longitude") String longitude, @Param("latitude") String latitude); - - - /** - * 获取图片信息 - * - * @param imgIds - * @return - */ - List> getImageList(@Param("imgIds") List imgIds); - - - /** - * 电站详情---价格详情 - * - * @param chargingStationId 电站ID - * @return 电站 - */ - List> getWXXhpcRateTimeMassage(@Param("chargingStationId") Long chargingStationId); - - - /** - * 电站详情---终端列表 - * - * @param chargingStationId 电站ID - * @return 电站 - */ - List> getWXXhpcTerminalMassage(@Param("chargingStationId") Long chargingStationId); - - - /** - * 添加费率模型 - */ - int addXhpcRateModel(XhpcRateModel xhpcRateModel); - - /** - * 添加场站信息 - */ - int addXhpcChargingStation(XhpcChargingStation xhpcChargingStation); - - /** - * 添加费率 - */ - int addXhpcRate(XhpcRate xhpcRate); - - - /** - * 添加费率时段 - */ - int addXhpcRateTime(XhpcRateTime xhpcRateTime); - - - /** - * 返回费率 - */ - List> getXhpcRateList(@Param("chargingStationId") Long chargingStationId); - - - /** - * 返回费率时段(设置时段) - */ - List> getXhpcRateTimeTypeList(@Param("chargingStationId") Long chargingStationId, @Param("type") Integer type); - - - /** - * 今日充电量、今日充电用户、今日充电次数 - */ - Map 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 getXchargingPileList(@Param("chargingStationId") Long chargingStationId); - - /** - * 按照没30分钟为一段进行分组 - * - * @param chargingStationId - * @return - */ - List> 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 getLandUser(@Param("userId") Long userId); - - /** - * 添加场站数据权限 - */ - void addXhpcUserPrivilege(@Param("userId") Long userId, @Param("chargingStationId") Long chargingStationId); - } diff --git a/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/mapper/XhpcInvoiceMapHistoryOrderMapper.java b/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/mapper/XhpcInvoiceMapHistoryOrderMapper.java index c707e43f..500bbfae 100644 --- a/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/mapper/XhpcInvoiceMapHistoryOrderMapper.java +++ b/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/mapper/XhpcInvoiceMapHistoryOrderMapper.java @@ -70,7 +70,7 @@ public interface XhpcInvoiceMapHistoryOrderMapper { * @date 2021/12/29 11:00 * @since version-1.0 */ - void unlockHistoryOrdersByInvoiceId(Long invoiceId); + void updateUnlockHistoryOrdersByInvoiceId(Long invoiceId); /** * 查询该发票关联表中,该历史订单是否已经被存储且被锁定 diff --git a/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/mapper/XhpcInvoiceMapper.java b/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/mapper/XhpcInvoiceMapper.java index 3c277857..79d1bcd1 100644 --- a/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/mapper/XhpcInvoiceMapper.java +++ b/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/mapper/XhpcInvoiceMapper.java @@ -84,7 +84,7 @@ public interface XhpcInvoiceMapper { * @date 2021/12/22 15:07 * @since version-1.0 */ - Long invoiceToUser(InvoiceToUserRequest requestData); + Long updateInvoiceToUser(InvoiceToUserRequest requestData); /** * 更新指定发票状态,让其成为开发票失败状态 @@ -95,7 +95,7 @@ public interface XhpcInvoiceMapper { * @date 2021/12/23 13:30 * @since version-1.0 */ - Long failInvoiceToUser(InvoiceToUserRequest requestData); + Long updateFailInvoiceToUser(InvoiceToUserRequest requestData); /** * 模糊查询指定公司名称和税号 diff --git a/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/mapper/XhpcOperatorMapper.java b/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/mapper/XhpcOperatorMapper.java index c754db50..a814dcc5 100644 --- a/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/mapper/XhpcOperatorMapper.java +++ b/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/mapper/XhpcOperatorMapper.java @@ -1,10 +1,7 @@ package com.xhpc.invoice.mapper; -import com.xhpc.invoice.pojo.XhpcOperator; -import com.xhpc.system.api.domain.SysUser; import org.apache.ibatis.annotations.Param; -import java.util.List; import java.util.Map; /** @@ -14,101 +11,12 @@ import java.util.Map; */ public interface XhpcOperatorMapper { - /** - * 修改运营商信息 - * - * @param xhpcOperator 运营商信息 - * @return 结果 - */ - public int update(XhpcOperator xhpcOperator); - - /** - * 新增运营商信息 - * - * @param xhpcOperator 运营商信息 - * @return 结果 - */ - public int insert(XhpcOperator xhpcOperator); - - /** - * 批量删除运营商信息 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteByIds(String[] ids); - - /** - * 校验账号是否唯一 - * - * @param phone 用户手机号 - * @return 结果 - */ - public XhpcOperator checkAccountUnique(@Param("phone") String phone); - /** * 查询运营商详情 * * @param operatorId 运营商id * @return 结果 */ - public Map info(@Param("operatorId") Long operatorId); - - /** - * 获取运营商分页列表 - * - * @param name 运营商名称 - * @param contactName 联系人 - * @param contactPhone 联系人电话 - * @return 结果 - */ - public List> 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> getOperatorId(); + Map info(@Param("operatorId") Long operatorId); } diff --git a/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/service/impl/XhpcInvoiceServiceImpl.java b/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/service/impl/XhpcInvoiceServiceImpl.java index be80e01a..c1120442 100644 --- a/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/service/impl/XhpcInvoiceServiceImpl.java +++ b/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/service/impl/XhpcInvoiceServiceImpl.java @@ -1,5 +1,7 @@ package com.xhpc.invoice.service.impl; +import cn.hutool.extra.mail.MailUtil; +import cn.hutool.http.HttpUtil; import cn.hutool.poi.excel.ExcelUtil; import cn.hutool.poi.excel.ExcelWriter; import com.xhpc.common.core.utils.DateUtils; @@ -21,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; +import java.io.File; import java.io.IOException; import java.math.BigDecimal; import java.util.ArrayList; @@ -126,22 +129,22 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService { //发送电子发票pdf到接收者邮箱 XhpcInvoice xhpcInvoice = xhpcInvoiceMapper.selectByPrimaryKey(requestData.getInvoiceId()); String receiveEmail = xhpcInvoice.getReceiveEmail(); -// //从阿里云上下载下来电子发票 -// String fileUrl = requestData.getEletricInvoiceUrl(); -// File electricInvoiceFile = new File(environment.getProperty("file.serverStoreDisposableFileLocation") + "ElectricInvoice.pdf"); -// HttpUtil.downloadFile(fileUrl, electricInvoiceFile); -// try { -// MailUtil.send(receiveEmail, "【小华充电】电子发票", "邮件来自小华充电", false, electricInvoiceFile); -// } catch (Exception e) { -// System.out.println(e.getMessage()); -// return Boolean.FALSE; -// } finally { -// if (electricInvoiceFile.exists()) { -// electricInvoiceFile.delete(); -// } -// } + //从阿里云上下载下来电子发票 + String fileUrl = requestData.getEletricInvoiceUrl(); + File electricInvoiceFile = new File(environment.getProperty("file.serverStoreDisposableFileLocation") + "ElectricInvoice.pdf"); + HttpUtil.downloadFile(fileUrl, electricInvoiceFile); + try { + MailUtil.send(receiveEmail, "【小华充电】电子发票", "邮件来自小华充电", false, electricInvoiceFile); + } catch (Exception e) { + System.out.println(e.getMessage()); + return Boolean.FALSE; + } finally { + if (electricInvoiceFile.exists()) { + electricInvoiceFile.delete(); + } + } //更新发票数据,并设置用户未阅读状态 - Long successFlag = xhpcInvoiceMapper.invoiceToUser(requestData); + Long successFlag = xhpcInvoiceMapper.updateInvoiceToUser(requestData); if (successFlag == 0) { throw new RuntimeException("无法更新指定发票,传入的数据有问题"); } @@ -157,9 +160,9 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService { SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(requestData.getDrawer())); requestData.setDrawer(sysUser.getNickName()); //更新发票状态 - xhpcInvoiceMapper.failInvoiceToUser(requestData); + xhpcInvoiceMapper.updateFailInvoiceToUser(requestData); //解除锁定 - xhpcInvoiceMapHistoryOrderMapper.unlockHistoryOrdersByInvoiceId(requestData.getInvoiceId()); + xhpcInvoiceMapHistoryOrderMapper.updateUnlockHistoryOrdersByInvoiceId(requestData.getInvoiceId()); //将该用户未阅读的数量放入到redis中 putNoReadInvoiceCountIntoRedis(requestData); } diff --git a/xhpc-modules/xhpc-invoice/src/main/resources/mapper/XhpcInvoiceMapHistoryOrderMapper.xml b/xhpc-modules/xhpc-invoice/src/main/resources/mapper/XhpcInvoiceMapHistoryOrderMapper.xml index 1fda4377..08622bd6 100644 --- a/xhpc-modules/xhpc-invoice/src/main/resources/mapper/XhpcInvoiceMapHistoryOrderMapper.xml +++ b/xhpc-modules/xhpc-invoice/src/main/resources/mapper/XhpcInvoiceMapHistoryOrderMapper.xml @@ -161,7 +161,7 @@ ) ) - + UPDATE xhpc_invoice_map_history_order SET lock_flag = NULL WHERE invoice_id = #{invoiceId} diff --git a/xhpc-modules/xhpc-invoice/src/main/resources/mapper/XhpcInvoiceMapper.xml b/xhpc-modules/xhpc-invoice/src/main/resources/mapper/XhpcInvoiceMapper.xml index 9bce4773..ed6251f8 100644 --- a/xhpc-modules/xhpc-invoice/src/main/resources/mapper/XhpcInvoiceMapper.xml +++ b/xhpc-modules/xhpc-invoice/src/main/resources/mapper/XhpcInvoiceMapper.xml @@ -707,7 +707,7 @@ where invoice_id = #{invoiceId,jdbcType=BIGINT} - + UPDATE xhpc_invoice SET finance_notes = #{financeNotes}, invoicing_time = #{invoicingTime}, @@ -718,7 +718,7 @@ WHERE invoice_id = #{invoiceId}; - + UPDATE xhpc_invoice SET finance_notes = #{financeNotes}, invoicing_time = #{invoicingTime},