Browse Source

补打标签

zangguocen 4 years ago
parent
commit
ee716bf586
24 changed files with 1398 additions and 33 deletions
  1. 14 0
      yijia-admin/src/main/java/com/yijia/web/controller/system/SysDeptController.java
  2. 1 1
      yijia-admin/src/main/java/com/yijia/web/controller/system/SysUserController.java
  3. 9 0
      yijia-common/src/main/java/com/yijia/common/core/domain/BaseEntity.java
  4. 58 4
      yijia-label/src/main/java/com/yijia/label/controller/CustomerLabelController.java
  5. 20 1
      yijia-label/src/main/java/com/yijia/label/controller/LabelRuleController.java
  6. 353 0
      yijia-label/src/main/java/com/yijia/label/domain/CustomerLabelDemo.java
  7. 35 0
      yijia-label/src/main/java/com/yijia/label/mapper/CustomerLabelDemoMapper.java
  8. 38 0
      yijia-label/src/main/java/com/yijia/label/service/ICustomerLabelDemoService.java
  9. 46 0
      yijia-label/src/main/java/com/yijia/label/service/impl/CustomerLabelDemoServiceImpl.java
  10. 291 0
      yijia-label/src/main/resources/mapper/label/CustomerLabelDemoMapper.xml
  11. 128 7
      yijia-station/src/main/java/com/yijia/station/controller/PayOrderController.java
  12. 170 0
      yijia-station/src/main/java/com/yijia/station/controller/StationClassStructureController.java
  13. 11 0
      yijia-station/src/main/java/com/yijia/station/domain/DeptInfoDemo.java
  14. 20 11
      yijia-station/src/main/java/com/yijia/station/domain/StationBalanceChange.java
  15. 9 0
      yijia-station/src/main/java/com/yijia/station/domain/StationSettlementPriceAdjust.java
  16. 7 0
      yijia-station/src/main/java/com/yijia/station/mapper/PayOrderMapper.java
  17. 5 0
      yijia-station/src/main/java/com/yijia/station/service/IPayOrderService.java
  18. 10 0
      yijia-station/src/main/java/com/yijia/station/service/impl/PayOrderServiceImpl.java
  19. 69 4
      yijia-station/src/main/resources/mapper/station/PayOrderMapper.xml
  20. 3 1
      yijia-station/src/main/resources/mapper/station/StationBalanceChangeMapper.xml
  21. 4 1
      yijia-station/src/main/resources/mapper/station/StationSettlementPriceAdjustMapper.xml
  22. 6 1
      yijia-system/src/main/java/com/yijia/system/service/ISysDeptService.java
  23. 81 0
      yijia-system/src/main/java/com/yijia/system/service/impl/SysDeptServiceImpl.java
  24. 10 2
      yijia-system/src/main/resources/mapper/system/SysDeptMapper.xml

+ 14 - 0
yijia-admin/src/main/java/com/yijia/web/controller/system/SysDeptController.java

@@ -218,6 +218,20 @@ public class SysDeptController extends BaseController
         return AjaxResult.success(deptList);
     }
 
+    @GetMapping("/selectDeptBalance")
+    public AjaxResult selectDeptBalance(SysDept dept)
+    {
+        LoginUser currentUser = SecurityUtils.getLoginUser();
+        SysDept deptInfo = deptService.selectDeptById(currentUser.getUser().getDeptId());
+        DeptInfoDemo deptDemo =new DeptInfoDemo();
+        if(deptInfo!=null&&deptInfo.getJiBie()!=null && deptInfo.getJiBie() == 2){
+            deptDemo.setDeptId(deptInfo.getDeptId());
+            deptDemo.setBalance(deptInfo.getBalance());
+            deptDemo.setDeptName(deptInfo.getDeptName());
+        }
+        return AjaxResult.success(deptDemo);
+    }
+
     /**
      * 加载对应角色部门列表树
      */

+ 1 - 1
yijia-admin/src/main/java/com/yijia/web/controller/system/SysUserController.java

@@ -180,7 +180,7 @@ public class SysUserController extends BaseController
            for(Long id :userIds){
                SysAgent sysAgent =new SysAgent();
                sysAgent.setUserId(id);
-               i= sysAgentService.deleteSysAgent(sysAgent);
+               sysAgentService.deleteSysAgent(sysAgent);
            }
        }
         return toAjax(i);

+ 9 - 0
yijia-common/src/main/java/com/yijia/common/core/domain/BaseEntity.java

@@ -53,6 +53,15 @@ public class BaseEntity implements Serializable
     /** 请求参数 */
     private Map<String, Object> params;
 
+    private String createName;
+
+    public String getCreateName() {
+        return createName;
+    }
+
+    public void setCreateName(String createName) {
+        this.createName = createName;
+    }
 
     private Integer pageNumLimit;
 

+ 58 - 4
yijia-label/src/main/java/com/yijia/label/controller/CustomerLabelController.java

@@ -1,12 +1,15 @@
 package com.yijia.label.controller;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
 import com.yijia.common.core.domain.model.LoginUser;
 import com.yijia.common.utils.SecurityUtils;
+import com.yijia.label.domain.CustomerLabelDemo;
 import com.yijia.label.domain.RequstCustomerLabel;
 import com.yijia.label.domain.ResponeCustomerLabel;
+import com.yijia.label.service.ICustomerLabelDemoService;
 import com.yijia.system.service.ISysDeptService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
@@ -39,7 +42,8 @@ public class CustomerLabelController extends BaseController
 {
     @Autowired
     private ICustomerLabelService customerLabelService;
-
+    @Autowired
+    private ICustomerLabelDemoService customerLabelDemoService;
     @Autowired
     private ISysDeptService deptService;
     /**
@@ -175,9 +179,9 @@ public class CustomerLabelController extends BaseController
     @Log(title = "用户标签", businessType = BusinessType.UPDATE)
     @PostMapping("/addAndDelCustomerLabel")
     @Transactional
-    public AjaxResult addCustomerLabel(@RequestBody RequstCustomerLabel requstCustomerLabel)
+    public AjaxResult addAndDelCustomerLabel(@RequestBody RequstCustomerLabel requstCustomerLabel)
     {
-        int i =0;
+        int i =1;
         LoginUser currentUser = SecurityUtils.getLoginUser();
         if(requstCustomerLabel!=null && requstCustomerLabel.getFlag()!=null && requstCustomerLabel.getFlag().equals("0")){
             if(requstCustomerLabel.getPhoneList()!=null && requstCustomerLabel.getPhoneList().size()>0){
@@ -188,7 +192,7 @@ public class CustomerLabelController extends BaseController
                     customerLabel.setPhone(phone);
                     customerLabel.setLabelId(requstCustomerLabel.getLabelId());
                     customerLabel.setCreateBy(currentUser.getUser().getUserId()+"");
-                  i=  customerLabelService.insertCustomerLabel(customerLabel);
+                  i= customerLabelService.insertCustomerLabel(customerLabel);
                 }
             }
         }else if(requstCustomerLabel!=null && requstCustomerLabel.getFlag()!=null && requstCustomerLabel.getFlag().equals("1")){
@@ -207,6 +211,8 @@ public class CustomerLabelController extends BaseController
         return toAjax(i);
     }
 
+
+
     /**
      * 删除用户标签
      */
@@ -216,4 +222,52 @@ public class CustomerLabelController extends BaseController
     {
         return toAjax(customerLabelService.deleteCustomerLabelByIds(ids));
     }
+
+    /**
+     * 查询标签用户
+     */
+    @GetMapping(value = "/selectCustomerLabelInfoList")
+    public TableDataInfo selectCustomerLabelInfoList(CustomerLabelDemo customerLabelDemo)
+    {
+        LoginUser currentUser = SecurityUtils.getLoginUser();
+        customerLabelDemo.setStationId(currentUser.getUser().getDeptId());
+        startPage();
+        List<CustomerLabelDemo> list = new ArrayList<>();
+         if(customerLabelDemo.getSecondFlag()!=null && customerLabelDemo.getSecondFlag().equals("1")) {
+            //开启二次查询
+           list = customerLabelDemoService.secondCustomerLabelDemoList(customerLabelDemo);
+        }else if(customerLabelDemo.getSecondFlag()!=null && customerLabelDemo.getSecondFlag().equals("0")) {
+             list = customerLabelDemoService.selectCustomerLabelDemoList(customerLabelDemo);
+         }
+
+        return getDataTable(list);
+    }
+
+    /**
+     * 修改用户标签
+     */
+    @Log(title = "用户标签", businessType = BusinessType.UPDATE)
+    @PostMapping("/delCustomerLabel")
+    @Transactional
+    public AjaxResult delCustomerLabel(@RequestBody CustomerLabelDemo customerLabelDemo)
+    {
+        int i =1;
+        LoginUser currentUser = SecurityUtils.getLoginUser();
+        if(customerLabelDemo.getPhoneList()!=null && customerLabelDemo.getPhoneList().size()>0){
+            //根据手机号查询客户标签
+            customerLabelDemo.setDelFlag("0");
+            customerLabelDemo.setStationId(currentUser.getUser().getDeptId());
+            List<CustomerLabelDemo> demoList = customerLabelDemoService.selectPhoneCustomerLabelList(customerLabelDemo);
+            if(demoList!=null &&demoList.size()>0){
+                for(CustomerLabelDemo demo:demoList){
+                    CustomerLabel customerLabel =new CustomerLabel();
+                    customerLabel.setDelFlag("1");
+                    customerLabel.setUpdateBy(currentUser.getUser().getUserId()+"");
+                    customerLabel.setId(demo.getId());
+                    i=  customerLabelService.updateCustomerLabel(customerLabel);
+                }
+            }
+        }
+        return toAjax(i);
+    }
 }

+ 20 - 1
yijia-label/src/main/java/com/yijia/label/controller/LabelRuleController.java

@@ -24,7 +24,7 @@ import com.yijia.common.core.page.TableDataInfo;
 /**
  * 标签规则
 Controller
- * 
+ *
  * @author yijia
  * @date 2021-06-15
  */
@@ -55,6 +55,25 @@ public class LabelRuleController extends BaseController
     }
 
     /**
+     * 查詢油站的所有標簽
+     * @param labelRule
+     * @return
+     */
+    @GetMapping("/labelList")
+    public TableDataInfo labelList(LabelRule labelRule)
+    {
+        if(labelRule!=null && labelRule.getStationId()==null){
+            LoginUser currentUser = SecurityUtils.getLoginUser();
+            labelRule.setStationId(currentUser.getUser().getDeptId());
+        }
+
+        labelRule.setDelFlag("0");
+        List<LabelRule> list = labelRuleService.selectLabelRuleList(labelRule);
+        return getTable(list);
+    }
+
+
+    /**
      * 导出标签规则列表
      */
     @Log(title = "标签规则", businessType = BusinessType.EXPORT)

+ 353 - 0
yijia-label/src/main/java/com/yijia/label/domain/CustomerLabelDemo.java

@@ -0,0 +1,353 @@
+package com.yijia.label.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.yijia.common.annotation.Excel;
+import com.yijia.common.core.domain.BaseEntity;
+import org.apache.commons.collections4.splitmap.AbstractIterableGetMapDecorator;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 用户标签对象 customer_label
+ *
+ * @author yijia
+ * @date 2021-06-15
+ */
+public class CustomerLabelDemo extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    private Integer id;
+    /** 手机号 */
+    @Excel(name = "手机号")
+    private String phone;
+    /** 油站id */
+    @Excel(name = "油站id")
+    private Long stationId;
+    private String customerName;
+    private String labelName;
+    private Long labelId;
+    /** 删除 1是 0否 */
+    private String delFlag;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createDate;
+    /**
+     * 油品
+     */
+    private String oilName;
+    /** 开始时间 */
+    @JsonIgnore
+    private String beginDate;
+    @JsonIgnore
+    private String endDate;
+
+    /*** 加油金额 */
+    private BigDecimal startAmt;
+    private BigDecimal endAmt;
+
+    /*** 加油次数 */
+    private Integer startCountNum;
+    private Integer endCountNum;
+    /*** 加油升数 */
+    private BigDecimal startLiters;
+    private BigDecimal endLiters;
+
+    /**开启二次筛选*/
+    private String secondFlag;
+    /** 开始时间 */
+    @JsonIgnore
+    private String secondBeginDate;
+    @JsonIgnore
+    private String secondEndDate;
+
+    /*** 二次筛选加油金额 */
+    private BigDecimal secondStartAmt;
+    private BigDecimal secondEndAmt;
+    /*** 加油次数 */
+    private Integer secondStartCountNum;
+    private Integer secondEndCountNum;
+    /*** 加油升数 */
+    private BigDecimal secondStartLiters;
+    private BigDecimal secondEndLiters;
+    //and 、or 按加油升数
+    private String litersFlag;
+    //and 、or 按加油金额
+    private String amtFlag;
+    //and 、or 二次查询按加油升数
+    private String secondLitersFlag;
+    //and 、or 二次查询按加油金额
+    private String secondAmtFlag;
+    //手机号数组
+    private List<String> phoneList;
+
+
+    public String getLitersFlag() {
+        return litersFlag;
+    }
+
+    public void setLitersFlag(String litersFlag) {
+        this.litersFlag = litersFlag;
+    }
+
+    public String getAmtFlag() {
+        return amtFlag;
+    }
+
+    public void setAmtFlag(String amtFlag) {
+        this.amtFlag = amtFlag;
+    }
+
+    public String getSecondLitersFlag() {
+        return secondLitersFlag;
+    }
+
+    public void setSecondLitersFlag(String secondLitersFlag) {
+        this.secondLitersFlag = secondLitersFlag;
+    }
+
+    public String getSecondAmtFlag() {
+        return secondAmtFlag;
+    }
+
+    public void setSecondAmtFlag(String secondAmtFlag) {
+        this.secondAmtFlag = secondAmtFlag;
+    }
+
+    public String getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(String delFlag) {
+        this.delFlag = delFlag;
+    }
+
+    public List<String> getPhoneList() {
+        return phoneList;
+    }
+
+    public void setPhoneList(List<String> phoneList) {
+        this.phoneList = phoneList;
+    }
+
+    public Long getLabelId() {
+        return labelId;
+    }
+
+    public void setLabelId(Long labelId) {
+        this.labelId = labelId;
+    }
+
+    public String getLabelName() {
+        return labelName;
+    }
+
+    public void setLabelName(String labelName) {
+        this.labelName = labelName;
+    }
+
+    public Date getCreateDate() {
+        return createDate;
+    }
+
+    public void setCreateDate(Date createDate) {
+        this.createDate = createDate;
+    }
+
+    public String getOilName() {
+        return oilName;
+    }
+
+    public void setOilName(String oilName) {
+        this.oilName = oilName;
+    }
+
+    public String getBeginDate() {
+        return beginDate;
+    }
+
+    public void setBeginDate(String beginDate) {
+        this.beginDate = beginDate;
+    }
+
+    public String getEndDate() {
+        return endDate;
+    }
+
+    public void setEndDate(String endDate) {
+        this.endDate = endDate;
+    }
+
+    public BigDecimal getStartAmt() {
+        return startAmt;
+    }
+
+    public void setStartAmt(BigDecimal startAmt) {
+        this.startAmt = startAmt;
+    }
+
+    public BigDecimal getEndAmt() {
+        return endAmt;
+    }
+
+    public void setEndAmt(BigDecimal endAmt) {
+        this.endAmt = endAmt;
+    }
+
+    public Integer getStartCountNum() {
+        return startCountNum;
+    }
+
+    public void setStartCountNum(Integer startCountNum) {
+        this.startCountNum = startCountNum;
+    }
+
+    public Integer getEndCountNum() {
+        return endCountNum;
+    }
+
+    public void setEndCountNum(Integer endCountNum) {
+        this.endCountNum = endCountNum;
+    }
+
+    public BigDecimal getStartLiters() {
+        return startLiters;
+    }
+
+    public void setStartLiters(BigDecimal startLiters) {
+        this.startLiters = startLiters;
+    }
+
+    public BigDecimal getEndLiters() {
+        return endLiters;
+    }
+
+    public void setEndLiters(BigDecimal endLiters) {
+        this.endLiters = endLiters;
+    }
+
+    public String getSecondFlag() {
+        return secondFlag;
+    }
+
+    public void setSecondFlag(String secondFlag) {
+        this.secondFlag = secondFlag;
+    }
+
+    public String getSecondBeginDate() {
+        return secondBeginDate;
+    }
+
+    public void setSecondBeginDate(String secondBeginDate) {
+        this.secondBeginDate = secondBeginDate;
+    }
+
+    public String getSecondEndDate() {
+        return secondEndDate;
+    }
+
+    public void setSecondEndDate(String secondEndDate) {
+        this.secondEndDate = secondEndDate;
+    }
+
+    public BigDecimal getSecondStartAmt() {
+        return secondStartAmt;
+    }
+
+    public void setSecondStartAmt(BigDecimal secondStartAmt) {
+        this.secondStartAmt = secondStartAmt;
+    }
+
+    public BigDecimal getSecondEndAmt() {
+        return secondEndAmt;
+    }
+
+    public void setSecondEndAmt(BigDecimal secondEndAmt) {
+        this.secondEndAmt = secondEndAmt;
+    }
+
+    public Integer getSecondStartCountNum() {
+        return secondStartCountNum;
+    }
+
+    public void setSecondStartCountNum(Integer secondStartCountNum) {
+        this.secondStartCountNum = secondStartCountNum;
+    }
+
+    public Integer getSecondEndCountNum() {
+        return secondEndCountNum;
+    }
+
+    public void setSecondEndCountNum(Integer secondEndCountNum) {
+        this.secondEndCountNum = secondEndCountNum;
+    }
+
+    public BigDecimal getSecondStartLiters() {
+        return secondStartLiters;
+    }
+
+    public void setSecondStartLiters(BigDecimal secondStartLiters) {
+        this.secondStartLiters = secondStartLiters;
+    }
+
+    public BigDecimal getSecondEndLiters() {
+        return secondEndLiters;
+    }
+
+    public void setSecondEndLiters(BigDecimal secondEndLiters) {
+        this.secondEndLiters = secondEndLiters;
+    }
+
+    public String getCustomerName() {
+        return customerName;
+    }
+
+    public void setCustomerName(String customerName) {
+        this.customerName = customerName;
+    }
+
+    public void setId(Integer id)
+    {
+        this.id = id;
+    }
+    public Integer getId()
+    {
+        return id;
+    }
+    public void setPhone(String phone)
+    {
+        this.phone = phone;
+    }
+    public String getPhone()
+    {
+        return phone;
+    }
+
+    public Long getStationId() {
+        return stationId;
+    }
+
+    public void setStationId(Long stationId) {
+        this.stationId = stationId;
+    }
+
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("phone", getPhone())
+            .append("stationId", getStationId())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .toString();
+    }
+}

+ 35 - 0
yijia-label/src/main/java/com/yijia/label/mapper/CustomerLabelDemoMapper.java

@@ -0,0 +1,35 @@
+package com.yijia.label.mapper;
+
+import com.yijia.label.domain.CustomerLabelDemo;
+
+import java.util.List;
+
+/**
+ * 用户标签Mapper接口
+ *
+ * @author yijia
+ * @date 2021-06-15
+ */
+public interface CustomerLabelDemoMapper
+{
+    /**
+     * 查询用户标签列表
+     *
+     * @param customerLabelDemo 用户标签
+     * @return 用户标签集合
+     */
+    public List<CustomerLabelDemo> selectCustomerLabelDemoList(CustomerLabelDemo customerLabelDemo);
+
+    /**
+     * 根据手机号批量查询用户标签列表
+     * @param customerLabelDemo
+     * @return
+     */
+    public List<CustomerLabelDemo> selectPhoneCustomerLabelList(CustomerLabelDemo customerLabelDemo);
+    /***
+     * 二次查询
+     * @param customerLabelDemo
+     * @return
+     */
+    public List<CustomerLabelDemo> secondCustomerLabelDemoList(CustomerLabelDemo customerLabelDemo);
+}

+ 38 - 0
yijia-label/src/main/java/com/yijia/label/service/ICustomerLabelDemoService.java

@@ -0,0 +1,38 @@
+package com.yijia.label.service;
+
+import com.yijia.label.domain.CustomerLabelDemo;
+
+import java.util.List;
+
+/**
+ * 用户标签Service接口
+ *
+ * @author yijia
+ * @date 2021-06-15
+ */
+public interface ICustomerLabelDemoService
+{
+
+    /**
+     * 查询用户标签列表
+     *
+     * @param customerLabelDemo
+     * @return 用户标签集合
+     */
+    public List<CustomerLabelDemo> selectCustomerLabelDemoList(CustomerLabelDemo customerLabelDemo);
+
+    /**
+     * 根据手机号批量查询用户标签列表
+     *
+     * @param customerLabelDemo
+     * @return 用户标签集合
+     */
+    public List<CustomerLabelDemo> selectPhoneCustomerLabelList(CustomerLabelDemo customerLabelDemo);
+
+    /***
+     * 二次查询
+     * @param customerLabelDemo
+     * @return
+     */
+    public List<CustomerLabelDemo> secondCustomerLabelDemoList(CustomerLabelDemo customerLabelDemo);
+}

+ 46 - 0
yijia-label/src/main/java/com/yijia/label/service/impl/CustomerLabelDemoServiceImpl.java

@@ -0,0 +1,46 @@
+package com.yijia.label.service.impl;
+import com.yijia.label.domain.CustomerLabelDemo;
+import com.yijia.label.mapper.CustomerLabelDemoMapper;
+import com.yijia.label.service.ICustomerLabelDemoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 用户标签Service业务层处理
+ *
+ * @author yijia
+ * @date 2021-06-15
+ */
+@Service
+public class CustomerLabelDemoServiceImpl implements ICustomerLabelDemoService
+{
+    @Autowired(required = false)
+    private CustomerLabelDemoMapper customerLabelDemoMapper;
+
+    /**
+     * 查询用户标签列表
+     *
+     * @param customerLabelDemo 用户标签
+     * @return 用户标签
+     */
+    @Override
+    public List<CustomerLabelDemo> selectCustomerLabelDemoList(CustomerLabelDemo customerLabelDemo) {
+        return customerLabelDemoMapper.selectCustomerLabelDemoList(customerLabelDemo);
+    }
+
+    @Override
+    public List<CustomerLabelDemo> selectPhoneCustomerLabelList(CustomerLabelDemo customerLabelDemo) {
+        return customerLabelDemoMapper.selectPhoneCustomerLabelList(customerLabelDemo);
+    }
+    /***
+     * 二次查询
+     * @param customerLabelDemo
+     * @return
+     */
+    @Override
+    public List<CustomerLabelDemo> secondCustomerLabelDemoList(CustomerLabelDemo customerLabelDemo) {
+        return customerLabelDemoMapper.secondCustomerLabelDemoList(customerLabelDemo);
+    }
+}

+ 291 - 0
yijia-label/src/main/resources/mapper/label/CustomerLabelDemoMapper.xml

@@ -0,0 +1,291 @@
+<?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.yijia.label.mapper.CustomerLabelDemoMapper">
+    <resultMap type="CustomerLabelDemo" id="CustomerLabelDemoResult">
+        <result property="id"    column="id"    />
+        <result property="phone"    column="phone"    />
+        <result property="stationId"    column="station_id"    />
+        <result property="customerName"    column="customer_name"    />
+        <result property="labelName"    column="label_name"    />
+        <result property="labelId"    column="label_id"    />
+        <result property="createDate"    column="create_date"    />
+    </resultMap>
+
+    <select id="selectCustomerLabelDemoList" parameterType="CustomerLabelDemo" resultMap="CustomerLabelDemoResult">
+        SELECT zq.*,r.label_name,r.id as label_id from (
+        SELECT consumer_id,sum(order_liters) order_liters,sum(amt) as amt,count(1) count_num,p.station_id,max(created_date) as create_date,
+        a.mobile_phone as phone,blog_nick_name as customer_name
+        from pay_order p
+        join app_user_info a on a.user_id = p.consumer_id
+        where  p.status ="1"
+        <if test="stationId != null "> and p.station_id = #{stationId}</if>
+        <if test="oilName != null "> and oil_name = #{oilName} </if>
+        <if test="beginDate != null and beginDate != ''"><!-- 开始时间检索 -->
+            AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &gt;= date_format(#{beginDate},'%Y-%m-%d %H:%i:%s')
+        </if>
+        <if test="endDate != null and endDate != ''"><!-- 结束时间检索 -->
+            AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &lt;= date_format(#{endDate},'%Y-%m-%d %H:%i:%s')
+        </if>
+        group by consumer_id,p.station_id,a.mobile_phone,blog_nick_name
+        ORDER BY create_date desc) zq
+        left join customer_label l on zq.station_id = l.station_id and zq.phone = l.phone and l.del_flag ="0"
+        left join label_rule r on r.id = l.label_id and r.del_flag ="0"
+        <where>
+            <if test="labelId != null "> and l.label_id >= #{labelId}</if>
+            <if test="startCountNum != null "> and zq.count_num >= #{startCountNum}</if>
+            <if test="endCountNum != null "> and zq.count_num &lt;= #{endCountNum}</if>
+            <if test="amtFlag != null and amtFlag=='1' ">
+                <choose>
+                    <when test="startAmt != null and endAmt != null">
+                       and (  zq.amt >= #{startAmt} and zq.amt &lt;= #{endAmt})
+                    </when>
+                    <when test="startAmt != null and endAmt == null">
+                        and  zq.amt >= #{startAmt}
+                    </when>
+                    <when test="endAmt != null and startAmt == null">
+                        and  zq.amt >= #{startAmt}
+                    </when>
+                    <otherwise>
+                    </otherwise>
+                </choose>
+            </if>
+            <if test="amtFlag != null and amtFlag=='2' ">
+                <choose>
+                    <when test="startAmt != null and endAmt != null">
+                        or (  zq.amt >= #{startAmt} and zq.amt &lt;= #{endAmt})
+                    </when>
+                    <when test="startAmt != null and endAmt == null">
+                        or  zq.amt >= #{startAmt}
+                    </when>
+                    <when test="endAmt != null and startAmt == null">
+                        or  zq.amt >= #{endAmt}
+                    </when>
+                    <otherwise>
+                    </otherwise>
+                </choose>
+            </if>
+            <if test="litersFlag != null and litersFlag=='1' ">
+                <choose>
+                    <when test="startLiters != null and endLiters != null">
+                        and (  zq.order_liters >= #{startLiters} and zq.order_liters &lt;= #{endLiters})
+                    </when>
+                    <when test="startLiters != null and endLiters == null">
+                        and  zq.order_liters >= #{startLiters}
+                    </when>
+                    <when test="endLiters != null and startLiters == null">
+                        and  zq.order_liters >= #{endLiters}
+                    </when>
+                    <otherwise>
+                    </otherwise>
+                </choose>
+            </if>
+            <if test="litersFlag != null and litersFlag=='2' ">
+                <choose>
+                    <when test="startLiters != null and endLiters != null">
+                        or (  zq.order_liters >= #{startLiters} and zq.order_liters &lt;= #{endLiters})
+                    </when>
+                    <when test="startLiters != null and endLiters == null">
+                        or  zq.order_liters >= #{startLiters}
+                    </when>
+                    <when test="endLiters != null and startLiters == null">
+                        or  zq.order_liters >= #{endLiters}
+                    </when>
+                    <otherwise>
+                    </otherwise>
+                </choose>
+            </if>
+        </where>
+    </select>
+
+    <select id="selectPhoneCustomerLabelList" parameterType="CustomerLabelDemo" resultMap="CustomerLabelDemoResult">
+        SELECT id,phone,label_id,station_id	from customer_label
+        <where>
+            <if test="stationId != null "> and station_id = #{stationId}</if>
+            <if test="labelId != null "> and label_id = #{labelId}</if>
+            <if test="delFlag != null "> and del_flag = #{delFlag}</if>
+            <if test="phone != null  and phone != ''"> and phone like concat('%', #{phone}, '%')</if>
+            <if test="phoneList != null ">
+                and phone in
+                <foreach item="item" index="index" collection="phoneList"
+                         open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+    </select>
+
+    <select id="secondCustomerLabelDemoList" parameterType="CustomerLabelDemo" resultMap="CustomerLabelDemoResult">
+        SELECT  zh.*,r.label_name,r.id as label_id from (
+        SELECT consumer_id,sum(order_liters) order_liters,count(1) count_num,p.station_id,max(created_date) as create_date,
+        a.mobile_phone as phone,blog_nick_name as customer_name
+        from pay_order p
+        join app_user_info a on a.user_id = p.consumer_id
+        where `status` = "1"
+        <if test="stationId != null "> and p.station_id = #{stationId}</if>
+        <if test="oilName != null "> and oil_name = #{oilName} </if>
+        <if test="secondBeginDate != null and beginDate != ''"><!-- 开始时间检索 -->
+            AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &gt;= date_format(#{secondBeginDate},'%Y-%m-%d %H:%i:%s')
+        </if>
+        <if test="secondEndDate != null and secondEndDate != ''"><!-- 结束时间检索 -->
+            AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &lt;= date_format(#{secondEndDate},'%Y-%m-%d %H:%i:%s')
+        </if>
+        group by consumer_id,p.station_id,a.mobile_phone,blog_nick_name
+        ORDER BY create_date desc) zh
+        left join customer_label l on zh.station_id = l.station_id and zh.phone = l.phone and l.del_flag ="0"
+        left join label_rule r on r.id = l.label_id
+        where 1=1
+        <if test="labelId != null "> and l.label_id = #{labelId}</if>
+        <if test="stationId != null "> and zh.station_id = #{stationId}</if>
+        <if test="secondStartCountNum != null "> and zh.count_num >= #{secondStartCountNum}</if>
+        <if test="secondEndCountNum != null "> and  zh.count_num &lt;=#{secondEndCountNum} </if>
+        <if test="startCountNum != null "> and zq.count_num >= #{startCountNum}</if>
+        <if test="endCountNum != null "> and zq.count_num &lt;= #{endCountNum}</if>
+        <if test="secondAmtFlag != null and secondAmtFlag=='1' ">
+            <choose>
+                <when test="secondStartAmt != null and secondEndAmt != null">
+                    and (  zh.amt >= #{secondStartAmt} and zh.amt &lt;= #{secondEndAmt})
+                </when>
+                <when test="secondStartAmt != null and secondEndAmt == null">
+                    and  zh.amt >= #{secondStartAmt}
+                </when>
+                <when test="secondEndAmt != null and secondStartAmt == null">
+                    and  zh.amt &lt;= #{secondEndAmt}
+                </when>
+                <otherwise>
+                </otherwise>
+            </choose>
+        </if>
+        <if test="secondAmtFlag != null and secondAmtFlag=='2' ">
+            <choose>
+                <when test="secondStartAmt != null and secondEndAmt != null">
+                    or (  zh.amt >= #{secondStartAmt} and zh.amt &lt;=#{secondEndAmt})
+                </when>
+                <when test="secondStartAmt != null and secondEndAmt == null">
+                    or  zh.amt >= #{secondStartAmt}
+                </when>
+                <when test="secondEndAmt != null and startAmt == null">
+                    or  zh.amt &lt;= #{secondEndAmt}
+                </when>
+                <otherwise>
+                </otherwise>
+            </choose>
+        </if>
+        <if test="secondLitersFlag != null and secondLitersFlag=='1' ">
+            <choose>
+                <when test="secondStartLiters != null and secondEndLiters != null">
+                    and (  zh.order_liters  >= #{secondStartLiters} and zh.order_liters  &lt;= #{secondEndLiters})
+                </when>
+                <when test="secondStartLiters != null and secondEndLiters == null">
+                    and  zh.order_liters  >= #{secondStartLiters}
+                </when>
+                <when test="secondEndLiters != null and secondStartLiters == null">
+                    and  zh.order_liters  &lt;= #{secondEndLiters}
+                </when>
+                <otherwise>
+                </otherwise>
+            </choose>
+        </if>
+        <if test="secondLitersFlag != null and secondLitersFlag=='2' ">
+            <choose>
+                <when test="secondStartLiters != null and secondEndLiters != null">
+                    or (  zh.order_liters  >= #{secondStartLiters} and zq.order_liters &lt;= #{secondEndLiters})
+                </when>
+                <when test="secondStartLiters != null and secondEndLiters == null">
+                    or  zh.order_liters  >= #{secondStartLiters}
+                </when>
+                <when test="secondEndLiters != null and secondStartLiters == null">
+                    or  zh.order_liters &lt;= #{secondEndLiters}
+                </when>
+                <otherwise>
+                </otherwise>
+            </choose>
+        </if>
+        and zh.phone in (
+        SELECT zq.phone from (
+        SELECT consumer_id,sum(order_liters) order_liters,count(1) count_num,sum(amt) as amt,p.station_id,max(created_date) created_date,
+        a.mobile_phone as phone,blog_nick_name as customer_name
+        from pay_order p
+        join app_user_info a on a.user_id = p.consumer_id
+        where  p.status ="1"
+        <if test="stationId != null "> and p.station_id = #{stationId}</if>
+        <if test="oilName != null "> and oil_name = #{oilName} </if>
+        <if test="beginDate != null and beginDate != ''"><!-- 开始时间检索 -->
+            AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &gt;= date_format(#{beginDate},'%Y-%m-%d %H:%i:%s')
+        </if>
+        <if test="endDate != null and endDate != ''"><!-- 结束时间检索 -->
+            AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &lt;= date_format(#{endDate},'%Y-%m-%d %H:%i:%s')
+        </if>
+        group by consumer_id,p.station_id,a.mobile_phone,blog_nick_name
+        ORDER BY created_date desc) zq
+        left join customer_label l on zq.station_id = l.station_id and zq.phone = l.phone and l.del_flag ="0"
+        left join label_rule r on r.id = l.label_id
+        <where>
+            <if test="labelId != null "> and l.label_id = #{labelId}</if>
+            <if test="stationId != null "> and zq.station_id = #{stationId}</if>
+            <if test="startCountNum != null "> and zq.count_num >= #{startCountNum}</if>
+            <if test="endCountNum != null "> and zq.count_num &lt;= #{endCountNum}</if>
+            <if test="amtFlag != null and amtFlag=='1' ">
+                <choose>
+                    <when test="startAmt != null and endAmt != null">
+                        and (  zq.amt >= #{startAmt} and zq.amt &lt;= #{endAmt})
+                    </when>
+                    <when test="startAmt != null and endAmt == null">
+                        and  zq.amt >= #{startAmt}
+                    </when>
+                    <when test="endAmt != null and startAmt == null">
+                        and  zq.amt &lt;= #{startAmt}
+                    </when>
+                    <otherwise>
+                    </otherwise>
+                </choose>
+            </if>
+            <if test="amtFlag != null and amtFlag=='2' ">
+                <choose>
+                    <when test="startAmt != null and endAmt != null">
+                        or (  zq.amt >= #{startAmt} and zq.amt &lt;= #{endAmt})
+                    </when>
+                    <when test="startAmt != null and endAmt == null">
+                        or  zq.amt >= #{startAmt}
+                    </when>
+                    <when test="endAmt != null and startAmt == null">
+                        or  zq.amt &lt;= #{endAmt}
+                    </when>
+                    <otherwise>
+                    </otherwise>
+                </choose>
+            </if>
+            <if test="litersFlag != null and litersFlag=='1' ">
+                <choose>
+                    <when test="startLiters != null and endLiters != null">
+                        and (  zq.order_liters >= #{startLiters} and zq.order_liters &lt;= #{endLiters})
+                    </when>
+                    <when test="startLiters != null and endLiters == null">
+                        and  zq.order_liters >= #{startLiters}
+                    </when>
+                    <when test="endLiters != null and startLiters == null">
+                        and  zq.order_liters &lt;= #{endLiters}
+                    </when>
+                    <otherwise>
+                    </otherwise>
+                </choose>
+            </if>
+            <if test="litersFlag != null and litersFlag=='2' ">
+                <choose>
+                    <when test="startLiters != null and endLiters != null">
+                        or (  zq.order_liters >= #{startLiters} and zq.order_liters &lt;= #{endLiters})
+                    </when>
+                    <when test="startLiters != null and endLiters == null">
+                        or  zq.order_liters >= #{startLiters}
+                    </when>
+                    <when test="endLiters != null and startLiters == null">
+                        or  zq.order_liters &lt;=#{endLiters}
+                    </when>
+                    <otherwise>
+                    </otherwise>
+                </choose>
+            </if>
+        </where> )
+    </select>
+</mapper>

+ 128 - 7
yijia-station/src/main/java/com/yijia/station/controller/PayOrderController.java

@@ -4,10 +4,9 @@ import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.UUID;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.*;
 
 import com.yijia.common.config.YiJiaConfig;
 import com.yijia.common.core.domain.entity.SysDept;
@@ -16,6 +15,8 @@ import com.yijia.common.exception.CustomException;
 import com.yijia.common.utils.SecurityUtils;
 import com.yijia.station.domain.StationClassStructure;
 import com.yijia.station.domain.StationClassesSummary;
+import com.yijia.station.service.IStationDeviceManageService;
+import com.yijia.station.utils.FeiEPrinterUtil;
 import com.yijia.system.service.ISysDeptService;
 import com.yijia.system.service.ISysUserService;
 import org.apache.poi.ss.usermodel.*;
@@ -60,6 +61,9 @@ public class PayOrderController extends BaseController
     @Autowired
     private ISysDeptService deptService;
 
+    @Autowired
+    private IStationDeviceManageService stationDeviceManageService;
+
     /**
      * 查询订单支付列表
      */
@@ -76,6 +80,23 @@ public class PayOrderController extends BaseController
         List<PayOrder> payOrderList = payOrderService.selectPayOrderList(payOrder);
         return getDataTable(payOrderList);
     }
+    /**
+     * 关联用户查询订单支付列表
+     */
+    @GetMapping("/selectUserPayOrderList")
+    public TableDataInfo selectUserPayOrderList(PayOrder payOrder)
+    {
+        List<String> list = deptService.levelDeptList(payOrder.getLevelId());
+        if(list!=null && list.size()>0){
+            payOrder.setStationIdList(list);
+            payOrder.setStationId(null);
+        }
+        startPage();
+        payOrder.setStatus("1");
+        List<PayOrder> payOrderList = payOrderService.selectUserPayOrderList(payOrder);
+        return getDataTable(payOrderList);
+    }
+
 
     @GetMapping("/selectPayOrderList")
     public TableDataInfo selectPayOrderList(PayOrder payOrder)
@@ -448,7 +469,7 @@ public class PayOrderController extends BaseController
     @GetMapping("/LNGlist")
     public TableDataInfo LNGlist(PayOrder payOrder)
     {
-        List<String> list = deptService.levelDeptList(payOrder.getLevelId());
+        List<String> list = deptService.levelLngDeptList(payOrder.getLevelId());
         if(list!=null && list.size()>0){
             payOrder.setStationIdList(list);
             payOrder.setStationId(null);
@@ -463,7 +484,7 @@ public class PayOrderController extends BaseController
     @GetMapping("/LNGExport")
     public AjaxResult LNGExport(PayOrder payOrder)
     {
-        List<String> list = deptService.levelDeptList(payOrder.getLevelId());
+        List<String> list = deptService.levelLngDeptList(payOrder.getLevelId());
         if(list!=null && list.size()>0){
             payOrder.setStationIdList(list);
             payOrder.setStationId(null);
@@ -646,7 +667,7 @@ public class PayOrderController extends BaseController
     @GetMapping("/LNGDeptExport")
     public AjaxResult LNGDeptExport(PayOrder payOrder)
     {
-        List<String> list = deptService.levelDeptList(payOrder.getLevelId());
+        List<String> list = deptService.levelLngDeptList(payOrder.getLevelId());
         if(list!=null && list.size()>0){
             payOrder.setStationIdList(list);
             payOrder.setStationId(null);
@@ -796,4 +817,104 @@ public class PayOrderController extends BaseController
             }
         }
     }
+
+    /**
+     * 补打订单信息
+     */
+    @Log(title = "补打订单小票", businessType = BusinessType.OTHER)
+    @GetMapping("/printOrderInfo")
+    public AjaxResult printOrderInfo(PayOrder payOrder){
+        int i =0;
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        if(payOrder.getOrderId() !=null){
+            String content1 ="";
+            String content2 ="" ;
+            PayOrder order = payOrderService.selectPayOrderById(payOrder.getOrderId());
+            if(order!=null){
+                String  paytype ="";
+                String  phoneNumber ="";
+                if(order.getCustomerPhone()!=null ){
+                    phoneNumber = order.getCustomerPhone().replaceAll("(\\w{3})\\w*(\\w{4})", "$1****$2");
+                }
+                if(order.getPayType().equals("wx")){
+                    paytype="微信";
+                }else if(order.getPayType().equals("dzk")){
+                    paytype="电子卡";
+                }else if(order.getPayType().equals("zfb")){
+                    paytype="支付宝";
+                }else if(order.getPayType().equals("xj")){
+                    paytype="现金";
+                }
+                content1 = "<CB>油品订单--顾客联</CB><BR>";
+                content1 += "<BR>";
+                content1 += "--------------------------------<BR>";
+                content1 += "<BR>";
+                content1 += "<BOLD><B>原价: "+order.getReceivableAmt()+" 元</B></BOLD><BR>";
+                content1 += "订单号:"+order.getOrderNo()+" <BR>";
+                content1 += "支付方式: "+paytype+" <BR>";
+                content1 += "下单时间:"+dateFormat.format(order.getCreatedDate())+" <BR>";
+                content1 += "付款时间:"+dateFormat.format(order.getPayDate())+" <BR>";
+                content1 += "油站:"+order.getStationName()+"  <BR>";
+                content1 += "油枪:"+order.getOilGun()+"号枪<BR>";
+                if(order.getOilType()!=null && !order.getOilType().equals("3")){
+                    content1 += "油品: "+order.getOilName()+"  <BR>";
+                    content1 += "油量: "+order.getOrderLiters()+"  升<BR>";
+                    content1 += "单价: "+order.getOilPirce()+" L/元<BR>";
+                    content1 += "优惠: "+order.getDiscountAmt()+" 元<BR>";
+                }
+                content1 += "支付: "+order.getAmt()+" 元<BR>";
+                content1 += "手机号: "+phoneNumber +" <BR>";
+                content1 += "<BR>";
+
+                content2 = "<CB>油品订单--商户联</CB><BR>";
+                content2 += "<BR>";
+                content2 += "--------------------------------<BR>";
+                content2 += "<BR>";
+                content2 += "<BOLD><B>原价: "+order.getReceivableAmt()+" 元</B></BOLD><BR>";
+                content2 += "订单号:"+order.getOrderNo()+"  <BR>";
+                content2 += "支付方式: "+paytype+" <BR>";
+                content2 += "下单时间:"+dateFormat.format(order.getCreatedDate())+" <BR>";
+                content2 += "付款时间:"+dateFormat.format(order.getPayDate())+" <BR>";
+                content2 += "油站:"+order.getStationName()+"  <BR>";
+                content2 += "油枪:"+order.getOilGun()+"号枪<BR>";
+                if(order.getOilType()!=null && !order.getOilType().equals("3")){
+                    content2 += "油品: "+order.getOilName()+"  <BR>";
+                    content2 += "油量: "+order.getOrderLiters()+"  升<BR>";
+                    content2 += "单价: "+order.getOilPirce()+" L/元<BR>";
+                    content2 += "优惠: "+order.getDiscountAmt()+" 元<BR>";
+                }
+                content2 += "支付: "+order.getAmt()+" 元<BR>";
+                content2 += "手机号: "+phoneNumber +" <BR>";
+                content2 += "<BR>";
+            }
+            Map params  =new HashMap();
+            params.put("stationId", order.getStationId());
+            params.put("deviceType", "1");
+            Map mp  = stationDeviceManageService.getPrinterSnByStationId(params);
+           SysDept dept=  deptService.selectDeptById(order.getStationId());
+            if(mp!=null&&mp.containsKey("device_no") && mp.get("device_no")!= null && mp.get("device_no")!=""){
+                String sn = mp.get("device_no").toString();
+                if(dept!=null && dept.getPrintSetting()!=null&&dept.getPrintSetting().equals("1") &&content1!=null){
+                    FeiEPrinterUtil.printReceipt(sn,content1);
+                    i=1;
+                    logger.info("客户联打印成功");
+                }else if(dept!=null && dept.getPrintSetting()!=null&&dept.getPrintSetting().equals("2")&&content2!=null){
+                    FeiEPrinterUtil.printReceipt(sn,content2);
+                    i=1;
+                    logger.info("商户联打印成功");
+                }else if(dept!=null && dept.getPrintSetting()!=null&&dept.getPrintSetting().equals("3")&&content1!=null&&content2!=null){
+                    FeiEPrinterUtil.printReceipt(sn, content1+content2);
+                    i=1;
+                    logger.info("客户联和商户联打印成功");
+                }else {
+                    i=0;
+                    logger.info("打印失败");
+                }
+            }else {
+                logger.info("请正确配置打印机");
+                i=2;
+            }
+        }
+        return toAjaxee(i);
+    }
 }

+ 170 - 0
yijia-station/src/main/java/com/yijia/station/controller/StationClassStructureController.java

@@ -960,6 +960,176 @@ public class StationClassStructureController extends BaseController
         return str;
     }
 
+    /**
+     * 补打班结数据
+     * @param stationClassStructure
+     * @return
+     */
+    @GetMapping("/printClassInfo")
+    public AjaxResult printClassInfo(StationClassStructure stationClassStructure)
+    {
+        int i = 0;
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        if(stationClassStructure.getStationId()!=null && stationClassStructure.getClassStructureNo()!=null){
+            SysDept dept = sysDeptService.selectDeptById(stationClassStructure.getStationId());
+            if(dept!=null &&dept.getWsPrintFlag() !=null &&dept.getWsPrintFlag()!="" &&dept.getWsPrintFlag().equals("1")){
+                //查询班结小票数据
+                StationClassStructure classStructure= new StationClassStructure();
+                classStructure.setClassStructureNo(stationClassStructure.getClassStructureNo());
+                classStructure.setStationId(dept.getDeptId());
+                classStructure.setOrderType("1");// 油品
+                List<StationClassStructure>  list= stationClassStructureService.listOilStructure(classStructure);
+                //支付方式汇总数据
+                List<StationClassStructure>  paylist= stationClassStructureService.listPayStructure(classStructure);
+                //汇总非油品
+                StationClassStructure selectNoOil =new StationClassStructure();
+                selectNoOil.setClassStructureNo(stationClassStructure.getClassStructureNo());
+                selectNoOil.setStationId(dept.getDeptId());
+                selectNoOil.setOrderType("2");// 非油品
+                StationClassStructure search = stationClassStructureService.selectSummyClassStructure(selectNoOil);
+                //查询出小票数据
+                String content;
+                content = "<CB>班结小票</CB><BR>";
+                content += "--------------------------------<BR>";
+                if(list!=null && list.size()>0 && paylist !=null && paylist.size()>0 ){
+                    if(list.get(0).getClassStartDate()!=null){
+                        content += "开始时间:"+dateFormat.format(list.get(0).getClassStartDate())+"  <BR>";
+                    }else{
+                        content += "开始时间: <BR>";
+                    }
+                    content += "班结时间:"+dateFormat.format(list.get(0).getClassStructureDate())+" <BR>";
+                    content += "油品  笔    升数      金额<BR>";
+                    content += "--------------------------------<BR>";
+
+                    BigDecimal sumAmt = new BigDecimal(0);
+                    BigDecimal liters = new BigDecimal(0);
+                    BigDecimal coupon = new BigDecimal(0);
+                    BigDecimal ysAmt =  new BigDecimal(0);
+                    BigDecimal dzAmt =  new BigDecimal(0);
+                    int num = 0;
+                    int pageNum=0;
+                    for(StationClassStructure str : list){
+                        String orderLiter="";
+                        String amt="";
+                        String receivableAmt="";
+                        String orderno="";
+                        //打印小票数量
+                        if(str.getPrintNum()!=null){
+                            pageNum += str.getPrintNum();
+                        }
+                        if( str.getOrderLiters()==null){
+                            str.setOrderLiters(BigDecimal.valueOf(0));
+                            orderLiter="0";
+                        }else{
+                            liters=liters.add(str.getOrderLiters());
+                            orderLiter= str.getOrderLiters().toString();
+                        }
+                        //实收金额
+                        if( str.getAmt()==null){
+                            str.setAmt(BigDecimal.valueOf(0));
+                            amt="0";
+                        }else{
+                            sumAmt=sumAmt.add(str.getAmt());
+                            amt=str.getAmt().toString();
+                        }
+                        //应付金额
+                        if( str.getReceivableAmt()==null){
+                            str.setReceivableAmt(BigDecimal.valueOf(0));
+                            receivableAmt="0";
+                        }else{
+                            ysAmt=ysAmt.add(str.getReceivableAmt());
+                            receivableAmt=str.getReceivableAmt().toString();
+                        }
+                        //到款金额
+                        if( str.getReceivedAmt()==null){
+                            str.setReceivedAmt(BigDecimal.valueOf(0));
+                        }else{
+                            dzAmt = dzAmt.add(str.getReceivedAmt());
+                        }
+                        //优惠金额
+                        if( str.getDiscountAmt()==null){
+                            str.setDiscountAmt(BigDecimal.valueOf(0));
+                        }else{
+                            coupon=coupon.add(str.getDiscountAmt());
+                        }
+                        //订单数量
+                        if( str.getOrderNo()==null){
+                            str.setOrderNo(String.valueOf(0));
+                        }else{
+                            num= num+Integer.parseInt(str.getOrderNo());
+                            orderno=str.getOrderNo().toString();
+                        }
+                        String oilname=addSpace(str.getOilName(),4);
+                        orderno=addSpace(orderno,3);
+                        orderLiter=addSpace(orderLiter,8);
+                        receivableAmt=addSpace(receivableAmt,8);
+                        content += oilname+"  "+orderno+"  "+orderLiter+"  "+receivableAmt+"<BR>";
+                    }
+                    content += "--------------------------------<BR>";
+                    String sumorder=addSpace(String.valueOf(num),3);
+                    String oilliters=addSpace(String.valueOf(liters),9);
+                    String oilYsAmt=addSpace(String.valueOf(ysAmt),9);
+                    content += "合计  "+sumorder +"  "+liters +"  "+oilYsAmt+"<BR>";
+                    content += " <BR>";
+                    //按支付方式
+                    content += "支付方式  笔    升数      金额<BR>";
+                    for(StationClassStructure sc : paylist){
+                        String orderno= sc.getOrderNo();
+                        orderno =addSpace(orderno,3);
+                        String orderLiter="";
+                        if(sc.getOrderLiters()!=null){
+                            orderLiter = sc.getOrderLiters().toString();
+                        }else{
+                            sc.setOrderLiters(BigDecimal.valueOf(0));
+                            orderLiter= sc.getOrderLiters().toString();
+                        }
+                        orderLiter =addSpace(orderLiter,8);
+                        String receivableAmt="";
+                        if(sc.getReceivableAmt()!=null){
+                            receivableAmt = sc.getReceivableAmt().toString();
+                        }else{
+                            sc.setReceivableAmt(BigDecimal.valueOf(0));
+                            receivableAmt= sc.getReceivableAmt().toString();
+                        }
+                        content += sc.getPayType()+"  "+orderno+"  "+orderLiter+"  "+receivableAmt+"<BR>";
+                    }
+                    content += "小票张数: "+pageNum+" 张<BR>";
+                    content += "班结金额: "+ysAmt+" 元<BR>";
+                    content += "优惠总额: "+coupon+" 元<BR>";
+                    content += "实际支付: "+sumAmt+" 元<BR>";
+                    content += "到款金额: "+dzAmt+"元<BR>";
+                    content += "--------------------------------<BR>";
+                    if(search!=null){
+                        if( search.getAmt()==null){
+                            search.setAmt(BigDecimal.valueOf(0));
+                        }
+                        content +="非油总额: "+search.getAmt()+"元<BR>";
+                    }else{
+                        content +="非油总额: 0  元<BR>";
+                    }
+                    content += "班结人: "+list.get(0).getClassStructureMan()+"<BR>";
+                    content += "<BR>";
+                    content += "--------------------------------<BR>";
+                    content += "<BR>";
+                    //查询打印机信息
+                    Map params  =new HashMap();
+                    params.put("stationId", list.get(0).getStationId());
+                    params.put("deviceType", "1");
+                    Map mp  = stationDeviceManageService.getPrinterSnByStationId(params);
+                    if(mp!=null&&mp.containsKey("device_no") && mp.get("device_no")!= null && mp.get("device_no")!=""){
+                        String sn = mp.get("device_no").toString();
+                        FeiEPrinterUtil.printReceipt(sn, content);
+                        i=1;
+                    }else {
+                        logger.info("请正确配置打印机");
+                        i=2;
+                    }
+                }
+            }
+        }
+        return toAjaxee(i);
+    }
+
 
     /**
      * 修改班结管理

+ 11 - 0
yijia-station/src/main/java/com/yijia/station/domain/DeptInfoDemo.java

@@ -2,6 +2,8 @@ package com.yijia.station.domain;
 
 import com.yijia.common.core.domain.BaseEntity;
 
+import java.math.BigDecimal;
+
 public class DeptInfoDemo extends BaseEntity {
     private static final long serialVersionUID = 1L;
     /** 部门ID */
@@ -9,6 +11,15 @@ public class DeptInfoDemo extends BaseEntity {
 
     /** 部门名称 */
     private String deptName;
+    private BigDecimal balance;
+
+    public BigDecimal getBalance() {
+        return balance;
+    }
+
+    public void setBalance(BigDecimal balance) {
+        this.balance = balance;
+    }
 
     public Long getDeptId() {
         return deptId;

+ 20 - 11
yijia-station/src/main/java/com/yijia/station/domain/StationBalanceChange.java

@@ -8,7 +8,7 @@ import com.yijia.common.core.domain.BaseEntity;
 
 /**
  * LNG油站余额变化记录对象 station_balance_change
- * 
+ *
  * @author yijia
  * @date 2021-07-13
  */
@@ -30,53 +30,62 @@ public class StationBalanceChange extends BaseEntity
     /** 记录类型:+,充值;-,消费; */
     @Excel(name = "记录类型:+,充值;-,消费;")
     private String type;
+    private String stationName;
 
     /** 销售价支付金额 */
     @Excel(name = "销售价支付金额")
     private BigDecimal amt;
 
-    public void setId(Long id) 
+    public String getStationName() {
+        return stationName;
+    }
+
+    public void setStationName(String stationName) {
+        this.stationName = stationName;
+    }
+
+    public void setId(Long id)
     {
         this.id = id;
     }
 
-    public Long getId() 
+    public Long getId()
     {
         return id;
     }
-    public void setStationId(Long stationId) 
+    public void setStationId(Long stationId)
     {
         this.stationId = stationId;
     }
 
-    public Long getStationId() 
+    public Long getStationId()
     {
         return stationId;
     }
-    public void setOrderNo(String orderNo) 
+    public void setOrderNo(String orderNo)
     {
         this.orderNo = orderNo;
     }
 
-    public String getOrderNo() 
+    public String getOrderNo()
     {
         return orderNo;
     }
-    public void setType(String type) 
+    public void setType(String type)
     {
         this.type = type;
     }
 
-    public String getType() 
+    public String getType()
     {
         return type;
     }
-    public void setAmt(BigDecimal amt) 
+    public void setAmt(BigDecimal amt)
     {
         this.amt = amt;
     }
 
-    public BigDecimal getAmt() 
+    public BigDecimal getAmt()
     {
         return amt;
     }

+ 9 - 0
yijia-station/src/main/java/com/yijia/station/domain/StationSettlementPriceAdjust.java

@@ -34,9 +34,18 @@ public class StationSettlementPriceAdjust extends BaseEntity
     /** 站点id */
     @Excel(name = "站点id")
     private Long stationId;
+    private String stationName;
 
     private Long parentId;
 
+    public String getStationName() {
+        return stationName;
+    }
+
+    public void setStationName(String stationName) {
+        this.stationName = stationName;
+    }
+
     public Long getParentId() {
         return parentId;
     }

+ 7 - 0
yijia-station/src/main/java/com/yijia/station/mapper/PayOrderMapper.java

@@ -147,4 +147,11 @@ public interface PayOrderMapper
     public List<PayOrder> selectLNGPayOrderExport(PayOrder payOrder);
 
     public List<PayOrder> LNGDeptList(PayOrder payOrder);
+
+    /**
+     * 用戶信息关联订单查询
+     * @param payOrder
+     * @return
+     */
+    public List<PayOrder> selectUserPayOrderList(PayOrder payOrder);
 }

+ 5 - 0
yijia-station/src/main/java/com/yijia/station/service/IPayOrderService.java

@@ -149,4 +149,9 @@ public interface IPayOrderService
      * @return
      */
     public List<PayOrder> LNGDeptList(PayOrder payOrder);
+
+    /**
+     * 关联用户查询订单支付列表
+     */
+    public List<PayOrder> selectUserPayOrderList(PayOrder payOrder);
 }

+ 10 - 0
yijia-station/src/main/java/com/yijia/station/service/impl/PayOrderServiceImpl.java

@@ -221,4 +221,14 @@ public class PayOrderServiceImpl implements IPayOrderService
         return payOrderMapper.LNGDeptList(payOrder) ;
     }
 
+    /**
+     * 关联用户查询订单支付列表
+     * @param payOrder
+     * @return
+     */
+    @Override
+    public List<PayOrder> selectUserPayOrderList(PayOrder payOrder) {
+        return payOrderMapper.selectUserPayOrderList(payOrder);
+    }
+
 }

+ 69 - 4
yijia-station/src/main/resources/mapper/station/PayOrderMapper.xml

@@ -185,9 +185,69 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         order by order_id desc
     </select>
+    <!--用戶信息关联订单查询-->
+    <select id="selectUserPayOrderList" parameterType="PayOrder" resultMap="PayOrderResult">
+        SELECT order_id,dept_name as station_name,oil_name,order_no,p.oil_pirce,order_liters,receivable_amt,amt,sell_amt,sell_discount_amt,amt,discount_amt,pay_date,mobile_phone as customer_phone,sell_oil_price,driver_oil_price
+        from pay_order p
+        left join sys_dept d on d.dept_id =p.station_id
+        join app_user_info a on a.user_id=p.consumer_id
+        <where>
+            <if test="orderNo != null  and orderNo != ''"> and p.order_no = #{orderNo}</if>
+            <if test="stationId != null "> and p.station_id = #{stationId}</if>
+            <if test="status != null  and status != ''"> and p.status = #{status}</if>
+            <if test="consumerId != null "> and consumer_id = #{consumerId}</if>
+            <if test="consumer != null  and consumer != ''"> and consumer = #{consumer}</if>
+            <if test="oilGun != null  and oilGun != ''"> and oil_gun = #{oilGun}</if>
+            <if test="oilName != null  and oilName != ''"> and oil_name like concat('%', #{oilName}, '%')</if>
+            <if test="oilPirce != null "> and oil_pirce = #{oilPirce}</if>
+            <if test="oilType != null  and oilType != ''"> and oil_type = #{oilType}</if>
+            <if test="orderLiters != null "> and order_liters = #{orderLiters}</if>
+            <if test="amt != null "> and amt = #{amt}</if>
+            <if test="receivableAmt != null "> and receivable_amt = #{receivableAmt}</if>
+            <if test="receivedAmt != null "> and received_amt = #{receivedAmt}</if>
+            <if test="discountAmt != null "> and discount_amt = #{discountAmt}</if>
+            <if test="discountCouponAmt != null "> and discount_coupon_amt = #{discountCouponAmt}</if>
+            <if test="discountCoupon != null  and discountCoupon != ''"> and discount_coupon = #{discountCoupon}</if>
+            <if test="wxAmt != null "> and wx_amt = #{wxAmt}</if>
+            <if test="zfbAmt != null "> and zfb_amt = #{zfbAmt}</if>
+            <if test="posAmt != null "> and pos_amt = #{posAmt}</if>
+            <if test="xjAmt != null "> and xj_amt = #{xjAmt}</if>
+            <if test="didiAppAmt != null "> and didi_app_amt = #{didiAppAmt}</if>
+            <if test="tyAppAmt != null "> and ty_app_amt = #{tyAppAmt}</if>
+            <if test="otherAmt != null "> and other_amt = #{otherAmt}</if>
+            <if test="dzkAmt != null "> and dzk_amt = #{dzkAmt}</if>
+            <if test="score != null "> and score = #{score}</if>
+            <if test="memberNo != null  and memberNo != ''"> and member_no = #{memberNo}</if>
+            <if test="memberAmt != null "> and member_amt = #{memberAmt}</if>
+            <if test="printCount != null "> and print_count = #{printCount}</if>
+            <if test="payType != null  and payType != ''"> and pay_type = #{payType}</if>
+            <if test="payWay != null  and payWay != ''"> and pay_way = #{payWay}</if>
+            <if test="oilPersonnel != null  and oilPersonnel != ''"> and oil_personnel = #{oilPersonnel}</if>
+            <if test="payDate != null "> and pay_date = #{payDate}</if>
+            <if test="createdDate != null "> and created_date = #{createdDate}</if>
+            <if test="orderType != null  and orderType != ''"> and order_type = #{orderType}</if>
+            <if test="carNo != null  and carNo != ''"> and car_no = #{carNo}</if>
+            <if test="customerPhone != null  and customerPhone != ''"> and mobile_phone like concat('%',#{customerPhone}, '%') </if>
+            <if test="customerGrade != null  and customerGrade != ''"> and customer_grade like concat('%',#{customerGrade}, '%') </if>
+            <if test="stationIdList != null ">
+                and p.station_id in
+                <foreach item="item" index="index" collection="stationIdList"
+                         open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
+                AND date_format(p.created_date,'%y-%m-%d %H:%i:%s') &gt;= date_format(#{beginTime},'%y-%m-%d %H:%i:%s')
+            </if>
+            <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
+                AND date_format(p.created_date,'%y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%y-%m-%d %H:%i:%s')
+            </if>
+        </where>
+        order by order_id desc
+    </select>
     <!--查询LNG导出数据-->
     <select id="selectLNGPayOrderExport" parameterType="PayOrder" resultMap="PayOrderResult">
-        SELECT order_id,dept_name as station_name,oil_name,order_no,p.oil_pirce,order_liters,receivable_amt,sell_amt,sell_discount_amt,amt,discount_amt,pay_date,mobile_phone,sell_oil_price,driver_oil_price
+        SELECT order_id,dept_name as station_name,oil_name,order_no,p.oil_pirce,order_liters,receivable_amt,amt,sell_amt,sell_discount_amt,amt,discount_amt,pay_date,mobile_phone,sell_oil_price,driver_oil_price
         from pay_order p
         left join sys_dept d on d.dept_id =p.station_id
         join app_user_info a on a.user_id=p.consumer_id
@@ -227,7 +287,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createdDate != null "> and created_date = #{createdDate}</if>
             <if test="orderType != null  and orderType != ''"> and order_type = #{orderType}</if>
             <if test="carNo != null  and carNo != ''"> and car_no = #{carNo}</if>
-            <if test="customerPhone != null  and customerPhone != ''"> and customer_phone like concat('%',#{customerPhone}, '%') </if>
+            <if test="customerPhone != null  and customerPhone != ''"> and mobile_phone like concat('%',#{customerPhone}, '%') </if>
             <if test="customerGrade != null  and customerGrade != ''"> and customer_grade like concat('%',#{customerGrade}, '%') </if>
             <if test="stationIdList != null ">
                 and p.station_id in
@@ -307,7 +367,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         order by order_id desc
     </select>
     <select id="selectPayOrderById" parameterType="Long" resultMap="PayOrderResult">
-        <include refid="selectPayOrderVo"/>
+       select order_id, order_no, p.station_id, p.station_name, p.status,consumer_id, consumer, oil_gun,
+        oil_name, oil_pirce, oil_type, order_liters, amt, receivable_amt, received_amt, discount_amt,sell_oil_price,driver_oil_price,
+        discount_coupon_amt, discount_coupon, wx_amt, zfb_amt, pos_amt, xj_amt, didi_app_amt, ty_app_amt,
+        other_amt, dzk_amt, score, member_no, member_amt, print_count, pay_type, pay_way, oil_personnel,
+        pay_date, created_date, order_type, car_no,customer_grade,sell_amt,sell_discount_amt,d.mobile_phone as customer_phone
+        from pay_order p join app_user_info d on p.consumer_id =d.user_id
         where order_id = #{orderId}
     </select>
     <select id="selectDaySources" parameterType="PayOrder" resultMap="PayOrderResult">
@@ -334,7 +399,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
     </select>
     <select id="selectOilTypeSources" parameterType="Long" resultMap="PayOrderResult">
-        SELECT SUM(amt) as amt,sum(order_liters) as order_liters, oil_type,count(1) count_num
+        SELECT SUM(amt) as amt,sum(order_liters) as order_liters,sum(sell_amt) sell_amt, oil_type,count(1) count_num
         from pay_order
         <where>
             <if test="stationId != null "> and station_id = #{stationId}</if>

+ 3 - 1
yijia-station/src/main/resources/mapper/station/StationBalanceChangeMapper.xml

@@ -12,12 +12,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="amt"    column="amt"    />
         <result property="createTime"    column="create_time"    />
         <result property="createBy"    column="create_by"    />
+        <result property="createName"    column="create_name"    />
         <result property="stationName"    column="station_name"    />
     </resultMap>
 
     <sql id="selectStationBalanceChangeVo">
-        select c.id, c.station_id, c.order_no, c.type, c.amt, c.create_time, c.create_by,dept_name as station_name
+        select c.id, c.station_id, c.order_no, c.type, c.amt, c.create_time, c.create_by,dept_name as station_name,u.nick_name as create_name
 		from station_balance_change c  join sys_dept d on c.station_id = d.dept_id
+		join sys_user u on c.create_by =u.user_id
     </sql>
 
     <select id="selectStationBalanceChangeList" parameterType="StationBalanceChange" resultMap="StationBalanceChangeResult">

+ 4 - 1
yijia-station/src/main/resources/mapper/station/StationSettlementPriceAdjustMapper.xml

@@ -13,12 +13,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="driverPrice"    column="driver_price"    />
         <result property="stationId"    column="station_id"    />
         <result property="parentId"    column="parent_id"    />
+        <result property="createName"    column="create_name"    />
+        <result property="stationName"    column="station_name"    />
     </resultMap>
 
     <sql id="selectStationSettlementPriceAdjustVo">
         select c.id, c.create_by, c.create_time,c.parent_id, c.settlement_price, c.settlement_type,
-         c.driver_price,c.station_id,dept_name as station_name
+         c.driver_price,c.station_id,dept_name as station_name,u.nick_name as create_name
 		from station_settlement_price_adjust c  join sys_dept d on c.station_id = d.dept_id
+		join sys_user u on c.create_by =u.user_id
     </sql>
 
     <select id="selectStationSettlementPriceAdjustList" parameterType="StationSettlementPriceAdjust" resultMap="StationSettlementPriceAdjustResult">

+ 6 - 1
yijia-system/src/main/java/com/yijia/system/service/ISysDeptService.java

@@ -207,5 +207,10 @@ public interface ISysDeptService
 
     public boolean isLngInfoList();
 
-
+    /**
+     * 获取所有的Lng站点
+     * @param levelId
+     * @return
+     */
+    public List<String> levelLngDeptList(Long levelId);
 }

+ 81 - 0
yijia-system/src/main/java/com/yijia/system/service/impl/SysDeptServiceImpl.java

@@ -584,6 +584,87 @@ public class SysDeptServiceImpl implements ISysDeptService
     }
 
     /**
+     * 获取所有的LNG站点数据
+     * @param levelId
+     * @return
+     */
+    @Override
+    public List<String> levelLngDeptList(Long levelId) {
+        LoginUser currentUser = SecurityUtils.getLoginUser();
+        List<SysDept> deptList = new ArrayList<>();
+        List<String> stringList = new ArrayList<>();
+        if(levelId!=null){
+            //查询油站信息
+            SysDept dept = deptMapper.selectDeptById(levelId);
+            if(dept!=null && dept.getJiBie()!=null &&dept.getJiBie()==0){
+                SysDept deptGroup =new SysDept();
+                deptGroup.setIsLngFlag("1");
+                List<SysDept>   deptInfoList =deptMapper.selectDeptList(deptGroup);
+                if(deptInfoList!=null && deptInfoList.size()>0){
+                    SysDept deptinfo =new SysDept();
+                    List<String> deptIdList = new ArrayList<>();
+                    for(SysDept sysDept:deptInfoList){
+                        deptIdList.add(sysDept.getDeptId().toString());
+                    }
+                    deptList = deptMapper.selectDeptList(deptinfo);
+                }
+            }else if(dept!=null && dept.getJiBie()!=null && dept.getJiBie()==1 && dept.getIsLngFlag()!=null && dept.getIsLngFlag().equals("1")){
+                deptList =deptMapper.selectChildrenDeptById(dept.getDeptId());
+            }else if(dept!=null && dept.getJiBie()!=null && dept.getJiBie()==2){
+                SysDept dept1 =deptMapper.selectDeptById(dept.getParentId());
+                if(dept1.getIsLngFlag()!=null && dept1.getIsLngFlag().equals("1")){
+                    deptList.add(dept);
+                }
+            }
+        }else{
+            if(currentUser.getUser().getDept().getJiBie()!=null && currentUser.getUser().getDept().getJiBie() == 0 && currentUser.getUser().getAgentFlag()!=null&& currentUser.getUser().getAgentFlag().equals("0")){
+                //顶级 查询处所有的 集团和油站id
+                SysDept deptGroup =new SysDept();
+                deptGroup.setIsLngFlag("1");
+                List<SysDept>   deptInfoList =deptMapper.selectDeptList(deptGroup);
+                if(deptInfoList!=null && deptInfoList.size()>0){
+                    SysDept deptinfo =new SysDept();
+                    List<String> deptIdList = new ArrayList<>();
+                    for(SysDept sysDept:deptInfoList){
+                        deptIdList.add(sysDept.getDeptId().toString());
+                    }
+                    deptList = deptMapper.selectDeptList(deptinfo);
+                }
+            }else if(currentUser.getUser().getDept().getJiBie()!=null && currentUser.getUser().getDept().getJiBie() == 0 && currentUser.getUser().getAgentFlag()!=null&& currentUser.getUser().getAgentFlag().equals("1")){
+                SysDept dept =new SysDept();
+                dept.setIsLngFlag("1");
+                dept.setUserId(currentUser.getUser().getUserId());
+                List<SysDept>   deptInfoList = deptMapper.selectDeptAgentList(dept);
+                if(deptInfoList!=null && deptInfoList.size()>0){
+                    SysDept deptinfo =new SysDept();
+                    List<String> deptIdList = new ArrayList<>();
+                    for(SysDept sysDept:deptInfoList){
+                        deptIdList.add(sysDept.getDeptId().toString());
+                    }
+                    deptList = deptMapper.selectDeptList(deptinfo);
+                }
+            }else if(currentUser.getUser().getDept().getJiBie()!=null && currentUser.getUser().getDept().getJiBie() == 1&& currentUser.getUser().getDept().getIsLngFlag()!=null && currentUser.getUser().getDept().getIsLngFlag().equals("1")){
+                //查询集团及站点
+                deptList =deptMapper.selectChildrenDeptById(currentUser.getUser().getDeptId());
+            }else{
+                SysDept dept1 =deptMapper.selectDeptById(currentUser.getUser().getDept().getParentId());
+                if(dept1.getIsLngFlag()!=null && dept1.getIsLngFlag().equals("1")){
+                    SysDept dept =new SysDept();
+                    dept.setDeptId(currentUser.getUser().getDeptId());
+                    dept.setParentId(currentUser.getUser().getDept().getParentId());
+                    deptList.add(dept);
+                }
+            }
+        }
+        if(deptList!=null && deptList.size()>0){
+            for(SysDept sysDept:deptList){
+                stringList.add(sysDept.getDeptId()+"");
+            }
+        }
+        return stringList;
+    }
+
+    /**
      * 查询代理所有的集团
      * @param sysDept
      * @return

+ 10 - 2
yijia-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -53,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<result property="labelFlag"    column="label_flag"    />
 		<result property="printDeviceType"    column="print_device_type" />
 		<result property="balance"    column="balance" />
+		<result property="isLngFlag"    column="is_lng_flag" />
 	</resultMap>
 
 	<sql id="selectDeptVo">
@@ -60,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         d.del_flag, d.create_by, d.create_time ,d.ji_bie, d.dept_address, d.oil_gun_num, d.station_pic, d.station_longitude,
         d.station_latitude, d.mno, discount_setting,card_enabled_flag,d.app_id, d.app_secret,gzh_app_id,gzh_app_secret,ali_app_id,gzh_app_secret
         ali_app_id,ali_public_key,ali_private_key,ali_encrypt_key,image1,image2,image3,image4,image5,ws_print_flag,print_setting,notice,integral_print_flag,
-        d.integral_flag,d.integral_rule_flag,d.card_rule_flag,d.coupon_flag,d.label_flag,d.print_device_type,d.balance
+        d.integral_flag,d.integral_rule_flag,d.card_rule_flag,d.coupon_flag,d.label_flag,d.print_device_type,d.balance,d.is_lng_flag
         from sys_dept d
     </sql>
 
@@ -70,6 +71,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<if test="deptId != null">
 			AND dept_id = #{deptId}
 		</if>
+		<if test="isLngFlag != null">
+			AND is_lng_flag = #{isLngFlag}
+		</if>
 		<if test="jiBie != null">
 			AND ji_bie = #{jiBie}
 		</if>
@@ -180,7 +184,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		where t.parent_id in (
 		SELECT dept_id from sys_dept d join  sys_agent a on d.dept_id =a.group_id
 		where d.del_flag = '0'
-		<if test="userId != null "> and a.user_id = #{userId}</if>)
+		<if test="userId != null "> and a.user_id = #{userId}</if>
+		<if test="isLngFlag != null">
+			AND a.is_lng_flag = #{isLngFlag}
+		</if>
+		 )
 		and  t.del_flag = '0'
 	</select>
 	<!--查询代理人对应的集团信息-->