Bladeren bron

接口修改优化

jk-GitHub-coder 3 jaren geleden
bovenliggende
commit
eb0612eb0c

+ 128 - 90
YijiaRestful/src/main/java/com/platform/yijia/controller/PayOrderController.java

@@ -51,7 +51,7 @@ public class PayOrderController {
     @ResponseBody
     @Transactional
     public String  AddPayOrderInfoNew(@RequestBody PayOrderRequest payOrderRequest){
-        logger.info("获取订单前端传来参数openId:"+ payOrderRequest.getOpenId());
+        logger.info("生成订单前端传来参数油站ID:"+payOrderRequest.getStationId()+"; 用户openId:"+ payOrderRequest.getOpenId() +"; 加油员ID:" +payOrderRequest.getPersonnelId()+ ";");
         Gson gson =new Gson();
         ResultData resultData =null;
         AppUserInfo appUserInfo =new AppUserInfo();     //查询客户信息传递参数
@@ -111,9 +111,9 @@ public class PayOrderController {
                     payOrder.setScore(payOrderRequest.getScore());                          //积分
                     payOrder.setStationId(payOrderRequest.getStationId());                  //油站id
                     payOrder.setStatus("0");                                                //创建订单 未支付状态 0
-                    payOrder.setCreatedDate(new Timestamp(new Date().getTime()));                    //创建时间
-                    payOrder.setOrderType(payOrderRequest.getOrderType());  //订单类型
-                    payOrder.setOilGun(payOrderRequest.getOilGun());        //油枪号
+                    payOrder.setCreatedDate(new Timestamp(new Date().getTime()));           //创建时间
+                    payOrder.setOrderType(payOrderRequest.getOrderType());                  //订单类型
+                    payOrder.setOilGun(payOrderRequest.getOilGun());                        //油枪号
                     payOrder.setReceivableAmt(Double.valueOf(payOrderRequest.getReceivableAmt()));                //订单应收金额
                     String oilName = payOrderRequest.getOilName();
                     //获取该油品所属哪一类
@@ -121,53 +121,17 @@ public class PayOrderController {
                     oil.setOilName(oilName);
                     oil.setDictType("oil_name");
                     Oil oilInfo = sysDictDataService.selectOilType(oil);
-                    payOrder.setOilType(oilInfo.getOilsType());     //油品类型
-                    String oilsType = oilInfo.getOilsType();                          //获取订单类型
+                    payOrder.setOilType(oilInfo.getOilsType());                                     //油品类型
+                    String oilsType = oilInfo.getOilsType();                                        //获取订单类型
                     logger.info("订单油品类型:" + oilsType);
-                    payOrderRequest.setCardOilsType(oilInfo.getOilsType());                 //电子卡类型;注:用于获取客户电子卡参数查询
-                    payOrder.setOilName(oilName);                   //油品名称
+                    payOrderRequest.setCardOilsType(oilInfo.getOilsType());                         //电子卡类型;注:用于获取客户电子卡参数查询
+                    payOrder.setOilName(oilName);                                                   //油品名称
 
-                    //根据油站和油枪获取加油员
-                    if (payOrderRequest.getPersonnelId() != null) {
-                        //表示为一人一码:一个加油员一个码
-                        Map<String, Object> params = new HashMap<>();
-                        params.put("personnelId", payOrderRequest.getPersonnelId());
-                        List<Map<String, Object>> list = stationOilGunService.selectOilGunByPersonalId(params);
-                        if (list != null && list.size() > 0) {
-                            if(list.get(0).containsKey("personnelName") && list.get(0).get("personnelName") !=null && list.get(0).get("personnelName").toString() !=""){
-                                payOrder.setOilPersonnel(list.get(0).get("personnelName").toString());
-                            }else {
-                                payOrder.setOilPersonnel("--");
-                            }
-                        } else {
-                            payOrder.setOilPersonnel("--");
-                        }
-                    } else {
-                        //根据油站和油枪获取加油员
-                        HashMap<String, Object> params = new HashMap<>();
-                        params.put("oliGunNo", payOrderRequest.getOilGun());
-                        params.put("stationId", payOrderRequest.getStationId());
-                        List<Map> mapResultList = payOrderMapper.selectPersonelName(params);    //使用list原因:一个枪号对应多个加油员场景
-                        logger.info("加油员信息:"+ mapResultList.toString());
-                        if(mapResultList != null && mapResultList.size() > 0){
-                            String oilPersonnel = "";
-                            for (Map per : mapResultList){
-                                if(per.containsKey("personnelName") && per.get("personnelName").toString() !=null && per.get("personnelName").toString() !=""){
-                                    oilPersonnel += per.get("personnelName").toString() +",";
-                                }
-                            }
-                            if(oilPersonnel !=""){
-                                payOrder.setOilPersonnel(oilPersonnel.substring(0, oilPersonnel.length()-1));   //加油员
-                            }
-                        }else {
-                            payOrder.setOilPersonnel("--");
-                        }
-                    }
-                    if(oilsType.equals("3")){                                                  //订单类型是油品时计算
+                    if(oilsType.equals("3")){                                                       //订单类型是油品时计算
                         payOrder.setOrderType("2");
                         payOrder.setAmt(Double.valueOf(payOrderRequest.getReceivableAmt()));        //非油品金额
                         payOrder.setDiscountAmt(Double.valueOf(0));                                 //优惠金额
-                        payOrder.setOilPirce(payOrderRequest.getReceivableAmt());        //非油品价格
+                        payOrder.setOilPirce(payOrderRequest.getReceivableAmt());                   //非油品价格
                         payOrder.setOrderLiters("0");
                         resultMap.put("oilsCardFlag", "0");
                         resultMap.put("discountAmt", "0");                                          //优惠价格
@@ -176,7 +140,8 @@ public class PayOrderController {
                         resultMap.put("oilLiters", "0");
                         resultMap.put("discountPrice", "0");
                         resultMap.put("ordNo", ordNo);
-                        payOrderMapper.insertSelective(payOrder);
+                        logger.info("返回前端的结果:" +resultMap.toString());
+                        //payOrderMapper.insertSelective(payOrder);
                     }else {
                         PayOrderResultInfo payOrderResultInfo = this.calculateAmt(payOrderRequest); //计算订单金额 价格 加油升数 等等
                         payOrder.setOilPirce(payOrderResultInfo.getOilPrice());
@@ -197,20 +162,63 @@ public class PayOrderController {
                             payOrder.setSellAmt(Double.valueOf(payOrderResultInfo.getSellAmt()));
                             payOrder.setSellDiscountAmt(Double.valueOf(payOrderResultInfo.getSellDiscountAmt()));
                             payOrder.setSellOilPrice(Double.valueOf(payOrderResultInfo.getSellPrice()));
-                            //resultMap.put("discountPrice", payOrderResultInfo.getDiscountPrice());
+                            payOrder.setDriverDiscountAmt(Double.valueOf(payOrderResultInfo.getDriverDiscountAmt()));
+                            resultMap.put("driverDiscountAmt", payOrderResultInfo.getDriverDiscountAmt());
+                            resultMap.put("sellDiscountAmt", payOrderResultInfo.getSellDiscountAmt());
                         }
                         payOrder.setDriverOilPrice(Double.valueOf(payOrderResultInfo.getDiscountPrice()));
-                        resultMap.put("receivableAmt", payOrderResultInfo.getReceivableAmt());         //应收价格
+                        resultMap.put("receivableAmt", payOrderResultInfo.getReceivableAmt());           //应收价格
                         resultMap.put("oilLiters", payOrderResultInfo.getOilLiters());
                         resultMap.put("amt_dzk", payOrderResultInfo.getDzkAmt());
-                        resultMap.put("discountAmt_dzk", payOrderResultInfo.getDzkDiscountAmt());   //电子卡优惠金额
-                        resultMap.put("balance", payOrderResultInfo.getBalance());               //电子卡余额
-                        resultMap.put("cardOilsType", payOrderResultInfo.getCardOilsType());     //电子卡类型1.汽油; 2.柴油
+                        resultMap.put("discountAmt_dzk", payOrderResultInfo.getDzkDiscountAmt());        //电子卡优惠金额
+                        resultMap.put("balance", payOrderResultInfo.getBalance());                       //电子卡余额
+                        resultMap.put("cardOilsType", payOrderResultInfo.getCardOilsType());             //电子卡类型1.汽油; 2.柴油
                         resultMap.put("ordNo", ordNo);
                         logger.info("返回前端的结果:" +resultMap.toString());
-                        payOrderMapper.insertSelective(payOrder);
+                        //payOrderMapper.insertSelective(payOrder);
+                    }
+
+                    //根据油站和油枪获取加油员
+                    if (payOrderRequest.getPersonnelId() != null && payOrderRequest.getPersonnelId() != "" && !payOrderRequest.getPersonnelId().equals("undefined")) {
+                        //表示为一人一码:一个加油员一个码
+                        Map<String, Object> params = new HashMap<>();
+                        params.put("personnelId", payOrderRequest.getPersonnelId());
+                        params.put("stationId", payOrderRequest.getStationId());
+                        List<Map<String, Object>> list = stationOilGunService.selectOilGunByPersonalId(params);
+                        if (list != null && list.size() > 0) {
+                            if(list.get(0).containsKey("personnelName") && list.get(0).get("personnelName") !=null && list.get(0).get("personnelName").toString() !=""){
+                                payOrder.setOilPersonnel(list.get(0).get("personnelName").toString());
+                                payOrderMapper.insertSelective(payOrder);
+                                resultData = ResultData.success(resultMap);
+                            }else {
+                                resultData = ResultData.error(CodeMsg.NO_PERSONNAL);
+                            }
+                        } else {
+                            resultData = ResultData.error(CodeMsg.NO_PERSONNAL);
+                        }
+                    } else {
+                        //根据油站和油枪获取加油员
+                        HashMap<String, Object> params = new HashMap<>();
+                        params.put("oliGunNo", payOrderRequest.getOilGun());
+                        params.put("stationId", payOrderRequest.getStationId());
+                        List<Map> mapResultList = payOrderMapper.selectPersonelName(params);    //使用list原因:一个枪号对应多个加油员场景
+                        logger.info("加油员信息:"+ mapResultList.toString());
+                        if(mapResultList != null && mapResultList.size() > 0){
+                            String oilPersonnel = "";
+                            for (Map per : mapResultList){
+                                if(per.containsKey("personnelName") && per.get("personnelName").toString() !=null && per.get("personnelName").toString() !=""){
+                                    oilPersonnel += per.get("personnelName").toString() +",";
+                                }
+                            }
+                            if(oilPersonnel !=""){
+                                payOrder.setOilPersonnel(oilPersonnel.substring(0, oilPersonnel.length()-1));   //加油员
+                            }
+                            payOrderMapper.insertSelective(payOrder);
+                            resultData = ResultData.success(resultMap);
+                        }else {
+                            resultData = ResultData.error(CodeMsg.NO_PERSONNAL);
+                        }
                     }
-                    resultData = ResultData.success(resultMap);
                 }else {
                     //登录人验证失败
                     resultData=ResultData.error(CodeMsg.USER_NOT_EXSIST);
@@ -288,7 +296,22 @@ public class PayOrderController {
                 payOrderResultInfo = this.calculateLabelDiscount(params);
                 //是否强制将该扫码用户拉入此标签:0、否;1、是;
                 if(payOrderResultInfo.getIsAddLabel() !=null && payOrderResultInfo.getIsAddLabel().equals("1")){
-                    labelService.updateCustomerLabel(customerLabel);
+                    CustomerLabel customerLabel_info = labelService.getCustomerLabel(customerLabel);
+                    if(customerLabel_info !=null){
+                        customerLabel.setUpdateTime(new Date());
+//                        customerLabel.setCreateBy(payOrderResultInfo.getLabelCreateBy());
+//                        if(payOrderResultInfo.getLabelUpdateBy() !=null){
+//                            customerLabel.setUpdateBy(payOrderResultInfo.getLabelUpdateBy());
+//                        }
+                        customerLabel.setLabelId(payOrderRequest.getLabelId());
+                        labelService.updateCustomerLabel(customerLabel);
+                    }else {
+                        customerLabel.setCreateTime(new Date());
+                        customerLabel.setDelFlag("0");
+                        //customerLabel.setCreateBy(payOrderResultInfo.getLabelCreateBy());
+                        customerLabel.setLabelId(payOrderRequest.getLabelId());
+                        labelService.insertCustomerLabel(customerLabel);
+                    }
                 }
             }else {
                 //按照正常优惠计算
@@ -325,16 +348,17 @@ public class PayOrderController {
     //计算集团下站点LNG平台加气
     public PayOrderResultInfo calculateLngGroupStaDiscount(Map<String ,Object> params){
         PayOrderResultInfo payOrderResultInfo = new PayOrderResultInfo();
-        BigDecimal oilPrice = new BigDecimal(params.get("oilPrice").toString());    //油品价格
+        BigDecimal oilPrice = new BigDecimal(params.get("oilPrice").toString());             //油品价格
         BigDecimal receivableAmt = new BigDecimal(params.get("receivableAmt").toString());   //应收金额
-        BigDecimal oilLiters = new BigDecimal("0.00");  //加油升数
-        BigDecimal discountAmt = new BigDecimal(0);     //油站销售价后优惠金额
-        BigDecimal sellDiscountAmt = new BigDecimal(0); //油站销售价后优惠金额
-        BigDecimal dzkDiscountAmt = new BigDecimal(0);  //电子卡优惠金额
-        BigDecimal amt = receivableAmt;             //司机价后支付金额
-        BigDecimal sellAmt = new BigDecimal(0);         //油站结算价支付金额
-        BigDecimal discountPrice = oilPrice;                //司机销售价
-        BigDecimal sellPrice = discountPrice;              //油站销售价
+        BigDecimal oilLiters = new BigDecimal("0.00");              //加油升数
+        BigDecimal discountAmt = new BigDecimal(0);                 //油站销售价后优惠金额
+        BigDecimal sellDiscountAmt = new BigDecimal(0);             //油站销售价后优惠金额
+        BigDecimal dzkDiscountAmt = new BigDecimal(0);              //电子卡优惠金额
+        BigDecimal amt = receivableAmt;                                 //司机价后支付金额
+        BigDecimal sellAmt = new BigDecimal(0);                     //油站结算价支付金额
+        BigDecimal discountPrice = oilPrice;                            //司机销售价
+        BigDecimal sellPrice = discountPrice;                           //油站销售价
+        BigDecimal driverDiscountAmt = new BigDecimal("0");         //司机价优惠金额
         //加油升数
         oilLiters = receivableAmt.divide(oilPrice,2, BigDecimal.ROUND_HALF_UP);
 //        if(!oilLiters.toString().substring(oilLiters.toString().indexOf(".") + 1).equals("00")){
@@ -350,7 +374,6 @@ public class PayOrderController {
                         sellPrice = oilPrice.subtract(new BigDecimal(params.get("settlementPrice").toString()));
                         sellAmt = sellPrice.multiply(oilLiters); //优惠价实付金额
                         sellDiscountAmt = receivableAmt.subtract(sellAmt);
-                        sellDiscountAmt = sellDiscountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
                     }
                     break;
                 case "2":   //折扣
@@ -359,7 +382,7 @@ public class PayOrderController {
                         sellPrice = oilPrice.multiply(new BigDecimal(params.get("settlementPrice").toString())).divide(new BigDecimal("100"));
                         sellAmt =sellPrice.multiply(oilLiters);
                         sellDiscountAmt = receivableAmt.subtract(sellAmt);
-                        sellDiscountAmt = sellDiscountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
+                        //sellDiscountAmt = sellDiscountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
                     }
                     break;
             }
@@ -368,7 +391,9 @@ public class PayOrderController {
             //司机价
             discountPrice = sellPrice.multiply(new BigDecimal(params.get("driverPrice").toString())).divide(new BigDecimal("100"));
             amt = sellAmt.multiply(new BigDecimal(params.get("driverPrice").toString())).divide(new BigDecimal("100"));
+            //driverDiscountAmt = sellDiscountAmt.multiply(new BigDecimal("1").subtract(new BigDecimal(params.get("driverPrice").toString()).divide(new BigDecimal("100"))));
             discountAmt = receivableAmt.subtract(amt);
+            driverDiscountAmt = discountAmt.subtract(sellDiscountAmt);
             discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
             discountPrice = discountPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
         }
@@ -381,16 +406,20 @@ public class PayOrderController {
         payOrderResultInfo.setOilPrice(oilPrice.toString());            //油机价
         payOrderResultInfo.setAmt(amt.toString());                      //司机价后时候金额
         payOrderResultInfo.setDiscountPrice(discountPrice.toString());  //司机价
-        payOrderResultInfo.setDiscountAmt(discountAmt.toString());      //司机价后优惠金额
+        payOrderResultInfo.setDiscountAmt(discountAmt.toString());      //司机价后优惠总金额
+
+        driverDiscountAmt = driverDiscountAmt.setScale(2,BigDecimal.ROUND_HALF_UP);
+        payOrderResultInfo.setDriverDiscountAmt(driverDiscountAmt.toString());              //司机价后优惠金额
 
         payOrderResultInfo.setSellAmt(sellAmt.toString());                      //销售价后支付金额
         sellPrice = sellPrice.setScale(2, BigDecimal.ROUND_HALF_UP);   //销售价
         payOrderResultInfo.setSellPrice(sellPrice.toString());                  //销售价
+        sellDiscountAmt = sellDiscountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
         payOrderResultInfo.setSellDiscountAmt(sellDiscountAmt.toString());      //销售价后优惠金额
 
         //LNG加气平台没有电子卡功能:此下参数无用用作填充参数值 0:代表否;4:代表LNG油品
-        payOrderResultInfo.setDzkAmt(amt.toString());                   //电子卡支付金额
-        payOrderResultInfo.setDzkDiscountAmt(dzkDiscountAmt.toString());    //电子卡优惠金额
+        payOrderResultInfo.setDzkAmt(amt.toString());                           //电子卡支付金额
+        payOrderResultInfo.setDzkDiscountAmt(dzkDiscountAmt.toString());        //电子卡优惠金额
         payOrderResultInfo.setBalance("0");
         payOrderResultInfo.setCardOilsType("4");
 
@@ -419,33 +448,42 @@ public class PayOrderController {
         //获取该油站的标签规则
         LabelRule labelRule = new LabelRule();
         labelRule.setStationId(Integer.valueOf(params.get("stationId").toString()));        //油站ID
-        labelRule.setOilName(params.get("oilName").toString());                         //oilName
+        //labelRule.setOilName(params.get("oilName").toString());                         //oilName
+        labelRule.setDelFlag("0");
         labelRule.setLabelId(Integer.valueOf(params.get("labelId").toString()));//
         List<LabelRule> labelRuleList = labelService.getLabelRuleList(labelRule);
         if(labelRuleList !=null && labelRuleList.size()> 0){
             payOrderResultInfo.setIsAddLabel(labelRuleList.get(0).getIsAddLabel()); //'是否强制将该扫码用户拉入此标签:0、否;1、是
+            payOrderResultInfo.setLabelCreateBy(labelRuleList.get(0).getCreateBy());        //标签创建人
+            payOrderResultInfo.setLabelUpdateBy(labelRuleList.get(0).getUpdateBy());        //标签更新人
+            payOrderResultInfo.setLabelCreateTime(labelRuleList.get(0).getCreateTime());    //标签创建时间
             //获取该油品的优惠明细
-            List<LabelRuleDetail> labelRuleDetailList = labelRuleList.get(0).getLabelRuleDetailList();
-            if(labelRuleDetailList !=null && labelRuleDetailList.size() ==1){
-                BigDecimal discountAmt_B = new BigDecimal(labelRuleDetailList.get(0).getDiscountAmt()); //满足享受优惠条件(满多少升、满多少元)
-                String discountTerm = labelRuleDetailList.get(0).getDiscountTerm();
-                switch (discountTerm){
-                    case "1":   //按加油升数
-                        if(oilLiters.compareTo(discountAmt_B) ==1 || oilLiters.compareTo(discountAmt_B) ==0 ){
-                            discountPrice = oilPrice.subtract(new BigDecimal(labelRuleDetailList.get(0).getDiscountLitersAmt()));
-                            discountAmt = oilLiters.multiply(new BigDecimal(labelRuleDetailList.get(0).getDiscountLitersAmt()));
-                            discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
-                        }
-                        break;
-                    case "2":   //按加油金额
-                        if(receivableAmt.compareTo(discountAmt_B) ==1 || receivableAmt.compareTo(discountAmt_B) ==0 ){
-                            discountPrice = oilPrice.subtract(new BigDecimal(labelRuleDetailList.get(0).getDiscountLitersAmt()));
-                            discountAmt = oilLiters.multiply(new BigDecimal(labelRuleDetailList.get(0).getDiscountLitersAmt()));
-                            discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
-                        }
-                        break;
+            labelRule.setOilName(params.get("oilName").toString());
+            labelRule.setDelFlagDetail("0");
+            List<LabelRule> labelRuleList_oilName = labelService.getLabelRuleList(labelRule);
+            if(labelRuleList_oilName !=null && labelRuleList_oilName.size() >0){
+                List<LabelRuleDetail> labelRuleDetailList = labelRuleList_oilName.get(0).getLabelRuleDetailList();
+                if(labelRuleDetailList !=null && labelRuleDetailList.size() ==1){
+                    BigDecimal discountAmt_B = new BigDecimal(labelRuleDetailList.get(0).getDiscountAmt()); //满足享受优惠条件(满多少升、满多少元)
+                    String discountTerm = labelRuleDetailList.get(0).getDiscountTerm();
+                    switch (discountTerm){
+                        case "1":   //按加油升数
+                            if(oilLiters.compareTo(discountAmt_B) ==1 || oilLiters.compareTo(discountAmt_B) ==0 ){
+                                discountPrice = oilPrice.subtract(new BigDecimal(labelRuleDetailList.get(0).getDiscountLitersAmt()));
+                                discountAmt = oilLiters.multiply(new BigDecimal(labelRuleDetailList.get(0).getDiscountLitersAmt()));
+                                discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
+                            }
+                            break;
+                        case "2":   //按加油金额
+                            if(receivableAmt.compareTo(discountAmt_B) ==1 || receivableAmt.compareTo(discountAmt_B) ==0 ){
+                                discountPrice = oilPrice.subtract(new BigDecimal(labelRuleDetailList.get(0).getDiscountLitersAmt()));
+                                discountAmt = oilLiters.multiply(new BigDecimal(labelRuleDetailList.get(0).getDiscountLitersAmt()));
+                                discountAmt = discountAmt.setScale(2, BigDecimal.ROUND_HALF_UP);
+                            }
+                            break;
+                    }
+                    dzkDiscountAmt = discountAmt;       //赋值电子卡优惠金额
                 }
-                dzkDiscountAmt = discountAmt;       //赋值电子卡优惠金额
             }
         }
         amt = receivableAmt.subtract(discountAmt);  //应收金额

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

@@ -479,6 +479,7 @@ public class StationController {
             if(personnelId !=null && personnelId !=""){
                 Map<String, Object> params = new HashMap<>();
                 params.put("personnelId", personnelId);
+                params.put("stationId", stationId);
                 List<Map<String, Object>> list = stationOilGunService.selectOilGunByPersonalId(params);
                 resultData=ResultData.success(list);
             }else {
@@ -539,6 +540,7 @@ public class StationController {
             if(personnelId !=null && personnelId !="" && !personnelId.equals("undefined")){
                 Map<String, Object> params = new HashMap<>();
                 params.put("personnelId", personnelId);
+                params.put("stationId", stationId);
                 List<Map<String, Object>> stationOilGunList = stationOilGunService.selectOilGunByPersonalId(params);
                 resultMap.put("stationOilGunList", stationOilGunList);
                 //resultData=ResultData.success(stationOilGunList);

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

@@ -59,7 +59,7 @@ public class PayOrderRequest {
     private String labelId;
 
     //加油员ID
-    private Integer personnelId;    //加油员ID
+    private String personnelId;    //加油员ID
 
 
 

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

@@ -24,4 +24,5 @@ public class LabelRule {
     //查询参数
     private String oilName;         //油品名称
     private Integer labelId;        //标签ID
+    private String delFlagDetail;          //'删除标识1 是 0 否',
 }

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

@@ -91,6 +91,7 @@ public class PayOrder implements Serializable {
     private Double sellOilPrice;        //销售价
     private Double sellAmt;             //销售金额
     private Double sellDiscountAmt;     //销售价后优惠金额
+    private Double driverDiscountAmt;   //司机价后优惠金额
     private Double driverOilPrice;      //司机价
     private String isLngFlagGroup;
 

+ 11 - 5
YijiaRestful/src/main/java/com/platform/yijia/pojo/PayOrderResultInfo.java

@@ -2,6 +2,8 @@ package com.platform.yijia.pojo;
 
 import lombok.Data;
 
+import java.util.Date;
+
 /***
  * 生成订单时返回前端参数信息
  */
@@ -23,11 +25,15 @@ public class PayOrderResultInfo {
     private String cardOilsType;    //电子卡类型
     private String oilsCardFlag;      //该用户是否有改电子卡
 
-    //是否强制将该扫码用户拉入此标签:0、否;1、是;
-    private String isAddLabel;
+    //标签功能参数
+    private String isAddLabel;          //是否强制将该扫码用户拉入此标签:0、否;1、是;
+    private String labelCreateBy;       //标签创建人
+    private Date labelCreateTime;       //标签创建时间
+    private String labelUpdateBy;       //标签更新人
 
     //集团为LNG平台加气 时所需司机价
-    private String sellPrice;             //司机价
-    private String sellAmt;               //司机价后实收金额
-    private String sellDiscountAmt;     //司机价后优惠金额
+    private String sellPrice;               //司机价
+    private String sellAmt;                 //司机价后实收金额
+    private String sellDiscountAmt;         //销售价后优惠金额
+    private String driverDiscountAmt;       //司机价后优惠金额
 }

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

@@ -36,6 +36,8 @@ public class CodeMsg {
     public static CodeMsg COUPON_LOSE_EFFECTIVE = new CodeMsg(-2,"优惠券已无效");
     public static CodeMsg NO_COUPON = new CodeMsg(-3,"此优惠券不存在");
     public static CodeMsg COUPON_NO_GRANT = new CodeMsg(-4,"此优惠券暂未发放");
+    public static CodeMsg NO_PERSONNAL = new CodeMsg(-4,"该油站或油枪未添加或绑定加油员");
+
 
 
     private CodeMsg(int retCode, String message) {

+ 39 - 1
YijiaRestful/src/main/resources/mapper/LabelMapper.xml

@@ -44,6 +44,38 @@
       <result column="del_flag"               jdbcType="VARCHAR"   property="delFlag" />
   </resultMap>
 
+    <!--查询油站标签规则信息-->
+<!--    <select id="getLabelRuleDetailList" resultMap="LabelRuleBaseResultMap" parameterType="com.platform.yijia.pojo.LabelRule">-->
+<!--        SELECT-->
+<!--        T1.id,-->
+<!--        T1.station_id,-->
+<!--        T1.label_name,-->
+<!--        T1.is_add_label,-->
+<!--        T2.id                           AS      labelRuleDetailId,-->
+<!--        T2.parent_id,-->
+<!--        T2.oil_name,-->
+<!--        T2.discount_term,-->
+<!--        T2.discount_amt,-->
+<!--        T2.discount_liters_amt,-->
+<!--        T2.create_by,-->
+<!--        T2.create_time-->
+<!--        FROM-->
+<!--        label_rule AS T1 LEFT JOIN label_rule_detail AS T2 ON T1.id = T2.parent_id-->
+<!--        <where>-->
+<!--            T2.del_flag ="0"-->
+<!--            <if test="labelId !=null and labelId !=''">-->
+<!--                AND T1.id = #{labelId}-->
+<!--            </if>-->
+<!--            <if test="stationId !=null and stationId !=''">-->
+<!--                AND T1.station_id = #{stationId}-->
+<!--            </if>-->
+<!--            <if test="oilName !=null and oilName !=''">-->
+<!--                AND T2.oil_name = #{oilName}-->
+<!--            </if>-->
+<!--        </where>-->
+<!--    </select>-->
+
+
   <!--查询油站标签规则信息-->
   <select id="getLabelRuleList" resultMap="LabelRuleBaseResultMap" parameterType="com.platform.yijia.pojo.LabelRule">
     SELECT
@@ -51,6 +83,7 @@
         T1.station_id,
         T1.label_name,
         T1.is_add_label,
+        T1.create_by,
         T2.id                           AS      labelRuleDetailId,
         T2.parent_id,
         T2.oil_name,
@@ -62,7 +95,12 @@
     FROM
       label_rule AS T1 LEFT JOIN label_rule_detail AS T2 ON T1.id = T2.parent_id
     <where>
-            T2.del_flag ="0"
+          <if test="delFlag !=null and delFlag !=''">
+             T1.del_flag =#{delFlag}
+          </if>
+          <if test="delFlagDetail !=null and delFlagDetail !=''">
+             AND T2.del_flag =#{delFlagDetail}
+          </if>
           <if test="labelId !=null and labelId !=''">
              AND T1.id = #{labelId}
           </if>

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

@@ -620,6 +620,9 @@
         <if test="sellDiscountAmt != null">
             sell_discount_amt,
         </if>
+        <if test="driverDiscountAmt != null">
+            driver_discount_amt,
+        </if>
       <if test="stationId != null">
         station_id,
       </if>
@@ -757,6 +760,9 @@
         <if test="sellDiscountAmt != null">
             #{sellDiscountAmt,jdbcType=DOUBLE},
         </if>
+        <if test="driverDiscountAmt != null">
+            #{driverDiscountAmt,jdbcType=DOUBLE},
+        </if>
       <if test="stationId != null">
         #{stationId,jdbcType=INTEGER},
       </if>

+ 4 - 1
YijiaRestful/src/main/resources/mapper/StationOilGunMapper.xml

@@ -311,7 +311,10 @@
         <where>
           T1.del_flag = "0"
           <if test="personnelId != null and personnelId !=''">
-            AND personnel_id = #{personnelId}
+            AND T1.personnel_id = #{personnelId}
+          </if>
+          <if test="stationId != null">
+            AND T1.station_id = #{stationId}
           </if>
         </where>
   </select>

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

@@ -17,6 +17,13 @@ public class test {
 
     public static void main(String[] args) throws ParseException {
 
+        BigDecimal sellDiscountAmt = new BigDecimal("20");
+
+
+
+        BigDecimal driverDiscountAmt = sellDiscountAmt.multiply(new BigDecimal("1").subtract(new BigDecimal("97").divide(new BigDecimal("100"))));
+        System.out.println(driverDiscountAmt);
+
 
 //        Date parse = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").parse("2021-04-24 22:22:22");
 //        System.out.println(parse);