From c0d5aea0dd238b1d7cb99fc630121c2bf38563ba Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期一, 23 九月 2024 17:24:24 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/task/TaskUtil.java                                         |   26 +++++
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java                    |    2 
 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TAccountingStrategyServiceImpl.java |    4 
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TVipServiceImpl.java                              |   17 +++
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TAdvertisingServiceImpl.java                      |    5 +
 ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUser.java                                    |    3 
 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TVipOrder.java                                       |    3 
 ruoyi-service/ruoyi-order/pom.xml                                                                                      |   11 ++
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java                                 |    5 
 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/VipInfoDto.java                                        |    2 
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppCouponServiceImpl.java                    |   10 ++
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderInvoiceController.java                        |  106 ++++++++++++++++++++
 ruoyi-service/ruoyi-payment/src/main/resources/bootstrap.yml                                                           |    1 
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCompanyController.java                             |    5 +
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java                         |   14 ++
 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TApplyChargingPileController.java     |    4 
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderInvoiceServiceImpl.java                     |    3 
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TVipOrderController.java                            |    1 
 ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml                                     |    2 
 ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/controller/WxPayController.java                            |    1 
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEnterpriseUserApplicationController.java           |   22 ++--
 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java                               |    1 
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/CarUtil.java                                          |    4 
 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TOrderInvoiceVO.java                                    |    3 
 24 files changed, 223 insertions(+), 32 deletions(-)

diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUser.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUser.java
index 3639029..32db936 100644
--- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUser.java
+++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUser.java
@@ -136,6 +136,9 @@
     @ApiModelProperty("剩余天数")
     @TableField(exist = false)
     private Long lastDays;
+    @ApiModelProperty(value = "单位名称")
+    @TableField(exist = false)
+    private String companyName;
 
 
 }
diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java
index ee7f887..9e49992 100644
--- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java
+++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java
@@ -48,6 +48,7 @@
     @PostMapping("/t-vip-order/callBack")
     public R vipCallBack(@RequestParam("code")String code,@RequestParam("outTradeNo")String outTradeNo);
 
+
     /**
      * 管理后台 活动费用统计
      * @param
diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TVipOrder.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TVipOrder.java
index ab4f606..541c529 100644
--- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TVipOrder.java
+++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TVipOrder.java
@@ -37,6 +37,9 @@
     @ApiModelProperty(value = "订单编号")
     @TableField("code")
     private String code;
+    @ApiModelProperty(value = "标题")
+    @TableField("title")
+    private String title;
 
     @ApiModelProperty(value = "用户id")
     @TableField("app_user_id")
diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TOrderInvoiceVO.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TOrderInvoiceVO.java
index b6dd626..80615b0 100644
--- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TOrderInvoiceVO.java
+++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TOrderInvoiceVO.java
@@ -17,7 +17,8 @@
 
     @ApiModelProperty(value = "服务费税率")
     private BigDecimal serviceTariff;
-
+    @ApiModelProperty(value = "uid")
+    private String uid;
     @ApiModelProperty(value = "增值服务费税率")
     private BigDecimal addedServiceTariff;
     @ApiModelProperty(value = "电费")
diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/VipInfoDto.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/VipInfoDto.java
index 86e0ed5..17df5bc 100644
--- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/VipInfoDto.java
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/VipInfoDto.java
@@ -9,7 +9,7 @@
 import java.util.List;
 @Data
 public class VipInfoDto {
-
+    private Integer id;
     @ApiModelProperty("月卡价格")
     private BigDecimal monthlyCard;
     @ApiModelProperty(value = "月卡折扣")
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
index ac8d6b4..5b8ce08 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
@@ -228,7 +228,7 @@
             return R.ok(page);
         }
         List<Integer> vipIds = new ArrayList<>();
-              vipIds     = page.getRecords().stream().map(TAppUser::getVipId).collect(Collectors.toList());
+//              vipIds     = page.getRecords().stream().map(TAppUser::getVipId).collect(Collectors.toList());
         //获取会员map
         R<Map<Integer, String>> vipMap = otherClient.getVipMap(vipIds);
         //循环处理
@@ -242,12 +242,20 @@
                     appUser.setTagName(byIdTag.getData().getName());
                 }
             }
-            //匹配vipMap的值
-            appUser.setVipName(vipMap.getData().get(appUser.getVipId()));
+            if (appUser.getVipEndTime()!=null&&appUser.getVipEndTime().isAfter(LocalDateTime.now())) {
+                //匹配vipMap的值
+                appUser.setVipName(vipMap.getData().get(appUser.getVipId()));
+            }
             //累计充电次数
             R<Long> useOrderCount = chargingOrderClient.useOrderCount(appUser.getId());
             appUser.setOrderCount(useOrderCount.getData());
             appUser.setUid(appUser.getId().toString());
+            if (appUser.getCompanyId()!=null){
+                TCompany data = otherClient.unitDetail(appUser.getCompanyId()).getData();
+                if (data!=null){
+                    appUser.setCompanyName(data.getName());
+                }
+            }
 
             TAppUserCar one1 = appUserCarService.lambdaQuery().eq(TAppUserCar::getAppUserId, appUser.getId()).orderByDesc(BasePojo::getCreateTime).last("limit 1").one();
             if (one1!=null){
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppCouponServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppCouponServiceImpl.java
index 8c230d6..0d25253 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppCouponServiceImpl.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppCouponServiceImpl.java
@@ -42,6 +42,7 @@
 import java.util.Comparator;
 import java.util.Date;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -76,10 +77,19 @@
         List<Integer> integers = new ArrayList<>();
         integers.add(1);
         integers.add(2);
+
         SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         QueryWrapper<TAppCoupon> wrapper = new QueryWrapper<>();
         wrapper.eq("coupon_id",dto.getCouponId());
         wrapper.in("ways_to_obtain",integers);
+        if (StringUtils.hasLength(dto.getPhone())){
+            List<Long> collect = tAppUserMapper.selectList(new QueryWrapper<TAppUser>().like("phone", dto.getPhone())).stream()
+                    .map(TAppUser::getId).collect(Collectors.toList());
+            if(collect.isEmpty()){
+                collect.add(-1L);
+            }
+            wrapper.in("id",collect);
+        }
         if (dto.getStatus()!=null){
             wrapper.eq("status",dto.getStatus());
         }
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/task/TaskUtil.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/task/TaskUtil.java
index 0bdf907..7e87177 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/task/TaskUtil.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/task/TaskUtil.java
@@ -1,8 +1,11 @@
 package com.ruoyi.account.task;
 
 
+import com.ruoyi.account.api.model.TAppUser;
 import com.ruoyi.account.api.model.TAppUserVipDetail;
+import com.ruoyi.account.service.TAppUserService;
 import com.ruoyi.account.service.TAppUserVipDetailService;
+import org.intellij.lang.annotations.RegExp;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
@@ -21,6 +24,8 @@
     @Resource
     private TAppUserVipDetailService tAppUserVipDetailService;
 
+    @Resource
+    private TAppUserService appUserService;
 
 
     /**
@@ -48,6 +53,27 @@
         } catch (Exception e) {
             e.printStackTrace();
         }
+
+
+
+
+    }
+
+    @Scheduled(fixedRate = 1000 * 60)
+    public void changeVipId(){
+        LocalDate currentDate = LocalDate.now();
+        List<TAppUserVipDetail> recentDetails = tAppUserVipDetailService.lambdaQuery()
+                .le(TAppUserVipDetail::getStartTime, currentDate)
+                .ge(TAppUserVipDetail::getEndTime, currentDate)
+                .orderByDesc(TAppUserVipDetail::getStartTime).list();
+        for (TAppUserVipDetail recentDetail : recentDetails) {
+            TAppUser byId = appUserService.getById(recentDetail.getAppUserId());
+            if (byId!=null) {
+                byId.setVipId(recentDetail.getVipId());
+                appUserService.updateById(byId);
+            }
+        }
+
     }
 
 
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/CarUtil.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/CarUtil.java
index f7025ca..532cc5d 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/CarUtil.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/CarUtil.java
@@ -2365,11 +2365,11 @@
                 "]}";
         String hp = num.substring(0, 2);//
         JSONObject jsonObject = JSONObject.parseObject(jsonStr);
-        JSONArray data = jsonObject.getJSONArray("data");
+        JSONArray data = jsonObject.getJSONArray("date");
         List<CarNumDto> carNumDtos = JSONObject.parseArray(data.toJSONString(), CarNumDto.class);
         CarNumDto carNumDto = new CarNumDto();
         for (CarNumDto carNumDtoTemp : carNumDtos) {
-            if (StringUtils.equals(carNumDto.getCode(), hp)) {
+            if (carNumDtoTemp.getCode().equals(hp)) {
                 carNumDto.setCity(carNumDtoTemp.getCity());
                 carNumDto.setCode(carNumDtoTemp.getCode());
                 carNumDto.setProvince(carNumDtoTemp.getProvince());
diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TApplyChargingPileController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TApplyChargingPileController.java
index 3ea8ece..74e0baf 100644
--- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TApplyChargingPileController.java
+++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TApplyChargingPileController.java
@@ -367,9 +367,9 @@
     @ApiOperation(value = "下载", tags = {"管理后台-结算表记录"})
     @PutMapping("/downloadSettlement")
     @Log(title = "【结算表记录】下载结算表", businessType = BusinessType.EXPORT)
-    public R downloadSettlement(String uid,HttpServletResponse response)
+    public R downloadSettlement(@RequestBody ExportUidDto uid,HttpServletResponse response)
     {
-        TSettlementConfirm data = chargingOrderClient.downloadSettlement(uid).getData();
+        TSettlementConfirm data = chargingOrderClient.downloadSettlement(uid.getUid()).getData();
         List<Site> data1 = siteClient.getSiteByIds(Arrays.asList(data.getSiteId())).getData();
         if (!data1.isEmpty()){
             data.setSiteName(data1.get(0).getName());
diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TAccountingStrategyServiceImpl.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TAccountingStrategyServiceImpl.java
index ad0bc26..39a7152 100644
--- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TAccountingStrategyServiceImpl.java
+++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TAccountingStrategyServiceImpl.java
@@ -46,11 +46,11 @@
             SysUser data = sysUserClient.getSysUser(tAccountingStrategyVO.getUserId()).getData();
             tAccountingStrategyVO.setUserName(data.getNickName());
             if (tAccountingStrategyVO.getFirstUserId()!=null){
-                SysUser first = sysUserClient.getSysUser(tAccountingStrategyVO.getUserId()).getData();
+                SysUser first = sysUserClient.getSysUser(tAccountingStrategyVO.getFirstUserId()).getData();
                 tAccountingStrategyVO.setFirstUserName(first==null?null:first.getNickName());
             }
             if (tAccountingStrategyVO.getTwoUserId()!=null){
-                SysUser two = sysUserClient.getSysUser(tAccountingStrategyVO.getUserId()).getData();
+                SysUser two = sysUserClient.getSysUser(tAccountingStrategyVO.getTwoUserId()).getData();
                 tAccountingStrategyVO.setTwoUserName(two==null?null:two.getNickName());
             }
             // 匹配编辑后的未审核的
diff --git a/ruoyi-service/ruoyi-order/pom.xml b/ruoyi-service/ruoyi-order/pom.xml
index f5641e4..c0c8fee 100644
--- a/ruoyi-service/ruoyi-order/pom.xml
+++ b/ruoyi-service/ruoyi-order/pom.xml
@@ -15,6 +15,17 @@
     </description>
 
     <dependencies>
+        <!--网易邮件-->
+        <dependency>
+            <groupId>javax.mail</groupId>
+            <artifactId>javax.mail-api</artifactId>
+            <version>1.6.2</version>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.mail</groupId>
+            <artifactId>jakarta.mail</artifactId>
+            <version>1.6.5</version>
+        </dependency>
         <!-- ruoyi-modules-other-api -->
         <dependency>
             <groupId>com.ruoyi</groupId>
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderInvoiceController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderInvoiceController.java
index 1b2dfc4..5132faf 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderInvoiceController.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderInvoiceController.java
@@ -20,18 +20,22 @@
 import com.ruoyi.order.service.TOrderInvoiceService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.compress.utils.IOUtils;
 import org.apache.poi.ss.usermodel.Workbook;
 import org.springframework.beans.BeanUtils;
 import org.springframework.web.bind.annotation.*;
 
+import javax.activation.DataHandler;
+import javax.activation.FileDataSource;
 import javax.annotation.Resource;
+import javax.mail.*;
+import javax.mail.internet.*;
 import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
+import java.io.*;
+import java.net.URL;
 import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * <p>
@@ -72,6 +76,100 @@
 		TOrderInvoice orderInvoice = orderInvoiceService.getById(id);
 		orderInvoice.setInvoiceUrl(invoiceUrl);
 		orderInvoiceService.updateById(orderInvoice);
+		// 发送邮箱
+		// 收件人电子邮箱,TODO 换成自己的收件箱
+		String to = orderInvoice.getMailbox();
+		// 发件人电子邮箱,TODO 换成自己的发件箱
+		String from = "13281306557@163.com";
+		// 指定发送邮件的主机为
+		String host = "smtp.163.com";
+		// 获取系统属性
+		Properties properties = new Properties();
+		// 设置邮件服务器
+		properties.setProperty("mail.smtp.host", host);
+		// 邮件发送协议
+		properties.setProperty("mail.transport.protocol", "smtp");
+		//是否启用调试模式(启用调试模式可打印客户端与服务器交互过程时一问一答的响应消息)
+		properties.setProperty("mail.debug","true");
+		properties.setProperty("mail.smtp.auth", "true");
+		// 获取默认session对象
+		Session session = Session.getDefaultInstance(properties,new Authenticator(){
+			@Override
+			public PasswordAuthentication getPasswordAuthentication()
+			{
+				//发件人邮件用户名、授权码,换成自己的发件箱及授权码
+				return new PasswordAuthentication("13281306557@163.com", "NUSdxDQqadYvVek2");
+			}
+		});
+
+		try{
+			// 创建默认的 MimeMessage 对象
+			MimeMessage message = new MimeMessage(session);
+			// Set From,设置发件人
+			InternetAddress fromMail = new InternetAddress(from);
+			//设置发件人名称,TODO 换成自己的发件箱
+			fromMail.setPersonal(MimeUtility.encodeText("明星电力<13281306557@163.com>"));
+			message.setFrom(fromMail);
+			// Set To: 设置收件人
+			InternetAddress toMail = new InternetAddress(to);
+			// TODO 换成自己的收件箱
+			InternetAddress toMail2 = new InternetAddress(to);
+			//发多个邮箱
+			Address[] allRecipients = {toMail, toMail2};
+			message.setRecipients(Message.RecipientType.TO, allRecipients);
+			// Set Subject: 邮件主体
+			message.setSubject("明星电力");
+			// 设置消息体
+			message.setSentDate(new Date());
+			// 指定为混合关系
+			MimeMultipart msgMultipart = new MimeMultipart("mixed");
+			message.setContent(msgMultipart);
+			// 邮件信息组装
+			//组装的顺序非常重要,一定要先组装文本域,再组装文件
+			MimeBodyPart htmlPart = new MimeBodyPart();
+			// 组装内容
+			htmlPart.setContent("This is message content", "text/html;charset=UTF-8");
+			msgMultipart.addBodyPart(htmlPart);
+
+			// 组装附件
+			MimeBodyPart filePart = new MimeBodyPart();
+			String imageUrl = invoiceUrl;
+			try {
+				// 下载数据
+				URL url = new URL(imageUrl);
+				InputStream inputStream = url.openStream();
+				byte[] imageBytes = IOUtils.toByteArray(inputStream);
+
+				// 创建临时文件
+				File tempFile = File.createTempFile("tempImage", ".png");
+				try (FileOutputStream fos = new FileOutputStream(tempFile)) {
+					fos.write(imageBytes);
+				}
+
+				// 创建 FileDataSource
+				FileDataSource fileDataSource = new FileDataSource(tempFile);
+				System.out.println("FileDataSource created: " + fileDataSource.getName());
+				// 如果需要,可以使用 DataHandler 进行进一步处理
+				DataHandler dh = new DataHandler(fileDataSource);
+				// 清理:删除临时文件(如果不再需要)
+				tempFile.deleteOnExit(); // 可根据需要保留或删除
+				filePart.setDataHandler(dh);
+				// 附件区别内嵌内容的一个特点是有文件名,为防止中文乱码要编码
+				filePart.setFileName(MimeUtility.encodeText(dh.getName()));
+				msgMultipart.addBodyPart(filePart);
+				message.saveChanges();
+				//发送
+				//Transport.send(message, message.getAllRecipients());
+				Transport.send(message);
+				System.out.println("发送成功");
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		}catch (MessagingException | UnsupportedEncodingException mex) {
+			mex.printStackTrace();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
 		return AjaxResult.success();
 	}
 
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TVipOrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TVipOrderController.java
index db0a79a..74c4dfc 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TVipOrderController.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TVipOrderController.java
@@ -69,6 +69,7 @@
 
         TVipOrder one = vipOrderService.lambdaQuery().eq(TVipOrder::getCode, code).one();
         one.setSerialNumber(outTradeNo);
+        one.setPaymentStatus(2);
         vipOrderService.updateById(one);
         GiveVipDto giveVipDto = new GiveVipDto();
         giveVipDto.setVipId(one.getVipId());
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
index 633923e..3d0b7e4 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
@@ -2059,7 +2059,7 @@
 			for (TChargingPile datum : data) {
 				bigDecimal = bigDecimal.add(datum.getRatedPower());
 			}
-			BigDecimal bigDecimal1 = bigDecimal.divide(new BigDecimal(data.size())).setScale(2, RoundingMode.HALF_DOWN);
+
 
 			tSettlementConfirm.setIncome(tSettlementConfirm.getElectrovalence().add(tSettlementConfirm.getServiceCharge()));
 			// todo 计算利用率 该电站充电桩本月利用率:
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderInvoiceServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderInvoiceServiceImpl.java
index 6202b2e..9e9a60e 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderInvoiceServiceImpl.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderInvoiceServiceImpl.java
@@ -37,6 +37,7 @@
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
+import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -121,6 +122,7 @@
 		addOrderInvoice.setAppUserId(userId);
 		addOrderInvoice.setCode(code);
 		addOrderInvoice.setStatus(1);
+		addOrderInvoice.setCreateTime(LocalDateTime.now());
 		this.save(addOrderInvoice);
 		//获取开票类型
 		TInvoiceType invoiceType = invoiceTypeClient.getInvoiceType(addOrderInvoice.getInvoiceTypeId()).getData();
@@ -260,6 +262,7 @@
 		PageInfo<TOrderInvoiceVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize());
 		List<TOrderInvoiceVO> list = this.baseMapper.pageList(query,pageInfo);
 		for (TOrderInvoiceVO tOrderInvoiceVO : list) {
+			tOrderInvoiceVO.setUid(tOrderInvoiceVO.getId().toString());
 			List<Long> collect = orderInvoiceDetailService.lambdaQuery().eq(TOrderInvoiceDetail::getOrderInvoiceId, tOrderInvoiceVO.getId())
 					.eq(TOrderInvoiceDetail::getOrderType, 1).list().stream()
 					.map(TOrderInvoiceDetail::getOrderId).collect(Collectors.toList());
diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
index 3c00f46..3d2dba7 100644
--- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
+++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
@@ -201,7 +201,7 @@
                     <if test="data.createTime2 != null">
                         AND o.create_time &lt;= #{data.createTime2}
                     </if>
-                    <if test="data.ids != null and data.ids() > 0">
+                    <if test="data.ids != null and data.ids.size() > 0">
                         AND o.id IN
                         <foreach collection="data.ids" item="id" open="(" separator="," close=")">
                             #{id}
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCompanyController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCompanyController.java
index c5e604a..d355f5c 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCompanyController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCompanyController.java
@@ -50,5 +50,10 @@
 	public R delete(@RequestParam("id") Integer id) {
 		return R.ok(companyService.removeById(id));
 	}
+
+	@PostMapping(value = "/unit/detail")
+	public R detail(@RequestParam("id") Integer id) {
+		return R.ok(companyService.getById(id));
+	}
 }
 
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEnterpriseUserApplicationController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEnterpriseUserApplicationController.java
index 830e8fb..8be32f5 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEnterpriseUserApplicationController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEnterpriseUserApplicationController.java
@@ -67,19 +67,19 @@
 
     @ApiOperation(tags = {"后台-申请表单-集团用户"},value = "集团用户列表")
     @PostMapping(value = "/page")
-    public R<Page<TEnterpriseUserApplication>> page(EnterpriseQuery enterpriseQuery) {
+    public R<Page<TEnterpriseUserApplication>> page(@RequestBody EnterpriseQuery enterpriseQuery) {
         // 用户id
-        if (enterpriseQuery.getPhone()!=null) {
-            List<Long> userIds = appUserClient.getUserIdsByPhone(enterpriseQuery.getPhone()).getData();
-            if (userIds.isEmpty()){
-                return R.ok();
-            }
-            Page<TEnterpriseUserApplication> page = enterpriseUserApplicationService.lambdaQuery().in(TEnterpriseUserApplication::getAppUserId, userIds).page(Page.of(enterpriseQuery.getPageCurr(), enterpriseQuery.getPageSize()));
-        return R.ok(page);
-        }else {
-            Page<TEnterpriseUserApplication> page = enterpriseUserApplicationService.lambdaQuery().page(Page.of(enterpriseQuery.getPageCurr(), enterpriseQuery.getPageSize()));
+//        if (enterpriseQuery.getPhone()!=null) {
+//            List<Long> userIds = appUserClient.getUserIdsByPhone(enterpriseQuery.getPhone()).getData();
+//            if (userIds.isEmpty()){
+//                return R.ok();
+//            }
+//            Page<TEnterpriseUserApplication> page = enterpriseUserApplicationService.lambdaQuery().in(TEnterpriseUserApplication::getAppUserId, userIds).page(Page.of(enterpriseQuery.getPageCurr(), enterpriseQuery.getPageSize()));
+//        return R.ok(page);
+//        }else {
+            Page<TEnterpriseUserApplication> page = enterpriseUserApplicationService.lambdaQuery().eq(enterpriseQuery.getPhone()!=null&&enterpriseQuery.getPhone()!="",TEnterpriseUserApplication::getPhone,enterpriseQuery.getPhone()).page(Page.of(enterpriseQuery.getPageCurr(), enterpriseQuery.getPageSize()));
             return R.ok(page);
-        }
+//        }
     }
     
     
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java
index b3e8971..5bb53f0 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java
@@ -180,6 +180,7 @@
             vipInfoDto.setDoubleIntegration(vip.getDoubleIntegration());
             vipInfoDto.setMallExclusivePrice(vip.getMallExclusivePrice());
             vipInfoDto.setName(vip.getName());
+            vipInfoDto.setId(vip.getId());
             List<SendCouponDto> javaList = JSON.parseArray(vip.getCoupon()).toJavaList(SendCouponDto.class);
             List<VipCouponDto> vipCouponDtos = new ArrayList<>();
             if (!javaList.isEmpty()){
@@ -215,8 +216,8 @@
 
     @ApiOperation(value = "购买会员", tags = {"小程序-个人中心"})
     @GetMapping("/vipInfo/pay")
-    public R vipInfoPay(@RequestParam("vipId")Integer vipId,@RequestParam(name = "1月2季3年",value = "buyType") Integer buyType,
-        @RequestParam(name = "1微信2支付宝",value = "payType") Integer payType
+    public R vipInfoPay(@RequestParam("vipId")Integer vipId,@RequestParam("buyType") Integer buyType,
+        @RequestParam("payType") Integer payType
     ) {
 
         TVip byId = vipService.getById(vipId);
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TAdvertisingServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TAdvertisingServiceImpl.java
index eb228f2..e9f2e51 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TAdvertisingServiceImpl.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TAdvertisingServiceImpl.java
@@ -37,6 +37,11 @@
             } else {
                 tAdvertising.setStartState(2);
             }
+            if (tAdvertising.getStatus() == 0 ){
+                // 未上架
+                tAdvertising.setStartState(3);
+
+            }
         }
         pageInfo.setRecords(list);
         return pageInfo;
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TVipServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TVipServiceImpl.java
index 369b371..0bad395 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TVipServiceImpl.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TVipServiceImpl.java
@@ -12,6 +12,8 @@
 import com.ruoyi.order.api.model.TVipOrder;
 import com.ruoyi.other.api.domain.TCoupon;
 import com.ruoyi.other.api.domain.TVip;
+import com.ruoyi.other.api.feignClient.OtherClient;
+import com.ruoyi.other.api.feignClient.VipClient;
 import com.ruoyi.other.mapper.TCouponMapper;
 import com.ruoyi.other.mapper.TVipMapper;
 import com.ruoyi.other.service.TVipService;
@@ -80,17 +82,30 @@
         return pageInfo;
     }
 
+    @Resource
+    private VipClient vipClient;
     @Override
     public Object vipInfoPay(TVip byId, BigDecimal payMoney, Integer payType,BigDecimal discountMoney,BigDecimal discount,Integer buyType, Long userId) {
         TAppUser user = appUserClient.getUserById(userId).getData();
+
 
         //生成会员购买订单
 
         TVipOrder shopOrder = new TVipOrder();
         shopOrder.setCode(OrderCodeUtil.getOrderCode("HY"));
+        shopOrder.setType(1);
+
         shopOrder.setAppUserId(userId);
         shopOrder.setType(1);
         shopOrder.setVipId(byId.getId());
+        shopOrder.setTitle(byId.getName());
+        if (buyType==1){
+            shopOrder.setTitle(byId.getName()+"月卡");
+        }else if (buyType==2){
+            shopOrder.setTitle(byId.getName()+"季卡");
+        }else {
+            shopOrder.setTitle(byId.getName()+"年卡");
+        }
         shopOrder.setVipType(buyType);
         shopOrder.setOrderAmount(payMoney.add(discountMoney));
         shopOrder.setDiscount(discount);
@@ -109,7 +124,7 @@
             paymentOrder.setAmount(shopOrder.getPaymentAmount());
             paymentOrder.setOpenId(user.getWxOpenid());
             paymentOrder.setDescription("购买会员");
-            return    wxPaymentClient.orderPay(paymentOrder);
+            return    wxPaymentClient.orderPay(paymentOrder).getData();
         }else {
             AliPaymentReq req = new AliPaymentReq();
             req.setOutTradeNo(shopOrder.getCode());
diff --git a/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/controller/WxPayController.java b/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/controller/WxPayController.java
index c5c808c..6c834a0 100644
--- a/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/controller/WxPayController.java
+++ b/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/controller/WxPayController.java
@@ -129,6 +129,7 @@
                     System.err.println("----收到购物回调");
                     break;
                 case "HY":
+                    orderClient.vipCallBack(out_trade_no,outRefundNo);
                     System.err.println("----收到会员回调");
                     break;
             }
diff --git a/ruoyi-service/ruoyi-payment/src/main/resources/bootstrap.yml b/ruoyi-service/ruoyi-payment/src/main/resources/bootstrap.yml
index f72b520..fe9bde5 100644
--- a/ruoyi-service/ruoyi-payment/src/main/resources/bootstrap.yml
+++ b/ruoyi-service/ruoyi-payment/src/main/resources/bootstrap.yml
@@ -24,7 +24,6 @@
         namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb
         username: nacos
         password: nacos
-        ip: 192.168.110.85
       config:
         # 配置中心地址
         server-addr: 192.168.110.169:8848

--
Gitblit v1.7.1