jk-GitHub-coder 4 年之前
父节点
当前提交
9933c70540

+ 15 - 11
YijiaRestful/src/main/java/com/platform/yijia/controller/AppUserInfoController.java

@@ -6,6 +6,7 @@ import com.platform.yijia.param.request.AppUserInfoRequest;
 import com.platform.yijia.pojo.AppUserInfo;
 import com.platform.yijia.pojo.CustomerElectronicCard;
 import com.platform.yijia.pojo.CustomerPoints;
+import com.platform.yijia.pojo.StationPayManage;
 import com.platform.yijia.service.*;
 import com.platform.yijia.utils.CodeMsg;
 import com.platform.yijia.utils.ResultData;
@@ -288,9 +289,6 @@ public class AppUserInfoController {
     }
 
 
-
-
-
     /*
      * 获取公众号信息
      * @param openId
@@ -432,15 +430,21 @@ public class AppUserInfoController {
             int count = appUserInfoService.isExistAppUser(params);
             if(count > 0){
                 appUserInfoService.updateAppUserInfo(appUserInfo);
-                this.upDateCustomerPointsInfo(customerPoints, request);
-                this.upDateCustomerElectronicCard(customerElectronicCard, request);
-                resultData = ResultData.error(CodeMsg.SUCCESS);
             }else {
                 appUserInfoService.AddAppUserInfo(appUserInfo);
-                this.upDateCustomerPointsInfo(customerPoints, request);
-                this.upDateCustomerElectronicCard(customerElectronicCard, request);
-                resultData = ResultData.success(CodeMsg.SUCCESS);
             }
+            StationPayManage stationPayManage = new StationPayManage();
+            stationPayManage.setStationId(request.getStationId());
+            StationPayManage stationPayManageInfo = stationService.selectStationPayManage(stationPayManage);    //换取油站配置信息
+            //是否开起积分功能
+            if(stationPayManageInfo !=null && stationPayManageInfo.getIntegralFlag().equals("1")){
+                this.insertCustomerPointsInfo(customerPoints, request);
+            }
+            //是否开起电子卡功能
+            if(stationPayManageInfo !=null && stationPayManageInfo.getCardEnabledFlag().equals("1")){
+                this.insertCustomerElectronicCard(customerElectronicCard, request);
+            }
+            resultData = ResultData.success(CodeMsg.SUCCESS);
         }catch (Exception e){
             resultData = ResultData.error(CodeMsg.INSERT_FAIL);
             e.printStackTrace();
@@ -449,7 +453,7 @@ public class AppUserInfoController {
     }
 
     //客户积分表信息操作
-    public void upDateCustomerPointsInfo(CustomerPoints customerPoints, AppUserInfoRequest request){
+    public void insertCustomerPointsInfo(CustomerPoints customerPoints, AppUserInfoRequest request){
         boolean boo = customerPointsService.isExistCustomerPointsInfo(customerPoints);
         if(!boo){
             customerPointsService.insertCustomerPointsInfo(customerPoints);
@@ -473,7 +477,7 @@ public class AppUserInfoController {
     }
 
     //客户电子会员卡表操作
-    public void upDateCustomerElectronicCard(CustomerElectronicCard customerElectronicCard, AppUserInfoRequest request){
+    public void insertCustomerElectronicCard(CustomerElectronicCard customerElectronicCard, AppUserInfoRequest request){
         List<CustomerElectronicCard> electronicCardList = electronicMembershipCardService.getElectronicCardList(customerElectronicCard);
         if(electronicCardList !=null && electronicCardList.size() ==2){
             electronicMembershipCardService.updateElectronicCardInfoByUnionId(customerElectronicCard);

+ 493 - 27
YijiaRestful/src/main/java/com/platform/yijia/controller/ElectronicMembershipCardController.java

@@ -6,9 +6,7 @@ import com.alibaba.fastjson.parser.Feature;
 import com.google.gson.Gson;
 import com.platform.yijia.param.request.RechargeBalance;
 import com.platform.yijia.pojo.*;
-import com.platform.yijia.service.ElectronicMembershipCardService;
-import com.platform.yijia.service.GzhNewsTemplateService;
-import com.platform.yijia.service.StationService;
+import com.platform.yijia.service.*;
 import com.platform.yijia.utils.*;
 import com.platform.yijia.utils.weixinapp.WxPushUtil;
 import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
@@ -21,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
@@ -43,6 +42,18 @@ public class ElectronicMembershipCardController {
     private GzhNewsTemplateService gzhNewsTemplateService;
     @Resource
     private WxPushUtil wxPushUtil;
+    @Resource
+    private PayOrderService payOrderService;
+    @Resource
+    private CustomerGradeServices customerGradeServices;
+    @Resource
+    private  CustomerManagerService customerManagerService;
+    @Resource
+    private CustomerPointsService customerPointsService;
+    @Resource
+    private IntegralRuleService integralRuleService;
+    @Resource
+    private CustomerPointsRecordService customerPointsRecordService;
 
     //查询该油站是否启用电子会员卡
     @RequestMapping(value = "/getStationCardEnabledFlag", method = RequestMethod.GET)
@@ -240,6 +251,173 @@ public class ElectronicMembershipCardController {
         return gson.toJson(resultData);
     }
 
+    //电子卡支付
+    @RequestMapping(value = "/dzkPaySet", method = RequestMethod.GET)
+    @ResponseBody
+    @Transactional
+    public  String dzkPaySet(@RequestParam String ordNo) throws ParseException {
+        Gson gson =new Gson();
+        ResultData resultData =ResultData.success(CodeMsg.SELECT_ORDER_ERROR);
+        if(ordNo !=null){
+            PayOrder payOrder = new PayOrder();
+            payOrder.setOrderNo(ordNo);
+            //获取用户订单信息
+            Map<String, Object> resultMap = payOrderService.getOrderInfoAndUserInfoByOrderNo(payOrder);
+            if(resultMap !=null && resultMap.get("status").toString().equals("0")){
+                String stationId = resultMap.get("stationId").toString();
+                String oilName =resultMap.get("oilName").toString();
+                String mobilePhone =resultMap.get("mobilePhone").toString();
+                String unionId =resultMap.get("unionId").toString();
+                String minaOpenid =resultMap.get("minaOpenid").toString();
+                String consumerId =resultMap.get("consumerId").toString();
+                String registeDate =resultMap.get("registeDate").toString();
+                String stationName =resultMap.get("stationName").toString();
+                String consumer =resultMap.get("consumer").toString();
+                String oilLiters = resultMap.get("orderLiters").toString();   //orderLiters
+                String receivableAmt = resultMap.get("receivableAmt").toString();
+                String amt = resultMap.get("amt").toString();
+                String orderType = resultMap.get("orderType").toString();
+
+                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 "97#":
+                        cardOilsType ="1";
+                        break;
+                    case "0#":
+                        cardOilsType ="2";
+                        break;
+                    case "-10#":
+                        cardOilsType ="2";
+                        break;
+                    case "-20#":
+                        cardOilsType ="2";
+                        break;
+                }
+                customerElectronicCard.setCardOilsType(cardOilsType);
+                customerElectronicCard.setUnionId(resultMap.get("unionId").toString());
+                customerElectronicCard.setStationId(Integer.valueOf(resultMap.get("stationId").toString()));
+                //获取用户电子会员卡信息
+                CustomerElectronicCard cardInfo = electronicMembershipCardService.getElectronicCardInfoByUnionId(customerElectronicCard);
+                if(cardInfo !=null ){
+                    customerCardUseRecord.setOrderNo(ordNo);                                        //电子会员卡记录订单号
+                    customerCardUseRecord.setUnionId(cardInfo.getUnionId());                        //电子会员卡记录用户唯一标识
+                    customerCardUseRecord.setCustomerNo(cardInfo.getCustomerNo());
+                    customerCardUseRecord.setAmt(new BigDecimal(amt));      //电子会员卡记录用户余额
+                    customerCardUseRecord.setStatus("1");
+                    customerCardUseRecord.setCardOilsType(cardInfo.getCardOilsType());
+                    customerCardUseRecord.setBalance(cardInfo.getAmt().subtract(new BigDecimal(amt)));
+                    customerCardUseRecord.setStationName(cardInfo.getStationName());
+                    customerCardUseRecord.setStationId(cardInfo.getStationId());
+                    customerCardUseRecord.setUsageType("-");
+                    customerCardUseRecord.setCustomerName(payOrder.getConsumer());
+                    customerCardUseRecord.setCreateTime(new Date());
+                    balance = cardInfo.getAmt();
+                }
+                //判断订单金额是否小于电子会员卡的余额
+                if(balance !=null && customerCardUseRecord.getAmt().compareTo(balance) == -1){
+                    electronicMembershipCardService.insetCardUseRecordConsumption(customerCardUseRecord);
+                    //更新电子会员卡余额
+                    CustomerElectronicCard c = new CustomerElectronicCard();
+                    c.setAmt(balance.subtract(customerCardUseRecord.getAmt()));
+                    c.setUnionId(customerCardUseRecord.getUnionId());
+                    c.setStationId(customerCardUseRecord.getStationId());
+                    c.setCardOilsType(cardOilsType);
+                    electronicMembershipCardService.updateElectronicCardInfoByUnionId(c);
+                    payOrder.setPayType("dzk");   //支付方式                                                 //支付类型
+                    payOrder.setStatus("1");
+                    payOrder.setPayDate(new Date());    //支付时间
+                    payOrderService.getUpdatePayOrder(payOrder);
+                    //更新客户表
+                    CustomerManage customerManage = new CustomerManage();
+                    customerManage.setStationId(Integer.valueOf(stationId));
+                    customerManage.setMinaOpenid(minaOpenid);
+                    customerManage.setOilName(oilName);
+                    customerManage.setPhoneNumber(mobilePhone);
+                    Map<String, Object> params_1 = new HashMap<>();
+                    params_1.put("stationId", stationId);
+                    params_1.put("oilName", oilName);
+                    //获取该油站的优惠方式
+                    String discountPlanType = stationService.getStationDiscountWay(stationId);
+                    logger.info("油站优惠方式:"+discountPlanType);
+                    CustomerManage customerManageInfo = customerManagerService.getCustomerManageInfo(customerManage);
+                    if(customerManageInfo !=null){
+                        customerManage.setPhoneNumber(mobilePhone);
+                        customerManage.setAmt(customerManageInfo.getAmt().add(new BigDecimal(amt)));
+                        customerManage.setLiters(customerManageInfo.getLiters().add(new BigDecimal(oilLiters)));
+                        if(discountPlanType !=null && discountPlanType.equals("1")){
+                            List<Map> customerGradeInfo = customerGradeServices.getCustomerGradeList(params_1);  //直降
+                            logger.info("该站直降等级信息:"+ customerGradeInfo);
+                            for (Map m: customerGradeInfo){
+                                if(Double.valueOf(customerManage.getAmt().toString()) >= Double.valueOf(m.get("memberConditStart").toString()) && Double.valueOf(customerManage.getAmt().toString()) < Double.valueOf(m.get("memberConditEnd").toString())){
+                                    customerManage.setGrade(m.get("grade").toString());     //存入等级名称
+                                    customerManage.setMemberGrade(m.get("id").toString());     //存入等级ID
+                                    break;
+                                }
+                            }
+                            logger.info("直降等级信息是否存入客户表:"+ "直降ID:"+ customerManage.getMemberGrade()+ "直降名称: "+customerManage.getGrade());
+                        }
+                        customerManagerService.updateCustomerInfo(customerManage);
+                    }else {
+                        customerManage.setCustomerName(consumer);
+                        customerManage.setStationName(stationName);
+                        customerManage.setLiters(new BigDecimal(oilLiters));
+                        customerManage.setAmt(new BigDecimal(amt));
+                        customerManage.setPhoneNumber(mobilePhone);
+                        customerManage.setMinaUserId(Integer.valueOf(consumerId));
+                        customerManage.setUnionId(unionId);
+                        customerManage.setRegtime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(registeDate));
+                        if(discountPlanType !=null && discountPlanType.equals("1")){
+                            List<Map> customerGradeInfo = customerGradeServices.getCustomerGradeList(params_1);  //直降
+                            logger.info("该站直降等级信息:"+ customerGradeInfo);
+                            if(customerGradeInfo !=null && customerGradeInfo.size() >0){
+                                customerManage.setGrade(customerGradeInfo.get(0).get("grade").toString());     //存入等级名称
+                                customerManage.setMemberGrade(customerGradeInfo.get(0).get("id").toString());     //存入等级ID
+                            }
+                            logger.info("直降等级信息是否存入客户表:"+ "直降ID:"+ customerManage.getMemberGrade()+ "直降名称: "+customerManage.getGrade());
+                        }
+                        customerManagerService.insertCustomerInfo(customerManage);
+                    }
+
+                    StationPayManage stationPayManage = new StationPayManage();
+                    stationPayManage.setStationId(Integer.valueOf(stationId));
+                    StationPayManage stationPayManageInfo = stationService.selectStationPayManage(stationPayManage);
+                    //是否启用积分功能
+                    if(stationPayManageInfo !=null && stationPayManageInfo.getIntegralFlag().equals("1")){
+                        //计算积分
+                        CalculateIntegral calculateIntegral = new CalculateIntegral();
+                        calculateIntegral.setAmt(new BigDecimal(amt));
+                        calculateIntegral.setReceivableAmt(new BigDecimal(receivableAmt));
+                        calculateIntegral.setOilLiters(new BigDecimal(oilLiters));
+                        calculateIntegral.setOilName(oilName);
+                        calculateIntegral.setOilType(orderType);
+                        calculateIntegral.setStationId(Integer.valueOf(stationId));
+                        calculateIntegral.setUnionId(unionId);
+                        calculateIntegral.setOpenId(minaOpenid);   //小程序openId
+                        //计算积分且推送积分
+                        calculateIntegralAndPushIntegral(calculateIntegral, customerManage);
+                    }
+                    resultData = ResultData.success(CodeMsg.SUCCESS);
+                }else {
+                    resultData=ResultData.error(CodeMsg.BALANCE_NOT_EENOUGH);
+                }
+            }
+            else {
+                resultData=ResultData.error(CodeMsg.NO_ORDER);
+            }
+        }
+
+        return gson.toJson(resultData);
+    }
+
     //用户充值电子会员卡(储蓄卡)拉起随行付支付接口
     @RequestMapping(value = "/rechargeBalanceSXFPay", method = RequestMethod.POST)
     @ResponseBody
@@ -561,16 +739,16 @@ public class ElectronicMembershipCardController {
         }
     }
 
-    //获取用户电子会员卡(储蓄卡)充值记录
-    @RequestMapping(value = "/getCardRechargeRecord", method = RequestMethod.GET)
+    //获取用户电子会员卡(储蓄卡)充值消费记录
+    @RequestMapping(value = "/getCardRecordList", method = RequestMethod.GET)
     @ResponseBody
-    public String getCardRechargeRecord(@RequestParam Integer stationId, String unionId){
+    public String getCardRecordList(@RequestParam Integer stationId, String unionId, String usageType){
         Gson gson =new Gson();
         //返回结果集
         ResultData resultData = null;
         if(stationId !=null && unionId !=null){
             CustomerCardUseRecord customerCardUseRecord = new CustomerCardUseRecord();
-            customerCardUseRecord.setUsageType("recharge"); // 'recharge' 代表充值
+            customerCardUseRecord.setUsageType(usageType); // '1' 代表充值 '0' 代表消费
             customerCardUseRecord.setStationId(stationId);
             customerCardUseRecord.setUnionId(unionId);
             List<CustomerCardUseRecord> cardUseRecordList = electronicMembershipCardService.getCardUseRecordList(customerCardUseRecord);
@@ -581,26 +759,6 @@ public class ElectronicMembershipCardController {
         return gson.toJson(resultData);
     }
 
-    //获取用户电子会员卡(储蓄卡)消费记录
-    @RequestMapping(value = "/getCardConsumptionRecord", method = RequestMethod.GET)
-    @ResponseBody
-    public String getCardConsumptionRecord(@RequestParam Integer stationId, String unionId){
-        Gson gson =new Gson();
-        //返回结果集
-        ResultData resultData = null;
-        if(stationId !=null && unionId !=null){
-            CustomerCardUseRecord customerCardUseRecord = new CustomerCardUseRecord();
-            customerCardUseRecord.setUnionId(unionId);
-            customerCardUseRecord.setStationId(stationId);
-            customerCardUseRecord.setUsageType("consumption"); // 'consumption' 代表消费
-            List<CustomerCardUseRecord> cardUseRecordList = electronicMembershipCardService.getCardUseRecordList(customerCardUseRecord);
-            resultData = ResultData.success(cardUseRecordList);
-        }else {
-            resultData = ResultData.error(CodeMsg.REQUEST_FAIL);
-        }
-        return gson.toJson(resultData);
-    }
-
     //查询油站电子会员卡(储蓄卡)充值设置规则
     @RequestMapping(value = "/getCardRechargeSettingList", method = RequestMethod.GET)
     @ResponseBody
@@ -621,4 +779,312 @@ public class ElectronicMembershipCardController {
         return gson.toJson(resultData);
     }
 
+    /*
+     * 计算消费生成积分
+     * 注释:  1.判断油站配置的优惠类型
+     *        2.如果是等级直降则存在等级取对应等级的积分规则,否则按照其他优惠方式
+     */
+    public void calculateIntegralAndPushIntegral(CalculateIntegral calculateIntegral, CustomerManage customerManage){
+        int integral =0;
+        //获取该油站的优惠方式
+        String discountPlanType = stationService.getStationDiscountWay(calculateIntegral.getStationId().toString());
+        IntegralRule integralRule = new IntegralRule();
+        integralRule.setStationId(calculateIntegral.getStationId());
+        integralRule.setEmptyDate(new Date());
+        integralRule.setOilName(calculateIntegral.getOilName());
+        integralRule.setOilType(calculateIntegral.getOilType());
+        //获取该油站的积分规则
+        List<IntegralRule> integralRuleList = integralRuleService.getIntegralRule(integralRule);
+        if(integralRuleList !=null && integralRuleList.size() >0){
+            logger.info("该油站积分规则信息:" + integralRuleList.toString());
+            List<IntegralRuleDetail> integralRuleDetailList = integralRuleList.get(0).getIntegralRuleDetailList();
+            String currentTime = null;          //当前时间
+            String datePickerTime=null;         //活动时间
+            String[] datePickerTimeArray ={};
+            String integralActivity = integralRuleList.get(0).getIntegralActivity();
+            String integralProportion =null;
+            if(integralActivity !=null && integralActivity.equals("1")){
+                datePickerTime = integralRuleList.get(0).getDatePickerTime();
+                integralProportion = integralRuleList.get(0).getIntegralProportion();
+                if(datePickerTime.contains(",")){
+                    datePickerTimeArray = datePickerTime.split(",");
+                }else {
+                    datePickerTimeArray= new String[1];
+                    datePickerTimeArray[0] = datePickerTime;
+                }
+            }
+            if(integralRuleDetailList !=null && integralRuleDetailList.size() >0){
+                Calendar calendar = Calendar.getInstance();
+                calendar.setTime(new Date());   //获取当前时间
+                for (IntegralRuleDetail integralRuleDetail : integralRuleDetailList){
+                    if(integralRuleDetail.getOilType().equals("1")){    //油品
+                        if (integralRuleDetail.getRuleType().equals("1")){  //按照实收金额
+                            if(calculateIntegral.getAmt().compareTo(integralRuleDetail.getRuleTerms()) == 1 || calculateIntegral.getAmt().compareTo(integralRuleDetail.getRuleTerms()) == 0){
+                                BigDecimal divide = null;
+                                BigDecimal multiply = null;
+                                //判断油站配置的优惠类型
+                                if(discountPlanType.equals("1") && integralRuleDetail.getGread() !=null && customerManage.getGrade().equals(integralRuleDetail.getGread())){   //等级直降
+                                    divide = calculateIntegral.getAmt().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN);
+                                    multiply = divide.multiply(integralRuleDetail.getIntegral());
+                                }else {
+                                    divide = calculateIntegral.getAmt().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN);
+                                    multiply = divide.multiply(integralRuleDetail.getIntegral());
+                                }
+                                if(integralActivity !=null && integralActivity.equals("1") &&  datePickerTimeArray !=null && integralProportion !=null){
+                                    String datePicker = integralRuleList.get(0).getDatePicker();
+                                    switch (datePicker){
+                                        case "1":   //  1.按周来
+                                            int day_Week = calendar.get(Calendar.DAY_OF_WEEK);
+                                            day_Week= day_Week-1;     //减一原因:数据库存的下标从零开始
+                                            currentTime = String.valueOf(day_Week);
+                                            break;
+                                        case "2":   //  2.每月的多少号
+                                            int day_month = calendar.get(Calendar.DAY_OF_MONTH);
+                                            day_month = day_month-1;        //减一原因:数据库存的下标从零开始
+                                            currentTime = String.valueOf(day_month); //当前时间
+                                            break;
+                                        case "3":   //  3.固定日期
+                                            currentTime =new SimpleDateFormat("yyyy-MM-dd").format(new Date());
+                                            break;
+                                    }
+                                    for (String s : datePickerTimeArray){
+                                        if(s.equals(currentTime)){
+                                            multiply = multiply.multiply(new BigDecimal(integralProportion));
+                                            break;
+                                        }
+                                    }
+                                }
+                                integral =multiply.intValue();
+                                logger.info("本次客户所得积分:" + integral);
+                                break;
+                            }
+                        }else if (integralRuleDetail.getRuleType().equals("2")){    //按应收金额
+                            if(calculateIntegral.getReceivableAmt().compareTo(integralRuleDetail.getRuleTerms()) ==1 || calculateIntegral.getReceivableAmt().compareTo(integralRuleDetail.getRuleTerms()) ==0){
+                                BigDecimal divide = null;
+                                BigDecimal multiply = null;
+                                //判断油站配置的优惠类型
+                                if(discountPlanType.equals("1") && integralRuleDetail.getGread() !=null && customerManage.getGrade().equals(integralRuleDetail.getGread())){   //等级直降
+                                    divide = calculateIntegral.getReceivableAmt().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN);
+                                    multiply = divide.multiply(integralRuleDetail.getIntegral());
+                                }else {
+                                    divide = calculateIntegral.getReceivableAmt().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN);
+                                    multiply = divide.multiply(integralRuleDetail.getIntegral());
+                                }
+                                if(integralActivity !=null && integralActivity.equals("1") && datePickerTimeArray !=null && integralProportion !=null){
+                                    String datePicker = integralRuleList.get(0).getDatePicker();
+                                    switch (datePicker){
+                                        case "1":   //  1.按周来
+                                            int day_Week = calendar.get(Calendar.DAY_OF_WEEK);
+                                            day_Week= day_Week-1;     //减一原因:数据库存的下标从零开始
+                                            currentTime = String.valueOf(day_Week);
+                                            break;
+                                        case "2":   //  2.每月的 多少号
+                                            int day_month = calendar.get(Calendar.DAY_OF_MONTH);
+                                            day_month = day_month-1;        //减一原因:数据库存的下标从零开始
+                                            currentTime = String.valueOf(day_month); //当前时间
+                                            break;
+                                        case "3":   //  3.固定日期
+                                            currentTime =new SimpleDateFormat("yyyy-MM-dd").format(new Date()); //当前时间
+                                            break;
+                                    }
+                                    for (String s : datePickerTimeArray){
+                                        if(s.equals(currentTime)){
+                                            multiply = multiply.multiply(new BigDecimal(integralProportion));
+                                            break;
+                                        }
+                                    }
+                                }
+                                integral = multiply.intValue();
+                                logger.info("本次客户所得积分:" + integral);
+                                break;
+                            }
+                        }else if (integralRuleDetail.getRuleType().equals("3")){    //按照加油升数
+                            if(calculateIntegral.getOilLiters().compareTo(integralRuleDetail.getRuleTerms()) ==1 || calculateIntegral.getOilLiters().compareTo(integralRuleDetail.getRuleTerms()) ==0){
+                                BigDecimal divide = null;
+                                BigDecimal multiply = null;
+                                //判断油站配置的优惠类型
+                                if(discountPlanType.equals("1") && integralRuleDetail.getGread() !=null && customerManage.getGrade().equals(integralRuleDetail.getGread())){   //等级直降
+                                    divide = calculateIntegral.getOilLiters().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN);
+                                    multiply = divide.multiply(integralRuleDetail.getIntegral());
+                                }else {
+                                    divide = calculateIntegral.getOilLiters().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN);
+                                    multiply = divide.multiply(integralRuleDetail.getIntegral());
+                                }
+                                if(integralActivity !=null && integralActivity.equals("1") && datePickerTimeArray !=null && integralProportion !=null){
+                                    String datePicker = integralRuleList.get(0).getDatePicker();
+                                    switch (datePicker){
+                                        case "1":   //  1.按周来
+                                            int day_Week = calendar.get(Calendar.DAY_OF_WEEK);
+                                            day_Week= day_Week-1;     //减一原因:数据库存的下标从零开始
+                                            currentTime = String.valueOf(day_Week);
+                                            break;
+                                        case "2":  //  2.每月的 多少号
+                                            int day_month = calendar.get(Calendar.DAY_OF_MONTH);
+                                            day_month = day_month-1;        //减一原因:数据库存的下标从零开始
+                                            currentTime = String.valueOf(day_month); //当前时间
+                                            break;
+                                        case "3":   //  3.固定日期
+                                            currentTime =new SimpleDateFormat("yyyy-MM-dd").format(new Date()); //当前时间
+                                            break;
+                                    }
+                                    for (String s : datePickerTimeArray){
+                                        if(s.equals(currentTime)){
+                                            multiply = multiply.multiply(new BigDecimal(integralProportion));
+                                            break;
+                                        }
+                                    }
+                                }
+                                integral =multiply.intValue();
+                                logger.info("本次客户所得积分:" + integral);
+                                break;
+                            }
+                        }
+                    }else if (integralRuleDetail.getOilType().equals("2")){     //非油品
+                        if (calculateIntegral.getReceivableAmt().compareTo(integralRuleDetail.getRuleTerms()) ==1 || calculateIntegral.getReceivableAmt().compareTo(integralRuleDetail.getRuleTerms()) ==0){
+                            BigDecimal divide = null;
+                            BigDecimal multiply = null;
+                            //判断油站配置的优惠类型
+                            if(discountPlanType.equals("1") && integralRuleDetail.getGread() !=null && customerManage.getGrade().equals(integralRuleDetail.getGread())){   //等级直降
+                                divide = calculateIntegral.getReceivableAmt().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN);
+                                multiply = divide.multiply(integralRuleDetail.getIntegral());
+                            }else {
+                                divide = calculateIntegral.getReceivableAmt().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN);
+                                multiply = divide.multiply(integralRuleDetail.getIntegral());
+                            }
+                            if(integralActivity !=null && integralActivity.equals("1") && datePickerTimeArray !=null && integralProportion !=null){
+                                String datePicker = integralRuleList.get(0).getDatePicker();    //获取日期类型
+                                switch (datePicker){
+                                    case "1":   //  1.按周来
+                                        int day_Week = calendar.get(Calendar.DAY_OF_WEEK);
+                                        day_Week= day_Week-1;     //减一原因:数据库存的下标从零开始
+                                        currentTime = String.valueOf(day_Week);
+                                        break;
+                                    case "2":   //  2.每月的 多少号
+                                        int day_month = calendar.get(Calendar.DAY_OF_MONTH);
+                                        day_month = day_month-1;        //减一原因:数据库存的下标从零开始
+                                        currentTime = String.valueOf(day_month); //当前时间
+                                        break;
+                                    case "3":   //  3.固定日期
+                                        currentTime =new SimpleDateFormat("yyyy-MM-dd").format(new Date()); //当前时间
+                                        break;
+                                }
+                                for (String s : datePickerTimeArray){
+                                    if(s.equals(currentTime)){
+                                        multiply = multiply.multiply(new BigDecimal(integralProportion));
+                                        break;
+                                    }
+                                }
+                            }
+                            integral = multiply.intValue();
+                            logger.info("本次客户所得积分:" + integral);
+                            break;
+                        }
+                    }
+                }
+            }
+            calculateIntegral.setIntegral(integral);
+            this.pushIntegral(calculateIntegral);
+        }
+    }
+
+    //更新积分并公众号推送积分
+    public void pushIntegral(CalculateIntegral calculateIntegral){
+        String gzhAppId ="";
+        String gzhAppSecret ="";
+        String stationName = "";        //油站名称
+        BigDecimal surplusIntegral=null;
+        String customerName =calculateIntegral.getNickName();       //客户昵称
+        String openId = calculateIntegral.getOpenId();      //客户小程序ID
+        Integer stationId = calculateIntegral.getStationId();   //油站ID
+        int integral = calculateIntegral.getIntegral();     //当前加油积分
+        String unionId = calculateIntegral.getUnionId();
+        String mobilePhone = calculateIntegral.getMobilePhone();
+        logger.info("客户小程序openId:" + openId);
+        if(StringUtils.isNotBlank(calculateIntegral.getOpenId())){
+            Map<String, String> m = stationService.getStationAppIdAndAppSecret(stationId);
+            if(m !=null && m.containsKey("stationName") && m.containsKey("gzhAppId") && m.containsKey("gzhAppSecret")){
+                stationName = m.get("stationName");
+                gzhAppId = m.get("gzhAppId");
+                gzhAppSecret = m.get("gzhAppSecret");
+            }
+            CustomerPoints customerPoints = new CustomerPoints();
+            customerPoints.setStationId(calculateIntegral.getStationId());
+            customerPoints.setMinaOpenId(openId);
+            customerPoints.setUnionId(calculateIntegral.getUnionId());
+            CustomerPoints customerPointsInfo = customerPointsService.getCustomerPointsInfoByUnionId(customerPoints);
+            if(customerPointsInfo !=null){
+                logger.info("当前存在客户:"+ customerPointsInfo.getMinaOpenId());
+                logger.info("当前客户原有剩余积分:"+ customerPointsInfo.getPoints().toString());
+                customerName =customerPointsInfo.getCustomerName();
+                surplusIntegral =new BigDecimal(customerPointsInfo.getPoints()).add(new BigDecimal(integral));
+                CustomerPointsRecord customerPointsRecord = new CustomerPointsRecord();
+                customerPointsRecord.setCreateTime(new Date());
+                customerPointsRecord.setCustomerName(customerName);
+                customerPointsRecord.setStationName(stationName);
+                customerPointsRecord.setStationId(stationId);
+                customerPointsRecord.setRecordType("+");
+                customerPointsRecord.setUnionId(customerPointsInfo.getUnionId());
+                customerPointsRecord.setIntegral(integral);
+                customerPointsRecordService.insertCustomerPointsRecordInfo(customerPointsRecord);
+                //customerPoints.setUnionId(customerPointsInfo.getUnionId());
+                customerPoints.setPoints(surplusIntegral.intValue());
+                logger.info("本次加油后客户应有总积分:"+ customerPoints.getPoints().toString());
+                //用户已累积积分
+                BigDecimal add = new BigDecimal(customerPointsInfo.getAccumulatePoints()).add(new BigDecimal(integral));
+                customerPoints.setAccumulatePoints(add.intValue());
+                //更新客户积分
+                customerPointsService.updateCustomerPointsInfo(customerPoints);
+                logger.info("更新客户积分信息成功!");
+                String blogOpenId = customerPointsInfo.getBlogOpenId();     //公众号openId
+                if(blogOpenId !=null){
+                    //推送模板
+                    List<WxMpTemplateData> wxMpTemplate = new ArrayList<>();
+                    wxMpTemplate.add(new WxMpTemplateData("first","尊敬的"+customerName+",您好:\n" + "您在"+stationName+"的积分最新交易信息如下"));
+                    wxMpTemplate.add(new WxMpTemplateData("time", new SimpleDateFormat("yyyy年MM月dd日HH时mm分").format(new Date())));
+                    wxMpTemplate.add(new WxMpTemplateData("type", "增加"));
+                    wxMpTemplate.add(new WxMpTemplateData("Point", String.valueOf(integral)));
+                    wxMpTemplate.add(new WxMpTemplateData("From", stationName));
+                    wxMpTemplate.add(new WxMpTemplateData("remark",
+                            "截止至" + new SimpleDateFormat(" yyyy年MM月dd日HH时mm分").format(new Date())+",您在"+stationName+"的可用积分为 "+surplusIntegral.toString()+" 分"));
+                    GzhNewsTemplate gzhNewsTemplate = new GzhNewsTemplate();
+                    gzhNewsTemplate.setStationId(stationId);
+                    gzhNewsTemplate.setTemplateType("1");
+                    GzhNewsTemplate gzhNewsTemplateInfo = gzhNewsTemplateService.getGzhNewsTemplate(gzhNewsTemplate);
+                    if(gzhNewsTemplateInfo !=null && gzhNewsTemplateInfo.getTemplateId() !=null){
+                        wxPushUtil.push(gzhAppId, gzhAppSecret, gzhNewsTemplateInfo.getTemplateId(), blogOpenId, wxMpTemplate);
+                    }
+                }
+
+            }else {
+                logger.info("当前系统不存在该客户积分信息");
+                //customerName =userName;
+                surplusIntegral =new BigDecimal(integral);
+                CustomerPointsRecord customerPointsRecord = new CustomerPointsRecord();
+                customerPointsRecord.setCreateTime(new Date());
+                customerPointsRecord.setCustomerName(customerName);
+                customerPointsRecord.setStationName(stationName);
+                customerPointsRecord.setStationId(stationId);
+                customerPointsRecord.setRecordType("+");
+                customerPointsRecord.setUnionId(unionId);
+                customerPointsRecord.setIntegral(integral);
+                customerPointsRecordService.insertCustomerPointsRecordInfo(customerPointsRecord);
+
+                customerPoints.setUnionId(unionId);
+                customerPoints.setPoints(surplusIntegral.intValue());
+                customerPoints.setPoints(integral);
+                customerPoints.setConsumptionPoints(0);
+                customerPoints.setMobilePhone(mobilePhone);
+                customerPoints.setCustomerName(customerName);
+                customerPoints.setStationName(stationName);
+                customerPoints.setAccumulatePoints(integral);
+                customerPoints.setInvalidPoints(0);
+                customerPoints.setCreateTime(new Date());
+                //新增客户积分
+                customerPointsService.insertCustomerPointsInfo(customerPoints);
+                logger.info("新增客户积分信息成功!");
+            }
+
+        }
+    }
+
 }

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

@@ -55,168 +55,8 @@ public class PayController {
     @Resource
     private  CustomerManagerService customerManagerService;
 
-    /***
-     * 电子卡支付
-     * @param
-     * @return
-     */
-    @RequestMapping(value = "/dzkPaySet", method = RequestMethod.GET)
-    @ResponseBody
-    public  String dzkPaySet(@RequestParam String ordNo) throws ParseException {
-        Gson gson =new Gson();
-        ResultData resultData =null;
-        if(ordNo !=null){
-            PayOrder payOrder = new PayOrder();
-            payOrder.setOrderNo(ordNo);
-            //获取用户订单信息
-            Map<String, Object> resultMap = payOrderService.getOrderInfoAndUserInfoByOrderNo(payOrder);
-            if(resultMap !=null && resultMap.get("status").toString().equals("0")){
-                String stationId = resultMap.get("stationId").toString();
-                String oilName =resultMap.get("oilName").toString();
-                String mobilePhone =resultMap.get("mobilePhone").toString();
-                String unionId =resultMap.get("unionId").toString();
-                String minaOpenid =resultMap.get("minaOpenid").toString();
-                String consumerId =resultMap.get("consumerId").toString();
-                String registeDate =resultMap.get("registeDate").toString();
-                String stationName =resultMap.get("stationName").toString();
-                String consumer =resultMap.get("consumer").toString();
-                String oilLiters = resultMap.get("oilLiters").toString();
-                String receivableAmt = resultMap.get("receivableAmt").toString();
-                String amt = resultMap.get("amt").toString();
-                String orderType = resultMap.get("orderType").toString();
-
-                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 "97#":
-                        cardOilsType ="1";
-                        break;
-                    case "0#":
-                        cardOilsType ="2";
-                        break;
-                    case "-10#":
-                        cardOilsType ="2";
-                        break;
-                    case "-20#":
-                        cardOilsType ="2";
-                        break;
-                }
-                customerElectronicCard.setCardOilsType(cardOilsType);
-                customerElectronicCard.setUnionId(resultMap.get("unionId").toString());
-                customerElectronicCard.setStationId(Integer.valueOf(resultMap.get("stationId").toString()));
-                //获取用户电子会员卡信息
-                CustomerElectronicCard cardInfo = electronicMembershipCardService.getElectronicCardInfoByUnionId(customerElectronicCard);
-                if(cardInfo !=null ){
-                    customerCardUseRecord.setOrderNo(ordNo);                                        //电子会员卡记录订单号
-                    customerCardUseRecord.setUnionId(cardInfo.getUnionId());                        //电子会员卡记录用户唯一标识
-                    customerCardUseRecord.setCustomerNo(cardInfo.getCustomerNo());
-                    customerCardUseRecord.setAmt(new BigDecimal(amt));      //电子会员卡记录用户余额
-                    customerCardUseRecord.setStatus("1");
-                    customerCardUseRecord.setCardOilsType(cardInfo.getCardOilsType());
-                    customerCardUseRecord.setBalance(cardInfo.getAmt().subtract(new BigDecimal(amt)));
-                    customerCardUseRecord.setStationName(cardInfo.getStationName());
-                    customerCardUseRecord.setStationId(cardInfo.getStationId());
-                    customerCardUseRecord.setUsageType("-");
-                    customerCardUseRecord.setCustomerName(payOrder.getConsumer());
-                    customerCardUseRecord.setCreateTime(new Date());
-                    balance = cardInfo.getAmt();
-                }
-                //判断订单金额是否小于电子会员卡的余额
-                if(balance !=null && customerCardUseRecord.getAmt().compareTo(balance) == -1){
-                    electronicMembershipCardService.insetCardUseRecordConsumption(customerCardUseRecord);
-                    //更新电子会员卡余额
-                    CustomerElectronicCard c = new CustomerElectronicCard();
-                    c.setAmt(balance.subtract(customerCardUseRecord.getAmt()));
-                    c.setUnionId(customerCardUseRecord.getUnionId());
-                    c.setStationId(customerCardUseRecord.getStationId());
-                    c.setCardOilsType(cardOilsType);
-                    electronicMembershipCardService.updateElectronicCardInfoByUnionId(c);
-                    payOrder.setPayType("dzk");   //支付方式                                                 //支付类型
-                    payOrder.setStatus("1");
-                    payOrder.setPayDate(new Date());    //支付时间
-                    payOrderService.getUpdatePayOrder(payOrder);
-                    //更新客户表
-                    CustomerManage customerManage = new CustomerManage();
-                    customerManage.setStationId(Integer.valueOf(stationId));
-                    customerManage.setMinaOpenid(minaOpenid);
-                    customerManage.setOilName(oilName);
-                    customerManage.setPhoneNumber(mobilePhone);
-                    Map<String, Object> params_1 = new HashMap<>();
-                    params_1.put("stationId", stationId);
-                    params_1.put("oilName", oilName);
-                    //获取该油站的优惠方式
-                    String discountPlanType = stationService.getStationDiscountWay(stationId);
-                    logger.info("油站优惠方式:"+discountPlanType);
-                    CustomerManage customerManageInfo = customerManagerService.getCustomerManageInfo(customerManage);
-                    if(customerManageInfo !=null){
-                        customerManage.setPhoneNumber(mobilePhone);
-                        customerManage.setAmt(customerManageInfo.getAmt().add(new BigDecimal(amt)));
-                        customerManage.setLiters(customerManageInfo.getLiters().add(new BigDecimal(oilLiters)));
-                        if(discountPlanType !=null && discountPlanType.equals("1")){
-                            List<Map> customerGradeInfo = customerGradeServices.getCustomerGradeList(params_1);  //直降
-                            logger.info("该站直降等级信息:"+ customerGradeInfo);
-                            for (Map m: customerGradeInfo){
-                                if(Double.valueOf(customerManage.getAmt().toString()) >= Double.valueOf(m.get("memberConditStart").toString()) && Double.valueOf(customerManage.getAmt().toString()) < Double.valueOf(m.get("memberConditEnd").toString())){
-                                    customerManage.setGrade(m.get("grade").toString());     //存入等级名称
-                                    customerManage.setMemberGrade(m.get("id").toString());     //存入等级ID
-                                    break;
-                                }
-                            }
-                            logger.info("直降等级信息是否存入客户表:"+ "直降ID:"+ customerManage.getMemberGrade()+ "直降名称: "+customerManage.getGrade());
-                        }
-                        customerManagerService.updateCustomerInfo(customerManage);
-                    }else {
-                        customerManage.setCustomerName(consumer);
-                        customerManage.setStationName(stationName);
-                        customerManage.setLiters(new BigDecimal(oilLiters));
-                        customerManage.setAmt(new BigDecimal(amt));
-                        customerManage.setPhoneNumber(mobilePhone);
-                        customerManage.setMinaUserId(Integer.valueOf(consumerId));
-                        customerManage.setUnionId(unionId);
-                        customerManage.setRegtime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(registeDate));
-                        if(discountPlanType !=null && discountPlanType.equals("1")){
-                            List<Map> customerGradeInfo = customerGradeServices.getCustomerGradeList(params_1);  //直降
-                            logger.info("该站直降等级信息:"+ customerGradeInfo);
-                            if(customerGradeInfo !=null && customerGradeInfo.size() >0){
-                                customerManage.setGrade(customerGradeInfo.get(0).get("grade").toString());     //存入等级名称
-                                customerManage.setMemberGrade(customerGradeInfo.get(0).get("id").toString());     //存入等级ID
-                            }
-                            logger.info("直降等级信息是否存入客户表:"+ "直降ID:"+ customerManage.getMemberGrade()+ "直降名称: "+customerManage.getGrade());
-                        }
-                        customerManagerService.insertCustomerInfo(customerManage);
-                    }
 
 
-                    //计算积分
-                    CalculateIntegral calculateIntegral = new CalculateIntegral();
-                    calculateIntegral.setAmt(new BigDecimal(amt));
-                    calculateIntegral.setReceivableAmt(new BigDecimal(receivableAmt));
-                    calculateIntegral.setOilLiters(new BigDecimal(oilLiters));
-                    calculateIntegral.setOilName(oilName);
-                    calculateIntegral.setOilType(orderType);
-                    calculateIntegral.setStationId(Integer.valueOf(stationId));
-                    calculateIntegral.setUnionId(unionId);
-                    calculateIntegral.setOpenId(minaOpenid);   //小程序openId
-                    //计算积分且推送积分
-                    this.calculateIntegralAndPushIntegral(calculateIntegral, customerManage);
-                    resultData = ResultData.success(CodeMsg.SUCCESS);
-                }else {
-                    resultData=ResultData.error(CodeMsg.BALANCE_NOT_EENOUGH);
-                }
-            }
-        }
-
-        return gson.toJson(resultData);
-    }
-
 
     /***
      * 微信子商户支付接口
@@ -721,24 +561,30 @@ public class PayController {
                         if(infoMap != null && infoMap.containsKey("mobilePhone") && infoMap.get("mobilePhone") !=null ){
                             //插入客户积分返回要插入客户的信息
                             CustomerManage customerManage = insertCustomerManage(infoMap);
-                            //计算积分并推送
-                            CalculateIntegral calculateIntegral = new CalculateIntegral();
-                            calculateIntegral.setOpenId(infoMap.get("minaOpenid").toString());
-                            calculateIntegral.setStationId(Integer.valueOf(infoMap.get("stationId").toString()));
-                            calculateIntegral.setAmt(new BigDecimal(infoMap.get("amt").toString()));
-                            if(infoMap.containsKey("orderType") && infoMap.get("orderType").toString().equals("1")){
-                                calculateIntegral.setOilType(infoMap.get("orderType").toString());
-                                calculateIntegral.setOilName(infoMap.get("oilName").toString());
-                                calculateIntegral.setOilLiters(new BigDecimal(infoMap.get("orderLiters").toString()));
-                            }else if(infoMap.containsKey("orderType") && infoMap.get("orderType").toString().equals("2")){
-                                calculateIntegral.setOilType(infoMap.get("orderType").toString());
+                            StationPayManage stationPayManage = new StationPayManage();
+                            stationPayManage.setStationId(Integer.valueOf(infoMap.get("stationId").toString()));
+                            StationPayManage stationPayManageInfo = stationService.selectStationPayManage(stationPayManage);
+                            //是否启用积分功能
+                            if(stationPayManageInfo !=null && stationPayManageInfo.getIntegralFlag().equals("1")){
+                                //计算积分并推送
+                                CalculateIntegral calculateIntegral = new CalculateIntegral();
+                                calculateIntegral.setOpenId(infoMap.get("minaOpenid").toString());
+                                calculateIntegral.setStationId(Integer.valueOf(infoMap.get("stationId").toString()));
+                                calculateIntegral.setAmt(new BigDecimal(infoMap.get("amt").toString()));
+                                if(infoMap.containsKey("orderType") && infoMap.get("orderType").toString().equals("1")){
+                                    calculateIntegral.setOilType(infoMap.get("orderType").toString());
+                                    calculateIntegral.setOilName(infoMap.get("oilName").toString());
+                                    calculateIntegral.setOilLiters(new BigDecimal(infoMap.get("orderLiters").toString()));
+                                }else if(infoMap.containsKey("orderType") && infoMap.get("orderType").toString().equals("2")){
+                                    calculateIntegral.setOilType(infoMap.get("orderType").toString());
+                                }
+                                calculateIntegral.setUnionId(infoMap.get("unionId").toString());
+                                calculateIntegral.setNickName(infoMap.get("consumer").toString());
+                                calculateIntegral.setMobilePhone(infoMap.get("mobilePhone").toString());
+                                calculateIntegral.setReceivableAmt(new BigDecimal(infoMap.get("receivableAmt").toString()));
+                                //计算积分并推送
+                                this.calculateIntegralAndPushIntegral(calculateIntegral, customerManage);
                             }
-                            calculateIntegral.setUnionId(infoMap.get("unionId").toString());
-                            calculateIntegral.setNickName(infoMap.get("consumer").toString());
-                            calculateIntegral.setMobilePhone(infoMap.get("mobilePhone").toString());
-                            calculateIntegral.setReceivableAmt(new BigDecimal(infoMap.get("receivableAmt").toString()));
-                            //计算积分并推送
-                            this.calculateIntegralAndPushIntegral(calculateIntegral, customerManage);
                             //打印小票
                             this.printReceipt(infoMap);
                         }else{

+ 13 - 11
YijiaRestful/src/main/java/com/platform/yijia/controller/PosMachineController.java

@@ -466,17 +466,19 @@ public class PosMachineController {
             stationClassesSummary.setClassesMan(stationclass.getClassStructureMan());
             i=stationClassesSummaryService.insertStationClassesSummary(stationClassesSummary);
             if(i==1){
-                //查询班结小票数据
-                StationClassStructure classStructure= new StationClassStructure();
-                classStructure.setClassStructureNo(no);
-                classStructure.setStationId(stationId);
-                //根据油品汇总数据
-                List<StationClassStructure> list= stationClassStructureService.listOilStructure(classStructure);
-                if(list!=null && list.size()>0){
-                    map.put("code","200");
-                    map.put("msg","班结成功");
-                    map.put("oilList",list);
-                }
+                map.put("code","200");
+                map.put("msg","班结成功");
+//                //查询班结小票数据
+//                StationClassStructure classStructure= new StationClassStructure();
+//                classStructure.setClassStructureNo(no);
+//                classStructure.setStationId(stationId);
+//                //根据油品汇总数据
+//                List<StationClassStructure> list= stationClassStructureService.listOilStructure(classStructure);
+//                if(list!=null && list.size()>0){
+//                    map.put("code","200");
+//                    map.put("msg","班结成功");
+//                    map.put("oilList",list);
+//                }
             }
         }else{
             map.put("code","100");

+ 19 - 0
YijiaRestful/src/main/java/com/platform/yijia/controller/StationController.java

@@ -56,6 +56,25 @@ public class StationController {
     }
 
     //获取油站信息
+    @RequestMapping(value = "/selectStationPayManage", method = RequestMethod.GET)
+    @ResponseBody
+    public String selectStationPayManage(@RequestParam Integer stationId){
+        Gson gson =new Gson();
+        //返回结果集
+        ResultData resultData=null;
+        if(stationId !=null){
+            StationPayManage stationPayManage = new StationPayManage();
+            stationPayManage.setStationId(stationId);
+            StationPayManage stationPayManageInfo = stationService.selectStationPayManage(stationPayManage);
+            resultData =ResultData.success(stationPayManageInfo);
+        }else {
+            resultData =ResultData.error(CodeMsg.REQUEST_FAIL);
+        }
+        return gson.toJson(resultData);
+    }
+
+
+    //获取油站信息
     @RequestMapping(value = "/getStationInfo", method = RequestMethod.GET)
     @ResponseBody
     public String getStationInfo(@RequestParam Integer stationId){

+ 3 - 115
YijiaRestful/src/main/java/com/platform/yijia/dao/StationPayManageMapper.java

@@ -1,120 +1,8 @@
 package com.platform.yijia.dao;
 
 import com.platform.yijia.pojo.StationPayManage;
-import com.platform.yijia.pojo.StationPayManageExample;
-import java.util.List;
-import org.apache.ibatis.annotations.Param;
 
 public interface StationPayManageMapper {
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table station_pay_manage
-     *
-     * @mbg.generated
-     */
-    long countByExample(StationPayManageExample example);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table station_pay_manage
-     *
-     * @mbg.generated
-     */
-    int deleteByExample(StationPayManageExample example);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table station_pay_manage
-     *
-     * @mbg.generated
-     */
-    int deleteByPrimaryKey(Integer payId);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table station_pay_manage
-     *
-     * @mbg.generated
-     */
-    int insert(StationPayManage record);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table station_pay_manage
-     *
-     * @mbg.generated
-     */
-    int insertSelective(StationPayManage record);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table station_pay_manage
-     *
-     * @mbg.generated
-     */
-    List<StationPayManage> selectByExampleWithBLOBs(StationPayManageExample example);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table station_pay_manage
-     *
-     * @mbg.generated
-     */
-    List<StationPayManage> selectByExample(StationPayManageExample example);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table station_pay_manage
-     *
-     * @mbg.generated
-     */
-    StationPayManage selectByPrimaryKey(Integer payId);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table station_pay_manage
-     *
-     * @mbg.generated
-     */
-    int updateByExampleSelective(@Param("record") StationPayManage record, @Param("example") StationPayManageExample example);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table station_pay_manage
-     *
-     * @mbg.generated
-     */
-    int updateByExampleWithBLOBs(@Param("record") StationPayManage record, @Param("example") StationPayManageExample example);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table station_pay_manage
-     *
-     * @mbg.generated
-     */
-    int updateByExample(@Param("record") StationPayManage record, @Param("example") StationPayManageExample example);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table station_pay_manage
-     *
-     * @mbg.generated
-     */
-    int updateByPrimaryKeySelective(StationPayManage record);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table station_pay_manage
-     *
-     * @mbg.generated
-     */
-    int updateByPrimaryKeyWithBLOBs(StationPayManage record);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table station_pay_manage
-     *
-     * @mbg.generated
-     */
-    int updateByPrimaryKey(StationPayManage record);
-}
+    //查询油站配置信息
+    StationPayManage selectStationPayManage(StationPayManage stationPayManage);
+}

+ 10 - 382
YijiaRestful/src/main/java/com/platform/yijia/pojo/StationPayManage.java

@@ -1,399 +1,27 @@
 package com.platform.yijia.pojo;
 
+import lombok.Data;
+
+@Data
 public class StationPayManage {
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column station_pay_manage.pay_id
-     *
-     * @mbg.generated
-     */
     private Integer payId;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column station_pay_manage.pay_mode
-     *
-     * @mbg.generated
-     */
     private String payMode;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column station_pay_manage.station_id
-     *
-     * @mbg.generated
-     */
     private Integer stationId;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column station_pay_manage.station_name
-     *
-     * @mbg.generated
-     */
     private String stationName;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column station_pay_manage.image_photos_flag
-     *
-     * @mbg.generated
-     */
     private String imagePhotosFlag;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column station_pay_manage.card_enabled_flag
-     *
-     * @mbg.generated
-     */
     private String cardEnabledFlag;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column station_pay_manage.preferential_way_share_flag
-     *
-     * @mbg.generated
-     */
     private String preferentialWayShareFlag;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column station_pay_manage.other_preferential_way
-     *
-     * @mbg.generated
-     */
     private String otherPreferentialWay;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column station_pay_manage.pay_print_num
-     *
-     * @mbg.generated
-     */
     private Integer payPrintNum;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column station_pay_manage.pay_callback_page
-     *
-     * @mbg.generated
-     */
     private String payCallbackPage;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column station_pay_manage.ws_print_flag
-     *
-     * @mbg.generated
-     */
     private String wsPrintFlag;
-
-    /**
-     *
-     * This field was generated by MyBatis Generator.
-     * This field corresponds to the database column station_pay_manage.activity_pic
-     *
-     * @mbg.generated
-     */
     private byte[] activityPic;
+    private String printSetting;
+    private String discountSetting;     //优惠设置
+    private String isNoOil;         //是否是油品
+    private String notice;          //油站公告信息
+    private String integralFlag;    //是否开启积分
+    private String integralPrintFlag;       //是否打印小票
 
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column station_pay_manage.pay_id
-     *
-     * @return the value of station_pay_manage.pay_id
-     *
-     * @mbg.generated
-     */
-    public Integer getPayId() {
-        return payId;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column station_pay_manage.pay_id
-     *
-     * @param payId the value for station_pay_manage.pay_id
-     *
-     * @mbg.generated
-     */
-    public void setPayId(Integer payId) {
-        this.payId = payId;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column station_pay_manage.pay_mode
-     *
-     * @return the value of station_pay_manage.pay_mode
-     *
-     * @mbg.generated
-     */
-    public String getPayMode() {
-        return payMode;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column station_pay_manage.pay_mode
-     *
-     * @param payMode the value for station_pay_manage.pay_mode
-     *
-     * @mbg.generated
-     */
-    public void setPayMode(String payMode) {
-        this.payMode = payMode == null ? null : payMode.trim();
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column station_pay_manage.station_id
-     *
-     * @return the value of station_pay_manage.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_pay_manage.station_id
-     *
-     * @param stationId the value for station_pay_manage.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_pay_manage.station_name
-     *
-     * @return the value of station_pay_manage.station_name
-     *
-     * @mbg.generated
-     */
-    public String getStationName() {
-        return stationName;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column station_pay_manage.station_name
-     *
-     * @param stationName the value for station_pay_manage.station_name
-     *
-     * @mbg.generated
-     */
-    public void setStationName(String stationName) {
-        this.stationName = stationName == null ? null : stationName.trim();
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column station_pay_manage.image_photos_flag
-     *
-     * @return the value of station_pay_manage.image_photos_flag
-     *
-     * @mbg.generated
-     */
-    public String getImagePhotosFlag() {
-        return imagePhotosFlag;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column station_pay_manage.image_photos_flag
-     *
-     * @param imagePhotosFlag the value for station_pay_manage.image_photos_flag
-     *
-     * @mbg.generated
-     */
-    public void setImagePhotosFlag(String imagePhotosFlag) {
-        this.imagePhotosFlag = imagePhotosFlag == null ? null : imagePhotosFlag.trim();
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column station_pay_manage.card_enabled_flag
-     *
-     * @return the value of station_pay_manage.card_enabled_flag
-     *
-     * @mbg.generated
-     */
-    public String getCardEnabledFlag() {
-        return cardEnabledFlag;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column station_pay_manage.card_enabled_flag
-     *
-     * @param cardEnabledFlag the value for station_pay_manage.card_enabled_flag
-     *
-     * @mbg.generated
-     */
-    public void setCardEnabledFlag(String cardEnabledFlag) {
-        this.cardEnabledFlag = cardEnabledFlag == null ? null : cardEnabledFlag.trim();
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column station_pay_manage.preferential_way_share_flag
-     *
-     * @return the value of station_pay_manage.preferential_way_share_flag
-     *
-     * @mbg.generated
-     */
-    public String getPreferentialWayShareFlag() {
-        return preferentialWayShareFlag;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column station_pay_manage.preferential_way_share_flag
-     *
-     * @param preferentialWayShareFlag the value for station_pay_manage.preferential_way_share_flag
-     *
-     * @mbg.generated
-     */
-    public void setPreferentialWayShareFlag(String preferentialWayShareFlag) {
-        this.preferentialWayShareFlag = preferentialWayShareFlag == null ? null : preferentialWayShareFlag.trim();
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column station_pay_manage.other_preferential_way
-     *
-     * @return the value of station_pay_manage.other_preferential_way
-     *
-     * @mbg.generated
-     */
-    public String getOtherPreferentialWay() {
-        return otherPreferentialWay;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column station_pay_manage.other_preferential_way
-     *
-     * @param otherPreferentialWay the value for station_pay_manage.other_preferential_way
-     *
-     * @mbg.generated
-     */
-    public void setOtherPreferentialWay(String otherPreferentialWay) {
-        this.otherPreferentialWay = otherPreferentialWay == null ? null : otherPreferentialWay.trim();
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column station_pay_manage.pay_print_num
-     *
-     * @return the value of station_pay_manage.pay_print_num
-     *
-     * @mbg.generated
-     */
-    public Integer getPayPrintNum() {
-        return payPrintNum;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column station_pay_manage.pay_print_num
-     *
-     * @param payPrintNum the value for station_pay_manage.pay_print_num
-     *
-     * @mbg.generated
-     */
-    public void setPayPrintNum(Integer payPrintNum) {
-        this.payPrintNum = payPrintNum;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column station_pay_manage.pay_callback_page
-     *
-     * @return the value of station_pay_manage.pay_callback_page
-     *
-     * @mbg.generated
-     */
-    public String getPayCallbackPage() {
-        return payCallbackPage;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column station_pay_manage.pay_callback_page
-     *
-     * @param payCallbackPage the value for station_pay_manage.pay_callback_page
-     *
-     * @mbg.generated
-     */
-    public void setPayCallbackPage(String payCallbackPage) {
-        this.payCallbackPage = payCallbackPage == null ? null : payCallbackPage.trim();
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column station_pay_manage.ws_print_flag
-     *
-     * @return the value of station_pay_manage.ws_print_flag
-     *
-     * @mbg.generated
-     */
-    public String getWsPrintFlag() {
-        return wsPrintFlag;
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column station_pay_manage.ws_print_flag
-     *
-     * @param wsPrintFlag the value for station_pay_manage.ws_print_flag
-     *
-     * @mbg.generated
-     */
-    public void setWsPrintFlag(String wsPrintFlag) {
-        this.wsPrintFlag = wsPrintFlag == null ? null : wsPrintFlag.trim();
-    }
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method returns the value of the database column station_pay_manage.activity_pic
-     *
-     * @return the value of station_pay_manage.activity_pic
-     *
-     * @mbg.generated
-     */
-    public byte[] getActivityPic() {
-        return activityPic;
-    }
 
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method sets the value of the database column station_pay_manage.activity_pic
-     *
-     * @param activityPic the value for station_pay_manage.activity_pic
-     *
-     * @mbg.generated
-     */
-    public void setActivityPic(byte[] activityPic) {
-        this.activityPic = activityPic;
-    }
-}
+}

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

@@ -5,6 +5,7 @@ import com.platform.yijia.param.response.StationInfoResponse;
 import com.platform.yijia.param.response.StationInfoVo;
 import com.platform.yijia.pojo.StationInfo;
 import com.platform.yijia.pojo.StationOilPrice;
+import com.platform.yijia.pojo.StationPayManage;
 import com.platform.yijia.pojo.StationPic;
 
 import java.util.List;
@@ -47,4 +48,7 @@ public interface StationService {
 
     //获取油站的打印机
     List<Map<String, Object>> getStationPrinterList(Integer stationId);
+
+    //查询油站配置信息
+    StationPayManage selectStationPayManage(StationPayManage stationPayManage);
 }

+ 12 - 4
YijiaRestful/src/main/java/com/platform/yijia/service/impl/StationServiceImpl.java

@@ -1,13 +1,11 @@
 package com.platform.yijia.service.impl;
 import com.platform.yijia.dao.StationInfoMapper;
 import com.platform.yijia.dao.StationOilPriceMapper;
+import com.platform.yijia.dao.StationPayManageMapper;
 import com.platform.yijia.param.request.StationRequest;
 import com.platform.yijia.param.response.StationInfoResponse;
 import com.platform.yijia.param.response.StationInfoVo;
-import com.platform.yijia.pojo.StationInfo;
-import com.platform.yijia.pojo.StationInfoExample;
-import com.platform.yijia.pojo.StationOilPrice;
-import com.platform.yijia.pojo.StationPic;
+import com.platform.yijia.pojo.*;
 import com.platform.yijia.service.StationService;
 import com.platform.yijia.utils.MapHelper;
 import com.platform.yijia.utils.PageUtil;
@@ -27,6 +25,16 @@ public class StationServiceImpl implements StationService {
 
     @Resource
     private StationOilPriceMapper stationOilPriceMapper;
+
+    @Resource
+    private StationPayManageMapper stationPayManageMapper;
+
+    //查询油站配置信息
+    @Override
+    public StationPayManage selectStationPayManage(StationPayManage stationPayManage) {
+        return stationPayManageMapper.selectStationPayManage(stationPayManage);
+    }
+
     //获取油站信息
     @Override
     public StationInfo selectStationInfo(StationInfo stationInfo) {

+ 2 - 0
YijiaRestful/src/main/java/com/platform/yijia/utils/CodeMsg.java

@@ -10,6 +10,8 @@ public class CodeMsg {
     public static CodeMsg USER_NOT_EXSIST = new CodeMsg(-1,"用户不存在");
     public static CodeMsg USER_EXSIST_CARD = new CodeMsg(-1,"该用户暂无此卡");
     public static CodeMsg USER_EXSIST = new CodeMsg(-1,"用户已存在");
+    public static CodeMsg NO_ORDER = new CodeMsg(-2,"暂无此订单");
+    public static CodeMsg SELECT_ORDER_ERROR = new CodeMsg(-1,"此订单已完成支付,请重新下单");
     public static CodeMsg BALANCE_NOT_EENOUGH = new CodeMsg(-2,"电子卡余额不足");
     public static CodeMsg PASSWORD_ERROR = new CodeMsg(-2,"密码错误");
     public static CodeMsg ACCOUNT_DISABLE = new CodeMsg(-3,"该账号已被停用");

+ 35 - 2
YijiaRestful/src/main/resources/mapper/ElectronicMembershipCardMapper.xml

@@ -392,14 +392,47 @@
         ORDER BY create_time DESC
     </sql>
 
+    <!--全部-->
+    <sql id="Base_Column_List">
+        SELECT
+            union_id, station_id, amt, present_amt, usage_type, create_time, `status`
+        FROM customer_card_record_recharge
+        <where>
+            status ="1"
+            <if test="stationId !=null and stationId !=''">
+                AND station_id = #{stationId}
+            </if>
+            <if test="unionId !=null and unionId !=''">
+                AND union_id = #{unionId}
+            </if>
+        </where>
+        UNION ALL
+        SELECT
+            union_id, station_id, amt, "0" AS present_amt, usage_type,create_time,  `status`
+        FROM customer_card_record_consumption
+        <where>
+            status ="1"
+            <if test="stationId !=null and stationId !=''">
+                AND station_id = #{stationId}
+            </if>
+            <if test="unionId !=null and unionId !=''">
+                AND union_id = #{unionId}
+            </if>
+        </where>
+        ORDER BY create_time DESC
+    </sql>
+
     <!--查询客户电子会员卡的使用记录-->
     <select id="getCardUseRecordList" resultMap="CardRecordBaseResultMap" parameterType="com.platform.yijia.pojo.CustomerCardUseRecord">
-        <if test="usageType !=null and usageType =='consumption'">
+        <if test="usageType !=null and usageType =='0'.toString()">
             <include refid="Base_Column_List_consumption"/>
         </if>
-        <if test="usageType !=null and usageType =='recharge'">
+        <if test="usageType !=null and usageType =='1'.toString()">
             <include refid="Base_Column_List_recharge"/>
         </if>
+        <if test="usageType ==''">
+            <include refid="Base_Column_List"/>
+        </if>
     </select>
 
 

+ 8 - 6
YijiaRestful/src/main/resources/mapper/PayOrderMapper.xml

@@ -169,13 +169,15 @@
   </sql>
   <sql id="Base_Column_List_NoGroupBy">
         SELECT
-            COUNT(T2.order_no)               AS orderSum,
-            SUM(IFNULL(T2.order_liters,0))   AS orderLitersSum,
-            SUM(IFNULL(T2.receivable_amt,0)) AS receivableAmtSum,
-            SUM(IFNULL(T2.discount_amt,0))   AS discountAmtSum,
-            SUM(IFNULL(T2.amt,0))            AS amtSum
+            COUNT(T2.order_no)                  AS orderSum,
+            SUM(IFNULL(T2.order_liters,0))      AS orderLitersSum,
+            SUM(IFNULL(T2.receivable_amt,0))    AS receivableAmtSum,
+            SUM(IFNULL(T2.discount_amt,0))      AS discountAmtSum,
+            SUM(IFNULL(T2.amt,0))               AS amtSum,
+            SUM(IFNULL(T2.received_amt,0))      AS receivedAmtSum,
+            SUM(IFNULL(T2.print_count,0))       AS printCountSum
         FROM
-            pay_order                        AS T2
+            pay_order                           AS T2
         <where>
             <if test="stationId !=null">
                  T2.station_id= #{stationId}

+ 32 - 447
YijiaRestful/src/main/resources/mapper/StationPayManageMapper.xml

@@ -2,457 +2,42 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.platform.yijia.dao.StationPayManageMapper">
   <resultMap id="BaseResultMap" type="com.platform.yijia.pojo.StationPayManage">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    <id column="pay_id" jdbcType="INTEGER" property="payId" />
-    <result column="pay_mode" jdbcType="VARCHAR" property="payMode" />
-    <result column="station_id" jdbcType="INTEGER" property="stationId" />
-    <result column="station_name" jdbcType="VARCHAR" property="stationName" />
-    <result column="image_photos_flag" jdbcType="CHAR" property="imagePhotosFlag" />
-    <result column="card_enabled_flag" jdbcType="CHAR" property="cardEnabledFlag" />
-    <result column="preferential_way_share_flag" jdbcType="CHAR" property="preferentialWayShareFlag" />
-    <result column="other_preferential_way" jdbcType="VARCHAR" property="otherPreferentialWay" />
-    <result column="pay_print_num" jdbcType="INTEGER" property="payPrintNum" />
-    <result column="pay_callback_page" jdbcType="VARCHAR" property="payCallbackPage" />
-    <result column="ws_print_flag" jdbcType="CHAR" property="wsPrintFlag" />
+    <id     column="pay_id"                           jdbcType="INTEGER"       property="payId" />
+    <result column="pay_mode"                         jdbcType="VARCHAR"       property="payMode" />
+    <result column="station_id"                       jdbcType="INTEGER"       property="stationId" />
+    <result column="station_name"                     jdbcType="VARCHAR"       property="stationName" />
+    <result column="image_photos_flag"                jdbcType="CHAR"          property="imagePhotosFlag" />
+    <result column="activity_pic"                     jdbcType="LONGVARBINARY" property="activityPic" />
+    <result column="card_enabled_flag"                jdbcType="CHAR"          property="cardEnabledFlag" />
+    <result column="preferential_way_share_flag"      jdbcType="CHAR"          property="preferentialWayShareFlag" />
+    <result column="other_preferential_way"           jdbcType="VARCHAR"       property="otherPreferentialWay" />
+    <result column="pay_print_num"                    jdbcType="INTEGER"       property="payPrintNum" />
+    <result column="pay_callback_page"                jdbcType="VARCHAR"       property="payCallbackPage" />
+    <result column="ws_print_flag"                    jdbcType="CHAR"          property="wsPrintFlag" />
+    <result column="print_setting"                    jdbcType="VARCHAR"       property="printSetting" />
+    <result column="discount_setting"                 jdbcType="VARCHAR"       property="discountSetting" />
+    <result column="is_no_oil"                        jdbcType="VARCHAR"       property="isNoOil" />
+    <result column="notice"                           jdbcType="VARCHAR"       property="notice" />
+    <result column="integral_flag"                    jdbcType="VARCHAR"       property="integralFlag" />
+    <result column="integral_print_flag"              jdbcType="VARCHAR"       property="integralPrintFlag" />
   </resultMap>
-  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.platform.yijia.pojo.StationPayManage">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    <result column="activity_pic" jdbcType="LONGVARBINARY" property="activityPic" />
-  </resultMap>
-  <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 id="Base_Column_List">
+    pay_id, pay_mode, station_id, station_name, image_photos_flag,activity_pic, card_enabled_flag,
+    preferential_way_share_flag, other_preferential_way, pay_print_num, pay_callback_page,
+    ws_print_flag, print_setting, discount_setting, is_no_oil, notice, integral_flag, integral_print_flag
   </sql>
-  <sql id="Update_By_Example_Where_Clause">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
+    <!--查询油站配置信息-->
+  <select id="selectStationPayManage" parameterType="com.platform.yijia.pojo.StationPayManage" resultMap="BaseResultMap">
+    SELECT
+        <include refid="Base_Column_List" />
+    FROM station_pay
     <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 test="stationId !=null">
+            station_id = #{stationId}
         </if>
-      </foreach>
     </where>
-  </sql>
-  <sql id="Base_Column_List">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    pay_id, pay_mode, station_id, station_name, image_photos_flag, card_enabled_flag,
-    preferential_way_share_flag, other_preferential_way, pay_print_num, pay_callback_page,
-    ws_print_flag
-  </sql>
-  <sql id="Blob_Column_List">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    activity_pic
-  </sql>
-  <select id="selectByExampleWithBLOBs" parameterType="com.platform.yijia.pojo.StationPayManageExample" resultMap="ResultMapWithBLOBs">
-    <!--
-      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" />
-    ,
-    <include refid="Blob_Column_List" />
-    from station_pay_manage
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-    <if test="orderByClause != null">
-      order by ${orderByClause}
-    </if>
-  </select>
-  <select id="selectByExample" parameterType="com.platform.yijia.pojo.StationPayManageExample" 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_pay_manage
-    <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="ResultMapWithBLOBs">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    select
-    <include refid="Base_Column_List" />
-    ,
-    <include refid="Blob_Column_List" />
-    from station_pay_manage
-    where pay_id = #{payId,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_pay_manage
-    where pay_id = #{payId,jdbcType=INTEGER}
-  </delete>
-  <delete id="deleteByExample" parameterType="com.platform.yijia.pojo.StationPayManageExample">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    delete from station_pay_manage
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-  </delete>
-  <insert id="insert" parameterType="com.platform.yijia.pojo.StationPayManage">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    insert into station_pay_manage (pay_id, pay_mode, station_id,
-      station_name, image_photos_flag, card_enabled_flag,
-      preferential_way_share_flag, other_preferential_way,
-      pay_print_num, pay_callback_page, ws_print_flag,
-      activity_pic)
-    values (#{payId,jdbcType=INTEGER}, #{payMode,jdbcType=VARCHAR}, #{stationId,jdbcType=INTEGER},
-      #{stationName,jdbcType=VARCHAR}, #{imagePhotosFlag,jdbcType=CHAR}, #{cardEnabledFlag,jdbcType=CHAR},
-      #{preferentialWayShareFlag,jdbcType=CHAR}, #{otherPreferentialWay,jdbcType=VARCHAR},
-      #{payPrintNum,jdbcType=INTEGER}, #{payCallbackPage,jdbcType=VARCHAR}, #{wsPrintFlag,jdbcType=CHAR},
-      #{activityPic,jdbcType=LONGVARBINARY})
-  </insert>
-  <insert id="insertSelective" parameterType="com.platform.yijia.pojo.StationPayManage">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    insert into station_pay_manage
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="payId != null">
-        pay_id,
-      </if>
-      <if test="payMode != null">
-        pay_mode,
-      </if>
-      <if test="stationId != null">
-        station_id,
-      </if>
-      <if test="stationName != null">
-        station_name,
-      </if>
-      <if test="imagePhotosFlag != null">
-        image_photos_flag,
-      </if>
-      <if test="cardEnabledFlag != null">
-        card_enabled_flag,
-      </if>
-      <if test="preferentialWayShareFlag != null">
-        preferential_way_share_flag,
-      </if>
-      <if test="otherPreferentialWay != null">
-        other_preferential_way,
-      </if>
-      <if test="payPrintNum != null">
-        pay_print_num,
-      </if>
-      <if test="payCallbackPage != null">
-        pay_callback_page,
-      </if>
-      <if test="wsPrintFlag != null">
-        ws_print_flag,
-      </if>
-      <if test="activityPic != null">
-        activity_pic,
-      </if>
-    </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="payId != null">
-        #{payId,jdbcType=INTEGER},
-      </if>
-      <if test="payMode != null">
-        #{payMode,jdbcType=VARCHAR},
-      </if>
-      <if test="stationId != null">
-        #{stationId,jdbcType=INTEGER},
-      </if>
-      <if test="stationName != null">
-        #{stationName,jdbcType=VARCHAR},
-      </if>
-      <if test="imagePhotosFlag != null">
-        #{imagePhotosFlag,jdbcType=CHAR},
-      </if>
-      <if test="cardEnabledFlag != null">
-        #{cardEnabledFlag,jdbcType=CHAR},
-      </if>
-      <if test="preferentialWayShareFlag != null">
-        #{preferentialWayShareFlag,jdbcType=CHAR},
-      </if>
-      <if test="otherPreferentialWay != null">
-        #{otherPreferentialWay,jdbcType=VARCHAR},
-      </if>
-      <if test="payPrintNum != null">
-        #{payPrintNum,jdbcType=INTEGER},
-      </if>
-      <if test="payCallbackPage != null">
-        #{payCallbackPage,jdbcType=VARCHAR},
-      </if>
-      <if test="wsPrintFlag != null">
-        #{wsPrintFlag,jdbcType=CHAR},
-      </if>
-      <if test="activityPic != null">
-        #{activityPic,jdbcType=LONGVARBINARY},
-      </if>
-    </trim>
-  </insert>
-  <select id="countByExample" parameterType="com.platform.yijia.pojo.StationPayManageExample" resultType="java.lang.Long">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    select count(*) from station_pay_manage
-    <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_pay_manage
-    <set>
-      <if test="record.payId != null">
-        pay_id = #{record.payId,jdbcType=INTEGER},
-      </if>
-      <if test="record.payMode != null">
-        pay_mode = #{record.payMode,jdbcType=VARCHAR},
-      </if>
-      <if test="record.stationId != null">
-        station_id = #{record.stationId,jdbcType=INTEGER},
-      </if>
-      <if test="record.stationName != null">
-        station_name = #{record.stationName,jdbcType=VARCHAR},
-      </if>
-      <if test="record.imagePhotosFlag != null">
-        image_photos_flag = #{record.imagePhotosFlag,jdbcType=CHAR},
-      </if>
-      <if test="record.cardEnabledFlag != null">
-        card_enabled_flag = #{record.cardEnabledFlag,jdbcType=CHAR},
-      </if>
-      <if test="record.preferentialWayShareFlag != null">
-        preferential_way_share_flag = #{record.preferentialWayShareFlag,jdbcType=CHAR},
-      </if>
-      <if test="record.otherPreferentialWay != null">
-        other_preferential_way = #{record.otherPreferentialWay,jdbcType=VARCHAR},
-      </if>
-      <if test="record.payPrintNum != null">
-        pay_print_num = #{record.payPrintNum,jdbcType=INTEGER},
-      </if>
-      <if test="record.payCallbackPage != null">
-        pay_callback_page = #{record.payCallbackPage,jdbcType=VARCHAR},
-      </if>
-      <if test="record.wsPrintFlag != null">
-        ws_print_flag = #{record.wsPrintFlag,jdbcType=CHAR},
-      </if>
-      <if test="record.activityPic != null">
-        activity_pic = #{record.activityPic,jdbcType=LONGVARBINARY},
-      </if>
-    </set>
-    <if test="_parameter != null">
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
-  <update id="updateByExampleWithBLOBs" parameterType="map">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    update station_pay_manage
-    set pay_id = #{record.payId,jdbcType=INTEGER},
-      pay_mode = #{record.payMode,jdbcType=VARCHAR},
-      station_id = #{record.stationId,jdbcType=INTEGER},
-      station_name = #{record.stationName,jdbcType=VARCHAR},
-      image_photos_flag = #{record.imagePhotosFlag,jdbcType=CHAR},
-      card_enabled_flag = #{record.cardEnabledFlag,jdbcType=CHAR},
-      preferential_way_share_flag = #{record.preferentialWayShareFlag,jdbcType=CHAR},
-      other_preferential_way = #{record.otherPreferentialWay,jdbcType=VARCHAR},
-      pay_print_num = #{record.payPrintNum,jdbcType=INTEGER},
-      pay_callback_page = #{record.payCallbackPage,jdbcType=VARCHAR},
-      ws_print_flag = #{record.wsPrintFlag,jdbcType=CHAR},
-      activity_pic = #{record.activityPic,jdbcType=LONGVARBINARY}
-    <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_pay_manage
-    set pay_id = #{record.payId,jdbcType=INTEGER},
-      pay_mode = #{record.payMode,jdbcType=VARCHAR},
-      station_id = #{record.stationId,jdbcType=INTEGER},
-      station_name = #{record.stationName,jdbcType=VARCHAR},
-      image_photos_flag = #{record.imagePhotosFlag,jdbcType=CHAR},
-      card_enabled_flag = #{record.cardEnabledFlag,jdbcType=CHAR},
-      preferential_way_share_flag = #{record.preferentialWayShareFlag,jdbcType=CHAR},
-      other_preferential_way = #{record.otherPreferentialWay,jdbcType=VARCHAR},
-      pay_print_num = #{record.payPrintNum,jdbcType=INTEGER},
-      pay_callback_page = #{record.payCallbackPage,jdbcType=VARCHAR},
-      ws_print_flag = #{record.wsPrintFlag,jdbcType=CHAR}
-    <if test="_parameter != null">
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
-  <update id="updateByPrimaryKeySelective" parameterType="com.platform.yijia.pojo.StationPayManage">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    update station_pay_manage
-    <set>
-      <if test="payMode != null">
-        pay_mode = #{payMode,jdbcType=VARCHAR},
-      </if>
-      <if test="stationId != null">
-        station_id = #{stationId,jdbcType=INTEGER},
-      </if>
-      <if test="stationName != null">
-        station_name = #{stationName,jdbcType=VARCHAR},
-      </if>
-      <if test="imagePhotosFlag != null">
-        image_photos_flag = #{imagePhotosFlag,jdbcType=CHAR},
-      </if>
-      <if test="cardEnabledFlag != null">
-        card_enabled_flag = #{cardEnabledFlag,jdbcType=CHAR},
-      </if>
-      <if test="preferentialWayShareFlag != null">
-        preferential_way_share_flag = #{preferentialWayShareFlag,jdbcType=CHAR},
-      </if>
-      <if test="otherPreferentialWay != null">
-        other_preferential_way = #{otherPreferentialWay,jdbcType=VARCHAR},
-      </if>
-      <if test="payPrintNum != null">
-        pay_print_num = #{payPrintNum,jdbcType=INTEGER},
-      </if>
-      <if test="payCallbackPage != null">
-        pay_callback_page = #{payCallbackPage,jdbcType=VARCHAR},
-      </if>
-      <if test="wsPrintFlag != null">
-        ws_print_flag = #{wsPrintFlag,jdbcType=CHAR},
-      </if>
-      <if test="activityPic != null">
-        activity_pic = #{activityPic,jdbcType=LONGVARBINARY},
-      </if>
-    </set>
-    where pay_id = #{payId,jdbcType=INTEGER}
-  </update>
-  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.platform.yijia.pojo.StationPayManage">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    update station_pay_manage
-    set pay_mode = #{payMode,jdbcType=VARCHAR},
-      station_id = #{stationId,jdbcType=INTEGER},
-      station_name = #{stationName,jdbcType=VARCHAR},
-      image_photos_flag = #{imagePhotosFlag,jdbcType=CHAR},
-      card_enabled_flag = #{cardEnabledFlag,jdbcType=CHAR},
-      preferential_way_share_flag = #{preferentialWayShareFlag,jdbcType=CHAR},
-      other_preferential_way = #{otherPreferentialWay,jdbcType=VARCHAR},
-      pay_print_num = #{payPrintNum,jdbcType=INTEGER},
-      pay_callback_page = #{payCallbackPage,jdbcType=VARCHAR},
-      ws_print_flag = #{wsPrintFlag,jdbcType=CHAR},
-      activity_pic = #{activityPic,jdbcType=LONGVARBINARY}
-    where pay_id = #{payId,jdbcType=INTEGER}
-  </update>
-  <update id="updateByPrimaryKey" parameterType="com.platform.yijia.pojo.StationPayManage">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-    -->
-    update station_pay_manage
-    set pay_mode = #{payMode,jdbcType=VARCHAR},
-      station_id = #{stationId,jdbcType=INTEGER},
-      station_name = #{stationName,jdbcType=VARCHAR},
-      image_photos_flag = #{imagePhotosFlag,jdbcType=CHAR},
-      card_enabled_flag = #{cardEnabledFlag,jdbcType=CHAR},
-      preferential_way_share_flag = #{preferentialWayShareFlag,jdbcType=CHAR},
-      other_preferential_way = #{otherPreferentialWay,jdbcType=VARCHAR},
-      pay_print_num = #{payPrintNum,jdbcType=INTEGER},
-      pay_callback_page = #{payCallbackPage,jdbcType=VARCHAR},
-      ws_print_flag = #{wsPrintFlag,jdbcType=CHAR}
-    where pay_id = #{payId,jdbcType=INTEGER}
-  </update>
+
 </mapper>