Przeglądaj źródła

Merge branch 'master' of http://47.92.161.104:10080/fulonglong/chargeing-parking into master

zhupeng 3 lat temu
rodzic
commit
34cad471bf
31 zmienionych plików z 861 dodań i 93 usunięć
  1. 13 0
      src/main/java/com/charging/chargingparking/dto/ParkingUserRelationDTO.java
  2. 13 0
      src/main/java/com/charging/chargingparking/entity/ParkingInfo.java
  3. 10 55
      src/main/java/com/charging/chargingparking/entity/ParkingMerchant.java
  4. 92 0
      src/main/java/com/charging/chargingparking/entity/ParkingPayProfit.java
  5. 8 1
      src/main/java/com/charging/chargingparking/mapper/ParkingFeeMapper.java
  6. 1 0
      src/main/java/com/charging/chargingparking/mapper/ParkingInfoMapper.java
  7. 15 0
      src/main/java/com/charging/chargingparking/mapper/ParkingPayProfitMapper.java
  8. 5 1
      src/main/java/com/charging/chargingparking/mapper/ParkingUserRelationMapper.java
  9. 195 0
      src/main/java/com/charging/chargingparking/modules/backController/ParkingFeeController.java
  10. 28 3
      src/main/java/com/charging/chargingparking/modules/backController/ParkingInfoController.java
  11. 6 4
      src/main/java/com/charging/chargingparking/modules/backController/ParkingMemberInfoController.java
  12. 91 0
      src/main/java/com/charging/chargingparking/modules/backController/ParkingUserRelationController.java
  13. 9 0
      src/main/java/com/charging/chargingparking/modules/pay/wechat/WxPayController.java
  14. 35 0
      src/main/java/com/charging/chargingparking/modules/vo/ProfitVo.java
  15. 7 0
      src/main/java/com/charging/chargingparking/service/ParkingFeeService.java
  16. 1 0
      src/main/java/com/charging/chargingparking/service/ParkingInfoService.java
  17. 14 0
      src/main/java/com/charging/chargingparking/service/ParkingPayProfitService.java
  18. 7 0
      src/main/java/com/charging/chargingparking/service/ParkingUserRelationService.java
  19. 1 1
      src/main/java/com/charging/chargingparking/service/impl/ParkingChannelServiceImpl.java
  20. 1 1
      src/main/java/com/charging/chargingparking/service/impl/ParkingChannelVoiceServiceImpl.java
  21. 47 0
      src/main/java/com/charging/chargingparking/service/impl/ParkingFeeServiceImpl.java
  22. 6 0
      src/main/java/com/charging/chargingparking/service/impl/ParkingInfoServiceImpl.java
  23. 64 0
      src/main/java/com/charging/chargingparking/service/impl/ParkingPayProfitServiceImpl.java
  24. 3 3
      src/main/java/com/charging/chargingparking/service/impl/ParkingRecordServiceImpl.java
  25. 50 0
      src/main/java/com/charging/chargingparking/service/impl/ParkingUserRelationServiceImpl.java
  26. 73 0
      src/main/resources/mapper/ParkingFeeMapper.xml
  27. 20 2
      src/main/resources/mapper/ParkingInfoMapper.xml
  28. 2 3
      src/main/resources/mapper/ParkingMemberMapper.xml
  29. 8 19
      src/main/resources/mapper/ParkingMerchantMapper.xml
  30. 31 0
      src/main/resources/mapper/ParkingPayProfitMapper.xml
  31. 5 0
      src/main/resources/mapper/ParkingUserRelationMapper.xml

+ 13 - 0
src/main/java/com/charging/chargingparking/dto/ParkingUserRelationDTO.java

@@ -0,0 +1,13 @@
+package com.charging.chargingparking.dto;
+
+import com.charging.chargingparking.entity.ParkingUserRelation;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class ParkingUserRelationDTO {
+
+    private String regUserId;
+    private String[] parkingInfoIds;
+}

+ 13 - 0
src/main/java/com/charging/chargingparking/entity/ParkingInfo.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.Date;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -23,6 +24,12 @@ public class ParkingInfo implements Serializable {
     @TableId
     private String id;
 
+
+    /**
+     * 商户id
+     */
+    private String merchantId;
+
     /**
      * 停车场云平台生成的停车场编号
      */
@@ -64,12 +71,18 @@ public class ParkingInfo implements Serializable {
      * 燃油车是否能进场
      */
     private Boolean oilCarEnable = true;
+    private String oilCarEnableN;
+    private Integer oilCarFreeTime;
+    private BigDecimal oilCarCost;
 
 
     /**
      * 新能车是否能进场
      */
     private Boolean newEnergyCarEnable = true;
+    private String newEnergyCarEnableN;
+    private Integer newEnergyCarTime;
+    private BigDecimal newEnergyCarCost;
 
     /**
      * 是否删除

+ 10 - 55
src/main/java/com/charging/chargingparking/entity/ParkingMerchant.java

@@ -5,9 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.Date;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 
 /**
@@ -23,52 +22,35 @@ public class ParkingMerchant implements Serializable {
     @TableId
     private String id;
 
-    /**
-     * 停车场id
-     */
-    private String parkId;
-
-    /**
-     * 商户编号
-     */
-    private String merchantNo;
-
     /**
      * 商户名称
      */
     private String merchantName;
 
     /**
-     * 商户生成的操作者编
+     * 服务商模式下子商户号id
      */
-    private String operatorNo;
+    private String subMchId;
 
     /**
-     * 操作者秘密
+     * 支付宝授权token
      */
-    private String operatorPassword;
+    private String appAuthToken;
 
     /**
-     * 优惠券类型(3:时长减免券,4:全免券,5:金额减免券
+     * 是否分润(0:不分润,1:分润
      */
-    @TableField(value = "type_")
-    private String type;
+    private Boolean profitFlag = false;
 
     /**
-     * 优惠额度
+     * 得利比例(小数,比如得利8层  :0.80)
      */
-    @TableField(value = "reduce_")
-    private Integer reduce;
-
-    /**
-     * 绑定的openId
-     */
-    private String openId;
+    private BigDecimal profitScale;
 
     /**
      * 是否删除
      */
-    private Boolean delFlag = false;
+    private Boolean delFlag;
 
     /**
      *
@@ -78,7 +60,6 @@ public class ParkingMerchant implements Serializable {
     /**
      *
      */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
     private Date createTime;
 
     /**
@@ -89,34 +70,8 @@ public class ParkingMerchant implements Serializable {
     /**
      *
      */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
     private Date updateTime;
 
-    /**
-     * 优惠券是否启用
-     */
-    private Boolean enableCoupon;
-
-    /**
-     * 白名单会员券是否启用
-     */
-    private Boolean enableMember;
-
-    /**
-     * 会员离场固定时间
-     */
-    private String memberLeaveTime;
-
-    /**
-     * 关联的后台账户
-     */
-    private String sysUserId;
-
-    /**
-     *
-     */
-    private String qrCode;
-
     @TableField(exist = false)
     private static final long serialVersionUID = 1L;
 }

+ 92 - 0
src/main/java/com/charging/chargingparking/entity/ParkingPayProfit.java

@@ -0,0 +1,92 @@
+package com.charging.chargingparking.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+import lombok.Data;
+
+/**
+ * 
+ * @TableName base_parking_pay_profit
+ */
+@TableName(value ="base_parking_pay_profit")
+@Data
+public class ParkingPayProfit implements Serializable {
+    /**
+     * 
+     */
+    @TableId
+    private String id;
+
+    /**
+     * 支付记录id
+     */
+    private String parkingPayId;
+
+    /**
+     * 资金来源账户
+     */
+    private String fundingSourceMchId;
+
+    /**
+     * 分账总金额
+     */
+    private BigDecimal profitTotalAmount;
+
+    /**
+     * 分账比例
+     */
+    private BigDecimal profitScale;
+
+    /**
+     * 分账金额流入账户
+     */
+    private String profitMchId;
+
+    /**
+     * 分账流入金额
+     */
+    private BigDecimal profitAmount;
+
+    /**
+     * 分账时间
+     */
+    private Date profitTime;
+
+    /**
+     * 分账订单号
+     */
+    private String profitOrderId;
+
+    /**
+     * 是否删除
+     */
+    private Boolean delFlag;
+
+    /**
+     * 
+     */
+    private String createBy;
+
+    /**
+     * 
+     */
+    private Date createTime;
+
+    /**
+     * 
+     */
+    private String updateBy;
+
+    /**
+     * 
+     */
+    private Date updateTime;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+}

+ 8 - 1
src/main/java/com/charging/chargingparking/mapper/ParkingFeeMapper.java

@@ -3,11 +3,18 @@ package com.charging.chargingparking.mapper;
 import com.charging.chargingparking.entity.ParkingFee;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
+import java.util.List;
+
 /**
  * @Entity com.charging.chargingparking.entity.ParkingFee
  */
 public interface ParkingFeeMapper extends BaseMapper<ParkingFee> {
-
+    int insert(ParkingFee entity);
+    int update(ParkingFee entity);
+    ParkingFee get(String id);
+    int delete(String id);
+    List<ParkingFee> list();
+    ParkingFee findByParkId(String id);
 }
 
 

+ 1 - 0
src/main/java/com/charging/chargingparking/mapper/ParkingInfoMapper.java

@@ -17,6 +17,7 @@ public interface ParkingInfoMapper extends BaseMapper<ParkingInfo> {
     ParkingInfo get(String id);
     int delete(String id);
     List<ParkingInfo> list();
+    List<ParkingInfo> findByUserId(String userId);
     List<ParkingInfo> search(Map<String,Object> searchParams,List<Sort> sortList);
 }
 

+ 15 - 0
src/main/java/com/charging/chargingparking/mapper/ParkingPayProfitMapper.java

@@ -0,0 +1,15 @@
+package com.charging.chargingparking.mapper;
+
+import com.charging.chargingparking.entity.ParkingPayProfit;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * @Entity com.charging.chargingparking.entity.ParkingPayProfit
+ */
+public interface ParkingPayProfitMapper extends BaseMapper<ParkingPayProfit> {
+
+}
+
+
+
+

+ 5 - 1
src/main/java/com/charging/chargingparking/mapper/ParkingUserRelationMapper.java

@@ -2,12 +2,16 @@ package com.charging.chargingparking.mapper;
 
 import com.charging.chargingparking.entity.ParkingUserRelation;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
 
 /**
  * @Entity com.charging.chargingparking.entity.ParkingUserRelation
  */
+@Repository
 public interface ParkingUserRelationMapper extends BaseMapper<ParkingUserRelation> {
-
+    List<ParkingUserRelation> findByUserId(String userId);
 }
 
 

+ 195 - 0
src/main/java/com/charging/chargingparking/modules/backController/ParkingFeeController.java

@@ -0,0 +1,195 @@
+package com.charging.chargingparking.modules.backController;
+
+import com.charging.chargingparking.dto.MessageResult;
+import com.charging.chargingparking.dto.PojoUtils;
+import com.charging.chargingparking.entity.ParkingFee;
+import com.charging.chargingparking.modules.common.dto.Sort;
+import com.charging.chargingparking.service.ParkingFeeService;
+import com.github.pagehelper.Page;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.*;
+
+
+@RestController
+@Slf4j
+@RequestMapping("/backParkingFee")
+public class ParkingFeeController {
+
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private ParkingFeeService parkingFeeService;
+
+    @ApiOperation(value="创建空记录")
+    @GetMapping("create")
+    public MessageResult<ParkingFee> create(){
+        MessageResult<ParkingFee> msgResult = new MessageResult<>();
+
+        ParkingFee parkingFee = new ParkingFee();
+
+        msgResult.setData(parkingFee);
+        msgResult.setResult(true);
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="添加信息")
+    @PostMapping("add")
+    public MessageResult<ParkingFee> add(@RequestBody ParkingFee parkingFee, @RequestAttribute String subject){
+        MessageResult<ParkingFee> msgResult = new MessageResult<>();
+
+        try {
+            parkingFee.setId(UUID.randomUUID().toString());
+            parkingFee.setDelFlag(false);
+            parkingFee.setCreateTime(new Date());
+
+            int affectCount = parkingFeeService.insert(parkingFee);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(parkingFee);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库添加失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="获取信息")
+    @GetMapping("edit/{id}")
+    public MessageResult<ParkingFee> edit(@PathVariable("id") String id){
+        MessageResult<ParkingFee> msgResult = new MessageResult<>();
+
+        try {
+            ParkingFee parkingFee = parkingFeeService.get(id);
+
+            if (parkingFee != null) {
+                msgResult.setResult(true);
+                msgResult.setData(parkingFee);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库不存在该记录!");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="更新用户")
+    @PostMapping("update")
+    public MessageResult<ParkingFee> update(@RequestBody ParkingFee parkingFee,@RequestAttribute String subject){
+        MessageResult<ParkingFee> msgResult = new MessageResult<>();
+
+        try {
+            parkingFee.setUpdateBy(subject);
+            parkingFee.setUpdateTime(new Date());
+
+            int affectCount = parkingFeeService.update(parkingFee);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(parkingFee);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库更新失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="删除")
+    @PostMapping("delete/{id}")
+    public MessageResult<Integer> delete(@PathVariable("id") String id,@RequestAttribute String subject){
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+            ParkingFee parkingFee = parkingFeeService.get(id);
+            parkingFee.setDelFlag(true);
+            parkingFee.setUpdateBy(subject);
+            parkingFee.setUpdateTime(new Date());
+
+            int affectCount = parkingFeeService.update(parkingFee);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(affectCount);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("删除失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+
+    @ApiOperation(value="批量删除")
+    @PostMapping("batchDelete")
+    public MessageResult<Integer> batchDelete(@RequestBody List<String> idList, @RequestAttribute String subject){
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+            int affectCount = 0;
+
+            for (String id : idList) {
+                ParkingFee parkingFee = parkingFeeService.get(id);
+                parkingFee.setDelFlag(true);
+                parkingFee.setUpdateBy(subject);
+                parkingFee.setUpdateTime(new Date());
+
+                affectCount += parkingFeeService.update(parkingFee);
+            }
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(affectCount);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("删除失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+}
+

+ 28 - 3
src/main/java/com/charging/chargingparking/modules/backController/ParkingInfoController.java

@@ -2,8 +2,10 @@ package com.charging.chargingparking.modules.backController;
 
 import com.charging.chargingparking.dto.MessageResult;
 import com.charging.chargingparking.dto.PojoUtils;
+import com.charging.chargingparking.entity.ParkingFee;
 import com.charging.chargingparking.entity.ParkingInfo;
 import com.charging.chargingparking.modules.common.dto.Sort;
+import com.charging.chargingparking.service.ParkingFeeService;
 import com.charging.chargingparking.service.ParkingInfoService;
 import com.github.pagehelper.Page;
 import io.swagger.annotations.ApiOperation;
@@ -30,6 +32,9 @@ public class ParkingInfoController {
     @Autowired
     private ParkingInfoService parkingInfoService;
 
+    @Autowired
+    private ParkingFeeService parkingFeeService;
+
     @ApiOperation(value="创建空记录")
     @GetMapping("create")
     public MessageResult<ParkingInfo> create(){
@@ -199,10 +204,10 @@ public class ParkingInfoController {
     @RequestMapping(value = "parkingInfoList",method = RequestMethod.POST)
     public MessageResult<Map> parkingInfoList(
             String parkingName,
+            Boolean oilCarEnable,
+            Boolean newEnergyCarEnable,
             @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
             @RequestParam(value="pageSize",defaultValue="20") int pageSize,
-            @RequestParam(value="field",defaultValue="create_time") String field,
-            @RequestParam(value="direction",defaultValue="desc") String direction,
             @RequestAttribute String subject){
 
         //当前用户ID
@@ -214,14 +219,34 @@ public class ParkingInfoController {
             Map<String,Object> searchParams = new HashMap<>();
 
             List<Sort> sortList = new ArrayList<>();
-            sortList.add(new Sort(field,direction));
+            sortList.add(new Sort("create_time", "desc"));
 
             if (StringUtils.isNotEmpty(parkingName)) {
                 searchParams.put("parkingName","%" + parkingName + "%");
             }
+            searchParams.put("oilCarEnable", oilCarEnable);
+            searchParams.put("newEnergyCarEnable", newEnergyCarEnable);
 
             Page<ParkingInfo> page = parkingInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
 
+            for(ParkingInfo parkingInfo : page) {
+                ParkingFee parkingFee = parkingFeeService.findByParkId(parkingInfo.getId());
+                parkingInfo.setOilCarFreeTime(parkingFee.getFreeDuration());
+                parkingInfo.setOilCarCost(parkingFee.getHourCost());
+                parkingInfo.setNewEnergyCarTime(parkingFee.getNewEnergyFreeDuration());
+                parkingInfo.setNewEnergyCarCost(parkingFee.getNewEnergyHourCost());
+                if(parkingInfo.getOilCarEnable()) {
+                    parkingInfo.setOilCarEnableN("允许");
+                } else {
+                    parkingInfo.setOilCarEnableN("不允许");
+                }
+                if(parkingInfo.getNewEnergyCarEnable()) {
+                    parkingInfo.setNewEnergyCarEnableN("允许");
+                } else {
+                    parkingInfo.setNewEnergyCarEnableN("不允许");
+                }
+            }
+
             messageResult.setData(PojoUtils.pageWrapper(page));
             messageResult.setResult(true);
 

+ 6 - 4
src/main/java/com/charging/chargingparking/modules/backController/ParkingMemberInfoController.java

@@ -174,7 +174,7 @@ public class ParkingMemberInfoController {
     @ApiOperation(value = "列表")
     @RequestMapping(value = "pageList", method = RequestMethod.POST)
     public MessageResult<Map> pageList(
-            String parkName, String memberCarNum, String rangeDate, String cloudDelFlag,
+            String parkId, String memberCarNum, String rangeDate, String cloudDelFlag,
             @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
             @RequestParam(value = "pageSize", defaultValue = "20") int pageSize,
             @RequestAttribute String subject) {
@@ -190,8 +190,8 @@ public class ParkingMemberInfoController {
         List<Sort> sortList = new ArrayList<>();
         sortList.add(new Sort("a.create_time", "desc"));
 
-        if (StringUtils.isNotEmpty(parkName)) {
-            searchParams.put("parkName", "%" + parkName + "%");
+        if (StringUtils.isNotEmpty(parkId)) {
+            searchParams.put("parkId", parkId);
         }
 
         if (StringUtils.isNotEmpty(memberCarNum)) {
@@ -220,6 +220,8 @@ public class ParkingMemberInfoController {
             searchParams.put("cloudDelFlag", cloudDelFlag);
         }
 
+        searchParams.put("userId", subject);
+
         Page<ParkingMember> page = parkingMemberService.pageSearch(searchParams, pageIndex, pageSize, sortList);
 
         for (ParkingMember parkingMember : page) {
@@ -238,7 +240,7 @@ public class ParkingMemberInfoController {
 
     @ApiOperation(value = "停车场列表")
     @RequestMapping(value = "parkingList", method = RequestMethod.POST)
-    public MessageResult<List<ParkingInfo>> parkingList() {
+    public MessageResult<List<ParkingInfo>> parkingList(@RequestAttribute String subject) {
         MessageResult<List<ParkingInfo>> msgResult = new MessageResult<>();
 
         List<ParkingInfo> list = parkingInfoService.list();

+ 91 - 0
src/main/java/com/charging/chargingparking/modules/backController/ParkingUserRelationController.java

@@ -0,0 +1,91 @@
+package com.charging.chargingparking.modules.backController;
+
+
+import com.charging.chargingparking.dto.MessageResult;
+import com.charging.chargingparking.dto.ParkingUserRelationDTO;
+import com.charging.chargingparking.entity.ParkingUserRelation;
+import com.charging.chargingparking.service.ParkingUserRelationService;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+@RestController
+@Slf4j
+@RequestMapping("/parkingUserRelation")
+public class ParkingUserRelationController {
+
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private ParkingUserRelationService parkingUserRelationService;
+
+
+    @ApiOperation(value="获取信息")
+    @GetMapping("findByUserId/{id}")
+    public MessageResult<ParkingUserRelationDTO> findByUserId(@PathVariable("id") String id){
+        MessageResult<ParkingUserRelationDTO> msgResult = new MessageResult<>();
+
+        try {
+            List<ParkingUserRelation> parkingUserRelationList = parkingUserRelationService.findByUserId(id);
+
+            ParkingUserRelationDTO dto = new ParkingUserRelationDTO();
+            dto.setRegUserId(id);
+
+            String[] parkingInfoIds = new String[parkingUserRelationList.size()];
+
+            for(int i=0;i<parkingUserRelationList.size();i++){
+                parkingInfoIds[i] = parkingUserRelationList.get(i).getParkingId();
+            }
+
+            dto.setParkingInfoIds(parkingInfoIds);
+
+            msgResult.setResult(true);
+            msgResult.setData(dto);
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+
+
+    @ApiOperation(value="添加信息")
+    @PostMapping("add")
+    public MessageResult<Integer> add(@RequestBody ParkingUserRelationDTO dto, @RequestAttribute String subject){
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+
+            int affectCount = parkingUserRelationService.batchSave(dto,subject);
+
+            if (affectCount>0) {
+                msgResult.setResult(true);
+                msgResult.setData(affectCount);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("添加失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage("添加失败");
+        }
+
+        return msgResult;
+    }
+
+}

+ 9 - 0
src/main/java/com/charging/chargingparking/modules/pay/wechat/WxPayController.java

@@ -12,7 +12,9 @@ import com.charging.chargingparking.dto.UserInfo;
 import com.charging.chargingparking.entity.ParkingPay;
 import com.charging.chargingparking.entity.ParkingRecord;
 import com.charging.chargingparking.modules.pay.properties.WxPayProperties;
+import com.charging.chargingparking.modules.vo.ProfitVo;
 import com.charging.chargingparking.service.ParkingFeeService;
+import com.charging.chargingparking.service.ParkingPayProfitService;
 import com.charging.chargingparking.service.ParkingPayService;
 import com.charging.chargingparking.service.ParkingRecordService;
 import com.charging.chargingparking.utils.Sign;
@@ -23,6 +25,8 @@ import com.ijpay.core.enums.TradeType;
 import com.ijpay.core.kit.HttpKit;
 import com.ijpay.core.kit.WxPayKit;
 import com.ijpay.wxpay.WxPayApi;
+import com.ijpay.wxpay.model.ProfitSharingModel;
+import com.ijpay.wxpay.model.ReceiverModel;
 import com.ijpay.wxpay.model.UnifiedOrderModel;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -56,6 +60,9 @@ public class WxPayController {
     @Autowired
     private ParkingPayService parkingPayService;
 
+    @Autowired
+    private ParkingPayProfitService parkingPayProfitService;
+
 
     /**
      * 停车微信JSAPI支付
@@ -106,6 +113,8 @@ public class WxPayController {
             parkingPay.setCodePayType(codePayType);
             parkingPayService.save(parkingPay);
 
+            ProfitVo profitVo = parkingPayProfitService.getProfitVo(parkingPay);
+
             Map<String, String> params = UnifiedOrderModel
                     .builder()
                     .appid(wxPayProperties.getAppId())

+ 35 - 0
src/main/java/com/charging/chargingparking/modules/vo/ProfitVo.java

@@ -0,0 +1,35 @@
+package com.charging.chargingparking.modules.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2022/6/16 0016 上午 11:10
+ */
+@Data
+public class ProfitVo {
+
+    //分账出资账户
+    private String subMchId;
+
+    //是否要分账
+    private Boolean profitFlag;
+
+    //分账比例
+    private BigDecimal profitScale;
+
+    //分账金额
+    private BigDecimal profitAmount;
+
+    //内部订单号
+    private String transactionId;
+
+    //外部订单号
+    private String outOrderNo;
+
+    //分账描述
+    private String description;
+
+}

+ 7 - 0
src/main/java/com/charging/chargingparking/service/ParkingFeeService.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.charging.chargingparking.entity.ParkingRecord;
 
 import java.math.BigDecimal;
+import java.util.List;
 
 /**
  *
@@ -16,4 +17,10 @@ public interface ParkingFeeService extends IService<ParkingFee> {
 
  //   BigDecimal allCost(ParkingRecord parkingRecord) throws Exception;
 
+    ParkingFee get(String id);
+    int insert(ParkingFee model);
+    int update(ParkingFee model);
+    int delete(String id);
+    List<ParkingFee> list();
+    ParkingFee findByParkId(String id);
 }

+ 1 - 0
src/main/java/com/charging/chargingparking/service/ParkingInfoService.java

@@ -17,5 +17,6 @@ public interface ParkingInfoService extends IService<ParkingInfo> {
     int update(ParkingInfo model);
     int delete(String id);
     List<ParkingInfo> list();
+    List<ParkingInfo> findByUserId(String userId);
     Page<ParkingInfo> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, boolean count, List<Sort> sortList);
 }

+ 14 - 0
src/main/java/com/charging/chargingparking/service/ParkingPayProfitService.java

@@ -0,0 +1,14 @@
+package com.charging.chargingparking.service;
+
+import com.charging.chargingparking.entity.ParkingPay;
+import com.charging.chargingparking.entity.ParkingPayProfit;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.charging.chargingparking.modules.vo.ProfitVo;
+
+/**
+ *
+ */
+public interface ParkingPayProfitService extends IService<ParkingPayProfit> {
+
+    ProfitVo getProfitVo(ParkingPay parkingPay);
+}

+ 7 - 0
src/main/java/com/charging/chargingparking/service/ParkingUserRelationService.java

@@ -1,11 +1,18 @@
 package com.charging.chargingparking.service;
 
+import com.charging.chargingparking.dto.ParkingUserRelationDTO;
 import com.charging.chargingparking.entity.ParkingUserRelation;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  *
  */
 public interface ParkingUserRelationService extends IService<ParkingUserRelation> {
 
+    List<ParkingUserRelation> findByUserId(String userId);
+
+    int batchSave(ParkingUserRelationDTO dto,String subject);
+
 }

+ 1 - 1
src/main/java/com/charging/chargingparking/service/impl/ParkingChannelServiceImpl.java

@@ -120,7 +120,7 @@ public class ParkingChannelServiceImpl extends ServiceImpl<ParkingChannelMapper,
                     parkingRecord.setReleaseStatus("1");
                     parkingRecordService.updateById(parkingRecord);
                     responseAlarmInfoPlate.setInfo(ParkingConstant.OK);
-                    responseAlarmInfoPlate.setSerialData(stringUtils.getSerialData(parkingRecord.getCarNum(), ParkingConstant.OUTMESSAGE, parkingChannel.getId(),true,true));
+                    responseAlarmInfoPlate.setSerialData(stringUtils.getSerialData(parkingRecord.getCarNum()+ParkingConstant.OUTMESSAGE, parkingRecord.getCarNum()+ParkingConstant.OUTMESSAGE, parkingChannel.getId(),true,true));
 
                     //出停车场检测是否需要删除临时会员
                     if (map.get(ParkingConstant.RESPONSEKEY) !=null && "1".equals(parkingRecord.getReleaseStatus())){

+ 1 - 1
src/main/java/com/charging/chargingparking/service/impl/ParkingChannelVoiceServiceImpl.java

@@ -28,7 +28,7 @@ public class ParkingChannelVoiceServiceImpl extends ServiceImpl<ParkingChannelVo
         try{
             QueryWrapper<ParkingChannelVoice> parkingChannelVoiceQueryWrapper = new QueryWrapper<>();
             parkingChannelVoiceQueryWrapper.eq("channel_id",channelId);
-            parkingChannelVoiceQueryWrapper.gt("create_time", DateUtil.offset(new Date(), DateField.SECOND,-30));
+            parkingChannelVoiceQueryWrapper.gt("create_time", DateUtil.offset(new Date(), DateField.SECOND,-60));
             parkingChannelVoiceQueryWrapper.eq("broadcast_flag",false);
             parkingChannelVoiceQueryWrapper.orderByAsc("create_time");
             parkingChannelVoiceQueryWrapper.last("LIMIT 1");

+ 47 - 0
src/main/java/com/charging/chargingparking/service/impl/ParkingFeeServiceImpl.java

@@ -12,17 +12,23 @@ import com.charging.chargingparking.dto.ParkingCostDTO;
 import com.charging.chargingparking.entity.ParkingFee;
 import com.charging.chargingparking.entity.ParkingMember;
 import com.charging.chargingparking.entity.ParkingRecord;
+import com.charging.chargingparking.modules.common.dto.Sort;
 import com.charging.chargingparking.service.ParkingFeeService;
 import com.charging.chargingparking.mapper.ParkingFeeMapper;
 import com.charging.chargingparking.service.ParkingMemberService;
 import com.charging.chargingparking.service.ParkingRecordService;
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageHelper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.Date;
+import java.util.List;
+import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
 /**
@@ -33,6 +39,9 @@ import java.util.concurrent.TimeUnit;
 public class ParkingFeeServiceImpl extends ServiceImpl<ParkingFeeMapper, ParkingFee>
         implements ParkingFeeService {
 
+    @Resource(name="parkingFeeMapper")
+    private ParkingFeeMapper parkingFeeMapper;
+
     @Autowired
     private ParkingMemberService parkingMemberService;
 
@@ -145,6 +154,7 @@ public class ParkingFeeServiceImpl extends ServiceImpl<ParkingFeeMapper, Parking
             BigDecimal hours0 = BigDecimal.ZERO;
             //需要计算费用的时间大于等于免费时间要计算费用
             if (time > freeDuration) {
+                time = time - freeDuration;
                 hours0 = NumberUtil.div(Convert.toBigDecimal(time), Convert.toBigDecimal(60), 0, RoundingMode.UP);
                 totalAmount = hourCost.multiply(hours0);
             }
@@ -175,6 +185,7 @@ public class ParkingFeeServiceImpl extends ServiceImpl<ParkingFeeMapper, Parking
             BigDecimal hours = BigDecimal.ZERO;
             //需要计算费用的时间大于等于免费时间要计算费用
             if (needCalcMin > freeDuration) {
+                needCalcMin = needCalcMin - freeDuration;
                  hours = NumberUtil.div(Convert.toBigDecimal(needCalcMin), Convert.toBigDecimal(60), 0, RoundingMode.UP);
                  resultCost = hourCost.multiply(hours);
             }
@@ -209,6 +220,42 @@ public class ParkingFeeServiceImpl extends ServiceImpl<ParkingFeeMapper, Parking
         return parkingCostDTO;
     }
 
+    @Override
+    public ParkingFee get(String id) {
+        // TODO Auto-generated method stub
+        return parkingFeeMapper.get(id);
+    }
+
+    @Override
+    public int insert(ParkingFee model) {
+        // TODO Auto-generated method stub
+        //model.setId(UUID.randomUUID().toString());
+
+        return parkingFeeMapper.insert(model);
+    }
+
+    @Override
+    public int update(ParkingFee model) {
+        // TODO Auto-generated method stub
+        return parkingFeeMapper.update(model);
+    }
+
+    @Override
+    public int delete(String id) {
+        // TODO Auto-generated method stub
+        return parkingFeeMapper.delete(id);
+    }
+
+    @Override
+    public List<ParkingFee> list() {
+        // TODO Auto-generated method stub
+        return parkingFeeMapper.list();
+    }
+
+    @Override
+    public ParkingFee findByParkId(String id) {
+        return parkingFeeMapper.findByParkId(id);
+    }
 }
 
 

+ 6 - 0
src/main/java/com/charging/chargingparking/service/impl/ParkingInfoServiceImpl.java

@@ -55,6 +55,12 @@ public class ParkingInfoServiceImpl extends ServiceImpl<ParkingInfoMapper, Parki
         return parkingInfoMapper.list();
     }
 
+
+    @Override
+    public List<ParkingInfo> findByUserId(String userId){
+        return parkingInfoMapper.findByUserId(userId);
+    }
+
     @Override
     public Page<ParkingInfo> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize, boolean count, List<Sort> sortList) {
         Page<ParkingInfo> page = PageHelper.startPage(pageNumber,pageSize,count).doSelectPage(()->{

+ 64 - 0
src/main/java/com/charging/chargingparking/service/impl/ParkingPayProfitServiceImpl.java

@@ -0,0 +1,64 @@
+package com.charging.chargingparking.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.charging.chargingparking.entity.*;
+import com.charging.chargingparking.modules.vo.ProfitVo;
+import com.charging.chargingparking.service.ParkingInfoService;
+import com.charging.chargingparking.service.ParkingMerchantService;
+import com.charging.chargingparking.service.ParkingPayProfitService;
+import com.charging.chargingparking.mapper.ParkingPayProfitMapper;
+import com.charging.chargingparking.service.ParkingRecordService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ */
+@Service
+@Slf4j
+public class ParkingPayProfitServiceImpl extends ServiceImpl<ParkingPayProfitMapper, ParkingPayProfit>
+    implements ParkingPayProfitService{
+
+    @Autowired
+    private ParkingRecordService parkingRecordService;
+
+    @Autowired
+    private ParkingInfoService parkingInfoService;
+
+    @Autowired
+    private ParkingMerchantService parkingMerchantService;
+
+    @Override
+    public ProfitVo getProfitVo(ParkingPay parkingPay) {
+
+        ProfitVo profitVo = new ProfitVo();
+        profitVo.setProfitFlag(false);
+
+        try{
+            ParkingRecord parkingRecord = parkingRecordService.getById(parkingPay.getParkingRecordId());
+            //停车场
+            ParkingInfo parkingInfo = parkingInfoService.getById(parkingRecord.getParkId());
+            //商户
+            ParkingMerchant parkingMerchant = parkingMerchantService.getById(parkingInfo.getMerchantId());
+            if (parkingMerchant.getProfitFlag()){
+                profitVo.setProfitFlag(true);
+                profitVo.setProfitScale(parkingMerchant.getProfitScale());
+
+
+            }
+
+
+        }catch (Exception ex){
+            log.error(ex.getMessage(),ex);
+        }
+
+
+
+        return profitVo;
+    }
+}
+
+
+
+

+ 3 - 3
src/main/java/com/charging/chargingparking/service/impl/ParkingRecordServiceImpl.java

@@ -141,7 +141,7 @@ public class ParkingRecordServiceImpl extends ServiceImpl<ParkingRecordMapper, P
 
                 responseAlarmInfoPlate.setInfo(ParkingConstant.OK);
                 responseAlarmInfoPlate.setPlateid(parkingRecord.getPlateId());
-                responseAlarmInfoPlate.setSerialData(stringUtils.getSerialData(license,ParkingConstant.INMESSAGE,parkingChannel.getId(),true,true));
+                responseAlarmInfoPlate.setSerialData(stringUtils.getSerialData(license+ParkingConstant.INMESSAGE,license+ParkingConstant.INMESSAGE,parkingChannel.getId(),true,true));
 
             }
             map.put(ParkingConstant.RESPONSEKEY,responseAlarmInfoPlate);
@@ -184,7 +184,7 @@ public class ParkingRecordServiceImpl extends ServiceImpl<ParkingRecordMapper, P
 
                 responseAlarmInfoPlate.setInfo("ok");
                 responseAlarmInfoPlate.setPlateid(parkingRecord.getPlateId());
-                responseAlarmInfoPlate.setSerialData(stringUtils.getSerialData(license,ParkingConstant.OUTMESSAGE,parkingChannel.getId(),true,true));
+                responseAlarmInfoPlate.setSerialData(stringUtils.getSerialData(license+ParkingConstant.OUTMESSAGE,license+ParkingConstant.OUTMESSAGE,parkingChannel.getId(),true,true));
                 map.put(ParkingConstant.RESPONSEKEY,responseAlarmInfoPlate);
             }
             //已存在记录,计算缴费金额
@@ -215,7 +215,7 @@ public class ParkingRecordServiceImpl extends ServiceImpl<ParkingRecordMapper, P
                 if (parkingCost.subtract(parkingRecord0.getPayAmount()).compareTo(BigDecimal.ZERO) ==0){
                     responseAlarmInfoPlate.setInfo("ok");
                     responseAlarmInfoPlate.setPlateid(parkingRecord0.getPlateId());
-                    responseAlarmInfoPlate.setSerialData(stringUtils.getSerialData(license,ParkingConstant.OUTMESSAGE,parkingChannel.getId(),true,true));
+                    responseAlarmInfoPlate.setSerialData(stringUtils.getSerialData(license+ParkingConstant.OUTMESSAGE,license+ParkingConstant.OUTMESSAGE,parkingChannel.getId(),true,true));
                     map.put(ParkingConstant.RESPONSEKEY,responseAlarmInfoPlate);
                     parkingRecord0.setReleaseStatus("1");
                 }else {

+ 50 - 0
src/main/java/com/charging/chargingparking/service/impl/ParkingUserRelationServiceImpl.java

@@ -1,11 +1,16 @@
 package com.charging.chargingparking.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.charging.chargingparking.dto.ParkingUserRelationDTO;
 import com.charging.chargingparking.entity.ParkingUserRelation;
 import com.charging.chargingparking.service.ParkingUserRelationService;
 import com.charging.chargingparking.mapper.ParkingUserRelationMapper;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Date;
+import java.util.List;
+
 /**
  *
  */
@@ -13,6 +18,51 @@ import org.springframework.stereotype.Service;
 public class ParkingUserRelationServiceImpl extends ServiceImpl<ParkingUserRelationMapper, ParkingUserRelation>
     implements ParkingUserRelationService{
 
+    @Autowired
+    private ParkingUserRelationMapper parkingUserRelationMapper;
+
+    @Autowired
+    private ParkingUserRelationService parkingUserRelationService;
+
+    @Override
+    public List<ParkingUserRelation> findByUserId(String userId) {
+        return parkingUserRelationMapper.findByUserId(userId);
+    }
+
+
+
+    @Override
+    public int batchSave(ParkingUserRelationDTO dto,String subject){
+        String regUserId = dto.getRegUserId();
+
+        String[] parkingIdArray = dto.getParkingInfoIds();
+
+        List<ParkingUserRelation> originalList = parkingUserRelationMapper.findByUserId(regUserId);
+
+        for (ParkingUserRelation parkingUserRelation:originalList) {
+            parkingUserRelationService.removeById(parkingUserRelation);
+        }
+
+        int count = 0;
+
+
+        for (String parkId:parkingIdArray) {
+            ParkingUserRelation parkingUserRelation = new ParkingUserRelation();
+            parkingUserRelation.setCreateBy(subject);
+            parkingUserRelation.setCreateTime(new Date());
+            parkingUserRelation.setDelFlag(false);
+            parkingUserRelation.setParkingId(parkId);
+            parkingUserRelation.setRegUserId(regUserId);
+
+            boolean result = parkingUserRelationService.save(parkingUserRelation);
+
+            if(result){
+                count++;
+            }
+        }
+
+        return count;
+    }
 }
 
 

+ 73 - 0
src/main/resources/mapper/ParkingFeeMapper.xml

@@ -25,4 +25,77 @@
         create_time,update_by,update_time,
         del_flag
     </sql>
+    <insert id="insert" parameterType="com.charging.chargingparking.entity.ParkingFee">
+        <![CDATA[
+		insert into base_parking_fee
+	    (id,park_id,free_duration,new_energy_free_duration,hour_cost,new_energy_hour_cost,day_capping_cost,create_by,
+            create_time,update_by,update_time,del_flag)
+		values
+		(
+			#{id,jdbcType=VARCHAR}
+            ,#{parkId,jdbcType=VARCHAR}
+            ,#{freeDuration,jdbcType=INTEGER}
+            ,#{newEnergyFreeDuration,jdbcType=INTEGER}
+            ,#{hourCost,jdbcType=DECIMAL}
+            ,#{newEnergyHourCost,jdbcType=DECIMAL}
+            ,#{dayCappingCost,jdbcType=DECIMAL}
+            ,#{createBy,jdbcType=VARCHAR}
+            ,#{createTime,jdbcType=TIMESTAMP}
+            ,#{updateBy,jdbcType=VARCHAR}
+            ,#{updateTime,jdbcType=TIMESTAMP}
+            ,#{delFlag,jdbcType=BIT}
+		)
+	]]>
+    </insert>
+    <update id="update" parameterType="com.charging.chargingparking.entity.ParkingFee">
+        update base_parking_fee
+        <set>
+            <if test="parkId!=null">
+                park_id=#{parkId,jdbcType=VARCHAR},
+            </if>
+            <if test="freeDuration!=null">
+                free_duration=#{freeDuration,freeDuration=INTEGER},
+            </if>
+            <if test="newEnergyFreeDuration!=null">
+                new_energy_free_duration=#{newEnergyFreeDuration,jdbcType=INTEGER},
+            </if>
+            <if test="hourCost!=null">
+                hour_cost=#{hourCost,jdbcType=DECIMAL},
+            </if>
+            <if test="newEnergyHourCost!=null">
+                new_energy_hour_cost=#{newEnergyHourCost,jdbcType=DECIMAL},
+            </if>
+            <if test="dayCappingCost!=null">
+                day_capping_cost=#{dayCappingCost,jdbcType=DECIMAL},
+            </if>
+            <if test="createBy!=null">
+                create_by=#{createBy,jdbcType=VARCHAR},
+            </if>
+            <if test="createTime!=null">
+                create_time=#{createTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="updateBy!=null">
+                update_by=#{updateBy,jdbcType=VARCHAR},
+            </if>
+            <if test="updateTime!=null">
+                update_time=#{updateTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="delFlag!=null">
+                del_flag=#{delFlag,jdbcType=BIT},
+            </if>
+        </set>
+        where id=#{id}
+    </update>
+    <delete id="delete" parameterType="string">
+        delete from base_parking_fee where id=#{id,jdbcType=VARCHAR}
+    </delete>
+    <select id="findByParkId" resultType="com.charging.chargingparking.entity.ParkingFee">
+        select * from base_parking_fee where del_flag = 0 and park_id=#{id}
+    </select>
+    <select id="get"  parameterType="string" resultType="com.charging.chargingparking.entity.ParkingFee">
+        select * from base_parking_fee where id=#{0} and del_flag = 0
+    </select>
+    <select id="list" resultType="com.charging.chargingparking.entity.ParkingFee">
+        select * from base_parking_fee
+    </select>
 </mapper>

+ 20 - 2
src/main/resources/mapper/ParkingInfoMapper.xml

@@ -6,6 +6,7 @@
 
     <resultMap id="ParkingInfoMap" type="com.charging.chargingparking.entity.ParkingInfo">
             <id property="id" column="id" jdbcType="VARCHAR"/>
+            <result property="merchantId" column="merchant_id" jdbcType="VARCHAR"/>
             <result property="parkUname" column="park_uname" jdbcType="BIGINT"/>
             <result property="parkKey" column="park_key" jdbcType="VARCHAR"/>
             <result property="password" column="password_" jdbcType="VARCHAR"/>
@@ -24,7 +25,7 @@
     </resultMap>
 
     <sql id="Base_Parking_Info">
-        id,park_uname,park_key,
+        id,merchant_id,park_uname,park_key,
         password_,company_name,parking_name,
         pic_url,charging_free_duration,oil_car_enable,new_energy_car_enable,del_flag,create_by,
         create_time,update_by,update_time,
@@ -33,11 +34,12 @@
     <insert id="insert" parameterType="com.charging.chargingparking.entity.ParkingInfo">
         <![CDATA[
 		insert into base_parking_info
-	    (id,park_uname,park_key,password_,company_name,parking_name,pic_url,charging_free_duration,oil_car_enable,
+	    (id,merchant_id,park_uname,park_key,password_,company_name,parking_name,pic_url,charging_free_duration,oil_car_enable,
 	        new_energy_car_enable,del_flag,create_by,create_time,update_by,update_time,address_)
 		values
 		(
 			#{id,jdbcType=VARCHAR}
+			,#{merchantId,jdbcType=VARCHAR}
             ,#{parkUname,jdbcType=BIGINT}
             ,#{parkKey,jdbcType=VARCHAR}
             ,#{password,jdbcType=VARCHAR}
@@ -59,6 +61,10 @@
     <update id="update" parameterType="com.charging.chargingparking.entity.ParkingInfo">
         update base_parking_info
         <set>
+
+            <if test="merchantId!=null">
+                merchant_id=#{merchantId,jdbcType=BIGINT},
+            </if>
             <if test="parkUname!=null">
                 park_uname=#{parkUname,jdbcType=BIGINT},
             </if>
@@ -116,6 +122,12 @@
     <select id="list" resultType="com.charging.chargingparking.entity.ParkingInfo">
         select * from base_parking_info
     </select>
+    <select id="findByUserId" resultType="com.charging.chargingparking.entity.ParkingInfo">
+        select a.* from base_parking_info a
+        inner join base_parking_user_relation b on a.id = b.parking_id
+        where b.reg_user_id = #{0} and a.del_flag=false and b.del_flag=false
+        order by a.create_time desc
+    </select>
     <select id="search" parameterType="hashmap" resultType="com.charging.chargingparking.entity.ParkingInfo">
         <![CDATA[
 			select * from base_parking_info
@@ -125,6 +137,12 @@
             <if test="searchParams.parkingName != null">
                 and parking_name like #{searchParams.parkingName}
             </if>
+            <if test="searchParams.oilCarEnable != null">
+                and oil_car_enable = #{searchParams.oilCarEnable}
+            </if>
+            <if test="searchParams.newEnergyCarEnable != null">
+                and new_energy_car_enable = #{searchParams.newEnergyCarEnable}
+            </if>
             <if test="searchParams.createTime != null">
                 and create_time like #{searchParams.createTime}
             </if>

+ 2 - 3
src/main/resources/mapper/ParkingMemberMapper.xml

@@ -30,15 +30,14 @@
         update_by,update_time,cloud_del_flag
     </sql>
 
-
     <select id="search" parameterType="hashmap" resultMap="BaseResultMap">
         <![CDATA[
 			select * from base_parking_member a
 			inner join base_parking_info b on a.park_id = b.id
 		]]>
         where a.del_flag=false and b.del_flag=false
-        <if test="searchParams.parkName != null">
-            and b.parking_name like #{searchParams.parkName}
+        <if test="searchParams.parkId != null">
+            and a.park_id = #{searchParams.parkId}
         </if>
         <if test="searchParams.memberCarNum != null">
             and a.member_car_num = #{searchParams.memberCarNum}

+ 8 - 19
src/main/resources/mapper/ParkingMerchantMapper.xml

@@ -6,33 +6,22 @@
 
     <resultMap id="BaseResultMap" type="com.charging.chargingparking.entity.ParkingMerchant">
             <id property="id" column="id" jdbcType="VARCHAR"/>
-            <result property="parkId" column="park_id" jdbcType="VARCHAR"/>
-            <result property="merchantNo" column="merchant_no" jdbcType="VARCHAR"/>
             <result property="merchantName" column="merchant_name" jdbcType="VARCHAR"/>
-            <result property="operatorNo" column="operator_no" jdbcType="VARCHAR"/>
-            <result property="operatorPassword" column="operator_password" jdbcType="VARCHAR"/>
-            <result property="type" column="type_" jdbcType="VARCHAR"/>
-            <result property="reduce" column="reduce_" jdbcType="INTEGER"/>
-            <result property="openId" column="open_id" jdbcType="VARCHAR"/>
+            <result property="subMchId" column="sub_mch_id" jdbcType="VARCHAR"/>
+            <result property="appAuthToken" column="app_auth_token" jdbcType="VARCHAR"/>
+            <result property="profitFlag" column="profit_flag" jdbcType="BIT"/>
+            <result property="profitScale" column="profit_scale" jdbcType="DECIMAL"/>
             <result property="delFlag" column="del_flag" jdbcType="BIT"/>
             <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
             <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
             <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
             <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
-            <result property="enableCoupon" column="enable_coupon" jdbcType="BIT"/>
-            <result property="enableMember" column="enable_member" jdbcType="BIT"/>
-            <result property="memberLeaveTime" column="member_leave_time" jdbcType="VARCHAR"/>
-            <result property="sysUserId" column="sys_user_id" jdbcType="VARCHAR"/>
-            <result property="qrCode" column="qr_code" jdbcType="VARCHAR"/>
     </resultMap>
 
     <sql id="Base_Column_List">
-        id,park_id,merchant_no,
-        merchant_name,operator_no,operator_password,
-        type_,reduce_,open_id,
-        del_flag,create_by,create_time,
-        update_by,update_time,enable_coupon,
-        enable_member,member_leave_time,sys_user_id,
-        qr_code
+        id,merchant_name,sub_mch_id,
+        app_auth_token,profit_flag,profit_scale,del_flag,
+        create_by,create_time,update_by,
+        update_time
     </sql>
 </mapper>

+ 31 - 0
src/main/resources/mapper/ParkingPayProfitMapper.xml

@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.charging.chargingparking.mapper.ParkingPayProfitMapper">
+
+    <resultMap id="BaseResultMap" type="com.charging.chargingparking.entity.ParkingPayProfit">
+            <id property="id" column="id" jdbcType="VARCHAR"/>
+            <result property="parkingPayId" column="parking_pay_id" jdbcType="VARCHAR"/>
+            <result property="fundingSourceMchId" column="funding_source_mch_id" jdbcType="VARCHAR"/>
+            <result property="profitTotalAmount" column="profit_total_amount" jdbcType="DECIMAL"/>
+            <result property="profitScale" column="profit_scale" jdbcType="DECIMAL"/>
+            <result property="profitMchId" column="profit_mch_id" jdbcType="VARCHAR"/>
+            <result property="profitAmount" column="profit_amount" jdbcType="DECIMAL"/>
+            <result property="profitTime" column="profit_time" jdbcType="TIMESTAMP"/>
+            <result property="profitOrderId" column="profit_order_id" jdbcType="VARCHAR"/>
+            <result property="delFlag" column="del_flag" jdbcType="BIT"/>
+            <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
+            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+            <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
+            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,parking_pay_id,funding_source_mch_id,
+        profit_total_amount,profit_scale,profit_mch_id,
+        profit_amount,profit_time,profit_order_id,
+        del_flag,create_by,create_time,
+        update_by,update_time
+    </sql>
+</mapper>

+ 5 - 0
src/main/resources/mapper/ParkingUserRelationMapper.xml

@@ -20,4 +20,9 @@
         del_flag,create_by,create_time,
         update_by,update_time
     </sql>
+
+    <select id="findByUserId" parameterType="hashmap" resultMap="BaseResultMap">
+		  select * from base_parking_user_relation where del_flag=false and reg_user_id = #{0} order by create_time desc
+    </select>
+
 </mapper>