jk-GitHub-coder 4 gadi atpakaļ
vecāks
revīzija
5d733a047b
35 mainītis faili ar 1487 papildinājumiem un 1491 dzēšanām
  1. 129 25
      YijiaRestful/src/main/java/com/platform/yijia/controller/AppUserInfoController.java
  2. 7 22
      YijiaRestful/src/main/java/com/platform/yijia/controller/ElectronicMembershipCardController.java
  3. 1 1
      YijiaRestful/src/main/java/com/platform/yijia/controller/PayController.java
  4. 450 413
      YijiaRestful/src/main/java/com/platform/yijia/controller/PayOrderController.java
  5. 2 0
      YijiaRestful/src/main/java/com/platform/yijia/controller/PosMachineController.java
  6. 9 2
      YijiaRestful/src/main/java/com/platform/yijia/dao/AppUserInfoMapper.java
  7. 0 3
      YijiaRestful/src/main/java/com/platform/yijia/dao/CustomerGradeMapper.java
  8. 3 0
      YijiaRestful/src/main/java/com/platform/yijia/dao/StationInfoMapper.java
  9. 9 0
      YijiaRestful/src/main/java/com/platform/yijia/dao/SysDictDataMapper.java
  10. 2 0
      YijiaRestful/src/main/java/com/platform/yijia/param/request/PayOrderRequest.java
  11. 5 402
      YijiaRestful/src/main/java/com/platform/yijia/pojo/AppUserInfo.java
  12. 0 1
      YijiaRestful/src/main/java/com/platform/yijia/pojo/IntegralRule.java
  13. 9 0
      YijiaRestful/src/main/java/com/platform/yijia/pojo/Oil.java
  14. 21 0
      YijiaRestful/src/main/java/com/platform/yijia/pojo/PayOrderResultInfo.java
  15. 29 0
      YijiaRestful/src/main/java/com/platform/yijia/pojo/StationInfo.java
  16. 6 193
      YijiaRestful/src/main/java/com/platform/yijia/pojo/StationOilPrice.java
  17. 8 2
      YijiaRestful/src/main/java/com/platform/yijia/service/AppUserInfoService.java
  18. 0 3
      YijiaRestful/src/main/java/com/platform/yijia/service/CustomerGradeServices.java
  19. 3 0
      YijiaRestful/src/main/java/com/platform/yijia/service/StationService.java
  20. 11 0
      YijiaRestful/src/main/java/com/platform/yijia/service/SysDictDataService.java
  21. 14 1
      YijiaRestful/src/main/java/com/platform/yijia/service/impl/AppUserInfoServiceImpl.java
  22. 0 6
      YijiaRestful/src/main/java/com/platform/yijia/service/impl/CustomerGradeServiceImpl.java
  23. 6 0
      YijiaRestful/src/main/java/com/platform/yijia/service/impl/StationServiceImpl.java
  24. 20 0
      YijiaRestful/src/main/java/com/platform/yijia/service/impl/SysDictDataServiceImpl.java
  25. 554 0
      YijiaRestful/src/main/java/com/platform/yijia/utils/CryptUtil.java
  26. 1 1
      YijiaRestful/src/main/resources/application.yml
  27. 62 20
      YijiaRestful/src/main/resources/mapper/AppUserInfoMapper.xml
  28. 17 85
      YijiaRestful/src/main/resources/mapper/CustomerGradeMapper.xml
  29. 0 2
      YijiaRestful/src/main/resources/mapper/IntegralRuleMapper.xml
  30. 0 1
      YijiaRestful/src/main/resources/mapper/PayOrderMapper.xml
  31. 39 21
      YijiaRestful/src/main/resources/mapper/StationInfoMapper.xml
  32. 15 283
      YijiaRestful/src/main/resources/mapper/StationOilPriceMapper.xml
  33. 33 0
      YijiaRestful/src/main/resources/mapper/SysDictDataMapper.xml
  34. 5 0
      YijiaRestful/src/test/java/com/palatform/yijia/A.java
  35. 17 4
      YijiaRestful/src/test/java/com/palatform/yijia/test.java

+ 129 - 25
YijiaRestful/src/main/java/com/platform/yijia/controller/AppUserInfoController.java

@@ -443,35 +443,11 @@ public class AppUserInfoController {
             CustomerPoints customerPoints =  new CustomerPoints();
             CustomerElectronicCard customerElectronicCard = new CustomerElectronicCard();   //客户电子卡
             String openId = "";     //此参数用于查询该用户是否已注册过
-            if(request.getUserType()!=null){
-                //1-微信公众号
-                if(request.getUserType().equals("1") &&StringUtils.isNotBlank(request.getOpenId())){
-                    appUserInfo.setUserType(request.getUserType());
-                    appUserInfo.setBlogToken(request.getBlogToken());
-                    openId = request.getOpenId();
-                    appUserInfo.setBlogOpenid(openId);
-                    customerPoints.setBlogOpenId(openId);
-                    customerElectronicCard.setBlogOpenid(openId);
-                 //2-微信小程序
-                }else if(request.getUserType().equals("2") &&StringUtils.isNotBlank(request.getOpenId())){
-                    appUserInfo.setUserType(request.getUserType());
-                    appUserInfo.setMinaToken(request.getMinaToken());
-                    openId = request.getOpenId();
-                    appUserInfo.setMinaOpenid(openId);
-                    customerPoints.setMinaOpenId(openId);
-                    customerElectronicCard.setMinaOpenid(openId);
-                }
-            }
             if(StringUtils.isNotBlank(request.getBlogNickName())){
                 appUserInfo.setBlogNickName(request.getBlogNickName());
                 customerPoints.setCustomerName(request.getBlogNickName());
                 customerElectronicCard.setCustomerName(request.getBlogNickName());
             }
-            if(StringUtils.isNotBlank(request.getMobilePhone())){
-                appUserInfo.setMobilePhone(request.getMobilePhone());
-                customerPoints.setMobilePhone(request.getMobilePhone());
-                customerElectronicCard.setMobilePhone(request.getMobilePhone());
-            }
             if(StringUtils.isNotBlank(request.getBlogProfilePhoto())){
                 appUserInfo.setBlogProfilePhoto(request.getBlogProfilePhoto());
             }
@@ -483,7 +459,6 @@ public class AppUserInfoController {
 
             appUserInfo.setStationId(request.getStationId());
             appUserInfo.setRegisteDate(new Date());
-            appUserInfo.setUpdateDate(new Date());
 
             customerPoints.setCreateTime(new Date());
             customerPoints.setUnionId(request.getUnionId());
@@ -509,6 +484,134 @@ public class AppUserInfoController {
             if(StringUtils.isNotBlank(request.getSexFlag())){
                 appUserInfo.setSexFlag(request.getSexFlag());
             }
+
+            if(StringUtils.isNotBlank(request.getMobilePhone())){
+                appUserInfo.setMobilePhone(request.getMobilePhone());
+                customerPoints.setMobilePhone(request.getMobilePhone());
+                customerElectronicCard.setMobilePhone(request.getMobilePhone());
+            }
+
+            if(request.getUserType()!=null){
+//                String userType = request.getUserType();
+//                appUserInfo.setUserType(userType);
+//                switch (userType){
+//                    case "1":   //1-微信公众号
+//                        appUserInfo.setBlogOpenid(request.getOpenId());
+//                        appUserInfo.setUnionId(request.getUnionId());
+//                        AppUserInfo a = new AppUserInfo();
+//                        a.setUnionId(request.getUnionId());
+//                        a.setUserType("2");
+//                        a.setStationId(request.getStationId());
+//                        List<AppUserInfo> userInfo = appUserInfoService.getUserInfo(a);
+//                        if(userInfo !=null && userInfo.size() ==1){
+//                            //如果有说明存在小程序用户信息,则将公众号的用户信息更新到小程序信息上,且删除公众号信息;
+//                            appUserInfo.setUserType("2");
+//                            appUserInfoService.updateAppUserInfo(appUserInfo);
+//                            AppUserInfo b = new AppUserInfo();
+//                            b.setUnionId(request.getUnionId());
+//                            b.setStationId(request.getStationId());
+//                            b.setUserType("1");
+//                            //删除公众号信息
+//                            //appUserInfoService.delUserInfo(b);
+//                        }else {
+//                            //如果没有小程序用户信息,则插入公众号信息
+//                            appUserInfo.setUserType("1");
+//                            appUserInfoService.AddAppUserInfo(appUserInfo);
+//                        }
+//
+//                        break;
+//                    case "2":   //2-微信小程序
+//                        appUserInfo.setMinaOpenid(request.getOpenId());
+//                        appUserInfo.setUnionId(request.getUnionId());
+//                        appUserInfo.setMobilePhone(request.getMobilePhone());
+
+
+
+//                        AppUserInfo b = new AppUserInfo();
+//                        b.setStationId(request.getStationId());
+//                        b.setUnionId(request.getUnionId());
+//                        b.setUserType("2");
+//                        List<AppUserInfo> userInfo1 = appUserInfoService.getUserInfo(b);
+//                        if(userInfo1 !=null && userInfo1.size() ==1){
+//                            //则说明存在小程序用户信息
+//                            //appUserInfoService.updateAppUserInfo(appUserInfo);
+//                            AppUserInfo c = new AppUserInfo();
+//                            c.setStationId(request.getStationId());
+//                            c.setUserType("3");
+//                            c.setMobilePhone(request.getMobilePhone());
+//                            //查看当前数据库是否已存在支付宝小程序用户信息
+//                            AppUserInfo appUserInfo1 = appUserInfoService.selectAppUserInfoByMobilePhoneAndStationId(c);
+//                            if(appUserInfo1 !=null){
+//                                appUserInfoService.updateAppUserInfo(appUserInfo);
+//                            }else {
+//                                appUserInfoService.updateAppUserInfo(appUserInfo);
+//                            }
+//                        }else {
+//                            appUserInfoService.AddAppUserInfo(appUserInfo);
+//                        }
+//                        break;
+//                    case "3":   //3-支付宝公众号
+//                        appUserInfo.setALiId(request.getOpenId());
+//                        AppUserInfo d = new AppUserInfo();
+//                        d.setStationId(request.getStationId());
+//                        d.setALiId(request.getOpenId());
+//                        d.setUserType("4");
+//                        AppUserInfo appUserInfo1 = appUserInfoService.getAppUserInfo(d);
+//                        if(appUserInfo1 !=null){
+//                            appUserInfoService.updateAppUserInfo(appUserInfo);
+//                        }else {
+//                            appUserInfoService.AddAppUserInfo(appUserInfo);
+//                        }
+//                        break;
+//                    case "4":   //4-支付宝小程序
+//                        appUserInfo.setALiId(request.getOpenId());
+//                        appUserInfo.setMobilePhone(request.getMobilePhone());
+//                        AppUserInfo u = new AppUserInfo();
+//                        //u.setMobilePhone(request.getMobilePhone());
+//                        u.setALiId(request.getOpenId());
+//                        u.setStationId(request.getStationId());
+//                        AppUserInfo appUserInfo3 = appUserInfoService.getAppUserInfo(u);
+//                        if(appUserInfo3 !=null){
+//                            appUserInfoService.updateAppUserInfo(appUserInfo);
+//                        }else {
+//                            AppUserInfo f = new AppUserInfo();
+//                            f.setMobilePhone(request.getMobilePhone());
+//                            f.setStationId(request.getStationId());
+//                            AppUserInfo appUserInfo2 = appUserInfoService.selectAppUserInfoByMobilePhoneAndStationId(f);
+//                            if(appUserInfo2 !=null){
+//                                appUserInfoService.updateAppUserInfo(appUserInfo);
+//                            }else {
+//                                appUserInfoService.AddAppUserInfo(appUserInfo);
+//                            }
+//                        }
+//                        break;
+//                }
+                //1-微信公众号
+                if(request.getUserType().equals("1") &&StringUtils.isNotBlank(request.getOpenId())){
+                    appUserInfo.setUserType(request.getUserType());
+                    openId = request.getOpenId();
+                    appUserInfo.setBlogOpenid(openId);
+                    customerPoints.setBlogOpenId(openId);
+                    customerElectronicCard.setBlogOpenid(openId);
+                    //2-微信小程序
+                }else if(request.getUserType().equals("2") &&StringUtils.isNotBlank(request.getOpenId())){
+                    appUserInfo.setUserType(request.getUserType());
+                    openId = request.getOpenId();
+                    appUserInfo.setMinaOpenid(openId);
+                    customerPoints.setMinaOpenId(openId);
+                    customerElectronicCard.setMinaOpenid(openId);
+                }else if(request.getUserType().equals("3") && StringUtils.isNotBlank(request.getOpenId())){
+                    appUserInfo.setALiId(openId);
+                    openId = request.getOpenId();
+                }else if(request.getUserType().equals("4") && StringUtils.isNotBlank(request.getOpenId())){
+                    appUserInfo.setALiId(openId);
+                    openId = request.getOpenId();
+                }
+            }
+
+
+
+
             logger.info("插入数据库用户信息参数:"+appUserInfo.toString());
             Map<String, Object> params = new HashMap<>();
             params.put("openId", openId);                   //注册用户openId
@@ -516,6 +619,7 @@ public class AppUserInfoController {
             //判断该用户是否已存在
             int count = appUserInfoService.isExistAppUser(params);
             if(count > 0){
+                appUserInfo.setUpdateDate(new Date());
                 appUserInfoService.updateAppUserInfo(appUserInfo);
             }else {
                 appUserInfoService.AddAppUserInfo(appUserInfo);

+ 7 - 22
YijiaRestful/src/main/java/com/platform/yijia/controller/ElectronicMembershipCardController.java

@@ -56,6 +56,8 @@ public class ElectronicMembershipCardController {
     private CustomerPointsRecordService customerPointsRecordService;
     @Resource
     private StationOilGunService stationOilGunService;
+    @Resource
+    private SysDictDataService sysDictDataService;
 
     //查询该油站是否启用电子会员卡
     @RequestMapping(value = "/getStationCardEnabledFlag", method = RequestMethod.GET)
@@ -290,27 +292,10 @@ public class ElectronicMembershipCardController {
                 CustomerCardUseRecord customerCardUseRecord = new CustomerCardUseRecord();  //电子会员卡插入消费记录
                 BigDecimal balance = null;                                                  //电子会员卡余额
                 CustomerElectronicCard customerElectronicCard = new CustomerElectronicCard();
-                String cardOilsType ="";
-                switch (oilName){                               //根据油品名称存储电子卡油品类型 1.汽油 2.柴油
-                    case "92#":
-                        cardOilsType ="1";
-                        break;
-                    case "95#":
-                        cardOilsType ="1";
-                        break;
-                    case "98#":
-                        cardOilsType ="1";
-                        break;
-                    case "0#":
-                        cardOilsType ="2";
-                        break;
-                    case "-10#":
-                        cardOilsType ="2";
-                        break;
-                    case "-20#":
-                        cardOilsType ="2";
-                        break;
-                }
+                Oil oil = new Oil();
+                oil.setOilName(oilName);
+                Oil oilInfo = sysDictDataService.selectOilType(oil);
+                String cardOilsType =oilInfo.getOilsType();
                 customerElectronicCard.setCardOilsType(cardOilsType);
                 customerElectronicCard.setUnionId(resultMap.get("unionId").toString());
                 customerElectronicCard.setStationId(Integer.valueOf(resultMap.get("stationId").toString()));
@@ -473,7 +458,7 @@ public class ElectronicMembershipCardController {
                     }
                     resultData = ResultData.success(CodeMsg.SUCCESS);
                     //打印小票
-                    this.printReceipt(payOrder);
+                    //this.printReceipt(payOrder);
                     //pos机打印小票
                     payOrder.setIntegral(String.valueOf(integral));
                     payOrder.setTransactionId(ordNo);

+ 1 - 1
YijiaRestful/src/main/java/com/platform/yijia/controller/PayController.java

@@ -555,7 +555,7 @@ public class PayController {
                     int count = payOrderService.getUpdatePayOrder(payOrder);
                     if(count == 1){
                         req.put("code","success");
-                        req.put("msg","修改订单状态成功");
+                        req.put("msg","成功");
                         logger.info(req.toString());
 
                         //将用户消费的信息插入顾客表: 以手机号 油品名称 油站id为条件插入且存入 加油升数、实收金额、油站名称  根据订单号查询用户手机号

+ 450 - 413
YijiaRestful/src/main/java/com/platform/yijia/controller/PayOrderController.java

@@ -1,5 +1,4 @@
 package com.platform.yijia.controller;
-import com.alibaba.fastjson.JSONObject;
 import com.google.gson.Gson;
 import com.platform.yijia.dao.PayOrderMapper;
 import com.platform.yijia.param.request.PayOrderRequest;
@@ -7,19 +6,14 @@ import com.platform.yijia.pojo.*;
 import com.platform.yijia.service.*;
 import com.platform.yijia.utils.CodeMsg;
 import com.platform.yijia.utils.ResultData;
-import com.platform.yijia.utils.weixinapp.WxPushUtil;
-import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.ibatis.javassist.util.HotSwapAgent;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Controller;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 import javax.annotation.Resource;
-import javax.naming.ldap.HasControls;
 import java.math.BigDecimal;
-import java.text.SimpleDateFormat;
 import java.util.*;
 
 @Controller
@@ -40,6 +34,8 @@ public class PayOrderController {
     private ElectronicMembershipCardService electronicMembershipCardService;
     @Resource
     private  CustomerManagerService customerManagerService;
+    @Resource
+    private SysDictDataService sysDictDataService;
 
     //小程序支付生成订单
     @RequestMapping(value = "/AddPayOrderInfoNew", consumes = "application/json", method = RequestMethod.POST)
@@ -47,181 +43,112 @@ public class PayOrderController {
     @Transactional
     public String  AddPayOrderInfoNew(@RequestBody PayOrderRequest payOrderRequest){
         logger.info("获取订单前端传来参数openId:"+ payOrderRequest.getOpenId());
-        logger.info("获取订单前端传来参数userType:"+ payOrderRequest.getUserType());
         Gson gson =new Gson();
         ResultData resultData =null;
-        AppUserInfo appUserInfo =new AppUserInfo();
-        appUserInfo.setUserType(payOrderRequest.getUserType());         //订单类型 是小程序还是公众号
-        if(payOrderRequest.getUserType().equals("1")){
-            appUserInfo.setBlogOpenid(payOrderRequest.getOpenId());     //1 是公众号
-        }else if(payOrderRequest.getUserType().equals("2")){
-            appUserInfo.setMinaOpenid(payOrderRequest.getOpenId());   //2是小程序
-        }
-        List<AppUserInfo> appUserInfoList =appUserInfoService.Authentication(appUserInfo);
-        Map<String ,Object> resultMap = new HashMap<>();            //返回结果集
-        //判断登录人员是否验证成功
-        if(appUserInfoList!=null && appUserInfoList.size()>0){
-            PayOrder payOrder = new PayOrder();
-            payOrder.setConsumer(appUserInfoList.get(0).getBlogNickName());             //昵称
-            payOrder.setConsumerId(appUserInfoList.get(0).getUserId());                 //用户id
-            Random random = new Random();
-            String result="";
-            for(int i=0;i<6;i++){
-                result+=random.nextInt(10);
-            }
-            String ordNo=System.nanoTime()+result;
-            payOrder.setOrderNo(ordNo);                                             //订单号
-            logger.info("生成的订单号:" + ordNo);
-            payOrder.setDiscountCouponAmt(payOrderRequest.getDiscountCouponAmt());  //优惠劵金额
-            payOrder.setDiscountCoupon(payOrderRequest.getDiscountCoupon());        //优惠券
-            payOrder.setCarNo(payOrderRequest.getCarNo());                          //车牌号、
-            payOrder.setCustomerGrade(payOrderRequest.getCustomerGrade());          //客户电话
-            payOrder.setMemberNo(payOrderRequest.getMemberNo());                    //会员卡号
-            payOrder.setMemberAmt(payOrderRequest.getMemberAmt());                  //会员支付金额
-            //payOrder.setPrintCount(payOrderRequest.getPrintCount());              //小票数量
-            payOrder.setScore(payOrderRequest.getScore());                          //积分
-            payOrder.setStationId(payOrderRequest.getStationId());                  //油站id
-            payOrder.setStatus("0");                                                //创建订单 未支付状态 0
-            if(StringUtils.isNotBlank(payOrderRequest.getUserType())){
-                String userType = payOrderRequest.getUserType();            //支付方式:02公众号,03小程序',
-                switch (userType){
-                    case "1":
-                        payOrder.setPayWay("02");
-                        break;
-                    case "2":
-                        payOrder.setPayWay("03");
-                        break;
-                }
+        AppUserInfo appUserInfo =new AppUserInfo();     //查询客户信息传递参数
+        PayOrder payOrder = new PayOrder();             //生成订单参数
+        if(StringUtils.isNotBlank(payOrderRequest.getUserType()) && StringUtils.isNotBlank(payOrderRequest.getOpenId()) && StringUtils.isNotBlank(payOrderRequest.getOilName()) &&
+                StringUtils.isNotBlank(payOrderRequest.getOilGun()) && payOrderRequest.getReceivableAmt() !=null && StringUtils.isNotBlank(payOrderRequest.getOrderType())){
+            appUserInfo.setUserType(payOrderRequest.getUserType());
+            switch (payOrderRequest.getUserType()){
+                case "1":       //公众号
+                    appUserInfo.setBlogOpenid(payOrderRequest.getOpenId());
+                    break;
+                case "2":       //小程序
+                    appUserInfo.setMinaOpenid(payOrderRequest.getOpenId());
+                    break;
+                case "3":       //支付宝公众号
+                    appUserInfo.setALiId(payOrderRequest.getOpenId());
+                    break;
+                case "4":       //支付宝小程序
+                    appUserInfo.setALiId(payOrderRequest.getOpenId());
+                    break;
             }
-            payOrder.setCreatedDate(new Date());                    //创建时间
-            payOrder.setOrderType(payOrderRequest.getOrderType());  //订单类型
-            payOrder.setOilGun(payOrderRequest.getOilGun());        //油枪号
-            //根据油站和油枪获取加油员
-            HashMap<String, Object> params = new HashMap<>();
-            params.put("oliGunNo", payOrderRequest.getOilGun());
-            params.put("stationId", payOrderRequest.getStationId());
-            String oilPersonnel = "";
-            List<Map> mapResultList = payOrderMapper.selectPersonelName(params);    //使用list原因:一个枪号对应多个加油员场景
-            logger.info("加油员信息:"+ mapResultList.toString());
-            if(mapResultList != null && mapResultList.size() > 0){
-                for (Map per : mapResultList){
-                    if(per.containsKey("personelName") && per.get("personelName").toString() !=null && per.get("personelName").toString() !=""){
-                        oilPersonnel += per.get("personelName").toString() +",";
-                    }
+            AppUserInfo appUserInfos = appUserInfoService.getAppUserInfo(appUserInfo);
+            Map<String ,Object> resultMap = new HashMap<>();            //返回结果集
+            if(appUserInfos !=null){
+                payOrderRequest.setCustomerPhone(appUserInfos.getMobilePhone());    //客户手机号; 注:此处存放手机号用于获取客户信息参数查询
+                payOrderRequest.setUnionId(appUserInfos.getUnionId());              //客户UnionId;注:此处存放unionId用于获取客户电子卡参数查询
+                payOrder.setConsumer(appUserInfos.getBlogNickName());             //昵称
+                payOrder.setConsumerId(appUserInfos.getUserId());                 //用户id
+                Random random = new Random();
+                String result="";
+                for(int i=0;i<6;i++){
+                    result+=random.nextInt(10);
                 }
-                if(oilPersonnel !=""){
-                    payOrder.setOilPersonnel(oilPersonnel.substring(0, oilPersonnel.length()-1));   //加油员
+                String ordNo=System.nanoTime()+result;
+                payOrder.setOrderNo(ordNo);                                             //订单号
+                logger.info("生成的订单号:" + ordNo);
+                payOrder.setDiscountCouponAmt(payOrderRequest.getDiscountCouponAmt());  //优惠劵金额
+                payOrder.setDiscountCoupon(payOrderRequest.getDiscountCoupon());        //优惠券
+                payOrder.setCarNo(payOrderRequest.getCarNo());                          //车牌号、
+                payOrder.setCustomerGrade(payOrderRequest.getCustomerGrade());          //客户电话
+                payOrder.setMemberNo(payOrderRequest.getMemberNo());                    //会员卡号
+                payOrder.setMemberAmt(payOrderRequest.getMemberAmt());                  //会员支付金额
+                payOrder.setScore(payOrderRequest.getScore());                          //积分
+                payOrder.setStationId(payOrderRequest.getStationId());                  //油站id
+                payOrder.setStatus("0");                                                //创建订单 未支付状态 0
+                payOrder.setCreatedDate(new Date());                    //创建时间
+                payOrder.setOrderType(payOrderRequest.getOrderType());  //订单类型
+                payOrder.setOilGun(payOrderRequest.getOilGun());        //油枪号
+                payOrder.setReceivableAmt(payOrderRequest.getReceivableAmt());                //订单应收金额
+                String oilName =payOrderRequest.getOilName();
+                //获取该油品所属哪一类
+                Oil oil = new Oil();
+                oil.setOilName(oilName);
+                Oil oilInfo = sysDictDataService.selectOilType(oil);
+                payOrder.setOilType(oilInfo.getOilsType());     //油品类型
+                payOrderRequest.setCardOilsType(oilInfo.getOilsType());                 //电子卡类型;注:用于获取客户电子卡参数查询
+                payOrder.setOilName(oilName);                   //油品名称
+                StationInfo stationInfo = new StationInfo();
+                stationInfo.setStationId(payOrderRequest.getStationId());
+                StationInfo stationInfos = stationService.selectStationInfo(stationInfo);
+                if(stationInfos !=null){
+                    payOrder.setStationName(stationInfos.getStationName());
+                    //获取油站图片和名称
+                    resultMap.put("stationPic", stationInfos.getStationPic());
+                    resultMap.put("stationName", stationInfos.getStationName());
                 }
-            }
-            String orderType = payOrderRequest.getOrderType();                          //获取订单类型
-            logger.info("订单类型:" + orderType);
-            if(orderType.equals("1")){                                                  //订单类型是油品时计算
-                //resultMap = this.calculateAmt(payOrderRequest);                         //计算油价 加油升数 优惠金额 实收金额 优惠价格
-                resultMap = this.calculateAmtNew(payOrderRequest);                         //计算油价 加油升数 优惠金额 实收金额 优惠价格
-                payOrder.setOilPirce(resultMap.get("oilPrice").toString());
-                payOrder.setOrderLiters(resultMap.get("oilLiters").toString());
-                payOrder.setDiscountAmt(Double.valueOf(resultMap.get("discountAmt").toString()));
-                payOrder.setAmt(Double.valueOf(resultMap.get("amt").toString()));
-                String stationCardEnabledFlag = electronicMembershipCardService.getStationCardEnabledFlag(payOrderRequest.getStationId());
-                logger.info("油站是否开启电子会员卡功能: " +stationCardEnabledFlag);
-                //查询油站是否开启电子会员卡功能
-                if(stationCardEnabledFlag.equals("1")){
-
-                    CustomerCardSetting customerCardSetting = new CustomerCardSetting();
-                    customerCardSetting.setStationId(payOrderRequest.getStationId());
-                    List<CustomerCardSetting> cardRechargeSettingList = electronicMembershipCardService.getCardRechargeSettingList(customerCardSetting);
-                    if(cardRechargeSettingList !=null && cardRechargeSettingList.size()>0){
-                        String isMarket = cardRechargeSettingList.get(0).getIsMarket(); //是否叠加营销方案
-                        String isGradeSetting = cardRechargeSettingList.get(0).getIsGradeSetting(); //是否叠加等级直降
 
-                        Map<String, Object> paramsMap = new HashMap<>();
-                        paramsMap.put("stationId", payOrderRequest.getStationId());
-                        paramsMap.put("oilName", payOrderRequest.getOilName());
-                        paramsMap.put("receivableAmt", payOrderRequest.getReceivableAmt());
-                        //获取油品价格
-                        StationOilPrice stationOilPrice = new StationOilPrice();
-                        stationOilPrice.setStationId(payOrderRequest.getStationId());
-                        stationOilPrice.setOilName(payOrderRequest.getOilName());
-                        StationOilPrice oilPriceInfo = stationService.getStationOilPrice(stationOilPrice);
-                        String oilPrice = oilPriceInfo.getOilPrice();
-                        paramsMap.put("oilPrice", oilPrice);
-                        paramsMap.put("mobilePhone", appUserInfoList.get(0).getMobilePhone());
-                        paramsMap.put("minaOpenid", appUserInfoList.get(0).getMinaOpenid());
-
-                        if (StringUtils.isNotBlank(isMarket) && isMarket.equals("0")){
-                            if(StringUtils.isNotBlank(isGradeSetting) && isGradeSetting.equals("0")){
-                                //如果营销和等级都设置叠加
-                                resultMap.put("amt_dzk", resultMap.get("amt").toString());
-                            }else {
-                                //如果营销叠加电子卡不叠加:则用总的实际所有的支付金额+等级优惠的金额
-                                Map<String, Object> map = this.calcuteDengJiZhiJiang(paramsMap);
-                                String string = map.get("discountAmt").toString();
-                                BigDecimal amt_dzk = new BigDecimal(resultMap.get("amt").toString()).add(new BigDecimal(string));
-                                resultMap.put("amt_dzk",amt_dzk.doubleValue());
-                            }
-                        }else {
-                            //如果不叠加营销,只叠加等级优惠
-                            if(StringUtils.isNotBlank(isGradeSetting) && isGradeSetting.equals("0")){
-                                Map<String, Object> map = this.calcuteDengJiZhiJiang(paramsMap);
-                                String string = map.get("discountAmt").toString();
-                                BigDecimal amt_dzk = new BigDecimal(payOrderRequest.getReceivableAmt()).subtract(new BigDecimal(string));
-                                resultMap.put("amt_dzk", amt_dzk);
-
-                            }else {
-                                //如果既不叠加营销优惠也不叠加等级优惠
-                                resultMap.put("amt_dzk", payOrderRequest.getReceivableAmt());
-
-                            }
+                //根据油站和油枪获取加油员
+                HashMap<String, Object> params = new HashMap<>();
+                params.put("oliGunNo", payOrderRequest.getOilGun());
+                params.put("stationId", payOrderRequest.getStationId());
+                List<Map> mapResultList = payOrderMapper.selectPersonelName(params);    //使用list原因:一个枪号对应多个加油员场景
+                logger.info("加油员信息:"+ mapResultList.toString());
+                if(mapResultList != null && mapResultList.size() > 0){
+                    String oilPersonnel = "";
+                    for (Map per : mapResultList){
+                        if(per.containsKey("personelName") && per.get("personelName").toString() !=null && per.get("personelName").toString() !=""){
+                            oilPersonnel += per.get("personelName").toString() +",";
                         }
                     }
-
-                    //获取用户电子卡余额
-                    Map<String, String> map = this.selectCardBalance(payOrderRequest.getStationId(), payOrderRequest.getOilName(), appUserInfoList.get(0).getUnionId());
-                    resultMap.put("balance", map.get("balance"));               //电子卡余额
-                    resultMap.put("cardOilsType", map.get("cardOilsType"));     //电子卡类型1.汽油; 2.柴油
-
+                    if(oilPersonnel !=""){
+                        payOrder.setOilPersonnel(oilPersonnel.substring(0, oilPersonnel.length()-1));   //加油员
+                    }
+                }else {
+                    payOrder.setOilPersonnel("");
                 }
-            }
-            payOrder.setReceivableAmt(payOrderRequest.getReceivableAmt());                //订单应收金额
-            String oilName =payOrderRequest.getOilName();
-            payOrder.setOilName(oilName);                   //油品名称
-            switch (oilName){
-                case "92#":
-                    payOrder.setOilType("2");
-                    break;
-                case "95#":
-                    payOrder.setOilType("2");
-                    break;
-                case "98#":
-                    payOrder.setOilType("2");
-                    break;
-                case "0#":
-                    payOrder.setOilType("1");
-                    break;
-                case "-10#":
-                    payOrder.setOilType("1");
-                    break;
-                case "-20#":
-                    payOrder.setOilType("1");
-                    break;
-            }
-            payOrder.setOrderType(orderType);
-            StationInfo stationInfo = new StationInfo();
-            stationInfo.setStationId(payOrderRequest.getStationId());
-            StationInfo stationInfos = stationService.selectStationInfo(stationInfo);
-            if(stationInfos !=null){
-                payOrder.setStationName(stationInfos.getStationName());
-                //获取油站图片和名称
-                resultMap.put("stationPic", stationInfos.getStationPic());
-                resultMap.put("stationName", stationInfos.getStationName());
-            }
-            //payOrder.setPayType("wx");                          //支付类型
-            switch (orderType){
-                case "1":       //油品
-                    payOrderMapper.insertSelective(payOrder);
+                String orderType = payOrderRequest.getOrderType();                          //获取订单类型
+                logger.info("订单类型:" + orderType);
+                if(orderType.equals("1")){                                                  //订单类型是油品时计算
+                    PayOrderResultInfo payOrderResultInfo = this.calculateAmt(payOrderRequest); //计算订单金额 价格 加油升数 等等
+                    payOrder.setOilPirce(payOrderResultInfo.getOilPrice());
+                    payOrder.setOrderLiters(payOrderResultInfo.getOilLiters());
+                    payOrder.setDiscountAmt(Double.valueOf(payOrderResultInfo.getDiscountAmt()));
+                    payOrder.setAmt(Double.valueOf(payOrderResultInfo.getAmt()));
+                    resultMap.put("discountAmt", payOrderResultInfo.getDiscountAmt());                                          //优惠价格
+                    resultMap.put("amt", payOrderResultInfo.getAmt());                   //实收价格
+                    resultMap.put("receivableAmt", payOrderResultInfo.getReceivableAmt());         //应收价格
+                    resultMap.put("oilLiters", payOrderResultInfo.getOilLiters());
+                    resultMap.put("discountPrice", payOrderResultInfo.getDiscountPrice());
+                    resultMap.put("amt_dzk", payOrderResultInfo.getDzkAmt());
+                    resultMap.put("balance", payOrderResultInfo.getBalance());               //电子卡余额
+                    resultMap.put("cardOilsType", payOrderResultInfo.getCardOilsType());     //电子卡类型1.汽油; 2.柴油
                     resultMap.put("ordNo", ordNo);
-                    break;
-                case "2":       //非油品
+                    logger.info("返回前端的结果:" +resultMap.toString());
+                    payOrderMapper.insertSelective(payOrder);
+                }else {
                     payOrder.setAmt(Double.valueOf(payOrderRequest.getReceivableAmt()));        //非油品金额
                     payOrder.setDiscountAmt(Double.valueOf(0));                                 //优惠金额
                     payOrder.setOilPirce(payOrderRequest.getReceivableAmt().toString());        //非油品价格
@@ -231,41 +158,369 @@ public class PayOrderController {
                     resultMap.put("receivableAmt", payOrderRequest.getReceivableAmt());         //应收价格
                     resultMap.put("oilLiters", "0");
                     resultMap.put("discountPrice", "0");
-                    payOrderMapper.insertSelective(payOrder);
                     resultMap.put("ordNo", ordNo);
-                    break;
+                    payOrderMapper.insertSelective(payOrder);
+                }
+                resultData = ResultData.success(resultMap);
+            }else {
+                //登录人验证失败
+                resultData=ResultData.error(CodeMsg.USER_NOT_EXSIST);
             }
-            resultData = ResultData.success(resultMap);
-        }else{
-            //登录人验证失败
-            resultData=ResultData.error(CodeMsg.USER_NOT_EXSIST);
+        }else {
+            resultData = ResultData.error(CodeMsg.REQUEST_FAIL);
         }
         return gson.toJson(resultData);
     }
 
-    //查询用户电子会员卡余额
-    public Map<String, String>  selectCardBalance(Integer stationId, String oilName, String unionId) {
-        String cardOilsType ="";
-        switch (oilName){
-            case "92#":
-                cardOilsType ="1";
-                break;
-            case "95#":
-                cardOilsType ="1";
-                break;
-            case "98#":
-                cardOilsType ="1";
+
+    //根据营销方案计算订单金额
+    public PayOrderResultInfo calculateAmt(PayOrderRequest payOrderRequest){
+        PayOrderResultInfo payOrderResultInfo = new PayOrderResultInfo();
+        Integer stationId = payOrderRequest.getStationId();         //油站ID
+        BigDecimal receivableAmt = new BigDecimal(payOrderRequest.getReceivableAmt());  //应收金额 用户输入的金额
+        String oilName = payOrderRequest.getOilName();          //油品名称
+        String openId = payOrderRequest.getOpenId();        //用户的openId
+        Map<String, Object> map = new HashMap<>();
+        map.put("oilName", oilName);
+        map.put("stationId", stationId);
+        Map<String, Object> result = stationService.selectStationOilPriceAndDiscountSetting(map);
+        String oilPrice = result.get("oilPrice").toString();
+        String discountSetting = result.get("discountSetting").toString();
+        String cardEnabledFlag = result.get("cardEnabledFlag").toString();
+
+        Map<String ,Object> params = new HashMap<String, Object>();
+        params.put("stationId", stationId);
+        params.put("oilName", oilName);
+        params.put("receivableAmt", receivableAmt);
+        params.put("oilPrice", oilPrice);
+        params.put("mobilePhone", payOrderRequest.getCustomerPhone());
+        params.put("minaOpenid", openId);
+        params.put("cardEnabledFlag", cardEnabledFlag);
+        params.put("unionId", payOrderRequest.getUnionId());
+        params.put("cardOilsType", payOrderRequest.getCardOilsType());
+        switch (discountSetting){
+            case "0":   //不执营销方案时 计算等级优惠
+                payOrderResultInfo = this.calculateGradeDiscount(params);
                 break;
-            case "0#":
-                cardOilsType ="2";
+            case "1":    //满减方案
+                payOrderResultInfo = this.calculateManJianDiscount(params);
                 break;
-            case "-10#":
-                cardOilsType ="2";
+            case "2":    //立减方案
+                payOrderResultInfo = this.calculateLiJianDiscount(params);
                 break;
-            case "-20#":
-                cardOilsType ="2";
+            case "3":    //独立直降
+                payOrderResultInfo = this.calculateZhiJiangDiscount(params);
                 break;
         }
+        return  payOrderResultInfo;
+    }
+
+    //计算直降
+    public PayOrderResultInfo calculateZhiJiangDiscount(Map<String ,Object> params){
+        BigDecimal oilPrice = new BigDecimal(params.get("oilPrice").toString());    //油品价格
+        BigDecimal receivableAmt = new BigDecimal(params.get("receivableAmt").toString());   //应收金额
+        BigDecimal oilLiters = new BigDecimal("0.00");  //加油升数
+        BigDecimal discountAmt = new BigDecimal(0);  //优惠金额
+        BigDecimal amt = new BigDecimal(0);
+        BigDecimal discountPrice = oilPrice;
+        BigDecimal gradeDiscountAmt = new BigDecimal(0);    //等级优惠金额
+        //加油升数
+        oilLiters = receivableAmt.divide(oilPrice,2, BigDecimal.ROUND_HALF_UP);
+        if(!oilLiters.toString().substring(oilLiters.toString().indexOf(".") + 1).equals("00")){
+            oilLiters = receivableAmt.divide(oilPrice,2, BigDecimal.ROUND_UP);
+        }
+        PayOrderResultInfo payOrderResultInfo = new PayOrderResultInfo();
+        params.put("discountPlanType", "3");
+        List<Map> customerMarkertPlanList = customerGradeServices.getCustomerMarkertPlanList(params);
+        if(customerMarkertPlanList !=null && customerMarkertPlanList.size() >0){
+            BigDecimal discountAmt_b = new BigDecimal(customerMarkertPlanList.get(0).get("discountAmt").toString());   //条件金额
+            BigDecimal gasoilDiscountAmt_b = new BigDecimal(customerMarkertPlanList.get(0).get("gasoilDiscountAmt").toString());
+            String discountTerm = customerMarkertPlanList.get(0).get("discountTerm").toString();
+            switch (discountTerm){
+                case "1":   //按加油升数
+                    if(oilLiters.compareTo(discountAmt_b) ==1 || oilLiters.compareTo(discountAmt_b) ==0){
+                        discountAmt = oilLiters.multiply(gasoilDiscountAmt_b);
+                        discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
+                    }
+                    break;
+                case "2":   //按加油金额
+                    if(receivableAmt.compareTo(discountAmt_b) ==1 || receivableAmt.compareTo(discountAmt_b) ==0){
+                        discountAmt = oilLiters.multiply(gasoilDiscountAmt_b);
+                        discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
+                    }
+                    break;
+            }
+            String vipDiscountyPlus = customerMarkertPlanList.get(0).get("vipDiscountyPlus").toString();
+            if(vipDiscountyPlus.equals("1")){
+                PayOrderResultInfo payOrderResultInfoGrade = this.calculateGradeDiscount(params);
+                discountAmt = discountAmt.add(new BigDecimal(payOrderResultInfoGrade.getDiscountAmt()));
+            }
+        }
+        amt = receivableAmt.subtract(discountAmt);  //应收金额
+        discountPrice = oilLiters.equals(new BigDecimal("0.00")) ? discountPrice : amt.divide(oilLiters, 2, BigDecimal.ROUND_HALF_UP);  //优惠价格
+        payOrderResultInfo.setAmt(amt.toString());
+        payOrderResultInfo.setDiscountAmt(discountAmt.toString());
+        payOrderResultInfo.setDiscountPrice(discountPrice.toString());
+        payOrderResultInfo.setOilLiters(oilLiters.toString());
+        payOrderResultInfo.setReceivableAmt(receivableAmt.toString());
+        payOrderResultInfo.setOilPrice(oilPrice.toString());
+        payOrderResultInfo.setDzkAmt(amt.toString());
+        logger.info("油站是否开启电子会员卡功能: " +params.get("cardEnabledFlag").toString());
+        if(params.get("cardEnabledFlag").toString().equals("1")){
+            CustomerCardSetting customerCardSetting = new CustomerCardSetting();
+            customerCardSetting.setStationId(Integer.valueOf(params.get("stationId").toString()));
+            List<CustomerCardSetting> cardRechargeSettingList = electronicMembershipCardService.getCardRechargeSettingList(customerCardSetting);
+            if(cardRechargeSettingList !=null && cardRechargeSettingList.size() >0){
+                String isGradeSetting = cardRechargeSettingList.get(0).getIsGradeSetting(); //是否叠加等级方案
+                String isMarket = cardRechargeSettingList.get(0).getIsMarket(); //等候否叠加营销方案
+                if(isMarket.equals("1")){
+                    if(isGradeSetting.equals("1")){
+                        payOrderResultInfo.setDzkAmt(amt.toString());
+                    }else {
+                        //如果电子卡设置执行营销方案不执行等级优惠 则 电子卡支付金额 =实收金额+等级优惠金额
+                        BigDecimal subtract = amt.add(gradeDiscountAmt);
+                        payOrderResultInfo.setDzkAmt(subtract.toString());
+                    }
+                }else {
+                    if(isGradeSetting.equals("1")){
+                        //如果电子卡设置不执行营销方案执行等级优惠 则 电子卡支付金额 =应收金额-等级优惠金额
+                        BigDecimal subtract = receivableAmt.subtract(gradeDiscountAmt);
+                        payOrderResultInfo.setDzkAmt(subtract.toString());
+                    }else {
+                        payOrderResultInfo.setDzkAmt(receivableAmt.toString());
+                    }
+                }
+            }
+            //查询客户余额和卡的类型
+            Map<String, String> map = this.selectCardBalance(Integer.valueOf(params.get("stationId").toString()), params.get("cardOilsType").toString(), params.get("unionId").toString());
+            payOrderResultInfo.setBalance(map.get("balance"));
+            payOrderResultInfo.setCardOilsType(map.get("cardOilsType"));
+        }
+        return  payOrderResultInfo;
+    }
+
+    //计算立减
+    public PayOrderResultInfo calculateLiJianDiscount(Map<String ,Object> params){
+        BigDecimal oilPrice = new BigDecimal(params.get("oilPrice").toString());    //油品价格
+        BigDecimal receivableAmt = new BigDecimal(params.get("receivableAmt").toString());   //应收金额
+        BigDecimal oilLiters = new BigDecimal("0.00");  //加油升数
+        BigDecimal discountAmt = new BigDecimal(0);  //优惠金额
+        BigDecimal amt = new BigDecimal(0);
+        BigDecimal discountPrice = oilPrice;
+        BigDecimal gradeDiscountAmt = new BigDecimal(0);    //等级优惠金额
+        //加油升数
+        oilLiters = receivableAmt.divide(oilPrice,2, BigDecimal.ROUND_HALF_UP);
+        if(!oilLiters.toString().substring(oilLiters.toString().indexOf(".") + 1).equals("00")){
+            oilLiters = receivableAmt.divide(oilPrice,2, BigDecimal.ROUND_UP);
+        }
+        PayOrderResultInfo payOrderResultInfo = new PayOrderResultInfo();
+        params.put("discountPlanType", "2");
+        List<Map> customerMarkertPlanList = customerGradeServices.getCustomerMarkertPlanList(params);
+        if(customerMarkertPlanList !=null && customerMarkertPlanList.size() >0){
+            BigDecimal discountAmt_b = new BigDecimal(customerMarkertPlanList.get(0).get("discountAmt").toString());                //条件金额
+            BigDecimal gasoilDiscountAmt_b = new BigDecimal(customerMarkertPlanList.get(0).get("gasoilDiscountAmt").toString());    //享受的优惠
+            if(receivableAmt.compareTo(discountAmt_b) == 1 || receivableAmt.compareTo(discountAmt_b) == 0){
+                discountAmt = gasoilDiscountAmt_b;
+            }
+            String vipDiscountyPlus = customerMarkertPlanList.get(0).get("vipDiscountyPlus").toString();
+            if(vipDiscountyPlus.equals("1")){
+                PayOrderResultInfo payOrderResultInfoGrade = this.calculateGradeDiscount(params);
+                gradeDiscountAmt = new BigDecimal(payOrderResultInfoGrade.getDiscountAmt());
+                discountAmt = discountAmt.add(gradeDiscountAmt);
+            }
+
+        }
+        amt = receivableAmt.subtract(discountAmt);  //应收金额
+        discountPrice = oilLiters.equals(new BigDecimal("0.00")) ? discountPrice : amt.divide(oilLiters, 2, BigDecimal.ROUND_HALF_UP);  //优惠价格
+        payOrderResultInfo.setAmt(amt.toString());
+        payOrderResultInfo.setDiscountAmt(discountAmt.toString());
+        payOrderResultInfo.setDiscountPrice(discountPrice.toString());
+        payOrderResultInfo.setOilLiters(oilLiters.toString());
+        payOrderResultInfo.setReceivableAmt(receivableAmt.toString());
+        payOrderResultInfo.setOilPrice(oilPrice.toString());
+        payOrderResultInfo.setDzkAmt(amt.toString());
+        logger.info("油站是否开启电子会员卡功能: " +params.get("cardEnabledFlag").toString());
+        if(params.get("cardEnabledFlag").toString().equals("1")){
+            CustomerCardSetting customerCardSetting = new CustomerCardSetting();
+            customerCardSetting.setStationId(Integer.valueOf(params.get("stationId").toString()));
+            List<CustomerCardSetting> cardRechargeSettingList = electronicMembershipCardService.getCardRechargeSettingList(customerCardSetting);
+            if(cardRechargeSettingList !=null && cardRechargeSettingList.size() >0){
+                String isGradeSetting = cardRechargeSettingList.get(0).getIsGradeSetting(); //是否叠加等级方案
+                String isMarket = cardRechargeSettingList.get(0).getIsMarket(); //等候否叠加营销方案
+                if(isMarket.equals("1")){
+                    if(isGradeSetting.equals("1")){
+                        payOrderResultInfo.setDzkAmt(amt.toString());
+                    }else {
+                        //如果电子卡设置执行营销方案不执行等级优惠 则 电子卡支付金额 =实收金额+等级优惠金额
+                        BigDecimal subtract = amt.add(gradeDiscountAmt);
+                        payOrderResultInfo.setDzkAmt(subtract.toString());
+                    }
+                }else {
+                    if(isGradeSetting.equals("1")){
+                        //如果电子卡设置不执行营销方案执行等级优惠 则 电子卡支付金额 =应收金额-等级优惠金额
+                        BigDecimal subtract = receivableAmt.subtract(gradeDiscountAmt);
+                        payOrderResultInfo.setDzkAmt(subtract.toString());
+                    }else {
+                        payOrderResultInfo.setDzkAmt(receivableAmt.toString());
+                    }
+                }
+            }
+            //查询客户余额和卡的类型
+            Map<String, String> map = this.selectCardBalance(Integer.valueOf(params.get("stationId").toString()), params.get("cardOilsType").toString(), params.get("unionId").toString());
+            payOrderResultInfo.setBalance(map.get("balance"));
+            payOrderResultInfo.setCardOilsType(map.get("cardOilsType"));
+        }
+        return  payOrderResultInfo;
+    }
+
+    //计算满减
+    public PayOrderResultInfo calculateManJianDiscount(Map<String ,Object> params){
+
+        BigDecimal oilPrice = new BigDecimal(params.get("oilPrice").toString());    //油品价格
+        BigDecimal receivableAmt = new BigDecimal(params.get("receivableAmt").toString());   //应收金额
+        BigDecimal oilLiters = new BigDecimal("0.00");  //加油升数
+        BigDecimal discountAmt = new BigDecimal(0);  //优惠金额
+        BigDecimal amt = new BigDecimal(0);
+        BigDecimal discountPrice = oilPrice;
+        BigDecimal gradeDiscountAmt = new BigDecimal(0);    //等级优惠金额
+        //加油升数
+        oilLiters = receivableAmt.divide(oilPrice,2, BigDecimal.ROUND_HALF_UP);
+        if(!oilLiters.toString().substring(oilLiters.toString().indexOf(".") + 1).equals("00")){
+            oilLiters = receivableAmt.divide(oilPrice,2, BigDecimal.ROUND_UP);
+        }
+        PayOrderResultInfo payOrderResultInfo = new PayOrderResultInfo();
+        params.put("discountPlanType", "1");
+        List<Map> customerMarkertPlanList = customerGradeServices.getCustomerMarkertPlanList(params);
+        if(customerMarkertPlanList !=null && customerMarkertPlanList.size() >0){
+            BigDecimal discountAmt_b = new BigDecimal(customerMarkertPlanList.get(0).get("discountAmt").toString());                //条件金额
+            BigDecimal gasoilDiscountAmt_b = new BigDecimal(customerMarkertPlanList.get(0).get("gasoilDiscountAmt").toString());    //享受的优惠
+            if(receivableAmt.compareTo(discountAmt_b) == 1 || receivableAmt.compareTo(discountAmt_b) == 0){
+                discountAmt = receivableAmt.divide(discountAmt_b, 2, BigDecimal.ROUND_HALF_UP).multiply(gasoilDiscountAmt_b);  //优惠金额
+                discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
+            }
+            //是否共享会员等级优惠叠加: 1 代表是; 2 代表否;
+            String vipDiscountyPlus = customerMarkertPlanList.get(0).get("vipDiscountyPlus").toString();
+            if(vipDiscountyPlus.equals("1")){
+                PayOrderResultInfo payOrderResultInfoGrade = this.calculateGradeDiscount(params);
+                discountAmt = discountAmt.add(new BigDecimal(payOrderResultInfoGrade.getDiscountAmt()));
+            }
+        }
+        amt = receivableAmt.subtract(discountAmt);  //应收金额
+        discountPrice = oilLiters.equals(new BigDecimal("0.00")) ? discountPrice : amt.divide(oilLiters, 2, BigDecimal.ROUND_HALF_UP);  //优惠价格
+        payOrderResultInfo.setAmt(amt.toString());
+        payOrderResultInfo.setDiscountAmt(discountAmt.toString());
+        payOrderResultInfo.setDiscountPrice(discountPrice.toString());
+        payOrderResultInfo.setOilLiters(oilLiters.toString());
+        payOrderResultInfo.setReceivableAmt(receivableAmt.toString());
+        payOrderResultInfo.setOilPrice(oilPrice.toString());
+        payOrderResultInfo.setDzkAmt(amt.toString());
+        logger.info("油站是否开启电子会员卡功能: " +params.get("cardEnabledFlag").toString());
+        if(params.get("cardEnabledFlag").toString().equals("1")){
+            CustomerCardSetting customerCardSetting = new CustomerCardSetting();
+            customerCardSetting.setStationId(Integer.valueOf(params.get("stationId").toString()));
+            List<CustomerCardSetting> cardRechargeSettingList = electronicMembershipCardService.getCardRechargeSettingList(customerCardSetting);
+            if(cardRechargeSettingList !=null && cardRechargeSettingList.size() >0){
+                String isGradeSetting = cardRechargeSettingList.get(0).getIsGradeSetting(); //是否叠加等级方案
+                String isMarket = cardRechargeSettingList.get(0).getIsMarket(); //等候否叠加营销方案
+                if(isMarket.equals("1")){
+                    if(isGradeSetting.equals("1")){
+                        payOrderResultInfo.setDzkAmt(amt.toString());
+                    }else {
+                        //如果电子卡设置执行营销方案不执行等级优惠 则 电子卡支付金额 =实收金额+等级优惠金额
+                        BigDecimal subtract = amt.add(gradeDiscountAmt);
+                        payOrderResultInfo.setDzkAmt(subtract.toString());
+                    }
+                }else {
+                    if(isGradeSetting.equals("1")){
+                        //如果电子卡设置不执行营销方案执行等级优惠 则 电子卡支付金额 =应收金额-等级优惠金额
+                        BigDecimal subtract = receivableAmt.subtract(gradeDiscountAmt);
+                        payOrderResultInfo.setDzkAmt(subtract.toString());
+                    }else {
+                        payOrderResultInfo.setDzkAmt(receivableAmt.toString());
+                    }
+                }
+            }
+            //查询客户余额和卡的类型
+            Map<String, String> map = this.selectCardBalance(Integer.valueOf(params.get("stationId").toString()), params.get("cardOilsType").toString(), params.get("unionId").toString());
+            payOrderResultInfo.setBalance(map.get("balance"));
+            payOrderResultInfo.setCardOilsType(map.get("cardOilsType"));
+        }
+        return payOrderResultInfo;
+    }
+
+    //计算等级优惠
+    public PayOrderResultInfo calculateGradeDiscount(Map<String ,Object> params){
+        String oilName = params.get("oilName").toString();
+        String stationId = params.get("stationId").toString();
+        BigDecimal oilPrice = new BigDecimal(params.get("oilPrice").toString());    //油品价格
+        BigDecimal receivableAmt = new BigDecimal(params.get("receivableAmt").toString());   //应收金额
+        BigDecimal oilLiters = new BigDecimal("0.00");  //加油升数
+        BigDecimal discountAmt = new BigDecimal(0);  //优惠金额
+        BigDecimal amt = new BigDecimal(0);
+        BigDecimal discountPrice = oilPrice;
+        PayOrderResultInfo payOrderResultInfo = new PayOrderResultInfo();
+
+        oilLiters = receivableAmt.divide(oilPrice,2, BigDecimal.ROUND_HALF_UP);
+        if(!oilLiters.toString().substring(oilLiters.toString().indexOf(".") + 1).equals("00")){
+            oilLiters = receivableAmt.divide(oilPrice,2, BigDecimal.ROUND_UP);
+        }
+        //当前客户是否已存在当前油站客户信息中
+        CustomerManage customerManage = new CustomerManage();
+        customerManage.setPhoneNumber(params.get("mobilePhone").toString());
+        customerManage.setOilName(oilName);
+        customerManage.setStationId(Integer.valueOf(stationId));
+        CustomerManage customerManageInfo = customerManagerService.getCustomerManageInfo(customerManage);
+        if(customerManageInfo !=null){
+            //当前客户所加油的订单已存在等级时
+            double amtSum = customerManageInfo.getAmt().doubleValue();   //当前客户已累计的金额
+            List<Map> cList = customerGradeServices.getCustomerGradeListOrderByDesc(params);    //获取油站的等级优惠方案 倒叙查询规则
+            if(cList !=null && cList.size() >0){    //当前油站设置等级方案时
+                for(Map m : cList){
+                    if(amtSum >= Double.valueOf(m.get("memberConditStart").toString())){
+                        discountAmt = oilLiters.multiply(new BigDecimal(m.get("discountAmt").toString()));
+                        discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
+                        break;
+                    }
+                }
+            }
+        }else {
+            //当前客户所加油的订单不存在等级时
+            List<Map> customerGradeList = customerGradeServices.getCustomerGradeList(params);   //升序查询 取第一条
+            if(customerGradeList !=null && customerGradeList.size() >0){
+                discountAmt = oilLiters.multiply(new BigDecimal(customerGradeList.get(0).get("discountAmt").toString()));
+                discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
+            }
+        }
+        amt = receivableAmt.subtract(discountAmt);  //应收金额
+        discountPrice = oilLiters.equals(new BigDecimal("0.00")) ? discountPrice : amt.divide(oilLiters, 2, BigDecimal.ROUND_HALF_UP);  //优惠价格
+        payOrderResultInfo.setAmt(amt.toString());
+        payOrderResultInfo.setDiscountAmt(discountAmt.toString());
+        payOrderResultInfo.setDiscountPrice(discountPrice.toString());
+        payOrderResultInfo.setOilLiters(oilLiters.toString());
+        payOrderResultInfo.setReceivableAmt(receivableAmt.toString());
+        payOrderResultInfo.setOilPrice(oilPrice.toString());
+        payOrderResultInfo.setDzkAmt(amt.toString());
+        logger.info("油站是否开启电子会员卡功能: " +params.get("cardEnabledFlag").toString());
+        if(params.get("cardEnabledFlag").toString().equals("1")){
+            CustomerCardSetting customerCardSetting = new CustomerCardSetting();
+            customerCardSetting.setStationId(Integer.valueOf(params.get("stationId").toString()));
+            List<CustomerCardSetting> cardRechargeSettingList = electronicMembershipCardService.getCardRechargeSettingList(customerCardSetting);
+            if(cardRechargeSettingList !=null && cardRechargeSettingList.size() >0){
+                String isGradeSetting = cardRechargeSettingList.get(0).getIsGradeSetting();
+                if(isGradeSetting.equals("1")){
+                    payOrderResultInfo.setDzkAmt(amt.toString());
+                }
+            }
+            //查询客户余额和卡的类型
+            Map<String, String> map = this.selectCardBalance(Integer.valueOf(params.get("stationId").toString()), params.get("cardOilsType").toString(), params.get("unionId").toString());
+            payOrderResultInfo.setBalance(map.get("balance"));
+            payOrderResultInfo.setCardOilsType(map.get("cardOilsType"));
+        }
+        return  payOrderResultInfo;
+    }
+
+    //查询用户电子会员卡余额
+    public Map<String, String>  selectCardBalance(Integer stationId, String cardOilsType, String unionId) {
         CustomerElectronicCard customerElectronicCard = new CustomerElectronicCard();
         customerElectronicCard.setCardOilsType(cardOilsType);
         customerElectronicCard.setStationId(stationId);
@@ -283,224 +538,6 @@ public class PayOrderController {
         return result;
     }
 
-    /***
-     * 计算订单金额
-     * @return
-     */
-    public Map<String ,Object> calculateAmt(PayOrderRequest payOrderRequest){
-        Map<String ,Object> resultMap = new HashMap<>();
-        if(payOrderRequest.getReceivableAmt() !=null){  //应收金额
-            Double receivableAmt = payOrderRequest.getReceivableAmt();  //应收金额 用户输入的金额
-            Integer stationId = payOrderRequest.getStationId();         //油站ID
-            //String oilGun = payOrderRequest.getOilGun();                //油枪号
-            String oilName = payOrderRequest.getOilName();          //油品名称
-            String openId = payOrderRequest.getOpenId();        //用户的openId
-            String mobilePhone = payOrderRequest.getCustomerPhone();        //客户手机号
-            //获取油品价格
-            StationOilPrice stationOilPrice = new StationOilPrice();
-            stationOilPrice.setStationId(stationId);
-            stationOilPrice.setOilName(oilName);
-            StationOilPrice oilPriceInfo = stationService.getStationOilPrice(stationOilPrice);
-            String oilPrice = oilPriceInfo.getOilPrice();
-            //String stationNanme = oilPriceInfo.getStationNanme();
-            BigDecimal oilLiters = null;
-            BigDecimal discountAmt =null;
-            BigDecimal discountPrice = null;
-            BigDecimal amt = null;
-
-            //resultMap.put("stationName", stationNanme);
-            resultMap.put("oilPrice", oilPrice);        //油品价格
-            resultMap.put("receivableAmt", receivableAmt);        //应收价格
-            //该油站的优惠方式
-            String stationDiscountWay = stationService.getStationDiscountWay(stationId.toString());
-            Map<String ,Object> params = new HashMap<String, Object>();
-            params.put("stationId", stationId);
-            params.put("oilName", oilName);
-            BigDecimal receivableAmt_b = new BigDecimal(receivableAmt); //传入的应收金额
-            switch (stationDiscountWay){
-                case "1":       //1.等级直降
-                    //查询等级直降的优惠方式
-                    params.put("mobilePhone", mobilePhone);
-                    params.put("minaOpenid", openId);
-                    //查询客户等级信息
-                    List<Map<String, Object>> customerGradeInfo = customerGradeServices.getCustomerGradeInfo(params);
-                    if(customerGradeInfo != null && customerGradeInfo.size() >0){   //已存在客户等级信息
-                        //使用客户已存在的等级计算优惠
-                        oilLiters = receivableAmt_b.divide(new BigDecimal(oilPrice),2, BigDecimal.ROUND_UP);
-                        discountAmt = oilLiters.multiply(new BigDecimal(customerGradeInfo.get(0).get("gasoilDiscountLitre").toString()));
-                        discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_UP);
-                        amt = receivableAmt_b.subtract(discountAmt);
-                        discountPrice = amt.divide(oilLiters, 2, BigDecimal.ROUND_UP);
-                        resultMap.put("discountAmt", discountAmt.doubleValue());
-                        resultMap.put("amt", amt.doubleValue());
-                        resultMap.put("oilLiters", oilLiters.doubleValue());
-                        resultMap.put("discountPrice", discountPrice.doubleValue());
-                    }else {
-                        //不存在客户等级信息时,查询油站的客户等级直降优惠(查询结果根据会员成长值条件做升序查询)
-                        List<Map> customerGradeList = customerGradeServices.getCustomerGradeList(params);
-                        //如果存在
-                        if(customerGradeList !=null && customerGradeList.size() >0){
-                            //用户第一次购买 取等级最低初始会员的优惠条件计算
-                            oilLiters = receivableAmt_b.divide(new BigDecimal(oilPrice), 2, BigDecimal.ROUND_UP);   //加油升数
-                            discountAmt = oilLiters.multiply(new BigDecimal(customerGradeList.get(0).get("gasoilDiscountLitre").toString()));
-                            discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_UP);
-                            amt = receivableAmt_b.subtract(discountAmt);
-                            discountPrice = amt.divide(oilLiters, 2, BigDecimal.ROUND_UP);
-                            resultMap.put("discountAmt", discountAmt.doubleValue());
-                            resultMap.put("amt", amt.doubleValue());
-                            resultMap.put("oilLiters", oilLiters.doubleValue());
-                            resultMap.put("discountPrice", discountPrice.doubleValue());
-                        }else {
-                            //不存在
-                            resultMap.put("discountAmt", 0);
-                            resultMap.put("amt", receivableAmt.doubleValue());
-                            oilLiters = new BigDecimal(receivableAmt).divide(new BigDecimal(oilPrice), 2, BigDecimal.ROUND_UP);
-                            resultMap.put("oilLiters", oilLiters.doubleValue());
-                            resultMap.put("discountPrice", oilPrice);
-                        }
-                    }
-                    break;
-                case "2":       //2.满减
-                    params.put("discountPlanType", "1");
-                    //营销方案
-                    List<Map> customerMarkertPlanList_1 = customerGradeServices.getCustomerMarkertPlanList(params);
-                    //有优惠规则
-                    if(customerMarkertPlanList_1 !=null && customerMarkertPlanList_1.size() >0){
-                        boolean flag = true;
-                        for (Map m : customerMarkertPlanList_1){
-                            //如果当前应收金额大于条件金额
-                            BigDecimal discountAmt_b = new BigDecimal(m.get("discountAmt").toString());   //条件金额
-                            if(receivableAmt_b.compareTo(discountAmt_b) ==1 || receivableAmt_b.compareTo(discountAmt_b) ==0){
-                                BigDecimal gasoilDiscountAmt_b = new BigDecimal(m.get("gasoilDiscountAmt").toString());   //每满多少优惠多少的金额
-                                discountAmt = receivableAmt_b.divide(discountAmt_b, 2, BigDecimal.ROUND_UP).multiply(gasoilDiscountAmt_b);  //优惠金额
-                                discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_UP);
-                                amt = receivableAmt_b.subtract(discountAmt);   //实收金额
-                                oilLiters = receivableAmt_b.divide(new BigDecimal(oilPrice),2, BigDecimal.ROUND_UP);   //加油升数
-                                discountPrice = amt.divide(oilLiters);        //优惠价格
-                                resultMap.put("discountAmt", discountAmt.doubleValue());
-                                resultMap.put("amt", amt.doubleValue());
-                                resultMap.put("oilLiters", oilLiters.doubleValue());
-                                resultMap.put("discountPrice", discountPrice.doubleValue());
-                                flag = false;
-                                break;
-                            }
-                        }
-                        if(flag){
-                            resultMap.put("discountAmt", 0);
-                            resultMap.put("amt", receivableAmt.doubleValue());
-                            oilLiters = new BigDecimal(receivableAmt).divide(new BigDecimal(oilPrice),2, BigDecimal.ROUND_UP);
-                            resultMap.put("oilLiters", oilLiters.doubleValue());
-                            resultMap.put("discountPrice", oilPrice);
-                        }
-                    }else {
-                        //没有优惠规则
-                        resultMap.put("discountAmt", 0);
-                        resultMap.put("amt", receivableAmt.doubleValue());
-                        oilLiters = new BigDecimal(receivableAmt).divide(new BigDecimal(oilPrice), 2, BigDecimal.ROUND_UP);
-                        resultMap.put("oilLiters", oilLiters.doubleValue());
-                        resultMap.put("discountPrice", oilPrice);
-                    }
-                    break;
-                case "3":       //3.立减
-                    params.put("discountPlanType", "2");
-                    //营销方案
-                    List<Map> customerMarkertPlanList_2 = customerGradeServices.getCustomerMarkertPlanList(params);
-                    if(customerMarkertPlanList_2 !=null && customerMarkertPlanList_2.size() >0){
-                        boolean flag = true;
-                        for (Map m : customerMarkertPlanList_2){
-                            //如果当前应收金额大于条件金额
-                            BigDecimal discountAmt_b = new BigDecimal(m.get("discountAmt").toString());   //条件金额
-                            if(receivableAmt_b.compareTo(discountAmt_b) ==1 || receivableAmt_b.compareTo(discountAmt_b) ==0){
-                                BigDecimal gasoilDiscountAmt_b = new BigDecimal(m.get("gasoilDiscountAmt").toString());   //每满多少优惠多少的金额
-                                discountAmt = gasoilDiscountAmt_b;  //优惠金额
-                                amt = receivableAmt_b.subtract(gasoilDiscountAmt_b);   //实收金额
-                                oilLiters = receivableAmt_b.divide(new BigDecimal(oilPrice), 2, BigDecimal.ROUND_UP);   //加油升数
-                                discountPrice = amt.divide(oilLiters);        //优惠价格
-                                resultMap.put("discountAmt", discountAmt.doubleValue());
-                                resultMap.put("amt", amt.doubleValue());
-                                resultMap.put("oilLiters", oilLiters.doubleValue());
-                                resultMap.put("discountPrice", discountPrice.doubleValue());
-                                flag = false;
-                                break;
-                            }
-                        }
-                        if(flag){   //用户加油金额不符合优惠条件
-                            resultMap.put("discountAmt", 0);
-                            resultMap.put("amt", receivableAmt.doubleValue());
-                            oilLiters = new BigDecimal(receivableAmt).divide(new BigDecimal(oilPrice), 2, BigDecimal.ROUND_UP);
-                            resultMap.put("oilLiters", oilLiters.doubleValue());
-                            resultMap.put("discountPrice", oilPrice);
-                        }
-                    }else {
-                        //没有优惠规则
-                        resultMap.put("discountAmt", 0);
-                        resultMap.put("amt", receivableAmt.doubleValue());
-                        oilLiters = new BigDecimal(receivableAmt).divide(new BigDecimal(oilPrice), 2, BigDecimal.ROUND_UP);
-                        resultMap.put("oilLiters", oilLiters.doubleValue());
-                        resultMap.put("discountPrice", oilPrice);
-                    }
-                    break;
-                case "4":       //4.独立直降
-                    params.put("discountPlanType", "3");
-                    //营销方案
-                    List<Map> customerMarkertPlanList_3 = customerGradeServices.getCustomerMarkertPlanList(params);
-                    if(customerMarkertPlanList_3 !=null && customerMarkertPlanList_3.size() >0){
-                        boolean flag= true;
-                        for(Map m : customerMarkertPlanList_3){
-                            BigDecimal discountAmt_b = new BigDecimal(m.get("discountAmt").toString());   //条件金额
-                            BigDecimal gasoilDiscountAmt_b = new BigDecimal(m.get("gasoilDiscountAmt").toString());
-                            oilLiters = receivableAmt_b.divide(new BigDecimal(oilPrice), 2, BigDecimal.ROUND_UP);   //加油升数
-                            if(m.get("discountTerm").toString().equals("1")){   //按升数优惠
-                                if(oilLiters.compareTo(discountAmt_b) ==1 || oilLiters.compareTo(discountAmt_b) ==0){
-                                    //计算
-                                    discountAmt = oilLiters.multiply(gasoilDiscountAmt_b);
-                                    discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_UP);
-                                    amt = receivableAmt_b.subtract(discountAmt);
-                                    discountPrice = amt.divide(oilLiters, 2, BigDecimal.ROUND_UP);        //优惠价格
-                                    resultMap.put("discountAmt", discountAmt.doubleValue());
-                                    resultMap.put("amt", amt.doubleValue());
-                                    resultMap.put("oilLiters", oilLiters.doubleValue());
-                                    resultMap.put("discountPrice", discountPrice.doubleValue());
-                                    flag =false;
-                                    break;
-                                }
-                            }else if(m.get("discountTerm").toString().equals("2")){     //按金额优惠
-                                if(receivableAmt_b.compareTo(discountAmt_b) ==1 || receivableAmt_b.compareTo(discountAmt_b) ==0){
-                                    discountAmt = oilLiters.multiply(gasoilDiscountAmt_b);
-                                    discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_UP);
-                                    amt = receivableAmt_b.subtract(discountAmt);
-                                    discountPrice = amt.divide(oilLiters, 2, BigDecimal.ROUND_UP);        //优惠价格
-                                    resultMap.put("discountAmt", discountAmt.doubleValue());
-                                    resultMap.put("amt", amt.doubleValue());
-                                    resultMap.put("oilLiters", oilLiters.doubleValue());
-                                    resultMap.put("discountPrice", discountPrice.doubleValue());
-                                    flag =false;
-                                    break;
-                                }
-                            }
-                        }
-                        if(flag){
-                            resultMap.put("discountAmt", 0);
-                            resultMap.put("amt", receivableAmt.doubleValue());
-                            oilLiters = new BigDecimal(receivableAmt).divide(new BigDecimal(oilPrice), 2, BigDecimal.ROUND_UP);
-                            resultMap.put("oilLiters", oilLiters.doubleValue());
-                            resultMap.put("discountPrice", oilPrice);
-                        }
-                    }else {
-                        //没有优惠规则
-                        resultMap.put("discountAmt", 0);
-                        resultMap.put("amt", receivableAmt.doubleValue());
-                        oilLiters = receivableAmt_b.divide(new BigDecimal(oilPrice), 2, BigDecimal.ROUND_UP);
-                        resultMap.put("oilLiters", oilLiters.doubleValue());
-                        resultMap.put("discountPrice", oilPrice);
-                    }
-                    break;
-            }
-
-            //resultData = ResultData.success(resultMap);
-        }
-        return resultMap;
-    }
 
     /*
      * ===========================计算订单金额======================================

+ 2 - 0
YijiaRestful/src/main/java/com/platform/yijia/controller/PosMachineController.java

@@ -6,6 +6,7 @@ import com.platform.yijia.param.request.LoginBody;
 import com.platform.yijia.pojo.*;
 import com.platform.yijia.service.*;
 import com.platform.yijia.utils.CodeMsg;
+import com.platform.yijia.utils.CryptUtil;
 import com.platform.yijia.utils.ResultData;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.ibatis.annotations.Param;
@@ -61,6 +62,7 @@ public class PosMachineController {
             if(sysUser !=null){
                 if(sysUser.getStatus().equals("0")){
                     String password = sysUser.getPassword();
+                    //password = CryptUtil.desedeDecrypt(password);
                     BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
                     //密码加密判断已加密密码是否与真实密码相同
                     boolean matches = bCryptPasswordEncoder.matches(loginBody.getPassword(), password);

+ 9 - 2
YijiaRestful/src/main/java/com/platform/yijia/dao/AppUserInfoMapper.java

@@ -9,6 +9,13 @@ import org.apache.ibatis.annotations.Param;
 
 public interface AppUserInfoMapper {
 
+    //根据手机号和油站获取用户信息
+    AppUserInfo selectAppUserInfoByMobilePhoneAndStationId(AppUserInfo appUserInfo);
+
+    //获取用户信息
+    AppUserInfo getAppUserInfo(AppUserInfo appUserInfo);
+
+
     /**
      * 判断使用小程序支付的用户是否关注公众号
      * @param map
@@ -113,6 +120,6 @@ public interface AppUserInfoMapper {
     //更新unionID
     void updateAppUserInfo(AppUserInfo appUserInfo);
 
-    //查询客户UnionId
-    AppUserInfo getUserInfo(AppUserInfo appUserInfo);
+    //查询客户
+    List<AppUserInfo> getUserInfo(AppUserInfo appUserInfo);
 }

+ 0 - 3
YijiaRestful/src/main/java/com/platform/yijia/dao/CustomerGradeMapper.java

@@ -19,9 +19,6 @@ public interface CustomerGradeMapper {
     //获取客户等级信息
     List<Map<String, Object>> getCustomerGradeInfo(Map map);
 
-    //获取客户优惠等级信息
-    List<Map<String, Object>> getCustomerGradeInfoByYouHui(Map map);
-
     //根据手机号和油站ID判断该用户是否已在客户表
     List<CustomerManage> isExistCustomerByStationIdAndPhoneNumber(CustomerManage customerManage);
 

+ 3 - 0
YijiaRestful/src/main/java/com/platform/yijia/dao/StationInfoMapper.java

@@ -11,6 +11,9 @@ import org.apache.ibatis.annotations.Param;
 
 public interface StationInfoMapper {
 
+    //获取油站的某个油品的价格和营销方案信息
+    Map<String, Object> selectStationOilPriceAndDiscountSetting(Map<String, Object> map);
+
     //获取油站的油枪所绑定的打印设备
     StationDeviceManager getStationDeviceManager(StationDeviceManager stationDeviceManager);
 

+ 9 - 0
YijiaRestful/src/main/java/com/platform/yijia/dao/SysDictDataMapper.java

@@ -0,0 +1,9 @@
+package com.platform.yijia.dao;
+
+import com.platform.yijia.pojo.Oil;
+
+public interface SysDictDataMapper {
+
+    //获取油品类型信息
+    Oil selectOilType(Oil oilType);
+}

+ 2 - 0
YijiaRestful/src/main/java/com/platform/yijia/param/request/PayOrderRequest.java

@@ -43,6 +43,8 @@ public class PayOrderRequest {
     private String customerGrade; //客户等级
     private String oilType; //油品类型
 
+    private String unionId; //unionId
+
 
 
 }

+ 5 - 402
YijiaRestful/src/main/java/com/platform/yijia/pojo/AppUserInfo.java

@@ -1,421 +1,24 @@
 package com.platform.yijia.pojo;
 
+import lombok.Data;
+
 import java.util.Date;
 
+@Data
 public class AppUserInfo {
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column app_user_info.user_id
-     *
-     * @mbg.generated
-     */
     private Integer userId;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column app_user_info.user_type
-     *
-     * @mbg.generated
-     */
     private String userType;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column app_user_info.blog_openid
-     *
-     * @mbg.generated
-     */
     private String blogOpenid;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column app_user_info.mina_openid
-     *
-     * @mbg.generated
-     */
-    private String minaOpenid;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column app_user_info.mobile_phone
-     *
-     * @mbg.generated
-     */
+    private String minaOpenid;  //minaOpenid
     private String mobilePhone;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column app_user_info.blog_nick_name
-     *
-     * @mbg.generated
-     */
     private String blogNickName;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column app_user_info.sex_flag
-     *
-     * @mbg.generated
-     */
     private String sexFlag;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column app_user_info.registe_date
-     *
-     * @mbg.generated
-     */
     private Date registeDate;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column app_user_info.blog_token
-     *
-     * @mbg.generated
-     */
     private String blogToken;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column app_user_info.mina_token
-     *
-     * @mbg.generated
-     */
     private String minaToken;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column app_user_info.blog_profile_photo
-     *
-     * @mbg.generated
-     */
     private String blogProfilePhoto;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column app_user_info.update_date
-     *
-     * @mbg.generated
-     */
     private Date updateDate;
-
     private String unionId;
-
+    private String aLiId;
     private Integer stationId;
-
-    public Integer getStationId() {
-        return stationId;
-    }
-
-    public void setStationId(Integer stationId) {
-        this.stationId = stationId;
-    }
-
-    public String getUnionId() {
-        return unionId;
-    }
-
-    public void setUnionId(String unionId) {
-        this.unionId = unionId;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column app_user_info.user_id
-     *
-     * @return the value of app_user_info.user_id
-     *
-     * @mbg.generated
-     */
-    public Integer getUserId() {
-        return userId;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column app_user_info.user_id
-     *
-     * @param userId the value for app_user_info.user_id
-     *
-     * @mbg.generated
-     */
-    public void setUserId(Integer userId) {
-        this.userId = userId;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column app_user_info.user_type
-     *
-     * @return the value of app_user_info.user_type
-     *
-     * @mbg.generated
-     */
-    public String getUserType() {
-        return userType;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column app_user_info.user_type
-     *
-     * @param userType the value for app_user_info.user_type
-     *
-     * @mbg.generated
-     */
-    public void setUserType(String userType) {
-        this.userType = userType == null ? null : userType.trim();
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column app_user_info.blog_openid
-     *
-     * @return the value of app_user_info.blog_openid
-     *
-     * @mbg.generated
-     */
-    public String getBlogOpenid() {
-        return blogOpenid;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column app_user_info.blog_openid
-     *
-     * @param blogOpenid the value for app_user_info.blog_openid
-     *
-     * @mbg.generated
-     */
-    public void setBlogOpenid(String blogOpenid) {
-        this.blogOpenid = blogOpenid == null ? null : blogOpenid.trim();
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column app_user_info.mina_openid
-     *
-     * @return the value of app_user_info.mina_openid
-     *
-     * @mbg.generated
-     */
-    public String getMinaOpenid() {
-        return minaOpenid;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column app_user_info.mina_openid
-     *
-     * @param minaOpenid the value for app_user_info.mina_openid
-     *
-     * @mbg.generated
-     */
-    public void setMinaOpenid(String minaOpenid) {
-        this.minaOpenid = minaOpenid == null ? null : minaOpenid.trim();
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column app_user_info.mobile_phone
-     *
-     * @return the value of app_user_info.mobile_phone
-     *
-     * @mbg.generated
-     */
-    public String getMobilePhone() {
-        return mobilePhone;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column app_user_info.mobile_phone
-     *
-     * @param mobilePhone the value for app_user_info.mobile_phone
-     *
-     * @mbg.generated
-     */
-    public void setMobilePhone(String mobilePhone) {
-        this.mobilePhone = mobilePhone == null ? null : mobilePhone.trim();
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column app_user_info.blog_nick_name
-     *
-     * @return the value of app_user_info.blog_nick_name
-     *
-     * @mbg.generated
-     */
-    public String getBlogNickName() {
-        return blogNickName;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column app_user_info.blog_nick_name
-     *
-     * @param blogNickName the value for app_user_info.blog_nick_name
-     *
-     * @mbg.generated
-     */
-    public void setBlogNickName(String blogNickName) {
-        this.blogNickName = blogNickName == null ? null : blogNickName.trim();
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column app_user_info.sex_flag
-     *
-     * @return the value of app_user_info.sex_flag
-     *
-     * @mbg.generated
-     */
-    public String getSexFlag() {
-        return sexFlag;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column app_user_info.sex_flag
-     *
-     * @param sexFlag the value for app_user_info.sex_flag
-     *
-     * @mbg.generated
-     */
-    public void setSexFlag(String sexFlag) {
-        this.sexFlag = sexFlag == null ? null : sexFlag.trim();
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column app_user_info.registe_date
-     *
-     * @return the value of app_user_info.registe_date
-     *
-     * @mbg.generated
-     */
-    public Date getRegisteDate() {
-        return registeDate;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column app_user_info.registe_date
-     *
-     * @param registeDate the value for app_user_info.registe_date
-     *
-     * @mbg.generated
-     */
-    public void setRegisteDate(Date registeDate) {
-        this.registeDate = registeDate;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column app_user_info.blog_token
-     *
-     * @return the value of app_user_info.blog_token
-     *
-     * @mbg.generated
-     */
-    public String getBlogToken() {
-        return blogToken;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column app_user_info.blog_token
-     *
-     * @param blogToken the value for app_user_info.blog_token
-     *
-     * @mbg.generated
-     */
-    public void setBlogToken(String blogToken) {
-        this.blogToken = blogToken == null ? null : blogToken.trim();
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column app_user_info.mina_token
-     *
-     * @return the value of app_user_info.mina_token
-     *
-     * @mbg.generated
-     */
-    public String getMinaToken() {
-        return minaToken;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column app_user_info.mina_token
-     *
-     * @param minaToken the value for app_user_info.mina_token
-     *
-     * @mbg.generated
-     */
-    public void setMinaToken(String minaToken) {
-        this.minaToken = minaToken == null ? null : minaToken.trim();
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column app_user_info.blog_profile_photo
-     *
-     * @return the value of app_user_info.blog_profile_photo
-     *
-     * @mbg.generated
-     */
-    public String getBlogProfilePhoto() {
-        return blogProfilePhoto;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column app_user_info.blog_profile_photo
-     *
-     * @param blogProfilePhoto the value for app_user_info.blog_profile_photo
-     *
-     * @mbg.generated
-     */
-    public void setBlogProfilePhoto(String blogProfilePhoto) {
-        this.blogProfilePhoto = blogProfilePhoto == null ? null : blogProfilePhoto.trim();
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column app_user_info.update_date
-     *
-     * @return the value of app_user_info.update_date
-     *
-     * @mbg.generated
-     */
-    public Date getUpdateDate() {
-        return updateDate;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column app_user_info.update_date
-     *
-     * @param updateDate the value for app_user_info.update_date
-     *
-     * @mbg.generated
-     */
-    public void setUpdateDate(Date updateDate) {
-        this.updateDate = updateDate;
-    }
 }

+ 0 - 1
YijiaRestful/src/main/java/com/platform/yijia/pojo/IntegralRule.java

@@ -21,7 +21,6 @@ public class IntegralRule {
     private String datePicker;                      //'日期选择',1,按照周选择,2.选择每月指定日,3固定日期
     private String datePickerTime;                  //日期时间
     private String integralProportion;              //'积分比例',
-    private String integralDeductionOil;      //'积分抵扣油品规则',
     private List<IntegralRuleDetail> integralRuleDetailList;  //积分规则明细实体类
 
     //此下参数用作SQL条件传参使用

+ 9 - 0
YijiaRestful/src/main/java/com/platform/yijia/pojo/Oil.java

@@ -0,0 +1,9 @@
+package com.platform.yijia.pojo;
+
+import lombok.Data;
+
+@Data
+public class Oil {
+    private String oilsType;
+    private String oilName;
+}

+ 21 - 0
YijiaRestful/src/main/java/com/platform/yijia/pojo/PayOrderResultInfo.java

@@ -0,0 +1,21 @@
+package com.platform.yijia.pojo;
+
+import lombok.Data;
+
+/***
+ * 生成订单时返回前端参数信息
+ */
+@Data
+public class PayOrderResultInfo {
+
+    private String ordNo;           //优惠金额
+    private String discountAmt;     //优惠金额
+    private String receivableAmt;   //应收金额
+    private String amt;             //实收金额
+    private String oilLiters;       //加油金额
+    private String discountPrice;   //优惠单价
+    private String oilPrice;        //原单价
+    private String dzkAmt;         //电子卡金额
+    private String balance;         //电子卡余额
+    private String cardOilsType;    //电子卡类型
+}

+ 29 - 0
YijiaRestful/src/main/java/com/platform/yijia/pojo/StationInfo.java

@@ -121,6 +121,25 @@ public class StationInfo {
     private String appId;       //小程序APPID
     private  String gzhAppId;   //公众号APPID
 
+    public String getDiscountSetting() {
+        return discountSetting;
+    }
+
+    public void setDiscountSetting(String discountSetting) {
+        this.discountSetting = discountSetting;
+    }
+
+    private String discountSetting;         //优惠方案
+    private String cardEnabledFlag;     //是否启用电子卡
+
+    public String getCardEnabledFlag() {
+        return cardEnabledFlag;
+    }
+
+    public void setCardEnabledFlag(String cardEnabledFlag) {
+        this.cardEnabledFlag = cardEnabledFlag;
+    }
+
     public String getGzhAppId() {
         return gzhAppId;
     }
@@ -141,6 +160,16 @@ public class StationInfo {
         return stationId;
     }
 
+    private String integralFlag;
+
+    public String getIntegralFlag() {
+        return integralFlag;
+    }
+
+    public void setIntegralFlag(String integralFlag) {
+        this.integralFlag = integralFlag;
+    }
+
     /**
      * This method was generated by MyBatis Generator.
      * This method sets the value of the database column station_info.station_id

+ 6 - 193
YijiaRestful/src/main/java/com/platform/yijia/pojo/StationOilPrice.java

@@ -1,203 +1,16 @@
 package com.platform.yijia.pojo;
 
+import lombok.Data;
+
 import java.util.Date;
 
+
+@Data
 public class StationOilPrice {
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column station_oil_price.oil_price_id
-     *
-     * @mbg.generated
-     */
     private Integer oilPriceId;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column station_oil_price.oil_name
-     *
-     * @mbg.generated
-     */
     private String oilName;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column station_oil_price.oil_price
-     *
-     * @mbg.generated
-     */
     private String oilPrice;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column station_oil_price.station_id
-     *
-     * @mbg.generated
-     */
     private Integer stationId;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column station_oil_price.station_nanme
-     *
-     * @mbg.generated
-     */
-    private String stationNanme;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column station_oil_price.date
-     *
-     * @mbg.generated
-     */
+    private String stationName;
     private Date date;
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column station_oil_price.oil_price_id
-     *
-     * @return the value of station_oil_price.oil_price_id
-     *
-     * @mbg.generated
-     */
-    public Integer getOilPriceId() {
-        return oilPriceId;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column station_oil_price.oil_price_id
-     *
-     * @param oilPriceId the value for station_oil_price.oil_price_id
-     *
-     * @mbg.generated
-     */
-    public void setOilPriceId(Integer oilPriceId) {
-        this.oilPriceId = oilPriceId;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column station_oil_price.oil_name
-     *
-     * @return the value of station_oil_price.oil_name
-     *
-     * @mbg.generated
-     */
-    public String getOilName() {
-        return oilName;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column station_oil_price.oil_name
-     *
-     * @param oilName the value for station_oil_price.oil_name
-     *
-     * @mbg.generated
-     */
-    public void setOilName(String oilName) {
-        this.oilName = oilName == null ? null : oilName.trim();
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column station_oil_price.oil_price
-     *
-     * @return the value of station_oil_price.oil_price
-     *
-     * @mbg.generated
-     */
-    public String getOilPrice() {
-        return oilPrice;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column station_oil_price.oil_price
-     *
-     * @param oilPrice the value for station_oil_price.oil_price
-     *
-     * @mbg.generated
-     */
-    public void setOilPrice(String oilPrice) {
-        this.oilPrice = oilPrice == null ? null : oilPrice.trim();
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column station_oil_price.station_id
-     *
-     * @return the value of station_oil_price.station_id
-     *
-     * @mbg.generated
-     */
-    public Integer getStationId() {
-        return stationId;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column station_oil_price.station_id
-     *
-     * @param stationId the value for station_oil_price.station_id
-     *
-     * @mbg.generated
-     */
-    public void setStationId(Integer stationId) {
-        this.stationId = stationId;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column station_oil_price.station_nanme
-     *
-     * @return the value of station_oil_price.station_nanme
-     *
-     * @mbg.generated
-     */
-    public String getStationNanme() {
-        return stationNanme;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column station_oil_price.station_nanme
-     *
-     * @param stationNanme the value for station_oil_price.station_nanme
-     *
-     * @mbg.generated
-     */
-    public void setStationNanme(String stationNanme) {
-        this.stationNanme = stationNanme == null ? null : stationNanme.trim();
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column station_oil_price.date
-     *
-     * @return the value of station_oil_price.date
-     *
-     * @mbg.generated
-     */
-    public Date getDate() {
-        return date;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column station_oil_price.date
-     *
-     * @param date the value for station_oil_price.date
-     *
-     * @mbg.generated
-     */
-    public void setDate(Date date) {
-        this.date = date;
-    }
-}
+}

+ 8 - 2
YijiaRestful/src/main/java/com/platform/yijia/service/AppUserInfoService.java

@@ -8,6 +8,12 @@ import java.util.Map;
 
 public interface AppUserInfoService {
 
+    //根据手机号和油站获取用户信息
+    AppUserInfo selectAppUserInfoByMobilePhoneAndStationId(AppUserInfo appUserInfo);
+
+    //获取用户信息
+    AppUserInfo getAppUserInfo(AppUserInfo appUserInfo);
+
     //验证身份
     List<AppUserInfo> Authentication(AppUserInfo appUserInfo);
     //添加信息
@@ -22,8 +28,8 @@ public interface AppUserInfoService {
     //更新unionID
     void updateAppUserInfo(AppUserInfo appUserInfo);
 
-    //查询客户UnionId
-    AppUserInfo getUserInfo(AppUserInfo appUserInfo);
+    //查询客户
+    List<AppUserInfo> getUserInfo(AppUserInfo appUserInfo);
 
     /**
      * 判断使用小程序支付的用户是否关注公众号

+ 0 - 3
YijiaRestful/src/main/java/com/platform/yijia/service/CustomerGradeServices.java

@@ -21,9 +21,6 @@ public interface CustomerGradeServices {
     //获取客户等级信息
     List<Map<String, Object>> getCustomerGradeInfo(Map map);
 
-    //获取客户优惠等级信息
-    List<Map<String, Object>> getCustomerGradeInfoByYouHui(Map map);
-
     //根据手机号和油站ID判断该用户是否已在客户表
     List<CustomerManage> isExistCustomerByStationIdAndPhoneNumber(CustomerManage customerManage);
 

+ 3 - 0
YijiaRestful/src/main/java/com/platform/yijia/service/StationService.java

@@ -10,6 +10,9 @@ import java.util.Map;
 
 public interface StationService {
 
+    //获取油站的某个油品的价格和营销方案信息
+    Map<String, Object> selectStationOilPriceAndDiscountSetting(Map<String, Object> map);
+
     //获取油站的油枪所绑定的打印设备
     StationDeviceManager getStationDeviceManager(StationDeviceManager stationDeviceManager);
 

+ 11 - 0
YijiaRestful/src/main/java/com/platform/yijia/service/SysDictDataService.java

@@ -0,0 +1,11 @@
+package com.platform.yijia.service;
+
+
+import com.platform.yijia.pojo.Oil;
+
+public interface SysDictDataService {
+
+    //获取油品类型信息
+    Oil selectOilType(Oil oilType);
+
+}

+ 14 - 1
YijiaRestful/src/main/java/com/platform/yijia/service/impl/AppUserInfoServiceImpl.java

@@ -15,6 +15,19 @@ import java.util.Map;
 public class AppUserInfoServiceImpl implements AppUserInfoService {
     @Resource
     private AppUserInfoMapper appUserInfoMapper;
+
+    //根据手机号和油站获取用户信息
+    @Override
+    public AppUserInfo selectAppUserInfoByMobilePhoneAndStationId(AppUserInfo appUserInfo) {
+        return appUserInfoMapper.selectAppUserInfoByMobilePhoneAndStationId(appUserInfo);
+    }
+
+    //获取用户信息
+    @Override
+    public AppUserInfo getAppUserInfo(AppUserInfo appUserInfo) {
+        return appUserInfoMapper.getAppUserInfo(appUserInfo);
+    }
+
     /**
      * 用户信息
      */
@@ -80,7 +93,7 @@ public class AppUserInfoServiceImpl implements AppUserInfoService {
 
     //获取用户信息
     @Override
-    public AppUserInfo getUserInfo(AppUserInfo appUserInfo) {
+    public List<AppUserInfo> getUserInfo(AppUserInfo appUserInfo) {
         return appUserInfoMapper.getUserInfo(appUserInfo);
     }
 

+ 0 - 6
YijiaRestful/src/main/java/com/platform/yijia/service/impl/CustomerGradeServiceImpl.java

@@ -39,12 +39,6 @@ public class CustomerGradeServiceImpl implements CustomerGradeServices {
         return customerGradeMapper.getCustomerGradeInfo(map);
     }
 
-    //获取客户优惠等级信息
-    @Override
-    public List<Map<String, Object>> getCustomerGradeInfoByYouHui(Map map) {
-        return customerGradeMapper.getCustomerGradeInfoByYouHui(map);
-    }
-
     //根据手机号和油站ID判断该用户是否已在客户表
     @Override
     public List<CustomerManage> isExistCustomerByStationIdAndPhoneNumber(CustomerManage customerManage) {

+ 6 - 0
YijiaRestful/src/main/java/com/platform/yijia/service/impl/StationServiceImpl.java

@@ -29,6 +29,12 @@ public class StationServiceImpl implements StationService {
     @Resource
     private StationPayManageMapper stationPayManageMapper;
 
+    //获取油站的某个油品的价格和营销方案信息
+    @Override
+    public Map<String, Object> selectStationOilPriceAndDiscountSetting(Map<String, Object> map) {
+        return stationInfoMapper.selectStationOilPriceAndDiscountSetting(map);
+    }
+
     //获取油站的油枪所绑定的打印设备
     @Override
     public StationDeviceManager getStationDeviceManager(StationDeviceManager stationDeviceManager) {

+ 20 - 0
YijiaRestful/src/main/java/com/platform/yijia/service/impl/SysDictDataServiceImpl.java

@@ -0,0 +1,20 @@
+package com.platform.yijia.service.impl;
+
+import com.platform.yijia.dao.SysDictDataMapper;
+import com.platform.yijia.pojo.Oil;
+import com.platform.yijia.service.SysDictDataService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+@Service("sysDictDataService")
+public class SysDictDataServiceImpl implements SysDictDataService {
+    @Resource
+    private SysDictDataMapper sysDictDataMapper;
+
+    //获取油品类型信息
+    @Override
+    public Oil selectOilType(Oil oilType) {
+        return sysDictDataMapper.selectOilType(oilType);
+    }
+}

+ 554 - 0
YijiaRestful/src/main/java/com/platform/yijia/utils/CryptUtil.java

@@ -0,0 +1,554 @@
+package com.platform.yijia.utils;
+
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.spec.InvalidKeySpecException;
+
+import javax.crypto.BadPaddingException;
+import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.NoSuchPaddingException;
+import javax.crypto.SecretKey;
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.spec.DESKeySpec;
+import javax.crypto.spec.DESedeKeySpec;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+
+public class CryptUtil {
+    private CryptUtil() {
+    }
+    /**
+     * 字符串进行加密
+     */
+    public static String useMD5(String passWord) {
+        try {
+            MessageDigest digest = MessageDigest.getInstance("MD5");
+            digest.update(passWord.getBytes());
+            return getHashString(digest);
+
+        } catch (NoSuchAlgorithmException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        return null;
+
+    }
+
+    private static String getHashString(MessageDigest digest) {
+        StringBuilder builder = new StringBuilder();
+        for (byte b : digest.digest()) {
+            builder.append(Integer.toHexString((b >> 4) & 0xf));
+            builder.append(Integer.toHexString(b & 0xf));
+        }
+        return builder.toString().toLowerCase();
+    }
+
+    /**
+     * MD5 消息摘要,对输入的内容,进行唯一表示的计算
+     *
+     * @param data 原数据
+     * @return byte[] 计算后的 MD5 值
+     */
+
+    public static byte[] md5(byte[] data) {
+        byte[] ret = null;
+        if (data != null) {
+            try {
+                // 创建 消息摘要对象
+                MessageDigest messageDigest = MessageDigest.getInstance("MD5");
+                ret = messageDigest.digest(data);
+            } catch (NoSuchAlgorithmException e) {
+                e.printStackTrace();
+            }
+        }
+        return ret;
+    }
+
+    /**
+     * SHA1 消息摘要,对输入的内容,进行唯一表示的计算
+     *
+     * @param data 原数据
+     * @return byte[] 计算后的 SHA1 值
+     */
+
+    public static byte[] sha1(byte[] data) {
+        byte[] ret = null;
+        if (data != null) {
+            try {
+                // 创建 消息摘要对象
+                MessageDigest messageDigest = MessageDigest.getInstance("SHA-1");
+                ret = messageDigest.digest(data);
+            } catch (NoSuchAlgorithmException e) {
+                e.printStackTrace();
+            }
+        }
+        return ret;
+    }
+
+    /**
+     * RC4对称加密
+     */
+
+    public static byte[] HloveyRC4(byte[] aInput, byte[] aKey) {
+        int[] iS = new int[256];
+        byte[] iK = new byte[256];
+        for (int i = 0; i < 256; i++) {
+            iS[i] = i;
+        }
+        int j = 1;
+        for (short i = 0; i < 256; i++) {
+            iK[i] = aKey[(i % aKey.length)];
+        }
+        j = 0;
+        for (int i = 0; i < 256; i++) {
+            j = (j + iS[i] & 0xff + iK[i] & 0xff) % 256;
+            int temp = iS[i];
+            iS[i] = iS[j];
+            iS[j] = temp;
+        }
+        int i = 0;
+        j = 0;
+        byte[] iOutputChar = new byte[aInput.length];
+        for (int x = 0; x < iOutputChar.length; x++) {
+            i = (i + 1) % 256;
+            j = (j + iS[i] & 0xff) % 256;
+            int temp = iS[i] & 0xff;
+            iS[i] = iS[j];
+            iS[j] = temp;
+            int t = (iS[i] + (iS[j] & 0xff % 256)) % 256;
+            int iY = iS[t] & 0xff;
+            byte iCY = (byte) iY;
+            iOutputChar[x] = (byte) (aInput[x] ^ iCY);
+        }
+        return iOutputChar;
+    }
+
+
+    /**
+     * DES 的加密方法
+     *
+     * @param data 原始的数据
+     * @param pwd  密码 8 个字节
+     * @return byte[] 加密后的数据
+     */
+    public static byte[] desEncrypt(byte[] data, byte[] pwd) {
+        byte[] ret = null;
+        if (data != null && pwd != null && pwd.length == 8) {
+            try {
+                Cipher cipher = Cipher.getInstance("DES");
+                SecretKeyFactory secretKeyFactory = SecretKeyFactory.getInstance("DES");
+                SecretKey secretKey = secretKeyFactory.generateSecret(new DESKeySpec(pwd));
+                // 代表当前是解密状态
+                cipher.init(Cipher.DECRYPT_MODE, secretKey);
+                ret = cipher.doFinal(data);
+            } catch (NoSuchAlgorithmException e) {
+                e.printStackTrace();
+            } catch (NoSuchPaddingException e) {
+                e.printStackTrace();
+            } catch (InvalidKeySpecException e) {
+                e.printStackTrace();
+            } catch (InvalidKeyException e) {
+                e.printStackTrace();
+            } catch (BadPaddingException e) {
+                e.printStackTrace();
+            } catch (IllegalBlockSizeException e) {
+                e.printStackTrace();
+            }
+        }
+        return ret;
+    }
+
+    /**
+     * DES 的解密方法
+     *
+     * @param enData 经过加密之后的数据
+     * @param pwd    密码 8 个字节
+     * @return byte[] 解密后的原数据
+     */
+    public static byte[] desDecrypt(byte[] enData, byte[] pwd) {
+        byte[] ret = null;
+        if (enData != null && pwd != null && pwd.length == 8) {
+            try {
+                Cipher cipher = Cipher.getInstance("DES");
+                SecretKeyFactory secretKeyFactory = SecretKeyFactory.getInstance("DES");
+                SecretKey secretKey = secretKeyFactory.generateSecret(new DESKeySpec(pwd));
+                // 代表当前是解密状态
+                cipher.init(Cipher.DECRYPT_MODE, secretKey);
+
+                ret = cipher.doFinal(enData);
+            } catch (NoSuchAlgorithmException e) {
+                e.printStackTrace();
+            } catch (NoSuchPaddingException e) {
+                e.printStackTrace();
+            } catch (InvalidKeySpecException e) {
+                e.printStackTrace();
+            } catch (InvalidKeyException e) {
+                e.printStackTrace();
+            } catch (BadPaddingException e) {
+                e.printStackTrace();
+            } catch (IllegalBlockSizeException e) {
+                e.printStackTrace();
+            }
+        }
+        return ret;
+    }
+
+
+
+    /**
+     * DESede (3DES)加密方法
+     *
+     * @param data 原始数据
+     * @param pwd  密码,长度 <= 24 个字节
+     * @return byte[] 加密后的数据
+     */
+    public static byte[] desedeEncrypt(byte[] data, byte[] pwd) {
+        byte[] ret = null;
+        if (data != null && pwd != null) {
+            int plen = pwd.length;
+            // 确保密码是24 个字节
+            if (plen < 24) {
+                byte[] fully = new byte[24];
+                System.arraycopy(pwd, 0, fully, 0, plen);
+                pwd = fully;
+            }
+            try {
+                Cipher cipher = Cipher.getInstance("DESede");
+                SecretKeyFactory secretKeyFactory = SecretKeyFactory.getInstance("DESede");
+                SecretKey secretKey = secretKeyFactory.generateSecret(new DESedeKeySpec(pwd));
+                // 代表当前是解密状态
+                cipher.init(Cipher.ENCRYPT_MODE, secretKey);
+
+                ret = cipher.doFinal(data);
+            } catch (NoSuchAlgorithmException e) {
+                e.printStackTrace();
+            } catch (NoSuchPaddingException e) {
+                e.printStackTrace();
+            } catch (InvalidKeySpecException e) {
+                e.printStackTrace();
+            } catch (InvalidKeyException e) {
+                e.printStackTrace();
+            } catch (BadPaddingException e) {
+                e.printStackTrace();
+            } catch (IllegalBlockSizeException e) {
+                e.printStackTrace();
+            }
+        }
+        return ret;
+    }
+
+    /**
+     * DESede (3DES)解密方法
+     *
+     * @param data 加密后数据
+     * @param pwd  密码,长度 <= 24 个字节
+     * @return byte[] 解密后的数据
+     */
+    public static byte[] desedeDecrypt(byte[] data, byte[] pwd) {
+        byte[] ret = null;
+        if (data != null && pwd != null) {
+            int plen = pwd.length;
+            // 确保密码是24 个字节
+            if (plen < 24) {
+                byte[] fully = new byte[24];
+                System.arraycopy(pwd, 0, fully, 0, plen);
+                pwd = fully;
+            }
+            try {
+                Cipher cipher = Cipher.getInstance("DESede");
+                SecretKeyFactory secretKeyFactory = SecretKeyFactory.getInstance("DESede");
+                SecretKey secretKey = secretKeyFactory.generateSecret(new DESedeKeySpec(pwd));
+                // 代表当前是解密状态
+                cipher.init(Cipher.DECRYPT_MODE, secretKey);
+
+                ret = cipher.doFinal(data);
+            } catch (NoSuchAlgorithmException e) {
+                e.printStackTrace();
+            } catch (NoSuchPaddingException e) {
+                e.printStackTrace();
+            } catch (InvalidKeySpecException e) {
+                e.printStackTrace();
+            } catch (InvalidKeyException e) {
+                e.printStackTrace();
+            } catch (BadPaddingException e) {
+                e.printStackTrace();
+            } catch (IllegalBlockSizeException e) {
+                e.printStackTrace();
+            }
+        }
+        return ret;
+    }
+
+
+    /**
+     * 非对称加密
+     * RSA 加密部分,加密的部分支持 PrivateKey 加密,同时也支持 Publickey 加密
+     * 因为 Privatekey 实现 Key 接口,同时 Publickey 也实现了 Key 接口
+     *
+     * @param data 要加密的数据
+     * @param key  秘钥
+     * @return byte[] 加密后的字节数组
+     */
+    public static byte[] rsaEncrypt(byte[] data, Key key) {
+        byte[] ret = null;
+        if (data != null && key != null) {
+            if (key instanceof PublicKey || key instanceof PrivateKey) {
+                try {
+                    Cipher cipher = Cipher.getInstance("RSA");
+                    // 初始化操作
+                    cipher.init(Cipher.ENCRYPT_MODE, key);
+                    ret = cipher.doFinal(data);
+                } catch (NoSuchAlgorithmException e) {
+                    e.printStackTrace();
+                } catch (NoSuchPaddingException e) {
+                    e.printStackTrace();
+                } catch (InvalidKeyException e) {
+                    e.printStackTrace();
+                } catch (BadPaddingException e) {
+                    e.printStackTrace();
+                } catch (IllegalBlockSizeException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return ret;
+    }
+
+    /**
+     * 非对称加密
+     * RSA 解密部分,解密的部分支持 PrivateKey 解密,同时也支持 Publickey 解密
+     * 因为 Privatekey 实现 Key 接口,同时 Publickey 也实现了 Key 接口
+     *
+     * @param data RSA 加密后的数据
+     * @param key  秘钥
+     * @return byte[] 解密后的原数据
+     */
+    public static byte[] rsaDecrypt(byte[] data, Key key) {
+        byte[] ret = null;
+        if (data != null && key != null) {
+            if (key instanceof PublicKey || key instanceof PrivateKey) {
+                try {
+                    Cipher cipher = Cipher.getInstance("RSA");
+// 初始化操作
+                    cipher.init(Cipher.DECRYPT_MODE, key);
+                    ret = cipher.doFinal(data);
+                } catch (NoSuchAlgorithmException e) {
+                    e.printStackTrace();
+                } catch (NoSuchPaddingException e) {
+                    e.printStackTrace();
+                } catch (InvalidKeyException e) {
+                    e.printStackTrace();
+                } catch (BadPaddingException e) {
+                    e.printStackTrace();
+                } catch (IllegalBlockSizeException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return ret;
+    }
+
+    /**
+     * AES 加密
+     * 采用 Cipher.getInstance("AES") 方式,并且直接指定密码的加密
+     *
+     * @param data 数据
+     * @param pwd  密码,密码长度建议 16 个字节
+     * @return byte[] 加密后的数据
+     */
+    public static byte[] aesEncrypt(byte[] data, byte[] pwd) {
+        byte[] ret = null;
+        if (data != null && pwd != null) {
+            // 检测密码长度,进行补充操作
+            int plen = pwd.length;
+            if (plen < 16) { // 128 bit
+                byte[] fully = new byte[16];
+                System.arraycopy(pwd, 0, fully, 0, plen);
+                pwd = fully;
+            }
+            try {
+                // !!! AES 的加密,算法部分是支持多种形式的
+                // 如果写的是 AES,那么对应的解密方法,使用的算法必须是 AES
+                // !!! AES 的加密,还可以使用 AES/CBC/PKCS5Padding 这个算法
+                // 对应的解密算法 必须使用 "AES/CBC/PKCS5Padding" 才可以解密
+                Cipher cipher = Cipher.getInstance("AES");
+                SecretKeySpec key = new SecretKeySpec(pwd, "AES");
+                cipher.init(Cipher.ENCRYPT_MODE, key);
+                ret = cipher.doFinal(data);
+            } catch (NoSuchAlgorithmException e) {
+                e.printStackTrace();
+            } catch (NoSuchPaddingException e) {
+                e.printStackTrace();
+            } catch (InvalidKeyException e) {
+                e.printStackTrace();
+            } catch (BadPaddingException e) {
+                e.printStackTrace();
+            } catch (IllegalBlockSizeException e) {
+                e.printStackTrace();
+            }
+        }
+        return ret;
+    }
+
+    /**
+     * AES 解密
+     * 采用 Cipher.getInstance("AES") 方式,并且直接指定密码的加密
+     *
+     * @param data 需要解密的数据
+     * @param pwd  密码,长度建议 16 个字节
+     * @return byte[] 解密后的数据
+     */
+    public static byte[] aesDecrypt(byte[] data, byte[] pwd) {
+        byte[] ret = null;
+        if (data != null && pwd != null) {
+            // 检测密码长度,进行补充操作
+            int plen = pwd.length;
+            if (plen < 16) { // 128 bit
+                byte[] fully = new byte[16];
+                System.arraycopy(pwd, 0, fully, 0, plen);
+                pwd = fully;
+            }
+            try {
+                // !!! AES 的加密,算法部分是支持多种形式的
+                // 如果写的是 AES,那么对应的解密方法,使用的算法必须是 AES
+                // !!! AES 的加密,还可以使用 AES/CBC/PKCS5Padding 这个算法
+                // 对应的解密算法 必须使用 "AES/CBC/PKCS5Padding" 才可以解密
+                Cipher cipher = Cipher.getInstance("AES");
+                SecretKeySpec key = new SecretKeySpec(pwd, "AES");
+                cipher.init(Cipher.DECRYPT_MODE, key);
+                ret = cipher.doFinal(data);
+            } catch (NoSuchAlgorithmException e) {
+                e.printStackTrace();
+            } catch (NoSuchPaddingException e) {
+                e.printStackTrace();
+            } catch (InvalidKeyException e) {
+                e.printStackTrace();
+            } catch (BadPaddingException e) {
+                e.printStackTrace();
+            } catch (IllegalBlockSizeException e) {
+                e.printStackTrace();
+            }
+        }
+        return ret;
+    }
+
+
+
+    /**
+     * 使用密码和Iv两个参数来进行加密,可以理解为用两个密码进行加密
+     * Iv 可以看做另外一个密码,对于解密而言,密码和Iv 同样要一致
+     * 自定义填充方式的 AES 加密
+     * 使加密的内容,强度更高
+     *
+     * @param data   要加密的数据
+     * @param pwd    密码,长度 <= 16 个字节
+     * @param ivData IvParameter
+     * @return byte[] 加密后的数据
+     */
+    public static byte[] aesIvEncrypt(byte[] data, byte[] pwd, byte[] ivData) {
+        byte[] ret = null;
+        if (data != null && pwd != null && ivData != null) {
+            int plen = pwd.length;
+            if (plen < 16) { // 128 bit
+                byte[] fully = new byte[16];
+                System.arraycopy(pwd, 0, fully, 0, plen);
+                pwd = fully;
+            }
+            plen = ivData.length;
+            if (plen < 16) { // 128 bit
+                byte[] fully = new byte[16];
+                System.arraycopy(ivData, 0, fully, 0, plen);
+                ivData = fully;
+            }
+            try {
+                // 支持的算法
+                // AES/CBC/PKCS5Padding
+                // AES/ECB/PKCS5Padding
+                // AES/CBC/NoPadding
+                // AES/ECB/NoPadding
+                Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
+                SecretKeySpec keySpec = new SecretKeySpec(pwd, "AES");
+                // 使用 Iv 增加 AES 的加密强度,参数必须是 16 个字节
+                IvParameterSpec ivParameterSpec = new IvParameterSpec(ivData);
+                // Iv 就是AES 中,另一套密码
+                cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivParameterSpec);
+                ret = cipher.doFinal(data);
+            } catch (NoSuchAlgorithmException e) {
+                e.printStackTrace();
+            } catch (NoSuchPaddingException e) {
+                e.printStackTrace();
+            } catch (InvalidAlgorithmParameterException e) {
+                e.printStackTrace();
+            } catch (InvalidKeyException e) {
+                e.printStackTrace();
+            } catch (BadPaddingException e) {
+                e.printStackTrace();
+            } catch (IllegalBlockSizeException e) {
+                e.printStackTrace();
+            }
+        }
+        return ret;
+    }
+
+    /**
+     * 使用密码和Iv两个参数来进行解密,可以理解为用两个密码进行加密
+     * Iv 可以看做另外一个密码,对于解密而言,密码和Iv 同样要一致
+     * 自定义填充方式的 AES 加密
+     * 使加密的内容,强度更高
+     *
+     * @param data   需要进行解密的数据
+     * @param pwd    密码,长度 <= 16 个字节
+     * @param ivData IvParameter
+     * @return byte[] 解密后的原数据
+     */
+    public static byte[] aesIvDecrypt(byte[] data, byte[] pwd, byte[] ivData) {
+        byte[] ret = null;
+        if (data != null && pwd != null && ivData != null) {
+            int plen = pwd.length;
+            if (plen < 16) { // 128 bit
+                byte[] fully = new byte[16];
+                System.arraycopy(pwd, 0, fully, 0, plen);
+                pwd = fully;
+            }
+            plen = ivData.length;
+            if (plen < 16) { // 128 bit
+                byte[] fully = new byte[16];
+                System.arraycopy(ivData, 0, fully, 0, plen);
+                ivData = fully;
+            }
+            try {
+                // 支持的算法
+                // AES/CBC/PKCS5Padding
+                // AES/ECB/PKCS5Padding
+                // AES/CBC/NoPadding
+                // AES/ECB/NoPadding
+                Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
+                SecretKeySpec keySpec = new SecretKeySpec(pwd, "AES");
+                // 使用 Iv 增加 AES 的加密强度,参数必须是 16 个字节
+                IvParameterSpec ivParameterSpec = new IvParameterSpec(ivData);
+                // Iv 就是AES 中,另一套密码
+                cipher.init(Cipher.DECRYPT_MODE, keySpec, ivParameterSpec);
+                ret = cipher.doFinal(data);
+            } catch (NoSuchAlgorithmException e) {
+                e.printStackTrace();
+            } catch (NoSuchPaddingException e) {
+                e.printStackTrace();
+            } catch (InvalidAlgorithmParameterException e) {
+                e.printStackTrace();
+            } catch (InvalidKeyException e) {
+                e.printStackTrace();
+            } catch (BadPaddingException e) {
+                e.printStackTrace();
+            } catch (IllegalBlockSizeException e) {
+                e.printStackTrace();
+            }
+        }
+        return ret;
+    }
+}

+ 1 - 1
YijiaRestful/src/main/resources/application.yml

@@ -16,7 +16,7 @@ pagehelper:
 spring:
     datasource:
 #        url: jdbc:mysql://47.105.116.204:3306/jiaduoduo_db?useUnicode=true&characterEncoding=utf8&nullCatalogMeansCurrent=true&serverTimezone=GMT%2b8&useSSL=true
-        url: jdbc:mysql://47.105.116.204:3306/jiaduoduo_db_demo?useUnicode=true&characterEncoding=utf8&nullCatalogMeansCurrent=true&serverTimezone=GMT%2b8&useSSL=true
+        url: jdbc:mysql://47.105.116.204:3306/jiaduoduo_db_test?useUnicode=true&characterEncoding=utf8&nullCatalogMeansCurrent=true&serverTimezone=GMT%2b8&useSSL=true
         username: develop
         password: 1234.Abcd
         driver-class-name: com.mysql.cj.jdbc.Driver

+ 62 - 20
YijiaRestful/src/main/resources/mapper/AppUserInfoMapper.xml

@@ -2,20 +2,19 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.platform.yijia.dao.AppUserInfoMapper">
   <resultMap id="BaseResultMap" type="com.platform.yijia.pojo.AppUserInfo">
-    <id column="user_id" jdbcType="INTEGER" property="userId" />
-    <result column="user_type" jdbcType="VARCHAR" property="userType" />
-    <result column="blog_openid" jdbcType="VARCHAR" property="blogOpenid" />
-    <result column="mina_openid" jdbcType="VARCHAR" property="minaOpenid" />
-    <result column="mobile_phone" jdbcType="VARCHAR" property="mobilePhone" />
-    <result column="blog_nick_name" jdbcType="VARCHAR" property="blogNickName" />
-    <result column="sex_flag" jdbcType="VARCHAR" property="sexFlag" />
-    <result column="registe_date" jdbcType="TIMESTAMP" property="registeDate" />
-    <result column="blog_token" jdbcType="VARCHAR" property="blogToken" />
-    <result column="mina_token" jdbcType="VARCHAR" property="minaToken" />
-    <result column="blog_profile_photo" jdbcType="VARCHAR" property="blogProfilePhoto" />
-    <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
-    <result column="union_id" jdbcType="VARCHAR" property="unionId" />
-    <result column="station_id" jdbcType="INTEGER" property="stationId" />
+    <id     column="user_id"              jdbcType="INTEGER"    property="userId" />
+    <result column="user_type"            jdbcType="VARCHAR"    property="userType" />
+    <result column="blog_openid"          jdbcType="VARCHAR"    property="blogOpenid" />
+    <result column="mina_openid"          jdbcType="VARCHAR"    property="minaOpenid" />
+    <result column="mobile_phone"         jdbcType="VARCHAR"    property="mobilePhone" />
+    <result column="blog_nick_name"       jdbcType="VARCHAR"    property="blogNickName" />
+    <result column="sex_flag"             jdbcType="VARCHAR"    property="sexFlag" />
+    <result column="registe_date"         jdbcType="TIMESTAMP"  property="registeDate" />
+    <result column="blog_profile_photo"   jdbcType="VARCHAR"    property="blogProfilePhoto" />
+    <result column="update_date"          jdbcType="TIMESTAMP"  property="updateDate" />
+    <result column="union_id"             jdbcType="VARCHAR"    property="unionId" />
+    <result column="ali_id"               jdbcType="VARCHAR"    property="aLiId" />
+    <result column="station_id"           jdbcType="INTEGER"    property="stationId" />
   </resultMap>
   <sql id="Example_Where_Clause">
     <!--
@@ -84,13 +83,50 @@
     </where>
   </sql>
   <sql id="Base_Column_List">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    user_id, user_type, blog_openid, mina_openid, mobile_phone, blog_nick_name, sex_flag,
-    registe_date, blog_token, mina_token, blog_profile_photo, update_date, union_id, station_id
+      user_id, user_type, blog_openid, mina_openid, mobile_phone, blog_nick_name, sex_flag,
+      registe_date blog_profile_photo, update_date, union_id, ali_id, station_id
   </sql>
+  <!-- 获取用户信息-->
+  <select id="getAppUserInfo" parameterType="com.platform.yijia.pojo.AppUserInfo" resultMap="BaseResultMap">
+    SELECT
+        <include refid="Base_Column_List" />
+    FROM
+        app_user_info
+    <where>
+      <if test="userType !=null and userType !=''">
+        user_type = #{userType}
+      </if>
+      <if test="stationId !=null and stationId !=''">
+        AND station_id = #{stationId}
+      </if>
+      <if test="blogOpenid !=null and blogOpenid !=''">
+        AND blog_openid = #{blogOpenid}
+      </if>
+      <if test="minaOpenid !=null and minaOpenid !=''">
+        AND mina_openid = #{minaOpenid}
+      </if>
+      <if test="aLiId !=null and aLiId !=''">
+        AND ali_id = #{aLiId}
+      </if>
+    </where>
+  </select>
+
+  <!-- selectAppUserInfoByMobilePhoneAndStationId -->
+  <!-- 根据手机号和油站ID获取用户信息-->
+  <select id="selectAppUserInfoByMobilePhoneAndStationId" parameterType="com.platform.yijia.pojo.AppUserInfo" resultMap="BaseResultMap">
+    SELECT
+        <include refid="Base_Column_List" />
+    FROM
+        app_user_info
+    <where>
+      <if test="stationId !=null and stationId !=''">
+        station_id = #{stationId}
+      </if>
+      <if test="mobilePhone !=null and mobilePhone !=''">
+        AND mobile_phone = #{mobilePhone}
+      </if>
+    </where>
+  </select>
 
   <!-- 判断注册账户是否已存在-->
   <select id="isExistAppUser" parameterType="map" resultType="int">
@@ -428,12 +464,18 @@
       <if test="userType !=null and userType !=''">
         user_type = #{userType}
       </if>
+      <if test="stationId !=null and stationId !=''">
+        station_id = #{stationId}
+      </if>
       <if test="blogOpenid !=null and blogOpenid !=''">
         AND blog_openid = #{blogOpenid}
       </if>
       <if test="minaOpenid !=null and minaOpenid !=''">
         AND mina_openid = #{minaOpenid}
       </if>
+      <if test="mobilePhone !=null and mobilePhone !=''">
+        AND mobile_phone = #{mobilePhone}
+      </if>
     </where>
   </select>
 

+ 17 - 85
YijiaRestful/src/main/resources/mapper/CustomerGradeMapper.xml

@@ -25,24 +25,16 @@
             discount_term               AS discountTerm,
             discount_amt                AS discountAmt,
             gasoil_discount_amt         AS gasoilDiscountAmt,
-            activity_day_setting        AS activityDaySetting,
-            activity_day_type           AS activityDayType,
-            activity_day_week           AS activityDayWeek,
-            activity_day_month          AS activityDayMonth,
-            activity_day_date           AS activityDayDate,
-            activity_day_time           AS activityDayTime,
-            activity_day_distnct        AS activityDayDistnct,
-            dieseloil_discount_amt      AS dieseloilDiscountAmt,
             station_id                  AS stationId,
             vip_discounty_plus          AS vipDiscountyPlus,
             coupon_plus                 AS couponPlus,
-            discount_plan_type          AS discountWay,
-            station_name                AS stationName,
+            discount_plan_type          AS discountPlanType,
             oil_name                    AS oilName
         FROM markert_plan
         <where>
+            status ="1"
             <if test="stationId != null and stationId != ''">
-                station_id = #{stationId}
+                AND station_id = #{stationId}
             </if>
             <if test="oilName != null and oilName != ''">
                 AND oil_name = #{oilName}
@@ -54,23 +46,19 @@
         ORDER BY discount_amt DESC
     </select>
 
-
-
-  <!-- 查询直降优惠方案 -->
-  <select id="getCustomerGradeList"  resultType="map" parameterType="map">
+    <!-- 查询直降优惠方案 -->
+    <select id="getCustomerGradeList"  resultType="map" parameterType="map">
     SELECT
         id                          AS id,
         grade                       AS grade,
-        discount_way                AS discountWay,
-        gasoil_discount_litre       AS gasoilDiscountLitre,
-        member_condit               AS memberCondit,
         station_id                  AS stationId,
+        discount_amt                AS discountAmt,
         member_condit_start         AS memberConditStart,
         member_condit_end           AS memberConditEnd,
-        station_name                AS stationName,
         oil_name                    AS oilName
     FROM customer_grade_setting
     <where>
+        del_flag ="0"
       <if test="stationId != null and stationId != ''">
           station_id = #{stationId}
       </if>
@@ -84,20 +72,18 @@
     <!-- 查询直降优惠方案 -->
     <select id="getCustomerGradeListOrderByDesc"  resultType="map" parameterType="map">
         SELECT
-        id                          AS id,
-        grade                       AS grade,
-        discount_way                AS discountWay,
-        gasoil_discount_litre       AS gasoilDiscountLitre,
-        member_condit               AS memberCondit,
-        station_id                  AS stationId,
-        member_condit_start         AS memberConditStart,
-        member_condit_end           AS memberConditEnd,
-        station_name                AS stationName,
-        oil_name                    AS oilName
+            id                          AS id,
+            grade                       AS grade,
+            station_id                  AS stationId,
+            discount_amt                AS discountAmt,
+            member_condit_start         AS memberConditStart,
+            member_condit_end           AS memberConditEnd,
+            oil_name                    AS oilName
         FROM customer_grade_setting
         <where>
+            del_flag ="0"
             <if test="stationId != null and stationId != ''">
-                station_id = #{stationId}
+                AND station_id = #{stationId}
             </if>
             <if test="oilName != null and oilName != ''">
                 AND oil_name = #{oilName}
@@ -106,19 +92,15 @@
         ORDER BY member_condit_start DESC
     </select>
 
-
     <!--查询客户等级直降信息-->
     <select id="getCustomerGradeInfo" parameterType="map" resultType="map">
         SELECT
             T2.station_name			        AS stationName,
             T2.member_grade			        AS memberGradeId,
             T3.grade					    AS grade,
-            T3.discount_way                 AS discountWay,
             T3.oil_name                     AS oilName,
-            T3.gasoil_discount_litre        AS gasoilDiscountLitre,
             T3.member_condit_start          AS memberConditStart,
-            T3.member_condit_end            AS memberConditEnd,
-            T3.member_condit                AS memberCondit
+            T3.member_condit_end            AS memberConditEnd
         FROM
             app_user_info 					AS T1
         LEFT JOIN customer_manage 			AS T2   ON T1.mobile_phone = T2.phone_number
@@ -149,55 +131,6 @@
         ORDER BY T3.member_condit_end ASC
     </select>
 
-
-    <!--查询客户等级优惠信息-->
-    <select id="getCustomerGradeInfoByYouHui" parameterType="map" resultType="map">
-        SELECT
-            T2.station_name			    AS stationName,
-            T3.oil_name                 AS oilName,
-            T2.member_grade			    AS memberGradeId,
-            T3.grade					AS grade,
-            T3.discount_term            AS discountTerm,
-            T3.gasoil_discount_amt      AS gasoilDiscountAmt,
-            T3.discount_amt             AS discountAmt,
-            T3.vip_discounty_plus       AS vipDiscountyPlus,
-            T3.coupon_plus              AS couponPlus,
-            T3.discount_plan_type       AS discountWay
-        FROM
-            app_user_info 				AS T1
-        LEFT JOIN customer_manage 		AS T2   ON T1.mobile_phone = T2.phone_number
-        LEFT JOIN markert_plan 	        AS T3   ON T3.station_id = T2.station_id AND T3.oil_name = T2.oil_name
-<!--            <if test="grade !=null and grade != ''"> AND T3.id = T2.member_grade </if>-->
-        <where>
-            <if test="mobilePhone != null and mobilePhone !=''">
-                T1.mobile_phone = #{mobilePhone}
-            </if>
-            <if test="userType != null and userType !=''">
-                AND T1.user_type = #{userType}
-            </if>
-            <if test="oilName != null and oilName !=''">
-                AND T2.oil_name = #{oilName}
-            </if>
-            <if test="discountPlanType != null and discountPlanType !=''">
-                AND T3.discount_plan_type = #{discountPlanType}
-            </if>
-            <if test="stationId != null and stationId != ''">
-                AND T2.station_id = #{stationId}
-            </if>
-            <if test="blogOpenid != null and blogOpenid != ''">
-                AND T1.blog_openid = #{blogOpenid}
-            </if>
-            <if test="minaOpenid != null and minaOpenid != ''">
-                AND T1.mina_openid = #{minaOpenid}
-            </if>
-            <if test="grade != null and grade != ''">
-                AND T3.id = #{grade}
-            </if>
-        </where>
-        ORDER BY T3.discount_amt ASC
-    </select>
-
-
     <!-- 判断客户表是否已存在-->
     <select id="isExistCustomerByStationIdAndPhoneNumber" parameterType="com.platform.yijia.pojo.CustomerManage" resultType="com.platform.yijia.pojo.CustomerManage">
         SELECT
@@ -225,7 +158,6 @@
         </where>
     </select>
 
-
     <!-- 营销立减-->
     <select id="getMarkertPlanListByDiscountPlanType"  resultType="map">
         SELECT

+ 0 - 2
YijiaRestful/src/main/resources/mapper/IntegralRuleMapper.xml

@@ -14,7 +14,6 @@
       <result column="date_picker"            jdbcType="VARCHAR" property="datePicker" />
       <result column="date_picker_time"       jdbcType="VARCHAR" property="datePickerTime" />
       <result column="integral_proportion"    jdbcType="VARCHAR" property="integralProportion" />
-      <result column="integral_deduction_oil" jdbcType="VARCHAR" property="integralDeductionOil" />
       <collection property="integralRuleDetailList" resultMap="IntegralRuleDetailResultMap"/>
   </resultMap>
 
@@ -46,7 +45,6 @@
         T1.date_picker,
         T1.date_picker_time,
         T1.integral_proportion,
-        T1.integral_deduction_oil,
         T2.id                           AS      integralRuleDetailId,
         T2.rule_type,
         T2.rule_terms,

+ 0 - 1
YijiaRestful/src/main/resources/mapper/PayOrderMapper.xml

@@ -215,7 +215,6 @@
             dict_type ="pay_type"
     </select>
 
-
     <!--查询油品总和-->
   <select id="selectSum" parameterType="com.platform.yijia.pojo.PayOrder" resultType="Map">
             <if test="groupBy !=null and groupBy =='oilName'">

+ 39 - 21
YijiaRestful/src/main/resources/mapper/StationInfoMapper.xml

@@ -2,31 +2,46 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.platform.yijia.dao.StationInfoMapper">
   <resultMap id="BaseResultMap" type="com.platform.yijia.pojo.StationInfo">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    <id column="dept_id" jdbcType="INTEGER" property="stationId" />
-    <result column="dept_name" jdbcType="VARCHAR" property="stationName" />
-    <result column="dept_address" jdbcType="VARCHAR" property="stationAddress" />
-    <result column="oil_gun_num" jdbcType="INTEGER" property="oilGunNum" />
-    <result column="leader" jdbcType="VARCHAR" property="contacts" />
-    <result column="phone" jdbcType="VARCHAR" property="phone" />
-    <result column="station_longitude" jdbcType="VARCHAR" property="stationLongitude" />
-    <result column="station_latitude" jdbcType="VARCHAR" property="stationLatitude" />
-    <result column="station_pic" jdbcType="VARCHAR" property="stationPic" />
-    <result column="mno" jdbcType="INTEGER" property="mno" />
-    <result column="app_id" jdbcType="VARCHAR" property="appId" />
-    <result column="gzh_app_id" jdbcType="VARCHAR" property="gzhAppId" />
+    <id column="dept_id"                  jdbcType="INTEGER" property="stationId" />
+    <result column="dept_name"            jdbcType="VARCHAR" property="stationName" />
+    <result column="dept_address"         jdbcType="VARCHAR" property="stationAddress" />
+    <result column="oil_gun_num"          jdbcType="INTEGER" property="oilGunNum" />
+    <result column="leader"               jdbcType="VARCHAR" property="contacts" />
+    <result column="phone"                jdbcType="VARCHAR" property="phone" />
+    <result column="station_longitude"    jdbcType="VARCHAR" property="stationLongitude" />
+    <result column="station_latitude"     jdbcType="VARCHAR" property="stationLatitude" />
+    <result column="station_pic"          jdbcType="VARCHAR" property="stationPic" />
+    <result column="mno"                  jdbcType="INTEGER" property="mno" />
+    <result column="discount_setting"     jdbcType="VARCHAR" property="discountSetting" />
+    <result column="card_enabled_flag"    jdbcType="VARCHAR" property="cardEnabledFlag" />
+    <result column="integral_flag"        jdbcType="VARCHAR" property="integralFlag" />
+    <result column="app_id"               jdbcType="VARCHAR" property="appId" />
+    <result column="gzh_app_id"           jdbcType="VARCHAR" property="gzhAppId" />
+
   </resultMap>
   <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.platform.yijia.pojo.StationInfo">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
     <result column="station_pic" jdbcType="LONGVARBINARY" property="stationPic" />
   </resultMap>
 
+  <!--获取油站的某个油品的价格和营销方案信息-->
+  <select id="selectStationOilPriceAndDiscountSetting" parameterType="Map" resultType="Map">
+    SELECT
+        T1.dept_id                   AS stationId,
+        T1.discount_setting          AS discountSetting,
+        T1.card_enabled_flag         AS cardEnabledFlag,
+        T2.oil_price                 AS oilPrice
+    FROM            sys_dept             AS T1
+        LEFT JOIN   station_oil_price    AS T2 ON T1.dept_id = T2.station_id
+    <where>
+      <if test="stationId !='' and stationId != null" >
+        T1.dept_id = #{stationId}
+      </if>
+      <if test="oilName !=null and oilName !=''">
+        AND T2.oil_name = #{oilName}
+      </if>
+    </where>
+  </select>
+
 
   <!--获取油站信息-->
   <select id="selectStationInfo" parameterType="com.platform.yijia.pojo.StationInfo" resultMap="BaseResultMap">
@@ -39,7 +54,10 @@
         station_longitude,
         station_latitude,
         station_pic,
-        mno
+        mno,
+        discount_setting,
+        card_enabled_flag,
+        integral_flag
     FROM
         sys_dept
     <where>

+ 15 - 283
YijiaRestful/src/main/resources/mapper/StationOilPriceMapper.xml

@@ -1,19 +1,21 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.platform.yijia.dao.StationOilPriceMapper">
+
   <resultMap id="BaseResultMap" type="com.platform.yijia.pojo.StationOilPrice">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    <id column="oil_price_id" jdbcType="INTEGER" property="oilPriceId" />
-    <result column="oil_name" jdbcType="VARCHAR" property="oilName" />
-    <result column="oil_price" jdbcType="VARCHAR" property="oilPrice" />
-    <result column="station_id" jdbcType="INTEGER" property="stationId" />
-    <result column="station_nanme" jdbcType="VARCHAR" property="stationNanme" />
-    <result column="date" jdbcType="TIMESTAMP" property="date" />
+    <id     column="oil_price_id"     jdbcType="INTEGER"    property="oilPriceId" />
+    <result column="oil_name"         jdbcType="VARCHAR"    property="oilName" />
+    <result column="oil_price"        jdbcType="VARCHAR"    property="oilPrice" />
+    <result column="station_id"       jdbcType="INTEGER"    property="stationId" />
+    <result column="station_name"     jdbcType="VARCHAR"    property="stationName" />
+    <result column="date"             jdbcType="TIMESTAMP"  property="date" />
   </resultMap>
 
+  <sql id="Base_Column_List">
+    oil_price_id, oil_name, oil_price, station_id, station_name, date
+  </sql>
+
+
   <!--查询油站油品价格-->
   <select id="getStationOilPrice" resultMap="BaseResultMap" parameterType="com.platform.yijia.pojo.StationOilPrice">
     SELECT
@@ -21,7 +23,7 @@
         oil_name,
         oil_price,
         station_id,
-        station_nanme,
+        station_name,
         date
     FROM
         station_oil_price
@@ -36,276 +38,6 @@
   </select>
 
 
-  <sql id="Example_Where_Clause">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    <where>
-      <foreach collection="oredCriteria" item="criteria" separator="or">
-        <if test="criteria.valid">
-          <trim prefix="(" prefixOverrides="and" suffix=")">
-            <foreach collection="criteria.criteria" item="criterion">
-              <choose>
-                <when test="criterion.noValue">
-                  and ${criterion.condition}
-                </when>
-                <when test="criterion.singleValue">
-                  and ${criterion.condition} #{criterion.value}
-                </when>
-                <when test="criterion.betweenValue">
-                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
-                </when>
-                <when test="criterion.listValue">
-                  and ${criterion.condition}
-                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
-                    #{listItem}
-                  </foreach>
-                </when>
-              </choose>
-            </foreach>
-          </trim>
-        </if>
-      </foreach>
-    </where>
-  </sql>
-  <sql id="Update_By_Example_Where_Clause">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    <where>
-      <foreach collection="example.oredCriteria" item="criteria" separator="or">
-        <if test="criteria.valid">
-          <trim prefix="(" prefixOverrides="and" suffix=")">
-            <foreach collection="criteria.criteria" item="criterion">
-              <choose>
-                <when test="criterion.noValue">
-                  and ${criterion.condition}
-                </when>
-                <when test="criterion.singleValue">
-                  and ${criterion.condition} #{criterion.value}
-                </when>
-                <when test="criterion.betweenValue">
-                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
-                </when>
-                <when test="criterion.listValue">
-                  and ${criterion.condition}
-                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
-                    #{listItem}
-                  </foreach>
-                </when>
-              </choose>
-            </foreach>
-          </trim>
-        </if>
-      </foreach>
-    </where>
-  </sql>
-  <sql id="Base_Column_List">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    oil_price_id, oil_name, oil_price, station_id, station_nanme, date
-  </sql>
-  <select id="selectByExample" parameterType="com.platform.yijia.pojo.StationOilPriceExample" resultMap="BaseResultMap">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    select
-    <if test="distinct">
-      distinct
-    </if>
-    <include refid="Base_Column_List" />
-    from station_oil_price
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-    <if test="orderByClause != null">
-      order by ${orderByClause}
-    </if>
-  </select>
-  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    select
-    <include refid="Base_Column_List" />
-    from station_oil_price
-    where oil_price_id = #{oilPriceId,jdbcType=INTEGER}
-  </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    delete from station_oil_price
-    where oil_price_id = #{oilPriceId,jdbcType=INTEGER}
-  </delete>
-  <delete id="deleteByExample" parameterType="com.platform.yijia.pojo.StationOilPriceExample">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    delete from station_oil_price
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-  </delete>
-  <insert id="insert" parameterType="com.platform.yijia.pojo.StationOilPrice">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    insert into station_oil_price (oil_price_id, oil_name, oil_price,
-      station_id, station_nanme, date
-      )
-    values (#{oilPriceId,jdbcType=INTEGER}, #{oilName,jdbcType=VARCHAR}, #{oilPrice,jdbcType=VARCHAR},
-      #{stationId,jdbcType=INTEGER}, #{stationNanme,jdbcType=VARCHAR}, #{date,jdbcType=TIMESTAMP}
-      )
-  </insert>
-  <insert id="insertSelective" parameterType="com.platform.yijia.pojo.StationOilPrice">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    insert into station_oil_price
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="oilPriceId != null">
-        oil_price_id,
-      </if>
-      <if test="oilName != null">
-        oil_name,
-      </if>
-      <if test="oilPrice != null">
-        oil_price,
-      </if>
-      <if test="stationId != null">
-        station_id,
-      </if>
-      <if test="stationNanme != null">
-        station_nanme,
-      </if>
-      <if test="date != null">
-        date,
-      </if>
-    </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="oilPriceId != null">
-        #{oilPriceId,jdbcType=INTEGER},
-      </if>
-      <if test="oilName != null">
-        #{oilName,jdbcType=VARCHAR},
-      </if>
-      <if test="oilPrice != null">
-        #{oilPrice,jdbcType=VARCHAR},
-      </if>
-      <if test="stationId != null">
-        #{stationId,jdbcType=INTEGER},
-      </if>
-      <if test="stationNanme != null">
-        #{stationNanme,jdbcType=VARCHAR},
-      </if>
-      <if test="date != null">
-        #{date,jdbcType=TIMESTAMP},
-      </if>
-    </trim>
-  </insert>
-  <select id="countByExample" parameterType="com.platform.yijia.pojo.StationOilPriceExample" resultType="java.lang.Long">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    select count(*) from station_oil_price
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-  </select>
-  <update id="updateByExampleSelective" parameterType="map">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    update station_oil_price
-    <set>
-      <if test="record.oilPriceId != null">
-        oil_price_id = #{record.oilPriceId,jdbcType=INTEGER},
-      </if>
-      <if test="record.oilName != null">
-        oil_name = #{record.oilName,jdbcType=VARCHAR},
-      </if>
-      <if test="record.oilPrice != null">
-        oil_price = #{record.oilPrice,jdbcType=VARCHAR},
-      </if>
-      <if test="record.stationId != null">
-        station_id = #{record.stationId,jdbcType=INTEGER},
-      </if>
-      <if test="record.stationNanme != null">
-        station_nanme = #{record.stationNanme,jdbcType=VARCHAR},
-      </if>
-      <if test="record.date != null">
-        date = #{record.date,jdbcType=TIMESTAMP},
-      </if>
-    </set>
-    <if test="_parameter != null">
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
-  <update id="updateByExample" parameterType="map">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    update station_oil_price
-    set oil_price_id = #{record.oilPriceId,jdbcType=INTEGER},
-      oil_name = #{record.oilName,jdbcType=VARCHAR},
-      oil_price = #{record.oilPrice,jdbcType=VARCHAR},
-      station_id = #{record.stationId,jdbcType=INTEGER},
-      station_nanme = #{record.stationNanme,jdbcType=VARCHAR},
-      date = #{record.date,jdbcType=TIMESTAMP}
-    <if test="_parameter != null">
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
-  <update id="updateByPrimaryKeySelective" parameterType="com.platform.yijia.pojo.StationOilPrice">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    update station_oil_price
-    <set>
-      <if test="oilName != null">
-        oil_name = #{oilName,jdbcType=VARCHAR},
-      </if>
-      <if test="oilPrice != null">
-        oil_price = #{oilPrice,jdbcType=VARCHAR},
-      </if>
-      <if test="stationId != null">
-        station_id = #{stationId,jdbcType=INTEGER},
-      </if>
-      <if test="stationNanme != null">
-        station_nanme = #{stationNanme,jdbcType=VARCHAR},
-      </if>
-      <if test="date != null">
-        date = #{date,jdbcType=TIMESTAMP},
-      </if>
-    </set>
-    where oil_price_id = #{oilPriceId,jdbcType=INTEGER}
-  </update>
-  <update id="updateByPrimaryKey" parameterType="com.platform.yijia.pojo.StationOilPrice">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    update station_oil_price
-    set oil_name = #{oilName,jdbcType=VARCHAR},
-      oil_price = #{oilPrice,jdbcType=VARCHAR},
-      station_id = #{stationId,jdbcType=INTEGER},
-      station_nanme = #{stationNanme,jdbcType=VARCHAR},
-      date = #{date,jdbcType=TIMESTAMP}
-    where oil_price_id = #{oilPriceId,jdbcType=INTEGER}
-  </update>
+
+
 </mapper>

+ 33 - 0
YijiaRestful/src/main/resources/mapper/SysDictDataMapper.xml

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.platform.yijia.dao.SysDictDataMapper">
+
+    <!--获取支付类型列表-->
+    <select id="selectPayTypeList" resultType="com.platform.yijia.pojo.PayType">
+        SELECT
+            dict_value      AS payType,
+            dict_label      AS payTypeName
+        FROM
+            sys_dict_data
+        WHERE
+            dict_type ="pay_type"
+    </select>
+
+
+    <!--获取油品类型列表-->
+    <select id="selectOilType" resultType="com.platform.yijia.pojo.Oil" parameterType="com.platform.yijia.pojo.Oil">
+        SELECT
+            dict_value      AS oilsType,
+            dict_label      AS oilName
+        FROM
+            sys_dict_data
+        <where>
+            dict_type ="oil_name"
+            <if test="oilName !=null and oilName !=''">
+                AND dict_label = #{oilName}
+            </if>
+        </where>
+
+    </select>
+
+</mapper>

+ 5 - 0
YijiaRestful/src/test/java/com/palatform/yijia/A.java

@@ -0,0 +1,5 @@
+package com.palatform.yijia;
+
+public class A {
+
+}

+ 17 - 4
YijiaRestful/src/test/java/com/palatform/yijia/test.java

@@ -6,8 +6,10 @@ import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.text.Bidi;
 import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
+import java.util.List;
 
 public class test {
 
@@ -26,16 +28,27 @@ public class test {
 //        }
 //        System.out.println(oilLiters);
 
-        String ss = "20210508171257";
-        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        //sdf.
-        System.out.println(sdf.format(ss));
+//        String ss = "20210508171257";
+//        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+//        //sdf.
+//        System.out.println(sdf.format(ss));
+
+        String  sss = null;
+        String ddd  =null;
+
+        List<String> aa  = new ArrayList<>();
+//        aa.add(sss);
+//        aa.add(ddd);
+        System.out.println(aa);
+
+
 
 
     }
 
 
 
+
     public static boolean isEqual(byte[] digesta, byte[] digestb) {
         if (digesta.length != digestb.length) {
             return false;