Browse Source

line pay add

liuzf 3 years ago
parent
commit
caaad678df
29 changed files with 913 additions and 115 deletions
  1. 7 0
      pom.xml
  2. 6 0
      ruoyi-admin/pom.xml
  3. 192 91
      ruoyi-admin/src/main/java/com/ruoyi/web/H5Api/api/H5OrderController.java
  4. 42 14
      ruoyi-admin/src/main/java/com/ruoyi/web/H5Api/api/H5SystemController.java
  5. 26 0
      ruoyi-admin/src/main/java/com/ruoyi/web/line/ConfirmBody.java
  6. 22 0
      ruoyi-admin/src/main/java/com/ruoyi/web/line/ConfirmInfo.java
  7. 18 0
      ruoyi-admin/src/main/java/com/ruoyi/web/line/Info.java
  8. 12 0
      ruoyi-admin/src/main/java/com/ruoyi/web/line/LineCallBankParam.java
  9. 23 0
      ruoyi-admin/src/main/java/com/ruoyi/web/line/LineConfig.java
  10. 208 0
      ruoyi-admin/src/main/java/com/ruoyi/web/line/LinePay.java
  11. 24 0
      ruoyi-admin/src/main/java/com/ruoyi/web/line/LinePayAPOD.java
  12. 24 0
      ruoyi-admin/src/main/java/com/ruoyi/web/line/LinePayConfirmAPOD.java
  13. 16 0
      ruoyi-admin/src/main/java/com/ruoyi/web/line/Option.java
  14. 39 0
      ruoyi-admin/src/main/java/com/ruoyi/web/line/OrderDetail.java
  15. 44 0
      ruoyi-admin/src/main/java/com/ruoyi/web/line/Orders.java
  16. 22 0
      ruoyi-admin/src/main/java/com/ruoyi/web/line/Package.java
  17. 15 0
      ruoyi-admin/src/main/java/com/ruoyi/web/line/PayInfo.java
  18. 13 0
      ruoyi-admin/src/main/java/com/ruoyi/web/line/PaymentUrl.java
  19. 16 0
      ruoyi-admin/src/main/java/com/ruoyi/web/line/Product.java
  20. 26 0
      ruoyi-admin/src/main/java/com/ruoyi/web/line/RedirectUrls.java
  21. 50 0
      ruoyi-admin/src/main/java/com/ruoyi/web/line/SendBody.java
  22. 10 3
      ruoyi-admin/src/main/java/com/ruoyi/web/pcApi/domain/TOrderManageTotal.java
  23. 9 0
      ruoyi-admin/src/main/java/com/ruoyi/web/pcApi/mapper/TOrderManageTotalMapper.java
  24. 9 0
      ruoyi-admin/src/main/java/com/ruoyi/web/pcApi/service/ITOrderManageTotalService.java
  25. 9 2
      ruoyi-admin/src/main/java/com/ruoyi/web/pcApi/service/impl/TOrderManageTotalServiceImpl.java
  26. 10 0
      ruoyi-admin/src/main/resources/application.yml
  27. 12 1
      ruoyi-admin/src/main/resources/mapper/OrderManageTotal/TOrderManageTotalMapper.xml
  28. 7 0
      ruoyi-admin/src/main/resources/mapper/customerManage/TCustomerManageMapper.xml
  29. 2 4
      ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java

+ 7 - 0
pom.xml

@@ -32,6 +32,7 @@
         <poi.version>4.1.2</poi.version>
         <velocity.version>2.3</velocity.version>
         <jwt.version>0.9.1</jwt.version>
+        <httpclient.version>5.2</httpclient.version>
     </properties>
 	
     <!-- 依赖声明 -->
@@ -193,6 +194,12 @@
                 <version>${ruoyi.version}</version>
             </dependency>
 
+			<!-- httpclient5-->
+			<dependency>
+	            <groupId>org.apache.httpcomponents.client5</groupId>
+	            <artifactId>httpclient5</artifactId>
+	            <version>${httpclient.version}</version>
+        	</dependency>
 
         </dependencies>
     </dependencyManagement>

+ 6 - 0
ruoyi-admin/pom.xml

@@ -65,6 +65,12 @@
             <artifactId>lombok</artifactId>
         </dependency>
 
+		<!-- httpclient -->
+        <dependency>
+            <groupId>org.apache.httpcomponents.client5</groupId>
+            <artifactId>httpclient5</artifactId>
+        </dependency>
+        
     </dependencies>
 
     <build>

+ 192 - 91
ruoyi-admin/src/main/java/com/ruoyi/web/H5Api/api/H5OrderController.java

@@ -1,32 +1,59 @@
 package com.ruoyi.web.H5Api.api;
 
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.collections.map.HashedMap;
+import org.redisson.api.RLock;
+import org.redisson.api.RedissonClient;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+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 com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.annotation.RepeatSubmit;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.enums.OperatorType;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.web.pcApi.domain.*;
+import com.ruoyi.web.line.LineCallBankParam;
+import com.ruoyi.web.line.LinePay;
+import com.ruoyi.web.line.LinePayAPOD;
+import com.ruoyi.web.line.LinePayConfirmAPOD;
+import com.ruoyi.web.pcApi.domain.TCommodityManage;
+import com.ruoyi.web.pcApi.domain.TCustomerCollectionOrFootprint;
+import com.ruoyi.web.pcApi.domain.TCustomerCoupon;
+import com.ruoyi.web.pcApi.domain.TCustomerDistributionRecord;
+import com.ruoyi.web.pcApi.domain.TCustomerDistributionSet;
+import com.ruoyi.web.pcApi.domain.TCustomerIntegralRecord;
+import com.ruoyi.web.pcApi.domain.TCustomerIntegralSet;
+import com.ruoyi.web.pcApi.domain.TCustomerManage;
+import com.ruoyi.web.pcApi.domain.TCustomerNotice;
+import com.ruoyi.web.pcApi.domain.TCustomerShoppingCart;
+import com.ruoyi.web.pcApi.domain.TOrderEvaluate;
+import com.ruoyi.web.pcApi.domain.TOrderManage;
+import com.ruoyi.web.pcApi.domain.TOrderManageTotal;
 import com.ruoyi.web.pcApi.mapper.TCommodityManageMapper;
-import com.ruoyi.web.pcApi.service.*;
-import org.apache.commons.collections.map.HashedMap;
-import org.redisson.api.RLock;
-import org.redisson.api.RedissonClient;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpRequest;
-import org.springframework.scheduling.annotation.Async;
-import org.springframework.security.core.Authentication;
-import org.springframework.web.bind.annotation.*;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.math.BigDecimal;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import com.ruoyi.web.pcApi.service.ITCommodityManageService;
+import com.ruoyi.web.pcApi.service.ITCustomerCollectionOrFootprintService;
+import com.ruoyi.web.pcApi.service.ITCustomerCouponService;
+import com.ruoyi.web.pcApi.service.ITCustomerDistributionRecordService;
+import com.ruoyi.web.pcApi.service.ITCustomerDistributionSetService;
+import com.ruoyi.web.pcApi.service.ITCustomerIntegralRecordService;
+import com.ruoyi.web.pcApi.service.ITCustomerIntegralSetService;
+import com.ruoyi.web.pcApi.service.ITCustomerManageService;
+import com.ruoyi.web.pcApi.service.ITCustomerNoticeService;
+import com.ruoyi.web.pcApi.service.ITCustomerShoppingCartService;
+import com.ruoyi.web.pcApi.service.ITOrderEvaluateService;
+import com.ruoyi.web.pcApi.service.ITOrderManageService;
+import com.ruoyi.web.pcApi.service.ITOrderManageTotalService;
 
 /**
  * h5端-订单信息api
@@ -68,7 +95,9 @@ public class H5OrderController extends BaseController {
     private ITOrderManageTotalService orderManageTotalService;
     @Autowired
     private ITCustomerIntegralSetService customerIntegralSetService;
-
+    @Autowired
+    private LinePay linePay;
+    
     /**
      * 增加收藏
      *
@@ -262,86 +291,158 @@ public class H5OrderController extends BaseController {
     @RepeatSubmit
     @PostMapping("/aiPay")
     public AjaxResult aiPay(@RequestBody TOrderManageTotal orderManageTotal) {
-        //TODO 接入支付接口
 
-        TCustomerManage customer = customerManageService.selectTCustomerManageById(getLoginUser().getLoginCustomer().getId());
-        // 多/单订单支付
-        for (TOrderManage order : orderManageTotal.getOrderList()) {
-            TOrderManage orderManage = orderManageService.selectTOrderManageById(order.getId());
-            /**  通知待使用*/
-            customerNoticeService.insertTCustomerNotice(TCustomerNotice.builder().customerId(customer.getId()).commodityId(order.getId())
-                    .content("您有一张" + orderManage.getCommodityName() + "商品待使用。").title("订单信息")
-                    .createBy(orderManage.getCreateBy()).status("0")
-                    .build());
-            // 若使用积分 则订单金额减去积分金额
-            if(orderManageTotal.getIntegralDeduction() != BigDecimal.ZERO && orderManageTotal.getIntegralDeduction() != null){
-                order.setOrderMoney(orderManage.getOrderMoney().subtract(orderManageTotal.getIntegralDeduction()));
-                order.setIntegralDeduction(orderManageTotal.getIntegralDeduction());
+        // 接入支付接口
+    	LinePayAPOD resp = linePay.pay(orderManageTotal, orderManageTotalService.getDeptName(orderManageTotal.getId()));
+    	
+    	//ok
+    	if (resp != null && "0000".equals(resp.returnCode)) {
+    		//set the transactionId to the db.
+    		orderManageTotal.setTransactionId(resp.info.transactionId);
+    		
+    		orderManageTotalService.updateTOrderManageTotal(orderManageTotal);
+    		
+    		return AjaxResult.success(resp.info);
+    	}
+    	//line支付error
+    	return AjaxResult.error("LINE PAY失敗しました。");
+    }
+ 
+    /**
+     * 支付回调接口,需接入支付接口后,填写该回调URL,进行订单支付
+     *
+     * @param orderManageTotal
+     * @return
+     */
+    @Log(title = "キャンセルCallBack", operatorType = OperatorType.MOBILE, businessType = BusinessType.INSERT)
+    @RepeatSubmit
+    @PostMapping("/cancel")
+    public AjaxResult apayCancelCallBack(@RequestBody LineCallBankParam param) {
+    	//
+    	TOrderManageTotal select = new TOrderManageTotal();
+    	
+    	select.setTransactionId(param.getTransactionId());
+    	select.setId(param.getOrderId());
+    	select.setDelFlag("1");
+    	
+    	orderManageTotalService.updateTOrderManageTotal(select);
+
+    	return AjaxResult.success("支払キャンセルしました。");
+    }
+ 
+    
+    /**
+     * 支付回调接口,需接入支付接口后,填写该回调URL,进行订单支付
+     *
+     * @param orderManageTotal
+     * @return
+     */
+    @Log(title = "用户支付CallBack", operatorType = OperatorType.MOBILE, businessType = BusinessType.INSERT)
+    @RepeatSubmit
+    @PostMapping("/confirm")
+    public AjaxResult aiPayCallBack(@RequestBody LineCallBankParam param) {
+    	//
+    	TOrderManageTotal select = new TOrderManageTotal();
+    	
+    	select.setTransactionId(param.getTransactionId());
+    	select.setId(param.getOrderId());
+    	
+    	List<TOrderManageTotal> lst = orderManageTotalService.selectTOrderManageTotalList(select);
+    	
+    	TOrderManageTotal orderManageTotal = lst.get(0);
+    	
+        // 接入支付接口
+    	LinePayConfirmAPOD resp = linePay.payConfirm(orderManageTotal.getTransactionId(), orderManageTotal.getOrderMoney().longValue());
+
+    	if ("0000".equals(resp.returnCode)) {
+    		//set order list
+        	TOrderManage orderPram = new TOrderManage();
+        	orderPram.setOrderTotalId(param.getOrderId());
+        	
+        	List<TOrderManage> orderList = orderManageService.selectTOrderManageList(orderPram);
+        	
+        	orderManageTotal.setOrderList(orderList);
+            TCustomerManage customer = customerManageService.selectTCustomerManageById(getLoginUser().getLoginCustomer().getId());
+            // 多/单订单支付
+            for (TOrderManage order : orderManageTotal.getOrderList()) {
+                TOrderManage orderManage = orderManageService.selectTOrderManageById(order.getId());
+                /**  通知待使用*/
+                customerNoticeService.insertTCustomerNotice(TCustomerNotice.builder().customerId(customer.getId()).commodityId(order.getId())
+                        .content("您有一张" + orderManage.getCommodityName() + "商品待使用。").title("订单信息")
+                        .createBy(orderManage.getCreateBy()).status("0")
+                        .build());
+                // 若使用积分 则订单金额减去积分金额
+                if(orderManageTotal.getIntegralDeduction() != BigDecimal.ZERO && orderManageTotal.getIntegralDeduction() != null){
+                    order.setOrderMoney(orderManage.getOrderMoney().subtract(orderManageTotal.getIntegralDeduction()));
+                    order.setIntegralDeduction(orderManageTotal.getIntegralDeduction());
+                }
+                order.setStatus("1");// 已支付   支付状态,若接入支付回调,则变更为支付中状态-9,支付回调成功后变更为1-已支付
+                order.setPayDate(new Date());
+                orderManageService.updateTOrderManage(order);
             }
-            order.setStatus("1");// 已支付   支付状态,若接入支付回调,则变更为支付中状态-9,支付回调成功后变更为1-已支付
-            order.setPayDate(new Date());
-            orderManageService.updateTOrderManage(order);
-        }
 
-        // 获取场馆积分获取比例
-        List<TCustomerIntegralSet> tCustomerIntegralSets = customerIntegralSetService.selectTCustomerIntegralSetList(TCustomerIntegralSet.builder().deptId(getLoginUser().getLoginCustomer().getDeptId()).build());
-        BigDecimal orderIntegral = orderManageTotal.getOrderMoney();
-        if (tCustomerIntegralSets.size() > 0) {
-            // 计算分销人员奖励
-            BigDecimal proportion = new BigDecimal(tCustomerIntegralSets.get(0).getProportion()).divide(new BigDecimal("100"));
-            orderIntegral= (orderManageTotal.getOrderMoney().multiply(proportion)).setScale(0, BigDecimal.ROUND_DOWN);
+        	
+            // 获取场馆积分获取比例
+            List<TCustomerIntegralSet> tCustomerIntegralSets = customerIntegralSetService.selectTCustomerIntegralSetList(TCustomerIntegralSet.builder().deptId(getLoginUser().getLoginCustomer().getDeptId()).build());
+            BigDecimal orderIntegral = orderManageTotal.getOrderMoney();
+            if (tCustomerIntegralSets.size() > 0) {
+                // 计算分销人员奖励
+                BigDecimal proportion = new BigDecimal(tCustomerIntegralSets.get(0).getProportion()).divide(new BigDecimal("100"));
+                orderIntegral= (orderManageTotal.getOrderMoney().multiply(proportion)).setScale(0, BigDecimal.ROUND_DOWN);
 
-        }
-            // 记录用户积分
-        customerIntegralRecordService.insertTCustomerIntegralRecord(TCustomerIntegralRecord.builder().
-                supIntegral(customer.getIntegral()==null?"0":customer.getIntegral().toString()).integralNum(String.valueOf(orderIntegral.longValue())).integralType("1")
-                .createBy(getLoginUser().getLoginCustomer().getUsername()).orderId(orderManageTotal.getId()).customerId(customer.getId()).deptId(getLoginUser().getDeptId())
-                .build());
-        /**  增加用户积分*/
-        customer.setIntegral(customer.getIntegral()==null?0:customer.getIntegral() + orderIntegral.longValue());
-        customerManageService.updateTCustomerManage(customer);
-
-        // 会员减去积分
-        if(orderManageTotal.getIntegralDeduction() != null && orderManageTotal.getIntegralDeduction() != BigDecimal.ZERO){
-            customer.setIntegral(customer.getIntegral() - orderManageTotal.getIntegralDeduction().longValue());
-            customerManageService.updateTCustomerManage(customer);
-            // 记录减去用户积分
+            }
+                // 记录用户积分
             customerIntegralRecordService.insertTCustomerIntegralRecord(TCustomerIntegralRecord.builder().
-                    supIntegral(customer.getIntegral().toString()).integralNum(orderManageTotal.getIntegralDeduction().toString()).integralType("4")
-                    .createBy(getLoginUser().getLoginCustomer().getUsername()).orderId(orderManageTotal.getOrderList().get(0).getId()).customerId(customer.getId()).deptId(getLoginUser().getDeptId())
+                    supIntegral(customer.getIntegral()==null?"0":customer.getIntegral().toString()).integralNum(String.valueOf(orderIntegral.longValue())).integralType("1")
+                    .createBy(getLoginUser().getLoginCustomer().getUsername()).orderId(orderManageTotal.getId()).customerId(customer.getId()).deptId(getLoginUser().getDeptId())
                     .build());
-        }
+            /**  增加用户积分*/
+            customer.setIntegral(customer.getIntegral()==null?0:customer.getIntegral() + orderIntegral.longValue());
+            customerManageService.updateTCustomerManage(customer);
 
-        // 是否有分销
-        if (orderManageTotal.getDistributionId() != null) {
-            // 获取场馆分销比例
-            List<TCustomerDistributionSet> tCustomerDistributionSets = customerDistributionSetService.selectTCustomerDistributionSetList(TCustomerDistributionSet.builder().deptId(getLoginUser().getLoginCustomer().getDeptId()).build());
-            if (tCustomerDistributionSets.size() > 0) {
-                // 计算分销人员奖励
-                BigDecimal proportion = new BigDecimal(tCustomerDistributionSets.get(0).getProportion()).divide(new BigDecimal("100"));
-                BigDecimal integral = (orderManageTotal.getOrderMoney().multiply(proportion)).setScale(0, BigDecimal.ROUND_DOWN);
-
-                // 增加用户积分
-                TCustomerManage customerManage = customerManageService.selectTCustomerManageById(orderManageTotal.getDistributionId());
-                customerManage.setIntegral(customerManage.getIntegral() + integral.longValue());
-                customerManageService.updateTCustomerManage(customerManage);
-
-                // 记录分销
-                customerDistributionRecordService.insertTCustomerDistributionRecord(
-                        TCustomerDistributionRecord.builder().customerId(orderManageTotal.getDistributionId()).deptId(getLoginUser().getLoginCustomer().getDeptId())
-                                .distributionIntegral(integral.toString()).createBy(getLoginUser().getLoginCustomer().getUsername()).orderId(orderManageTotal.getId()).build());
+            // 会员减去积分
+            if(orderManageTotal.getIntegralDeduction() != null && orderManageTotal.getIntegralDeduction() != BigDecimal.ZERO){
+                customer.setIntegral(customer.getIntegral() - orderManageTotal.getIntegralDeduction().longValue());
+                customerManageService.updateTCustomerManage(customer);
+                // 记录减去用户积分
+                customerIntegralRecordService.insertTCustomerIntegralRecord(TCustomerIntegralRecord.builder().
+                        supIntegral(customer.getIntegral().toString()).integralNum(orderManageTotal.getIntegralDeduction().toString()).integralType("4")
+                        .createBy(getLoginUser().getLoginCustomer().getUsername()).orderId(orderManageTotal.getOrderList().get(0).getId()).customerId(customer.getId()).deptId(getLoginUser().getDeptId())
+                        .build());
             }
-        }
 
-        // 查询总订单下-是否还有未支付的信息
-        List<TOrderManage> orderManageList = orderManageService.selectTOrderManageList(TOrderManage.builder().
-                orderTotalId(orderManageTotal.getId()).status("0").build());
-        if(orderManageList.size() <= 0){
-            orderManageTotal.setStatus("1");
-            orderManageTotalService.updateTOrderManageTotal(orderManageTotal);
-        }
+            // 是否有分销
+            if (orderManageTotal.getDistributionId() != null) {
+                // 获取场馆分销比例
+                List<TCustomerDistributionSet> tCustomerDistributionSets = customerDistributionSetService.selectTCustomerDistributionSetList(TCustomerDistributionSet.builder().deptId(getLoginUser().getLoginCustomer().getDeptId()).build());
+                if (tCustomerDistributionSets.size() > 0) {
+                    // 计算分销人员奖励
+                    BigDecimal proportion = new BigDecimal(tCustomerDistributionSets.get(0).getProportion()).divide(new BigDecimal("100"));
+                    BigDecimal integral = (orderManageTotal.getOrderMoney().multiply(proportion)).setScale(0, BigDecimal.ROUND_DOWN);
+
+                    // 增加用户积分
+                    TCustomerManage customerManage = customerManageService.selectTCustomerManageById(orderManageTotal.getDistributionId());
+                    customerManage.setIntegral(customerManage.getIntegral() + integral.longValue());
+                    customerManageService.updateTCustomerManage(customerManage);
+
+                    // 记录分销
+                    customerDistributionRecordService.insertTCustomerDistributionRecord(
+                            TCustomerDistributionRecord.builder().customerId(orderManageTotal.getDistributionId()).deptId(getLoginUser().getLoginCustomer().getDeptId())
+                                    .distributionIntegral(integral.toString()).createBy(getLoginUser().getLoginCustomer().getUsername()).orderId(orderManageTotal.getId()).build());
+                }
+            }
 
-        return AjaxResult.success();
+            // 查询总订单下-是否还有未支付的信息
+            List<TOrderManage> orderManageList = orderManageService.selectTOrderManageList(TOrderManage.builder().
+                    orderTotalId(orderManageTotal.getId()).status("0").build());
+            if(orderManageList.size() <= 0){
+                orderManageTotal.setStatus("1");
+                orderManageTotalService.updateTOrderManageTotal(orderManageTotal);
+            }
+    		return AjaxResult.success("支払成功");
+    	} else {
+    		return AjaxResult.success("支払失敗した");
+    	}
     }
 
 }

+ 42 - 14
ruoyi-admin/src/main/java/com/ruoyi/web/H5Api/api/H5SystemController.java

@@ -1,8 +1,19 @@
 package com.ruoyi.web.H5Api.api;
 
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.GetMapping;
+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 com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.annotation.RepeatSubmit;
-import com.ruoyi.common.constant.Constants;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.model.LoginCustomerManage;
@@ -11,23 +22,12 @@ import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.enums.OperatorType;
 import com.ruoyi.common.utils.CommonUtils;
 import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.framework.web.service.TokenService;
+import com.ruoyi.web.line.LineConfig;
 import com.ruoyi.web.pcApi.domain.BusCompany;
 import com.ruoyi.web.pcApi.domain.TCustomerManage;
 import com.ruoyi.web.pcApi.service.IBusCompanyService;
 import com.ruoyi.web.pcApi.service.ITCustomerManageService;
-import com.ruoyi.web.pcApi.service.ITOrderManageService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.web.bind.annotation.*;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
 
 /**
  * h5端-系统管理api
@@ -46,7 +46,9 @@ public class H5SystemController extends BaseController
     private TokenService tokenService;
     @Autowired
     private IBusCompanyService busCompanyService;
-
+    @Autowired
+    private LineConfig lineConfig;
+    
     @Log(title = "用户注册",operatorType = OperatorType.MOBILE,businessType = BusinessType.INSERT)
     @RepeatSubmit
     @PostMapping("/register")
@@ -62,6 +64,32 @@ public class H5SystemController extends BaseController
         return AjaxResult.success(customerManageService.insertTCustomerManage(customerManage));
     }
 
+    @Log(title = "LINE用户注册",operatorType = OperatorType.MOBILE,businessType = BusinessType.INSERT)
+    @RepeatSubmit
+    @PostMapping("/lineLogin")
+    public AjaxResult lineLogin(@RequestBody LoginCustomerManage loginCustomerManage){
+        // 校验用户名是否存在
+    	LoginCustomerManage loginCustomer = customerManageService.selectLoginUser(loginCustomerManage);
+        if(loginCustomer == null){
+        	TCustomerManage customerManage = new TCustomerManage();
+        	customerManage.setUsername(loginCustomerManage.getUsername());
+        	customerManage.setDeptId(loginCustomerManage.getDeptId());
+        	customerManage.setName(loginCustomerManage.getName());
+        	customerManage.setCustomerNo(CommonUtils.getStringSnowflakeId());
+            customerManage.setPassword(SecurityUtils.encryptPassword(lineConfig.password));
+            customerManage.setCreateBy(customerManage.getUsername());
+            customerManageService.insertTCustomerManage(customerManage);
+        }
+        
+        LoginUser loginUser = new LoginUser();
+        loginUser.setLoginCustomer(loginCustomer);
+        UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginUser,null,loginUser.getAuthorities());
+        SecurityContextHolder.getContext().setAuthentication(authenticationToken);
+        String token = tokenService.createToken(loginUser);
+
+        return AjaxResult.success(token);
+    }
+    
     /**
      *  app登陆
      * #param username

+ 26 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/line/ConfirmBody.java

@@ -0,0 +1,26 @@
+package com.ruoyi.web.line;
+
+import java.io.Serializable;
+
+import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
+
+@Data
+@Getter
+@Setter
+public class ConfirmBody implements Serializable {
+	
+    private static final long serialVersionUID = 1L;
+
+	/**
+	 * total amount
+	 */
+	private long amount;
+	
+	/**
+	 * currency default : JPY
+	 */
+	private String currency = "JPY";
+
+}

+ 22 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/line/ConfirmInfo.java

@@ -0,0 +1,22 @@
+package com.ruoyi.web.line;
+
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class ConfirmInfo {
+	public final String transactionId;
+	public final String orderId;
+	public final List<PayInfo> payInfo;
+	public final List<Package> packages;
+	
+	public ConfirmInfo(@JsonProperty("transactionId") String transactionId,
+            @JsonProperty("orderId") String orderId,
+            @JsonProperty("payInfo") List<PayInfo> payInfo,
+            @JsonProperty("packages") List<Package> packages) {
+		this.transactionId = transactionId;
+		this.payInfo = payInfo;
+		this.orderId = orderId;
+		this.packages = packages;
+	}
+}

+ 18 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/line/Info.java

@@ -0,0 +1,18 @@
+package com.ruoyi.web.line;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class Info {
+	public final String transactionId;
+	public final String paymentAccessToken;
+	public final PaymentUrl paymentUrl;
+	
+	public Info(@JsonProperty("transactionId") String transactionId,
+            @JsonProperty("paymentAccessToken") String paymentAccessToken,
+            @JsonProperty("paymentUrl") PaymentUrl paymentUrl) {
+		this.transactionId = transactionId;
+		this.paymentAccessToken = paymentAccessToken;
+		this.paymentUrl = paymentUrl;
+	}
+}
+

+ 12 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/line/LineCallBankParam.java

@@ -0,0 +1,12 @@
+package com.ruoyi.web.line;
+
+import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
+@Data
+@Getter
+@Setter
+public class LineCallBankParam {
+	private String transactionId;
+	private long orderId;
+}

+ 23 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/line/LineConfig.java

@@ -0,0 +1,23 @@
+package com.ruoyi.web.line;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class LineConfig {
+    @Value("${line.channelId}")
+    public String channelId;
+    @Value("${line.channelSecret}")
+    public String channelSecret;
+    @Value("${line.payUrl}")
+    public String payUrl;
+    @Value("${line.confirmUrl}")
+    public String confirmUrl;
+    @Value("${line.callbankConfirmUrl}")
+    public String callbankConfirmUrl;
+    @Value("${line.callbankCancelUrl}")
+    public String callbankCancelUrl;
+    @Value("${line.password}")
+    public String password;
+
+}

+ 208 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/line/LinePay.java

@@ -0,0 +1,208 @@
+package com.ruoyi.web.line;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.net.URISyntaxException;
+import java.text.MessageFormat;
+import java.util.UUID;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.codec.digest.HmacAlgorithms;
+import org.apache.commons.codec.digest.HmacUtils;
+import org.apache.hc.client5.http.classic.methods.HttpPost;
+import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
+import org.apache.hc.client5.http.impl.classic.HttpClients;
+import org.apache.hc.core5.http.ContentType;
+import org.apache.hc.core5.http.io.entity.EntityUtils;
+import org.apache.hc.core5.http.io.entity.StringEntity;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.ruoyi.web.pcApi.domain.TOrderManage;
+import com.ruoyi.web.pcApi.domain.TOrderManageTotal;
+import com.ruoyi.web.pcApi.service.ITOrderManageService;
+
+@Component
+public class LinePay  implements Serializable {
+	
+    private static final long serialVersionUID = 1L;
+    /** log */
+    private static final Logger log = LoggerFactory.getLogger(LinePay.class);
+    
+    @Autowired
+    private LineConfig lineConfig;
+    
+    @Autowired
+    private ITOrderManageService orderManageService;
+    
+	/**
+	 * create the line pay request body.
+	 * 
+	 * @param orderManageTotal 订单管理-总对象
+	 * @return line pay request body
+	 */
+	public SendBody createSendBody(TOrderManageTotal orderManageTotal, String deptName) {
+		//create line pay request body
+		SendBody sendBody = new SendBody();
+		//订单金额
+		sendBody.setAmount(orderManageTotal.getOrderMoney().intValue());
+		//order id
+		sendBody.setOrderId(String.valueOf(orderManageTotal.getId()));
+		
+		for (TOrderManage orderManage : orderManageTotal.getOrderList()) {
+			
+			TOrderManage order = orderManageService.selectTOrderManageById(orderManage.getId());
+			
+			//send order
+			Orders ord = new Orders();
+			//注文番号 
+			ord.setId(order.getOrderNo());
+			//決済金額
+			ord.setAmount(order.getOrderMoney().intValue());
+			//パッケージの名前(または、加盟店内の出店業者の名前)
+			ord.setName(deptName);
+			//add the packages
+			sendBody.add(ord);
+			
+			OrderDetail detail = new OrderDetail();
+			//販売商品の名前
+			detail.setName(order.getCommodityName());
+			//販売商品の画像URL
+			detail.setImageUrl(order.getFaceImg());
+			//商品数
+			detail.setQuantity(1);
+			//各商品の決済金額
+			detail.setPrice(order.getOrderMoney().intValue());
+			
+			ord.add(detail);
+			
+		}
+		//call back urls
+		RedirectUrls callBack = new RedirectUrls();
+		//confirm url
+		callBack.setConfirmUrl(lineConfig.callbankConfirmUrl);
+		//cancel url
+		callBack.setCancelUrl(lineConfig.callbankCancelUrl);
+		
+		sendBody.setRedirectUrls(callBack);
+		
+		return sendBody;
+	}
+	
+	/**
+	 * line pay 
+	 * @param orderManageTotal
+	 */
+	public LinePayAPOD pay(TOrderManageTotal orderManageTotal, String deptName) {
+
+		//create request body
+		SendBody sendBody = createSendBody(orderManageTotal, deptName);
+		
+		ObjectMapper mapper = new ObjectMapper();
+	
+		String nonce = UUID.randomUUID().toString();
+		
+		LinePayAPOD response = null;
+		
+		try (CloseableHttpClient client = HttpClients.createDefault()) {
+
+			HttpPost request = new HttpPost(lineConfig.payUrl);
+	
+			request.setHeader("Content-Type", "application/json");
+			request.setHeader("X-LINE-ChannelId", lineConfig.channelId);
+			request.setHeader("X-LINE-Authorization-Nonce", nonce);
+			
+			StringBuffer message = new StringBuffer();
+			//channelSecret
+			message.append(lineConfig.channelSecret);
+			//path
+			message.append(request.getUri().getPath());
+			//body
+			message.append(mapper.writeValueAsString(sendBody));
+			//nonce
+			message.append(nonce);
+			
+			byte[] bytes = HmacUtils.getInitializedMac(HmacAlgorithms.HMAC_SHA_256, lineConfig.channelSecret.getBytes()).doFinal(message.toString().getBytes());
+			
+			byte[] byteArray = Base64.encodeBase64(bytes);
+			
+			request.setHeader("X-LINE-Authorization", new String(byteArray));
+			
+			request.setEntity(new StringEntity(mapper.writeValueAsString(sendBody), ContentType.APPLICATION_JSON));
+			
+			response = client.execute(request, httpResponse ->
+		       mapper.readValue(EntityUtils.toString(httpResponse.getEntity()), LinePayAPOD.class));
+	
+		   log.debug(mapper.writeValueAsString(response));
+		   
+		} catch (IOException | URISyntaxException e) {
+			
+			log.error("line pay Request API エラーが発生しました。", e);
+		}
+		
+		return response;
+	}
+
+	/**
+	 * confirm line pay
+	 * @param transactionId
+	 * @param total
+	 */
+	public LinePayConfirmAPOD payConfirm(String transactionId, long total) {
+		//
+		ConfirmBody body = new ConfirmBody();
+		
+		body.setAmount(total);
+		
+		ObjectMapper mapper = new ObjectMapper();
+		
+		String nonce = UUID.randomUUID().toString();
+		
+		MessageFormat form = new MessageFormat(lineConfig.confirmUrl);
+				
+		String formatStr = form.format(new Object[] {transactionId}); 
+		
+		LinePayConfirmAPOD response = null;
+		
+		try (CloseableHttpClient client = HttpClients.createDefault()) {
+
+			HttpPost request = new HttpPost(formatStr);
+	
+			request.setHeader("Content-Type", "application/json");
+			request.setHeader("X-LINE-ChannelId", lineConfig.channelId);
+			request.setHeader("X-LINE-Authorization-Nonce", nonce);
+
+			StringBuffer message = new StringBuffer();
+			//channelSecret
+			message.append(lineConfig.channelSecret);
+			//path
+			message.append(request.getUri().getPath());
+			//body
+			message.append(mapper.writeValueAsString(body));
+			//nonce
+			message.append(nonce);
+			
+			byte[] bytes = HmacUtils.getInitializedMac(HmacAlgorithms.HMAC_SHA_256, lineConfig.channelSecret.getBytes()).doFinal(message.toString().getBytes());
+			
+			byte[] byteArray = Base64.encodeBase64(bytes);
+			
+			request.setHeader("X-LINE-Authorization", new String(byteArray));
+			
+			request.setEntity(new StringEntity(mapper.writeValueAsString(body), ContentType.APPLICATION_JSON));
+
+			response = client.execute(request, httpResponse ->
+		       mapper.readValue(EntityUtils.toString(httpResponse.getEntity()), LinePayConfirmAPOD.class));
+
+			log.debug(mapper.writeValueAsString(response));
+			
+		} catch (IOException | URISyntaxException e) {
+			
+			log.error("line pay Confirm API エラーが発生しました。", e);
+		}
+		
+		return response;
+	}
+}

+ 24 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/line/LinePayAPOD.java

@@ -0,0 +1,24 @@
+package com.ruoyi.web.line;
+
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class LinePayAPOD {
+	public final String returnCode;
+    public final String returnMessage;
+	public final Info info;
+	public final Map<String, String> errorDetailMap;
+    public LinePayAPOD(@JsonProperty("returnCode") String returnCode,
+                @JsonProperty("returnMessage") String returnMessage,
+                @JsonProperty("info") Info info,
+                @JsonProperty("errorDetailMap") Map<String, String> errorDetailMap) {
+        this.returnCode = returnCode;
+        this.returnMessage = returnMessage;
+        this.info = info;
+        this.errorDetailMap = errorDetailMap;
+    }
+
+}

+ 24 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/line/LinePayConfirmAPOD.java

@@ -0,0 +1,24 @@
+package com.ruoyi.web.line;
+
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class LinePayConfirmAPOD {
+	public final String returnCode;
+    public final String returnMessage;
+	public final ConfirmInfo info;
+	public final Map<String, String> errorDetailMap;
+    public LinePayConfirmAPOD(@JsonProperty("returnCode") String returnCode,
+                @JsonProperty("returnMessage") String returnMessage,
+                @JsonProperty("info") ConfirmInfo info,
+                @JsonProperty("errorDetailMap") Map<String, String> errorDetailMap) {
+        this.returnCode = returnCode;
+        this.returnMessage = returnMessage;
+        this.info = info;
+        this.errorDetailMap = errorDetailMap;
+    }
+
+}

+ 16 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/line/Option.java

@@ -0,0 +1,16 @@
+package com.ruoyi.web.line;
+
+import java.io.Serializable;
+
+import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
+
+@Data
+@Getter
+@Setter
+public class Option  implements Serializable {
+	
+    private static final long serialVersionUID = 1L;
+
+}

+ 39 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/line/OrderDetail.java

@@ -0,0 +1,39 @@
+package com.ruoyi.web.line;
+
+import java.io.Serializable;
+
+import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
+@Data
+@Getter
+@Setter
+public class OrderDetail  implements Serializable {
+	
+    private static final long serialVersionUID = 1L;
+
+	/**
+	 * 販売商品の名前
+	 */
+	private String name;
+	
+	/**
+	 * 販売商品の画像URL
+	 */
+	private String imageUrl;
+	
+	/**
+	 * 商品数
+	 */
+	private int quantity;
+	
+	/**
+	 * 各商品の元の金額
+	 */
+	private Integer originalPrice;
+	
+	/**
+	 * 各商品の決済金額
+	 */
+	private Integer price;
+}

+ 44 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/line/Orders.java

@@ -0,0 +1,44 @@
+package com.ruoyi.web.line;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
+@Data
+@Getter
+@Setter
+public class Orders  implements Serializable {
+	
+    private static final long serialVersionUID = 1L;
+
+	/**
+	 * パッケージリストのユニークなID
+	 */
+	private String id;
+	
+	/**
+	 * パッケージ内の商品金額合計
+	 */
+	private Integer amount;
+	
+	/**
+	 * パッケージの名前(または、加盟店内の出店業者の名前)
+	 */
+	private String name;
+	
+	/**
+	 * the product details
+	 */
+	private List<OrderDetail> products = new ArrayList<OrderDetail>();
+
+	/**
+	 * @param detail
+	 */
+	public void add(OrderDetail detail) {
+		this.products.add(detail);
+	}
+
+}

+ 22 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/line/Package.java

@@ -0,0 +1,22 @@
+package com.ruoyi.web.line;
+
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class Package {
+	public final String id;
+	public final int amount;
+	public final int userFeeAmount;
+	public final List<Product> products;
+	
+	public Package(@JsonProperty("id") String id,
+			@JsonProperty("amount") int amount,
+			@JsonProperty("userFeeAmount") int userFeeAmount,
+			@JsonProperty("products") List<Product> products) {
+		this.id = id;
+		this.amount = amount;
+		this.userFeeAmount = userFeeAmount;
+		this.products = products;
+	}
+}

+ 15 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/line/PayInfo.java

@@ -0,0 +1,15 @@
+package com.ruoyi.web.line;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class PayInfo {
+	public final int amount;
+	public final String method;
+	public PayInfo(@JsonProperty("amount") int amount,
+			@JsonProperty("method") String method,
+			@JsonProperty("creditCardBrand") String creditCardBrand,
+			@JsonProperty("maskedCreditCardNumber") String maskedCreditCardNumber) {
+		this.amount = amount;
+		this.method = method;
+	}
+}

+ 13 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/line/PaymentUrl.java

@@ -0,0 +1,13 @@
+package com.ruoyi.web.line;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class PaymentUrl {
+	public final String web;
+	public final String app;
+	public PaymentUrl(@JsonProperty("web") String web,
+            @JsonProperty("app") String app) {
+		this.app = app;
+		this.web = web;
+	}
+}

+ 16 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/line/Product.java

@@ -0,0 +1,16 @@
+package com.ruoyi.web.line;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class Product {
+	public final int price;
+	public final int quantity;
+	public final String name;
+	public Product(@JsonProperty("price") int price,
+			@JsonProperty("quantity") int quantity,
+			@JsonProperty("name") String name) {
+		this.price = price;
+		this.quantity = quantity;
+		this.name = name;
+	}
+}

+ 26 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/line/RedirectUrls.java

@@ -0,0 +1,26 @@
+package com.ruoyi.web.line;
+
+import java.io.Serializable;
+
+import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
+
+@Data
+@Getter
+@Setter
+public class RedirectUrls  implements Serializable {
+	
+    private static final long serialVersionUID = 1L;
+
+	/**
+	 * ユーザーが決済要求を承認した後に遷移する加盟店のURL
+	 */
+	private String confirmUrl;
+	
+	/**
+	 * LINEアプリの決済画面でLINE Payユーザーが決済を取り消した場合に遷移するURL
+	 */
+	private String cancelUrl;
+
+}

+ 50 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/line/SendBody.java

@@ -0,0 +1,50 @@
+package com.ruoyi.web.line;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
+
+@Data
+@Getter
+@Setter
+public class SendBody implements Serializable {
+	
+    private static final long serialVersionUID = 1L;
+
+	/**
+	 * total amount
+	 */
+	private Integer amount;
+	
+	/**
+	 * currency default : JPY
+	 */
+	private String currency = "JPY";
+	
+	/**
+	 * order id
+	 */
+	private String orderId;
+	
+	/**
+	 * order details
+	 */
+	private List<Orders> packages = new ArrayList<Orders>();
+	
+	/**
+	 * add 
+	 */
+	public void add(Orders order) {
+		packages.add(order);
+	}
+	
+	/**
+	 * call back
+	 */
+	private RedirectUrls redirectUrls;
+
+}

+ 10 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/pcApi/domain/TOrderManageTotal.java

@@ -5,12 +5,15 @@ import java.util.Date;
 import java.util.List;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
-import lombok.*;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
 
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
 /**
  * 订单管理-总对象 t_order_manage_total
  * 
@@ -41,6 +44,10 @@ public class TOrderManageTotal extends BaseEntity
     @Excel(name = "支付宝支付号")
     private String aipayNo;
 
+    /** LINE交易单号 */
+    @Excel(name = "LINE交易单号")
+    private String transactionId;
+
     /** 订单状态:0-待支付 1-已支付 99-已退款  */
     @Excel(name = "订单状态:0-待支付 1-已支付 99-已退款 ")
     private String status;

+ 9 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/pcApi/mapper/TOrderManageTotalMapper.java

@@ -1,6 +1,7 @@
 package com.ruoyi.web.pcApi.mapper;
 
 import java.util.List;
+
 import com.ruoyi.web.pcApi.domain.TOrderManageTotal;
 
 /**
@@ -58,4 +59,12 @@ public interface TOrderManageTotalMapper
      * @return 结果
      */
     public int deleteTOrderManageTotalByIds(Long[] ids);
+ 
+    /**
+     * 公交公司名称取得
+     * 
+     * @param id 订单管理-总主键
+     * @return 公交公司名称
+     */
+    public String getDeptName(Long id);
 }

+ 9 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/pcApi/service/ITOrderManageTotalService.java

@@ -1,6 +1,7 @@
 package com.ruoyi.web.pcApi.service;
 
 import java.util.List;
+
 import com.ruoyi.web.pcApi.domain.TOrderManageTotal;
 
 /**
@@ -58,4 +59,12 @@ public interface ITOrderManageTotalService
      * @return 结果
      */
     public int deleteTOrderManageTotalById(Long id);
+    
+    /**
+     * 公交公司名称取得
+     * 
+     * @param id 订单管理-总主键
+     * @return 公交公司名称
+     */
+    public String getDeptName(Long id);
 }

+ 9 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/pcApi/service/impl/TOrderManageTotalServiceImpl.java

@@ -1,11 +1,13 @@
 package com.ruoyi.web.pcApi.service.impl;
 
 import java.util.List;
-import com.ruoyi.common.utils.DateUtils;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import com.ruoyi.web.pcApi.mapper.TOrderManageTotalMapper;
+
+import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.web.pcApi.domain.TOrderManageTotal;
+import com.ruoyi.web.pcApi.mapper.TOrderManageTotalMapper;
 import com.ruoyi.web.pcApi.service.ITOrderManageTotalService;
 
 /**
@@ -93,4 +95,9 @@ public class TOrderManageTotalServiceImpl implements ITOrderManageTotalService
     {
         return tOrderManageTotalMapper.deleteTOrderManageTotalById(id);
     }
+
+	@Override
+	public String getDeptName(Long id) {
+		return tOrderManageTotalMapper.getDeptName(id);
+	}
 }

+ 10 - 0
ruoyi-admin/src/main/resources/application.yml

@@ -138,3 +138,13 @@ xss:
   excludes: /system/notice
   # 匹配链接
   urlPatterns: /system/*,/monitor/*,/tool/*
+
+#line pay
+line:
+  channelId: 1657699044
+  channelSecret: a83d9e950a065aab3866a69f7c92c69d
+  password: PiswoFEo823DeiL
+  payUrl: https://api-pay.line.me/v3/payments/request
+  confirmUrl: https://api-pay.line.me/v3/payments/{0}/confirm
+  callbankConfirmUrl: https://liff.line.me/1657344394-LBE9V9k9/linePayConfirm
+  callbankCancelUrl: https://liff.line.me/1657344394-LBE9V9k9/linePayCancel

+ 12 - 1
ruoyi-admin/src/main/resources/mapper/OrderManageTotal/TOrderManageTotalMapper.xml

@@ -19,10 +19,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateBy"    column="update_by"    />
         <result property="updateTime"    column="update_time"    />
         <result property="remark"    column="remark"    />
+        <result property="transactionId"    column="transaction_id"    />
     </resultMap>
 
     <sql id="selectTOrderManageTotalVo">
-        select id, integral_deduction, order_money, aipay_no, status, pay_date, return_date, dept_id, del_flag, create_by, create_time, update_by, update_time, remark from t_order_manage_total
+        select id, integral_deduction, order_money, aipay_no, status, pay_date, return_date, dept_id, del_flag, create_by, create_time, update_by, update_time, remark, transaction_id from t_order_manage_total
     </sql>
 
     <select id="selectTOrderManageTotalList" parameterType="TOrderManageTotal" resultMap="TOrderManageTotalResult">
@@ -35,6 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="payDate != null "> and pay_date = #{payDate}</if>
             <if test="returnDate != null "> and return_date = #{returnDate}</if>
             <if test="deptId != null "> and dept_id = #{deptId}</if>
+            <if test="transactionId != null">and transaction_id = #{transactionId}</if>
         </where>
     </select>
     
@@ -59,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateBy != null">update_by,</if>
             <if test="updateTime != null">update_time,</if>
             <if test="remark != null">remark,</if>
+            <if test="transactionId != null">transaction_id,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="integralDeduction != null">#{integralDeduction},</if>
@@ -74,6 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateBy != null">#{updateBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
             <if test="remark != null">#{remark},</if>
+            <if test="transactionId != null">#{transactionId},</if>
          </trim>
     </insert>
 
@@ -93,6 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
             <if test="remark != null">remark = #{remark},</if>
+            <if test="transactionId != null">transaction_id = #{transactionId},</if>
         </trim>
         where id = #{id}
     </update>
@@ -107,4 +112,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </delete>
+    
+    <select id="getDeptName" parameterType="Long" resultType="java.lang.String">
+        select a.dept_name from sys_dept a, t_order_manage_total b
+        where a.dept_id = b.dept_id and b.id = #{id}
+    </select>
+
 </mapper>

+ 7 - 0
ruoyi-admin/src/main/resources/mapper/customerManage/TCustomerManageMapper.xml

@@ -176,6 +176,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             a.update_by,
             a.update_time,
             a.remark,
+            a.dept_id,
             a.nick_name nickName
         FROM
             t_customer_manage a
@@ -186,6 +187,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="id != null">
             and a.username = #{username}
         </if>
+        <if test="deptId != null">
+            and a.dept_id = #{deptId}
+        </if>
+        <if test="deptId == null">
+            and a.dept_id is null
+        </if>
     </select>
 
 

+ 2 - 4
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java

@@ -14,15 +14,13 @@ import org.springframework.security.core.userdetails.UserDetailsService;
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
 import org.springframework.security.web.authentication.logout.LogoutFilter;
-import org.springframework.security.web.firewall.StrictHttpFirewall;
 import org.springframework.web.filter.CorsFilter;
+
 import com.ruoyi.framework.config.properties.PermitAllUrlProperties;
 import com.ruoyi.framework.security.filter.JwtAuthenticationTokenFilter;
 import com.ruoyi.framework.security.handle.AuthenticationEntryPointImpl;
 import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl;
 
-import java.nio.charset.StandardCharsets;
-
 /**
  * spring security配置
  * 
@@ -112,7 +110,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                 // 过滤请求
                 .authorizeRequests()
                 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
-                .antMatchers("/h5/system/register","/h5/system/login","/h5/system/getBusCompanyList").anonymous()
+                .antMatchers("/h5/system/register","/h5/system/login","/h5/system/lineLogin","/h5/system/getBusCompanyList").anonymous()
                 .antMatchers("/h5/home/selectPreferredList","/h5/home/selectTypeList","/h5/home/","/h5/home/","/h5/home/selectSalesTop10","/h5/home/getCommodity4H5Open/**").anonymous()
                 .antMatchers("/login", "/register", "/captchaImage").anonymous()
                 // 静态资源,可匿名访问