doum
7 小时以前 437027600391a245588e6f719717b2f27a4222dc
经销商管理
已添加3个文件
已修改5个文件
710 ■■■■■ 文件已修改
admin/src/api/business/withdrawRecord.js 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/components/business/OperaWithdrawRecordWindow.vue 353 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/views/business/integral.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/views/business/withdrawRecord.vue 158 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmmall_service/src/main/java/com/doumee/core/utils/CodeGenerator.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmmall_service/src/main/java/com/doumee/dao/business/WithdrawRecordMapper.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmmall_service/src/main/java/com/doumee/dao/business/model/WithdrawRecord.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmmall_service/src/main/java/com/doumee/service/business/impl/WithdrawRecordServiceImpl.java 141 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/api/business/withdrawRecord.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,23 @@
import request from '../../utils/request'
// æŸ¥è¯¢
export function fetchList (data) {
  return request.post('/business/withdrawRecord/page', data, {
    trim: true
  })
}
// å¯¼å‡ºExcel
export function exportExcel (data) {
  return request.post('/business/withdrawRecord/exportExcel', data, {
    trim: true,
    download: true
  })
}
export function updateById (data) {
  return request.post('/business/withdrawRecord/updateById', data)
}
export function detail (id) {
  return request.get('/business/withdrawRecord/'+id)
}
admin/src/components/business/OperaWithdrawRecordWindow.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,353 @@
<template>
  <GlobalWindow
      :title="title"
      width="100%"
      :visible.sync="visible"
  >
      <div style="display: block;">
        <div class="header">
          <div  class="header-b">基本信息</div>
          <div v-if="form.status ==0" class="header-orange">待审批</div>
          <div v-if="form.status ==1" class="header-green">已通过</div>
          <div v-if="form.status ==2" class="header-red">已驳回</div>
        </div>
        <div class="info-item">
          <div class="info-item-a">经销商名称:<span>{{form.shopName || ''}}</span> </div>
          <div class="info-item-a">门店ID:<span>{{form.shopCode || ''}}</span></div>
          <div class="info-item-a">申请时间:<span>{{form.createDate || ''}}</span></div>
        </div>
        <div class="info-item"></div>
      </div>
      <div style="display: block;">
        <div class="header">
          <div  class="header-b">提现信息</div>
        </div>
        <div class="info-item">
          <div class="info-item-a">提现金额:<span class="orange">ï¿¥{{(form.amount || 0).toFixed(2)}}</span> </div>
          <div class="info-item-a"> </div>
          <div class="info-item-a"> </div>
        </div>
        <div class="info-item">
          <div class="info-item-a">户名:<span class="orange">{{ form.name||'' }}</span> </div>
          <div class="info-item-a">账号:<span class="orange">{{ form.bankAccount||'' }}</span> </div>
          <div class="info-item-a">银行:<span class="orange">{{ form.bankName||'' }}</span> </div>
        </div>
        <div class="info-item"></div>
      </div>
      <div style="display: block">
        <div class="header">
          <div  class="header-b">审核流程</div>
        </div>
        <div class="info-item">
          <div class="time-line">
            <el-timeline :reverse="true">
              <el-timeline-item
                  v-for="(item, index) in logList"
                  :key="index"
                  color="#2991FF"
                  size="large"
                  type="primary"
              >
                <div class="ml10">
                  <div class="list-title">{{ item.title }}
                    <i  v-if="item.status ==1"  class="el-icon-success green"></i>
                    <i  v-if="item.status ==2"  class="el-icon-error red"></i>
                  </div>
                  <div class="list-company"><span>{{item.info }}</span><span style="margin-left: 10px">{{item.createTime }}</span></div>
                  <div class="list-company1" v-if="item.status ===1"><span>打款凭证:</span>
                     <div v-if="item.files && item.files.length"; style="display: block;margin-left: 100px;">
                       <el-image
                          v-for="file in item.files "
                          :key="'file_'+file.fileurl"
                          style="margin-right: 20px; width: 100px; height: 100px; border-radius: 2px;"
                          :src="file.fileFullUrl"
                          :preview-src-list="[file.fileFullUrl]"
                      ></el-image>
                     </div>
                    <span v-else>无</span>
                  </div>
                  <div class="list-company1"  v-if="item.status ===1"><span>打款银行:</span><span>{{item.payBank||'-' }}</span></div>
                  <div class="list-company1"  v-if="item.status ===1||item.status ==2"><span>审核备注:</span><span>{{item.auditRemark||'' }}</span></div>
                </div>
              </el-timeline-item>
            </el-timeline>
          </div>
        </div>
      </div>
    <div  v-if="form && form.status == 0">
      <p class="tip-header" >申请审批</p>
      <el-form :model="checkForm" ref="checkForm" :rules="rules" label-width="110px" label-suffix=":"  style="margin-left: 20px;width: 500px;" inline >
        <el-form-item label="审核结果" prop="status">
          <el-radio-group v-model="checkForm.status">
            <el-radio :label="1">通过</el-radio>
            <el-radio  :label="2">驳回</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="打款凭证" prop="payFileList" v-if="checkForm.status ==1">
          <div style="margin-left: 150px">
          <UploadImage
              :fileList="checkForm.payFileList"
              :uploadData="{folder:'transfer'}"
              @beginUpload="isUploading=true"
              @endUpload="isUploading=false"/>
          <p class="tip-warn">
            å»ºè®®å°ºå¯¸ï¼š750px X 750px,上限6å¼ 
            æ”¯æŒpng、jpg、jpeg格式,大小不超过2M,上传图片不允许涉及政治敏感与色情
          </p>
          </div>
        </el-form-item>
        <el-form-item label="打款银行" prop="payBank" v-if="checkForm.status ==1">
          <el-input v-model="checkForm.payBank" placeholder="请输入打款银行"  style="width: 350px"  v-trim/>
        </el-form-item>
        <el-form-item label="审核备注" prop="auditRemark">
          <el-input v-model="checkForm.auditRemark" placeholder="请输入审核备注" type="textarea"  style="width: 350px; " rows="6" v-trim/>
        </el-form-item>
      </el-form>
      <div class="info-item-a"></div>
    </div>
    <template  v-slot:footer>
      <el-button :loading="isWorking" @click="confirmDo" v-if="form && form.status ==0" :type="checkForm.status==2?'danger':'primary'"  >{{checkForm.status==2?'审核驳回':'审核通过'}}</el-button>
      <el-button @click="visible=false">返回</el-button>
    </template>
  </GlobalWindow>
</template>
<script>
import GlobalWindow from '@/components/common/GlobalWindow'
import BaseOpera from '@/components/base/BaseOpera'
import UploadImage from '@/components/common/UploadImage'
export default {
  name: 'OperaShopInfoWindow',
  extends: BaseOpera,
  components: { GlobalWindow, UploadImage },
  data () {
    return {
      title: '',
      visible: false,
      tabelHeight: null,
      isUploading: false,
      form: {},
      logList: [],
      checkForm: {
        id: '',
        status: '',
        auditRemark: '',
        payBank: '',
        payFileList: null
      },
      rules: {
        status: [
          { required: true, message: '请选择审核结果' }
        ]
      }
    }
  },
  created () {
    this.config({
      module: '提现申请表',
      api: '/business/withdrawRecord',
      'field.id': 'id',
      'field.main': 'id'
    })
  },
  methods: {
    confirmDo () {
      this.$refs.checkForm.validate((valid) => {
        if (!valid) {
          return
        }
        this.$dialog.confirm('您确定提交该审批结果吗?', '操作提示', {
          confirmButtonText: this.checkForm.status === 1 ? '确认通过' : '确定驳回',
          type: 'warning'
        })
          .then(() => {
            this.isWorking = true
            this.api.updateById(this.checkForm)
              .then(() => {
                this.$tip.apiSuccess('审批成功')
                this.loadInfo()
                this.$emit('success')
              }).catch(e => {
                this.$tip.apiFailed(e)
              })
              .finally(() => {
                this.isWorking = false
              })
          })
          .catch(e => {
          })
        // è°ƒç”¨æ–°å»ºæŽ¥å£
      })
    },
    loadInfo () {
      this.api.detail(this.form.id).then(res => {
        this.form = res || this.form
        this.logList = []
        if (this.form.status == 1) {
          this.logList.push({ title: '平台审核通过', info: this.form.auditUserName, createTime: this.form.auditTime || '', status: 1, files: this.form.payFileList || [], bank: this.form.payBank || '', auditRemark: this.form.auditRemark || '' })
        } else if (this.form.status == 2) {
          this.logList.push({ title: '平台审核驳回', info: this.form.auditUserName, createTime: this.form.auditTime || '', status: 2, auditRemark: this.form.auditRemark || '' })
        }
        this.logList.push({ title: '经销商发起提现申请', info: '恒达机械销售有限公司 ', createTime: this.form.createDate || '', status: 0 })
      })
    },
    open (title, info) {
      this.title = title
      this.visible = true
      this.form = info || {}
      this.loadInfo()
      this.logList = []
      this.checkForm = {
        id: info.id,
        status: 1,
        auditRemark: '',
        payBank: '',
        payFileList: []
      }
    }
  }
}
</script>
<style lang="scss"  scoped>
.platgroup_tabs {
  flex: 1;
  display: flex;
  border-bottom: 1px solid #dfe2e8;
  margin-bottom: 30px;
  .tab {
    color: #666666;
    margin-right: 40px;
    cursor: pointer;
    padding-bottom: 10px;
    border-bottom: 2px solid #fff;
  }
  .active {
    font-weight: 500;
    font-size: 15px;
    color: #216EEE;
    border-bottom: 2px solid #216EEE;
  }
}
.table-pagination{
  position: fixed !important;
  bottom: 50px;
}
.header-b{
  display: inline-block;
  font-size: 16px;
  font-weight: bold;
}
.confirmbtn1{
  color: #FFFFFF;
  background-color: #0e83d1!important;
  border-color: #0e83d1!important;
}
.confirmbtn2{
  color: #FFFFFF;
  background-color: red!important;
  border-color: red!important;
}
.header-green{
  display: inline-block;
  font-size: 12px;
  border: 1px solid green;
  padding: 2px 10px;
  margin-left: 20px;
  color: green;
  border-radius: 5px ;
}
.header-red{
  display: inline-block;
  font-size: 12px;
  border: 1px solid red;
  padding: 2px 10px;
  margin-left: 20px;
  color: red;
  border-radius: 5px ;
}
.header-orange{
  display: inline-block;
  font-size: 12px;
  border: 1px solid orange;
  padding: 2px 10px;
  margin-left: 20px;
  color:  orange;
  border-radius: 5px ;
}
.header-btn{
  display: inline-block;
  border: none;
  padding: 2px 10px;
  margin-left: 20px;
}
.info-item{
  display: flex;
  width: 100%;
  margin: 15px;
}
.info-item-a{
  flex: 1;
  font-size: 14px;
}
.info-item-a span{
  font-weight: 600;
}
.info-item-a  .btn{
  font-size: 12px !important;
  cursor: pointer !important;
}
.time-line {
  margin-top: 20px;
  margin-left: 20px;
}
.list-title {
  font-size: 12px;
  font-family: PingFangSC-Medium, PingFang SC;
  font-weight: 500;
  //color: #181b1e;
  margin-bottom: 5px;
}
.list-company {
  font-size: 12px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #596878;
  margin-bottom: 15px;
}
.list-company1 {
  font-size: 12px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  margin-bottom: 15px;
}
.list-desc {
  font-size: 12px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #596878;
}
//左侧时间
.time {
  color: #409eff;
  position: absolute;
  left: -94px;
  top: 1px;
  .year {
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #20354a;
  }
  .day {
    font-size: 12px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: black;
    text-align: right;
    margin-top: 0px;
  }
}
</style>
admin/src/views/business/integral.vue
@@ -27,9 +27,10 @@
        </el-select>
      </el-form-item>
      <div class="date-style" style="display: inline">
        <el-form-item label="变动时间" prop="queryStartDate" >
        <el-form-item label="变动时间" prop="starttime" >
          <el-date-picker
              style="width: 160px"
              clearable
              v-model="searchForm.starttime"
              type="datetime"
              value-format="yyyy-MM-dd HH:mm:ss"
@@ -38,9 +39,10 @@
              placeholder="开始时间"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="-" label-width="10px" prop="queryEndDate" >
        <el-form-item label="-" label-width="10px" prop="endtime" >
          <el-date-picker
              style="width: 160px"
              clearable
              v-model="searchForm.endtime"
              type="datetime"
              value-format="yyyy-MM-dd HH:mm:ss"
admin/src/views/business/withdrawRecord.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,158 @@
<template>
  <TableLayout :permissions="['business:withdrawrecord:query']">
    <!-- æœç´¢è¡¨å• -->
    <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
      <el-form-item label="经销商" prop="shopName">
        <el-input v-model="searchForm.shopName" placeholder="请输入经销商名称" clearable @keypress.enter.native="search"></el-input>
      </el-form-item>
      <el-form-item label="审核状态" prop="status"   >
        <!-- 0正常 1禁用 -->
        <el-select     v-model="searchForm.status"  placeholder="审核状态" style="width: 140px"   @change="search" clearable  >
          <el-option  :key="0" :value="0"  label="待审批"  ></el-option>
          <el-option   :key="1" :value="1" label="已通过"  ></el-option>
          <el-option   :key="2" :value="2" label="已驳回"  ></el-option>
        </el-select>
      </el-form-item>
      <div class="date-style" style="display: inline">
        <el-form-item label="申请时间" prop="starttime" >
          <el-date-picker
              style="width: 180px"
              v-model="searchForm.starttime"
              type="datetime"
              clearable
              value-format="yyyy-MM-dd HH:mm:ss"
              format="yyyy-MM-dd HH:mm:ss"
              range-separator="至"
              placeholder="开始时间"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="-" label-width="10px" prop="endtime" >
          <el-date-picker
              style="width: 180px"
              v-model="searchForm.endtime"
              type="datetime"
              clearable
              value-format="yyyy-MM-dd HH:mm:ss"
              format="yyyy-MM-dd HH:mm:ss"
              range-separator="至"
              placeholder="截止时间"
          ></el-date-picker>
        </el-form-item>
      </div>
      <section>
        <el-button type="primary" @click="search">搜索</el-button>
        <el-button @click="reset">重置</el-button>
      </section>
    </el-form>
    <!-- è¡¨æ ¼å’Œåˆ†é¡µ -->
    <template v-slot:table-wrap>
      <ul class="toolbar" >
        <li>累计提现:<span class="red">ï¿¥ {{(totalData.amount||0).toFixed(2)}}</span></li>
      </ul>
      <el-table
        v-loading="isWorking.search"
        :data="tableData.list"
        stripe
        border
        @selection-change="handleSelectionChange"
      >
        <!-- <el-table-column type="selection" width="55"></el-table-column> -->
        <el-table-column prop="shopName" label="经销商名称" fixed align="center" min-width="100px">  </el-table-column>
        <el-table-column prop="shopCode" label="门店ID" align="center" min-width="100px"></el-table-column>
        <el-table-column prop="integral" label="提现金额(元)" align="center" min-width="100px">
          <template slot-scope="{row}">
            <span class="orange">ï¿¥{{(row.amount || 0).toFixed(2)}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="name" label="收款人" align="center" min-width="100px"></el-table-column>
        <el-table-column prop="bankAccount" label="收款账号" align="center" min-width="150px" show-overflow-tooltip></el-table-column>
        <el-table-column prop="bankName" label="提现银行" align="center" min-width="100px"></el-table-column>
        <el-table-column prop="createDate" label="申请时间" align="center" min-width="140px"></el-table-column>
        <el-table-column prop="status" label="审核状态" align="center" min-width="100px" fixed="right">
          <template slot-scope="{row}">
              <span v-if="row.status==0" class="orange">待审批</span>
              <span v-if="row.status==1" class="green">已通过</span>
              <span v-if="row.status==2" class="red">已驳回</span>
          </template>
        </el-table-column>
        <el-table-column
          v-if="containPermissions(['business:withdrawrecord:update', 'business:withdrawrecord:delete'])"
          label="操作"
          min-width="120"
          fixed="right"
          align="center"
        >
          <template slot-scope="{row}">
            <el-button type="text" @click="$refs.operaWithdrawRecordWindow.open('提现申请详情', row)" v-permissions="['business:withdrawrecord:update']">查看详情</el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        @size-change="handleSizeChange"
        @current-change="handlePageChange"
        :pagination="tableData.pagination"
      >
      </pagination>
    </template>
    <!-- æ–°å»º/修改 -->
    <OperaWithdrawRecordWindow ref="operaWithdrawRecordWindow" @success="handlePageChange"/>
  </TableLayout>
</template>
<script>
import BaseTable from '@/components/base/BaseTable'
import TableLayout from '@/layouts/TableLayout'
import Pagination from '@/components/common/Pagination'
import OperaWithdrawRecordWindow from '@/components/business/OperaWithdrawRecordWindow'
export default {
  name: 'Shop',
  extends: BaseTable,
  components: { TableLayout, Pagination, OperaWithdrawRecordWindow },
  data () {
    return {
      // æœç´¢
      totalData: {},
      searchForm: {
        shopName: '',
        starttime: '',
        endtime: '',
        status: ''
      }
    }
  },
  created () {
    this.config({
      module: '提现申请信息表',
      api: '/business/withdrawRecord',
      'field.id': 'id',
      'field.main': 'id'
    })
    this.search()
  },
  methods: {
    handlePageChange (pageIndex) {
      this.tableData.pagination.pageIndex = pageIndex || this.tableData.pagination.pageIndex
      this.isWorking.search = true
      this.api.fetchList({
        page: this.tableData.pagination.pageIndex,
        capacity: this.tableData.pagination.pageSize,
        model: this.searchForm, // é”€å”®æ¨¡å¼å˜æ›´
        sorts: this.tableData.sorts
      })
        .then(data => {
          this.tableData.list = data.records || []
          this.tableData.pagination.total = data.total || 0
          if (this.tableData.pagination.pageIndex === 1) {
            this.totalData = data.countData || {}
          }
        })
        .catch(e => {
          this.$tip.apiFailed(e)
        })
        .finally(() => {
          this.isWorking.search = false
        })
    }
  }
}
</script>
server/dmmall_service/src/main/java/com/doumee/core/utils/CodeGenerator.java
@@ -32,11 +32,7 @@
        String password = "Doumee@168";
        String database = "dmmall_full";
        List<String> tables = new ArrayList<>();
        tables.add("member");
        tables.add("labels");
        tables.add("goods");
        tables.add("goodsorder");
        tables.add("integral");
        tables.add("withdraw_record");
        for(String tableName : tables){
            // èŽ·å–è¡¨ä¿¡æ¯å¹¶ç”Ÿæˆä»£ç 
server/dmmall_service/src/main/java/com/doumee/dao/business/WithdrawRecordMapper.java
@@ -2,11 +2,12 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.doumee.dao.business.model.WithdrawRecord;
import com.github.yulichang.base.MPJBaseMapper;
/**
 * @author æ±Ÿè¹„蹄
 * @date 2026/01/16 11:50
 */
public interface WithdrawRecordMapper extends BaseMapper<WithdrawRecord> {
public interface WithdrawRecordMapper extends MPJBaseMapper<WithdrawRecord> {
}
server/dmmall_service/src/main/java/com/doumee/dao/business/model/WithdrawRecord.java
@@ -35,7 +35,6 @@
    @ApiModelProperty(value = "创建时间")
    @ExcelColumn(name="创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date createDate;
    @ApiModelProperty(value = "更新人编码", example = "1")
@@ -44,7 +43,6 @@
    @ApiModelProperty(value = "更新时间")
    @ExcelColumn(name="更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date editDate;
    @ApiModelProperty(value = "是否删除0否 1是", example = "1")
@@ -79,7 +77,6 @@
    @ExcelColumn(name="开户人姓名")
    private String name;
    @ApiModelProperty(value = "银行主键(关联 member_bank è¡¨ï¼‰", example = "1")
    @ExcelColumn(name="银行主键(关联 member_bank è¡¨ï¼‰")
    private Integer bankId;
@@ -94,9 +91,7 @@
    @ApiModelProperty(value = "审批时间")
    @ExcelColumn(name="审批时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date auditTime;
    @ApiModelProperty(value = "审批备注")
    @ExcelColumn(name="审批备注")
    private String auditRemark;
@@ -104,9 +99,24 @@
    @ApiModelProperty(value = "打款银行")
    @ExcelColumn(name="打款银行")
    private String payBank;
    @ApiModelProperty(value = "经销商名称")
    @TableField(exist = false)
    private String shopName;
    @ApiModelProperty(value = "经销商门店ID")
    @TableField(exist = false)
    private String shopCode;
    @ApiModelProperty(value = "审核人")
    @TableField(exist = false)
    private String auditUserName;
    @ApiModelProperty(value = "打款凭证", example = "1")
    @TableField(exist = false)
    private List<Multifile> payFileList;
    @ApiModelProperty(value = "开始时间 ")
    @TableField(exist = false)
    private Date starttime;
    @ApiModelProperty(value = "结束时间 ")
    @TableField(exist = false)
    private Date endtime;
}
server/dmmall_service/src/main/java/com/doumee/service/business/impl/WithdrawRecordServiceImpl.java
@@ -3,6 +3,7 @@
import com.doumee.biz.system.SystemDictDataBiz;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.model.LoginUserInfo;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.Constants;
@@ -11,6 +12,7 @@
import com.doumee.core.utils.Utils;
import com.doumee.dao.business.*;
import com.doumee.dao.business.model.*;
import com.doumee.dao.system.model.SystemUser;
import com.doumee.dao.web.dto.MultiFileDTO;
import com.doumee.dao.web.request.DealIntegralRequest;
import com.doumee.dao.web.request.WithdrawApplyRequest;
@@ -20,15 +22,20 @@
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import lombok.With;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.bouncycastle.cert.dane.DANEEntry;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -88,11 +95,58 @@
        withdrawRecordMapper.deleteBatchIds(ids);
    }
    /**
     * æ‰“款审核
     * @param withdrawRecord å®žä½“对象
     */
    @Override
    @Transactional
    public void updateById(WithdrawRecord withdrawRecord) {
        withdrawRecordMapper.updateById(withdrawRecord);
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        if(!Constants.equalsObject(withdrawRecord.getStatus(),Constants.ONE)
                && !Constants.equalsObject(withdrawRecord.getStatus(),Constants.TWO)){
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        WithdrawRecord model = withdrawRecordMapper.selectById(withdrawRecord.getId());
        if(model == null || Constants.equalsObject(model.getIsdeleted(),Constants.ONE)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY);
        }
        if(!Constants.equalsObject(model.getStatus(),Constants.ZERO)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该申请已审批,请尝试刷新页面查看");
    }
        Date date = new Date();
        model.setPayBank(withdrawRecord.getPayBank());
        model.setEditor(user.getId());
        model.setEditDate(date);
        model.setAuditRemark(withdrawRecord.getAuditRemark());
        model.setAuditTime(date);
        model.setAuditUser(user.getId());
        model.setStatus(withdrawRecord.getStatus());
        model.setPayBank(withdrawRecord.getPayBank());
        withdrawRecordMapper.updateById(model);
        dealBatchMultiFiles(model,withdrawRecord.getPayFileList());
    }
    public void dealBatchMultiFiles(WithdrawRecord model, List<Multifile> fileList  ) {
        //清空原有的
        if(fileList!=null && fileList.size()>0){
            List<Multifile> multifileList = new ArrayList<>();
            fileList.stream().forEach(s -> {
                if(StringUtils.isNotBlank(s.getFileurl())){
                    s.setIsdeleted(Constants.ZERO);
                    s.setCreator(model.getAuditUser());
                    s.setCreateDate(model.getAuditTime());
                    s.setObjId(model.getId());
                    s.setType(Constants.ZERO);
                    s.setObjType(Constants.MultiFile.TRANSFER_FILE.getKey());
                    multifileList.add(s);
                }
            });
            if(multifileList.size()>0){
                multifileMapper.insert(multifileList);
            }
        }
    }
    @Override
    public void updateByIdInBatch(List<WithdrawRecord> withdrawRecords) {
        if (CollectionUtils.isEmpty(withdrawRecords)) {
@@ -105,7 +159,16 @@
    @Override
    public WithdrawRecord findById(Integer id) {
        WithdrawRecord withdrawRecord = withdrawRecordMapper.selectById(id);
        MPJLambdaWrapper<WithdrawRecord> queryWrapper = new MPJLambdaWrapper<WithdrawRecord>()
                .selectAll(WithdrawRecord.class)
                .selectAs(SystemUser::getRealname,WithdrawRecord::getAuditUserName)
                .selectAs(Shop::getName,WithdrawRecord::getShopName)
                .selectAs(Shop::getCode,WithdrawRecord::getShopCode)
                .leftJoin(Shop.class,Shop::getId,WithdrawRecord::getMemberId)
                .leftJoin(SystemUser.class,SystemUser::getId,WithdrawRecord::getAuditUser)
                .eq(WithdrawRecord::getId,id)
                .eq(WithdrawRecord::getIsdeleted,Constants.ZERO);
        WithdrawRecord withdrawRecord = withdrawRecordMapper.selectJoinOne(WithdrawRecord.class,queryWrapper);
        if (Objects.isNull(withdrawRecord)) {
            throw new BusinessException(ResponseStatus.DATA_EMPTY);
        }
@@ -119,7 +182,9 @@
            List<Multifile> filelist = multifileMapper.selectList(new QueryWrapper<>(queryfile));
            if(filelist !=null && filelist.size()>0){
                for (Multifile multifile:filelist) {
                    if(StringUtils.isNotBlank(multifile.getFileurl())){
                    multifile.setFileFullUrl(path + multifile.getFileurl());
                    }
                }
                withdrawRecord.setPayFileList(filelist);
            }
@@ -142,64 +207,86 @@
    @Override
    public PageData<WithdrawRecord> findPage(PageWrap<WithdrawRecord> pageWrap) {
        IPage<WithdrawRecord> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
        QueryWrapper<WithdrawRecord> queryWrapper = new QueryWrapper<>();
        MPJLambdaWrapper<WithdrawRecord> queryWrapper = new MPJLambdaWrapper<WithdrawRecord>()
                .selectAll(WithdrawRecord.class)
                .selectAs(Shop::getName,WithdrawRecord::getShopName)
                .selectAs(Shop::getCode,WithdrawRecord::getShopCode)
                .leftJoin(Shop.class,Shop::getId,WithdrawRecord::getMemberId);
        Utils.MP.blankToNull(pageWrap.getModel());
        pageWrap.getModel().setIsdeleted(Constants.ZERO);
        if (pageWrap.getModel().getId() != null) {
            queryWrapper.lambda().eq(WithdrawRecord::getId, pageWrap.getModel().getId());
           queryWrapper.eq(WithdrawRecord::getId, pageWrap.getModel().getId());
        }
        if (pageWrap.getModel().getCreator() != null) {
            queryWrapper.lambda().eq(WithdrawRecord::getCreator, pageWrap.getModel().getCreator());
           queryWrapper.eq(WithdrawRecord::getCreator, pageWrap.getModel().getCreator());
        }
        if (pageWrap.getModel().getCreateDate() != null) {
            queryWrapper.lambda().ge(WithdrawRecord::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate()));
            queryWrapper.lambda().le(WithdrawRecord::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate()));
           queryWrapper.ge(WithdrawRecord::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate()));
           queryWrapper.le(WithdrawRecord::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate()));
        }
        if (pageWrap.getModel().getEditor() != null) {
            queryWrapper.lambda().eq(WithdrawRecord::getEditor, pageWrap.getModel().getEditor());
           queryWrapper.eq(WithdrawRecord::getEditor, pageWrap.getModel().getEditor());
        }
        if (pageWrap.getModel().getEditDate() != null) {
            queryWrapper.lambda().ge(WithdrawRecord::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate()));
            queryWrapper.lambda().le(WithdrawRecord::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate()));
           queryWrapper.ge(WithdrawRecord::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate()));
           queryWrapper.le(WithdrawRecord::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate()));
        }
        if (pageWrap.getModel().getIsdeleted() != null) {
            queryWrapper.lambda().eq(WithdrawRecord::getIsdeleted, pageWrap.getModel().getIsdeleted());
           queryWrapper.eq(WithdrawRecord::getIsdeleted, pageWrap.getModel().getIsdeleted());
        }
        if (pageWrap.getModel().getRemark() != null) {
            queryWrapper.lambda().eq(WithdrawRecord::getRemark, pageWrap.getModel().getRemark());
           queryWrapper.eq(WithdrawRecord::getRemark, pageWrap.getModel().getRemark());
        }
        if (pageWrap.getModel().getMemberId() != null) {
            queryWrapper.lambda().eq(WithdrawRecord::getMemberId, pageWrap.getModel().getMemberId());
           queryWrapper.eq(WithdrawRecord::getMemberId, pageWrap.getModel().getMemberId());
        }
        if (pageWrap.getModel().getCode() != null) {
            queryWrapper.lambda().eq(WithdrawRecord::getCode, pageWrap.getModel().getCode());
           queryWrapper.eq(WithdrawRecord::getCode, pageWrap.getModel().getCode());
        }
        if (pageWrap.getModel().getBankId() != null) {
            queryWrapper.lambda().eq(WithdrawRecord::getBankId, pageWrap.getModel().getBankId());
           queryWrapper.eq(WithdrawRecord::getBankId, pageWrap.getModel().getBankId());
        }
        if (pageWrap.getModel().getStatus() != null) {
            queryWrapper.lambda().eq(WithdrawRecord::getStatus, pageWrap.getModel().getStatus());
           queryWrapper.eq(WithdrawRecord::getStatus, pageWrap.getModel().getStatus());
        }
        if (pageWrap.getModel().getAuditUser() != null) {
            queryWrapper.lambda().eq(WithdrawRecord::getAuditUser, pageWrap.getModel().getAuditUser());
           queryWrapper.eq(WithdrawRecord::getAuditUser, pageWrap.getModel().getAuditUser());
        }
        if (pageWrap.getModel().getAuditTime() != null) {
            queryWrapper.lambda().ge(WithdrawRecord::getAuditTime, Utils.Date.getStart(pageWrap.getModel().getAuditTime()));
            queryWrapper.lambda().le(WithdrawRecord::getAuditTime, Utils.Date.getEnd(pageWrap.getModel().getAuditTime()));
           queryWrapper.ge(WithdrawRecord::getAuditTime, Utils.Date.getStart(pageWrap.getModel().getAuditTime()));
           queryWrapper.le(WithdrawRecord::getAuditTime, Utils.Date.getEnd(pageWrap.getModel().getAuditTime()));
        }
        if (pageWrap.getModel().getAuditRemark() != null) {
            queryWrapper.lambda().eq(WithdrawRecord::getAuditRemark, pageWrap.getModel().getAuditRemark());
           queryWrapper.eq(WithdrawRecord::getAuditRemark, pageWrap.getModel().getAuditRemark());
        }
        if (pageWrap.getModel().getPayBank() != null) {
            queryWrapper.lambda().eq(WithdrawRecord::getPayBank, pageWrap.getModel().getPayBank());
           queryWrapper.eq(WithdrawRecord::getPayBank, pageWrap.getModel().getPayBank());
        }
        for(PageWrap.SortData sortData: pageWrap.getSorts()) {
            if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) {
                queryWrapper.orderByDesc(sortData.getProperty());
            } else {
                queryWrapper.orderByAsc(sortData.getProperty());
        queryWrapper.ge(pageWrap.getModel().getStarttime() != null,WithdrawRecord::getCreateDate, pageWrap.getModel().getStarttime());
        queryWrapper.le(pageWrap.getModel().getEndtime() != null,WithdrawRecord::getCreateDate, pageWrap.getModel().getEndtime());
        queryWrapper.like(pageWrap.getModel().getShopName() != null,Shop::getName, pageWrap.getModel().getShopName());
        queryWrapper.orderByDesc(WithdrawRecord::getCreateDate);
        PageData<WithdrawRecord> rr = PageData.from(withdrawRecordMapper.selectJoinPage(page,WithdrawRecord.class, queryWrapper));
        if(pageWrap.getPage() == 1){
            //如果查询第一页,做经销商销售信息统计业务查询
            WithdrawRecord count   =  withdrawRecordMapper.selectJoinOne(WithdrawRecord.class,new MPJLambdaWrapper<WithdrawRecord>()
                     .selectSum(WithdrawRecord::getAmount)
                     .leftJoin(Shop.class,Shop::getId,WithdrawRecord::getMemberId)
                     .ge(pageWrap.getModel().getStarttime() != null,WithdrawRecord::getCreateDate, pageWrap.getModel().getStarttime())
                     .le(pageWrap.getModel().getEndtime() != null,WithdrawRecord::getCreateDate, pageWrap.getModel().getEndtime())
                     .like(pageWrap.getModel().getShopName() != null,Shop::getName, pageWrap.getModel().getShopName())
                     .eq(WithdrawRecord::getIsdeleted,Constants.ZERO)
                     .eq(pageWrap.getModel().getStatus()!=null,WithdrawRecord::getStatus,pageWrap.getModel().getStatus())
            );
            if(count == null){
                count = new WithdrawRecord();
            }
            count.setAmount(Constants.formatBigdecimal4Float(count.getAmount()));
            rr.setCountData(count);
        }
        return PageData.from(withdrawRecordMapper.selectPage(page, queryWrapper));
        return rr;
    }