jiangping
2024-06-19 bf15135228cbb9ac186cc8cc39e9da32d3f1d90f
提交一把
已添加3个文件
已修改15个文件
827 ■■■■ 文件已修改
company/public/template/personnel_reduce.xlsx 补丁 | 查看 | 原始文档 | blame | 历史
company/src/api/business/member.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/assets/style/style.scss 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/components/business/OperaInsuranceApplyWindow.vue 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/components/business/OperaWtbApplyShopWindow.vue 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/components/enterprise/OperaInsuranceApplyAddWindow.vue 56 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/components/enterprise/addEmployeeWithDu.vue 195 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/components/enterprise/additionSubtractionApplication.vue 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/components/enterprise/importEmployees.vue 99 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/views/enterprise/insuranceApply.vue 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/views/enterprise/myPolicy.vue 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/company/src/main/java/com/doumee/api/business/MemberController.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/dao/business/dto/MemberImport.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/dao/business/dto/MemberReduceImport.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/dao/business/model/ApplyDetail.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/MemberService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java 267 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/public/template/personnel_reduce.xlsx
Binary files differ
company/src/api/business/member.js
@@ -21,6 +21,10 @@
export function importExcel (data) {
    return request.post('/business/member/importExcel', data)
}
// å¯¼å…¥æ¨¡æ¿
export function importReuduceExcel (data) {
    return request.post('/business/member/importReuduceExcel', data)
}
// åˆ—表查询
export function findList (data) {
company/src/assets/style/style.scss
@@ -101,6 +101,20 @@
.du-status2 {
  color: #F95601 !important;
}
.tip-warn {
  margin: 4px 0 25px 0;
  font-size: 12px;
  color: #999;
  line-height: 25px;
  i {
    color: orange;
    margin-right: 4px;
    font-size: 14px;
    position: relative;
    top: 1px;
  }
}
.union-change-status2,
  .apply-status5,.apply-status27,.settle-status7,.change-status2,
  .tax-status1,.du-status1,.settle-status4 ,.union-apply-status3 {
company/src/components/business/OperaInsuranceApplyWindow.vue
@@ -11,7 +11,7 @@
                <div class="desc_item_label" v-if="userInfo.type === 1 &&(model.statusCollect === 2 || model.statusCollect === 3)">
                    <div class="desc_item_label_left">
                        <span>保险到期还有 <b style="color: #F95601;">{{model.loseEfficacyDays ? model.loseEfficacyDays : '-'}}</b> å¤©</span>
                        <el-button type="primary" v-if="model.statusCollect === 2 || model.statusCollect === 3" @click="$refs.OperaInsuranceApplyAddWindow.open('续保', {id: dataId,type: 1 })">一键续保</el-button>
                        <el-button type="primary" v-if="model.statusCollect === 2 || model.statusCollect === 3" @click="goYjxb">一键续保</el-button>
                        <el-button type="primary" v-if="model.statusCollect === 2" @click="$refs.additionSubtractionApplication.open('加减保申请', { id: dataId })">加减保申请</el-button>
                        <el-button type="primary" v-if="model.statusCollect === 2" @click="$refs.factoryChange.open('更换派遣单位申请', { id: dataId })">更换派遣单位申请</el-button>
                    </div>
@@ -29,7 +29,7 @@
<!--                          $refs.operaverifyPhoneNumberWindew.open('验证手机号')-->
                        <el-button v-if="model.status == 2" type="primary" :disabled="loading" :loading="loading" @click="goSign()">签署投保单</el-button>
                        <el-button v-if="model.status == 5" type="primary" @click="viewBaoxiandan">查看保险单</el-button>
                        <el-button v-if="model.status == 4" type="primary" @click="$refs.OperaInsuranceApplyAddWindow.open('投保申请', {id: dataId})">再次投保</el-button>
                        <el-button v-if="model.status == 4" type="primary" @click="$refs.operaInsuranceApplyAddWindow.open('投保申请', {id: dataId})">再次投保</el-button>
                        <el-button v-if="[0, 2, 3, 10].includes(model.status)" type="danger" @click="$refs.applyReturn.open('申请退回', {id: dataId})">申请退回</el-button>
                        <el-button v-if="model.status == 4" type="primary" @click="closeOrder">关闭订单</el-button>
                      </template>
@@ -455,7 +455,7 @@
        <!--    ä¼ä¸šç”³è¯·é€€å›ž    -->
        <applyReturn ref="applyReturn" @success="successEvent" />
        <!--    æ–°å¢žæŠ•保    -->
        <OperaInsuranceApplyAddWindow ref="OperaInsuranceApplyAddWindow" @success="successEvent" />
        <OperaInsuranceApplyAddWindow ref="operaInsuranceApplyAddWindow" @success="result" />
        <!--    åŠ å‡ä¿ç”³è¯·    -->
        <additionSubtractionApplication ref="additionSubtractionApplication" @success="successEvent" />
        <!--    æ›´æ¢æ´¾é£å•位申请    -->
@@ -485,13 +485,12 @@
import OperaApplyChangeUnitDetailWindow from '@/components/business/OperaApplyChangeUnitDetailWindow'
import applyReturn from '@/components/enterprise/applyReturn'
import { getDetail, getSignLink, applyDetailPage, applyChagneDetailPage, exportExcel, applyChagneDetailExcel, applyOpt } from '@/api/business/insuranceApply'
import { getDetail, getSignLink, applyDetailPage,  exportExcel, applyChagneDetailExcel, applyOpt } from '@/api/business/insuranceApply'
import { findListByDTO } from '@/api/business/dispatchUnit'
import { fetchList } from '@/api/business/applyChange'
import { findListByDTO as worktypeFindListByDTO } from '@/api/business/worktype'
import OperaInsuranceApplyAddWindow from '@/components/enterprise/OperaInsuranceApplyAddWindow'
import { mapState } from 'vuex'
import OperaPdfViewerWindow from '@/components/business/OperaPdfViewerWindow'
export default {
  name: 'OperaInsuranceApplyWindow1',
@@ -502,11 +501,11 @@
    InsuranceDetails,
    OperaInsuranceApplyCheckWindow,
    applyReturn,
    OperaInsuranceApplyAddWindow,
    additionSubtractionApplication,
    factoryChange,
    OperaApplyChangeDetailWindow,
    OperaApplyChangeUnitDetailWindow,
    OperaInsuranceApplyAddWindow,
    operaverifyPhoneNumberWindew
  },
  data () {
@@ -587,6 +586,17 @@
      this.getDW()
      this.getGZ()
    },
    result(flag,param){
      console.log(flag,param)
      if(param && param.godetail && param.id){
        this.open('委托保详情',{id:param.id})
      }else{
        this.successEvent()
      }
    },
    goYjxb(){
      this.$refs.operaInsuranceApplyAddWindow.open('续保', {id: this.dataId,type: 1 })
    },
    // å…³é—­è®¢å•
    closeOrder () {
      this.$confirm('确认关闭此订单吗?', '提示', {
company/src/components/business/OperaWtbApplyShopWindow.vue
@@ -11,7 +11,7 @@
                <div class="desc_item_label" v-if="userInfo.type === 1 && model.status ===27 ">
                    <div class="desc_item_label_left">
                        <span>保险到期还有 <b style="color: #F95601;">{{model.loseEfficacyDays ? model.loseEfficacyDays : '-'}}</b> å¤©</span>
                        <el-button type="primary" v-if="model.status === 27" @click="$refs.OperaInsuranceApplyAddWindow.open('续保', {id: dataId,type: 1 })">一键续保</el-button>
                        <el-button type="primary" v-if="model.status === 27" @click="goYjxb">一键续保</el-button>
                        <el-button type="primary" v-if="model.status === 27 && ( model.loseEfficacyDays ||!model.loseEfficacyDays)" @click="$refs.additionSubtractionApplication.open('加减保申请', { id: dataId })">加减保申请</el-button>
                        <el-button type="primary" v-if="model.status === 27 &&  ( model.loseEfficacyDays ||!model.loseEfficacyDays)" @click="$refs.factoryChange.open('更换派遣单位申请', { id: dataId })">更换派遣单位申请</el-button>
                    </div>
@@ -461,7 +461,7 @@
        <!--    ä¼ä¸šç”³è¯·é€€å›ž    -->
        <applyReturn ref="applyReturn" @success="successEvent" />
        <!--    æ–°å¢žæŠ•保    -->
        <OperaInsuranceApplyAddWindowNew ref="OperaInsuranceApplyAddWindow" @success="successEvent" />
        <OperaInsuranceApplyAddWindowNew ref="OperaInsuranceApplyAddWindow" @success="result" />
        <!--    åŠ å‡ä¿ç”³è¯·    -->
        <additionSubtractionApplication ref="additionSubtractionApplication" @success="successEvent" />
        <!--    æ›´æ¢æ´¾é£å•位申请    -->
@@ -505,10 +505,9 @@
      </el-dialog>
    </GlobalWindow>
</template>
<script>
import BaseOpera from '@/components/base/BaseOpera'
import OperaInsuranceApplyAddWindowNew from '@/components/enterprise/OperaInsuranceApplyAddWindowNew'
import OperaInsuranceApplyAddWindowNew from '@/components/enterprise/OperaInsuranceApplyAddWindow'
import GlobalWindow from '@/components/common/GlobalWindow'
import InsuranceDetails from '@/components/business/InsuranceDetails'
import OperaWtbApplyCheckWindow from '@/components/business/OperaWtbApplyCheckWindow'
@@ -532,7 +531,7 @@
import { fetchList } from '@/api/business/applyChange'
import { findListByDTO as worktypeFindListByDTO } from '@/api/business/worktype'
import { mapState } from 'vuex'
import {sendSms} from "@/api/business/smsEmail";
import {sendSms} from '@/api/business/smsEmail';
export default {
  name: 'OperaWtbApplyShopWindow',
@@ -906,6 +905,9 @@
        this.$tip.apiFailed(err)
      })
    },
    goYjxb(){
      this.$refs.OperaInsuranceApplyAddWindow.open('续保', {id: this.dataId,type: 1 })
    },
    viewToubaodan () {
      if (this.model.toubaodanSignedFile && this.model.toubaodanSignedFile.fileurlFull) {
        setTimeout(() => {
@@ -960,6 +962,14 @@
      }).catch(err => {
      })
    },
    result(flag,param){
      console.log(flag,param)
      if(param && param.godetail && param.id){
       this.open('委托保详情',{id:param.id})
      }else{
        this.successEvent()
      }
    },
    successEvent () {
      // this.visible=false
      this.getDetail()
company/src/components/enterprise/OperaInsuranceApplyAddWindow.vue
@@ -168,10 +168,10 @@
    <confirmJobType ref="confirmJobType" @result="getUser" />
    <!--    æŸ¥çœ‹è¯¦å•    -->
    <detailsPolicyholder ref="detailsPolicyholder" @success="successEvent" />
    <!--    ç›´ä¿æŠ•保详情    -->
<!--    &lt;!&ndash;    ç›´ä¿æŠ•保详情    &ndash;&gt;
    <OperaInsuranceApplyDetails ref="OperaInsuranceApplyDetails" />
    <!--    å§”托投保详情    -->
    <OperaWtbApplyShopWindow ref="OperaWtbApplyShopWindow" />
    &lt;!&ndash;    å§”托投保详情    &ndash;&gt;
    <OperaWtbApplyShopWindow ref="OperaWtbApplyShopWindow" />-->
  </GlobalWindow>
</template>
@@ -179,28 +179,30 @@
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'
import selectEmployees from '@/components/enterprise/selectEmployees'
import addEmployee from '@/components/enterprise/addEmployee'
import addEmployee from '@/components/enterprise/addEmployeeWithDu'
import importEmployees from '@/components/enterprise/importEmployees'
import confirmJobType from '@/components/enterprise/confirmJobType'
import detailsPolicyholder from '@/components/business/detailsPolicyholder'
import OperaInsuranceApplyDetails from '@/components/business/OperaInsuranceApplyWindow'
import OperaWtbApplyShopWindow from '@/components/business/OperaWtbApplyShopWindow'
import { all, getNewVersion } from '@/api/business/solutions'
import { mapState } from 'vuex'
import { create, getCountCyclePriceVO, getDetail, findList, updateData } from '@/api/business/insuranceApply'
import { create, getCountCyclePriceVO, getDetail, findList } from '@/api/business/insuranceApply'
import { UTable, UTableColumn } from 'umy-ui'
// Vue.component(UTable.name, UTable);
// Vue.component(UTableColumn.name, UTableColumn);
export default {
  name: 'OperaInsuranceApplyAddWindowNew',
  extends: BaseOpera,
  components: {
    GlobalWindow, selectEmployees, addEmployee, importEmployees, confirmJobType, detailsPolicyholder, UTable, UTableColumn
    ,  OperaWtbApplyShopWindow, OperaInsuranceApplyDetails
    GlobalWindow,
    selectEmployees,
    addEmployee,
    importEmployees,
    confirmJobType,
    detailsPolicyholder,
    UTable,
    UTableColumn
  },
  data () {
    return {
      sumFee:0,
      sumFee: 0,
      form: {
        id: null,
        ID: null,
@@ -240,7 +242,7 @@
    // ç›‘听tableData的变化
    tableData: {
      deep: true,
      handler(newVal, oldVal) {
      handler (newVal, oldVal) {
        // æ•°æ®å˜åŒ–时的处理逻辑
        this.getSummaries2()
        console.log(this.tableData.length)
@@ -262,15 +264,9 @@
        solutionId: this.form.solutionId
      }).then(res => {
        console.log(res)
        this.visible = false
        if (this.item.type == 1) {
          this.$emit('success', 1, { id: res })
          this.$refs.OperaWtbApplyShopWindow.open('委托投保详情', { id: res })
        } else {
          this.$emit('success', 1, { id: res })
          this.$refs.OperaInsuranceApplyDetails.open('投保详情', { id: res })
        }
        this.$emit('success', 1, { id: res,godetail:true,type:this.item.type})
        this.$tip.apiSuccess('操作成功')
        this.visible = false
        // this.$emit('success','委托投保详情', { id: res })
      })
        .catch(e => {
@@ -364,7 +360,7 @@
          })
          sums[index] = total.toFixed(2)
          // }
        }else {
        } else {
          sums[index] = ''
        }
      })
@@ -372,8 +368,8 @@
      return sums
    },
    getSummaries2 () {
      this.sumFee = 0;
      if(this.tableData&&this.tableData.length){
      this.sumFee = 0
      if (this.tableData && this.tableData.length) {
        this.tableData.forEach((column, index) => {
          this.sumFee = parseFloat(this.sumFee) + parseFloat(column.fee)
        })
@@ -412,9 +408,9 @@
          let price = 0
          // if (this.item && this.item.type != 1) {
            this.tableData.forEach(item => {
              price = price + item.fee
            })
          this.tableData.forEach(item => {
            price = price + item.fee
          })
          // }
          this.$refs.detailsPolicyholder.open('投保详情单', {
            companyName: this.userInfo.company.name,
@@ -481,7 +477,7 @@
        this.$message.warning('请先选择保险方案')
        return
      }
      this.$refs.addEmployee.open('添加员工', { arr: this.tableData, price: this.price })
      this.$refs.addEmployee.open('添加员工', { arr: this.tableData, price: this.price, solutionId: this.form.solutionId })
    },
    uploadUser () {
      if (!this.form.solutionId) {
@@ -492,7 +488,7 @@
    },
    // åˆ‡æ¢æ–¹æ¡ˆ
    changeSolution (e) {
      this.sumFee =0;
      this.sumFee = 0
      this.form.applyEndTime = ''
      this.form.applyStartTime = ''
      if (!this.form.id) {
@@ -536,7 +532,7 @@
        })
      this.tableData.forEach(item => {
        // if (this.item.type != 0) {
          item.fee = this.price
        item.fee = this.price
        // }
      })
    },
company/src/components/enterprise/addEmployeeWithDu.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,195 @@
<template>
    <GlobalWindow
        :title="title"
        width="100%"
        :visible.sync="visible"
        :confirm-working="isWorking"
        @confirm="confirm"
    >
        <el-form :inline="true" class="demo-form-inline">
            <div v-for="(item, index) in list" :key="index">
                <el-form-item label="姓名" required>
                    <el-input v-model="item.memberName" placeholder="请输入"></el-input>
                </el-form-item>
                <el-form-item label="身份证号" required>
                    <el-input v-model="item.idCard" maxlength="18" placeholder="请输入"></el-input>
                </el-form-item>
              <el-form-item label="派遣单位" >
                <el-select v-model="item.duId" @change="selectChange(index)" placeholder="请选择" clearable>
                  <el-option
                      v-for="item in dispatching"
                      :key="item.id"
                      :label="item.name"
                      :value="item.id">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="所属工种" >
                <el-select v-model="item.worktypeId" @change="selectChangeWT(index)"  placeholder="请选择" clearable>
                  <el-option
                      v-for="item1 in item.options"
                      :key="item1.id"
                      :label="item1.name"
                      :value="item1.id">
                  </el-option>
                </el-select>
              </el-form-item>
                <el-form-item>
                    <el-button type="primary" v-if="index === 0" @click="add">添加</el-button>
                    <el-button type="danger" v-else @click="dele(index)">删除</el-button>
                </el-form-item>
            </div>
        </el-form>
    </GlobalWindow>
</template>
<script>
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'
import { findListByDTO } from '@/api/business/dispatchUnit'
import { findListByDTO as worktype } from '@/api/business/worktype'
export default {
  name: 'addEmployee',
  extends: BaseOpera,
  components: { GlobalWindow },
  data () {
    return {
      tempIndex: -1,
      dispatching: [],
      solutionId: null,
      list: [
        {
          memberName: '',
          idCard: '',
          workTypeName: '',
          worktypeId: '',
          duName: '',
          options: [],
          duId: '',
          fee: ''
        }
      ],
      price: 0,
      arr: []
    }
  },
  methods: {
    open (title, obj, tempIndex) {
      this.title = title
      this.visible = true
      this.tempIndex = tempIndex
      this.solutionId = obj.solutionId
      this.list = [
        {
          memberName: '',
          idCard: '',
          workTypeName: '',
          worktypeId: '',
          duName: '',
          options: [],
          duId: '',
          fee: ''
        }
      ]
      this.arr = obj.arr
      this.price = obj.price
      this.getFindListByDTO()
    },
    getFindListByDTO () {
      findListByDTO({
        solutionId: this.solutionId
        // dataType: 0
      }).then(res => {
        this.dispatching = res
      })
    },
    selectChange (index) {
      this.list[index].options = []
      let duSolutionId = ''
      this.list[index].duName = null
      this.dispatching.forEach(item => {
        if (item.id === this.list[index].duId) {
          duSolutionId = item.duSolutionId
          this.list[index].duName = item.name
        }
      })
      worktype({ id: duSolutionId, queryType: 1 })
        .then(res => {
          this.list[index].options = res
        })
    },
    selectChangeWT (index) {
      this.list[index].workTypeName =null
      this.list[index].options.forEach(item => {
        if (item.id === this.list[index].worktypeId) {
          this.list[index].workTypeName = item.name
        }
      })
    },
    add () {
      this.list.push({
        memberName: '',
        idCard: '',
        workTypeName: '',
        worktypeId: '',
        duName: '',
        duId: '',
        options: [],
        fee: '',
        id: this.tempIndex - 1
      })
    },
    dele (index) {
      this.list.splice(index, 1)
    },
    hasDuplicates (arr) {
      return arr.some((value, index) => arr.indexOf(value) !== index)
    },
    confirm () {
      // åˆ¤æ–­åˆ—表否是有空值
      // for (let i = 0; this.list.length; i++) {
      //     if (!this.list[i].memberName || !this.list[i].idCard) {
      //         this.$message.warning('请先完善信息后再提交')
      //         return
      //     }
      // }
      // åˆ¤æ–­æ–°å½•入数据身份证是否有重复
      const idcardList = this.list.map(item => item.idCard)
      if (this.hasDuplicates(idcardList)) {
        this.$message.warning('身份证有重复')
        return
      }
      // åˆ¤æ–­èº«ä»½è¯æ˜¯å¦æœ‰æ•ˆ
      for (let i = 0; i < this.list.length; i++) {
        const regExp = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
        if (!regExp.test(this.list[i].idCard)) {
          this.$message.warning(`第${i + 1}项员工身份证不合法`)
          return
        }
      }
      // åˆ¤æ–­è¯¦æƒ…列表数据身份证是否有重复
      let next = true
      this.list.forEach(item => {
        this.arr.forEach(child => {
          if (item.idCard === child.idCard) {
            next = false
          }
        })
      })
      if (next) {
        this.list.forEach(item => {
          item.fee = this.price
        })
        this.$emit('result', this.list)
        this.visible = false
      } else {
        this.$message.warning('身份证号不能重复!')
      }
    }
  }
}
</script>
<style lang="scss" scoped>
</style>
company/src/components/enterprise/additionSubtractionApplication.vue
@@ -101,7 +101,7 @@
        <div class="btns">
            <div class="btns_item">
                <el-button type="primary" @click="seleUser">选取员工</el-button>
                <el-button type="primary" @click="uploadUser" v-if="activeName !== '1'">导入员工</el-button>
                <el-button type="primary" @click="uploadUser">导入员工</el-button>
                <el-button type="primary" @click="addUser" v-if="activeName !== '1'">添加员工</el-button>
                <el-button type="danger" @click="deleItem">删除</el-button>
            </div>
@@ -350,14 +350,14 @@
          let total = 0
          if (this.activeName === '0') {
            this.form.addDetailList.forEach(item => {
              total += item.fee
              total += item.fee || 0
            })
            sums[index] = total.toFixed(2)
            sums[index] =  (total || 0).toFixed(2)
          } else {
            this.form.delDetailList.forEach(item => {
              total += item.reducePrice
            })
            sums[index] =  total.toFixed(2)
            sums[index] =  (total || 0).toFixed(2)
          }
        }
      })
@@ -485,9 +485,9 @@
        return
      }*/
      if (this.activeName === '0') {
        this.$refs.selectEmployees.open('选取员工', { arr: this.form.addDetailList, price: this.price, notInInsuranceApplyId: this.form.id, validTime: this.form.applyStartTime })
        this.$refs.selectEmployees.open('选取加保员工', { arr: this.form.addDetailList, price: this.price, notInInsuranceApplyId: this.form.id, validTime: this.form.applyStartTime })
      } else {
        this.$refs.selectEmployees.open('选取员工', { arr: this.form.delDetailList, price: this.reducePrice, insuranceApplyId: this.form.id, validTime: this.form.applyStartTime })
        this.$refs.selectEmployees.open('选取减保员工', { arr: this.form.delDetailList, price: this.reducePrice, insuranceApplyId: this.form.id, validTime: this.form.applyStartTime })
      }
    },
    addUser () {
@@ -496,9 +496,9 @@
        return
      }
      if (this.activeName === '0') {
        this.$refs.addEmployee.open('添加员工', { arr: this.form.addDetailList, price: this.price })
        this.$refs.addEmployee.open('添加加保员工', { arr: this.form.addDetailList, price: this.price })
      } else {
        this.$refs.addEmployee.open('添加员工', { arr: this.form.delDetailList, price: this.reducePrice })
        this.$refs.addEmployee.open('添加减保员工', { arr: this.form.delDetailList, price: this.reducePrice })
      }
    },
    uploadUser () {
@@ -507,9 +507,9 @@
        return
      }
      if (this.activeName === '0') {
        this.$refs.importEmployees.open('上传名单', { arr: this.form.addDetailList, price: this.price, solutionId: this.form.solutionId })
        this.$refs.importEmployees.open('加保员工名单', { arr: this.form.addDetailList,type:1, price: this.price, solutionId: this.form.solutionId })
      } else {
        this.$refs.importEmployees.open('上传名单', { arr: this.form.delDetailList, price: this.reducePrice, solutionId: this.form.solutionId })
        this.$refs.importEmployees.open('减保员工名单', { arr: this.form.delDetailList,type:0, price: this.reducePrice, solutionId: this.form.solutionId,insuranceApplyId: this.form.id  })
      }
    },
    // åˆ‡æ¢æ–¹æ¡ˆ
company/src/components/enterprise/importEmployees.vue
@@ -6,6 +6,12 @@
        :confirm-working="isWorking"
        @confirm="confirm"
    >
      <p class="tip-warn" v-if="type ==1"><i class="el-icon-warning"></i>提醒:<br>
         <span style="">加保人员名单中,人员姓名、身份证号、派遣单位和工种信息均为必填项,备注信息可为空,请录入合法数据。</span>
      </p>
      <p class="tip-warn"  v-if="type !=1"><i class="el-icon-warning"></i>提醒:<br>
        <span style="">减保人员名单中,人员姓名、身份证号均为必填项,备注信息可为空,请录入合法数据。</span>
      </p>
        <el-form class="demo-form-inline">
            <el-form-item label="上传名单" required>
                <div style="width: 100%;display: flex;align-items: center;">
@@ -26,7 +32,7 @@
<script>
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'
import { importExcel } from '@/api/business/member'
import { importExcel,importReuduceExcel } from '@/api/business/member'
export default {
  name: 'importEmployees',
  extends: BaseOpera,
@@ -39,7 +45,9 @@
      price: 0,
      type: null,
      solutionId: null,
      applyId: null,
      addList: [],
      delList: [],
      fileName: ''
    }
  },
@@ -47,24 +55,24 @@
    open (title, obj) {
      this.title = title
      this.addList = []
      this.delList = []
      this.fileName = ''
      this.type = obj.type
      this.visible = true
      this.solutionId = obj.solutionId
      this.applyId = obj.insuranceApplyId
      this.list = obj.arr
      this.price = obj.price
      this.importing=false
      this.confirming=false
      this.importing= false
      this.confirming= false
    },
    // å¯¼å‡ºæ¨¡æ¿
    exportTemplate () {
      // æŠ•保申请
      if (this.type === 1) {
        window.open('/template/personnel_add.xlsx')
        // window.open(process.env.VUE_APP_MEMBER1_URL)
      } else {
        window.open('/template/personnel_add.xlsx')
        // window.open(process.env.VUE_APP_MEMBER_URL)
        window.open('/template/personnel_reduce.xlsx')
      }
    },
    clickRef () {
@@ -74,7 +82,15 @@
      this.importing=true
      this.$refs.fileExcel.click()
    },
    result (e) {
    result(e){
      if (this.type === 1) {
        this.result1(e)
      } else {
        this.result2(e)
      }
    },
    result1 (e) {
      this.addList = []
      const data = new FormData()
      data.append('file', e.target.files[0])
      data.append('solutionId', this.solutionId)
@@ -98,10 +114,41 @@
          this.$refs.fileExcel.value = null
        })
    },
    result2 (e) {
      this.delList = []
      const data = new FormData()
      data.append('file', e.target.files[0])
      data.append('applyId', this.applyId)
      importReuduceExcel(data)
        .then(res => {
          res.forEach(item => {
            item.memberName = item.name
          })
          this.delList = res
          this.fileName = e.target.files[0].name
          this.importing =false
        })
        .catch(err => {
          this.importing = false
          this.$message.error(err)
          this.fileName = ''
        })
        .finally(() => {
          this.importing =false
          this.$refs.fileExcel.value = null
        })
    },
    confirm () {
      if (this.type === 1) {
        this.confirm1()
      } else {
        this.confirm2()
      }
    },
    confirm1 () {
      if(this.addList==null || this.addList.length ==0){
        this.$message.error('导入人员名单为空,请先上传人员名单')
        return;
        return
      }
      if(this.confirming){
        return
@@ -110,7 +157,13 @@
      for (let i = 0; i < this.addList.length; i++) {
        for (let a = 0; a < this.list.length; a++) {
          if (this.addList[i].idCard === this.list[a].idcardNo) {
            this.$message.warning(`[${this.addList[i].name}]员工重复`)
            this.$message.warning(`【${this.addList[i].name}】员工身份证【${this.addList[i].idCard}】重复`)
            this.confirming = false
            return
          }
          if (this.addList[i].idCard === this.list[a].idCard) {
            this.$message.warning(`【${this.addList[i].name}】员工身份证【${this.addList[i].idCard}】重复`)
            this.confirming = false
            return
          }
        }
@@ -118,10 +171,34 @@
      this.addList.forEach(item => {
        item.fee = this.price
      })
      // this.confirming = false
      this.visible = false
      this.$emit('result', this.addList)
    },
    confirm2() {
      if(this.delList==null || this.delList.length ==0){
        this.$message.error('导入人员名单为空,请先上传人员名单')
        return
      }
      if(this.confirming){
        return
      }
      this.confirming = true
      for (let i = 0; i < this.delList.length; i++) {
        for (let a = 0; a < this.list.length; a++) {
          if (this.delList[i].idCard === this.list[a].idcardNo) {
            this.$message.warning(`【${this.delList[i].name}】员工身份证【${this.delList[i].idCard}】重复`)
            this.confirming = false
            return
          }
          if (this.delList[i].idCard === this.list[a].idCard) {
            this.$message.warning(`【${this.delList[i].name}】员工身份证【${this.delList[i].idCard}】重复`)
            this.confirming = false
            return
          }
        }
      }
      this.visible = false
      this.$emit('result', this.delList)
    }
  }
}
company/src/views/enterprise/insuranceApply.vue
@@ -107,7 +107,7 @@
            </pagination>
        </template>
        <!--    æ–°å¢žæŠ•保    -->
        <OperaInsuranceApplyAddWindow ref="OperaInsuranceApplyAddWindow" @success="handlePageChange" />
        <OperaInsuranceApplyAddWindow ref="OperaInsuranceApplyAddWindow" @success="result" />
        <OperaWtbApplyShopWindow ref="OperaWtbApplyShopWindow" @success="handlePageChange" />
        <!--    æŠ•保详情    -->
        <OperaInsuranceApplyDetails ref="OperaInsuranceApplyDetails" @success="handlePageChange" />
@@ -155,6 +155,17 @@
          this.$refs.searchForm.resetFields()
          this.search()
      },
    result(flag,param){
      console.log(flag,param)
      if(param && param.godetail && param.id){
        if (param.type == 1) {
          this.$refs.OperaWtbApplyShopWindow.open('委托投保详情', { id: param.id })
        } else {
          this.$refs.OperaInsuranceApplyDetails.open('投保详情', { id: param.id })
        }
      }
      this.handlePageChange()
    },
    godetail (row) {
      if (row.solutionType == 1) {
        this.$refs.OperaWtbApplyShopWindow.open('委托投保详情', { id: row.id })
company/src/views/enterprise/myPolicy.vue
@@ -141,7 +141,7 @@
            </pagination>
        </template>
        <!--    æ–°å¢žæŠ•保    -->
        <OperaInsuranceApplyWindow ref="OperaInsuranceApplyWindow" @success="handlePageChange" />
        <OperaInsuranceApplyWindow ref="OperaInsuranceApplyWindow" @success="result" />
        <!--    æŠ•保详情    -->
        <OperaInsuranceApplyDetails ref="OperaInsuranceApplyDetails" @success="handlePageChange" />
      <OperaWtbApplyShopWindow ref="OperaWtbApplyShopWindow" @success="handlePageChange" />
@@ -215,6 +215,17 @@
        this.$refs.OperaInsuranceApplyDetails.open('投保详情', { id: row.id })
      }
    },
    result(flag,param){
      console.log(flag,param)
      if(param && param.godetail && param.id){
        if (param.type == 1) {
          this.$refs.OperaWtbApplyShopWindow.open('委托投保详情', { id: param.id })
        } else {
          this.$refs.OperaInsuranceApplyDetails.open('投保详情', { id: param.id })
        }
      }
      this.handlePageChange()
    },
    see () {
      this.searchForm.statusCollect = '7'
      this.search()
server/company/src/main/java/com/doumee/api/business/MemberController.java
@@ -10,6 +10,7 @@
import com.doumee.core.utils.Constants;
import com.doumee.dao.business.dto.MemberImport;
import com.doumee.dao.business.dto.MemberQueryDTO;
import com.doumee.dao.business.dto.MemberReduceImport;
import com.doumee.dao.business.model.Member;
import com.doumee.dao.business.model.MemberInsurance;
import com.doumee.service.business.MemberService;
@@ -124,5 +125,14 @@
    public ApiResponse<List<MemberImport>> importExcel (@ApiParam(value = "file") MultipartFile file,Integer  solutionId) {
        return ApiResponse.success(memberService.importBatch(file,solutionId));
    }
    @ApiOperation(value = "人员减保信息导入" ,notes = "保单申请")
    @PostMapping("/importReuduceExcel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "file", value = "file", required = true, paramType = "query", dataType = "file", dataTypeClass = File.class),
    })
    @RequiresPermissions("business:member:importExcel")
    public ApiResponse<List<MemberReduceImport>> importReuduceExcel (@ApiParam(value = "file") MultipartFile file, Integer  applyId) {
        return ApiResponse.success(memberService.importReduceBatch(file,applyId));
    }
}
server/service/src/main/java/com/doumee/dao/business/dto/MemberImport.java
@@ -6,6 +6,8 @@
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
 * å‘˜å·¥ä¿¡æ¯å¯¼å…¥è¡¨
 * @author æ±Ÿè¹„蹄
@@ -15,22 +17,22 @@
@ApiModel("员工信息导入")
public class MemberImport {
    @ExcelColumn(name="序号",value = "sn" )
    @ExcelColumn(name="序号",value = "sn"  ,index = 1)
    private Integer sn;
    @ExcelColumn(name="姓名",value = "name" )
    @ExcelColumn(name="姓名",value = "name"  ,index = 2)
    private String name;
    @ExcelColumn(name="身份证号",value = "idCard" )
    @ExcelColumn(name="身份证号",value = "idCard"  ,index = 3)
    private String idCard;
    @ExcelColumn(name="派遣单位" , value = "duName")
    @ExcelColumn(name="派遣单位" , value = "duName" ,index = 4)
    private String duName;
    @ExcelColumn(name="工种" , value = "workTypeName")
    @ExcelColumn(name="工种" , value = "workTypeName" ,index = 5)
    private String workTypeName;
    @ExcelColumn(name="备注",value = "备注")
    @ExcelColumn(name="备注",value = "备注" ,index = 6)
    private String remark;
    @ApiModelProperty(name="年龄",value = "age")
@@ -45,4 +47,5 @@
    @ApiModelProperty(value = "所属工种主键")
    private Integer worktypeId;
}
server/service/src/main/java/com/doumee/dao/business/dto/MemberReduceImport.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,52 @@
package com.doumee.dao.business.dto;
import com.doumee.core.annotation.excel.ExcelColumn;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
 * å‘˜å·¥ä¿¡æ¯å¯¼å…¥è¡¨
 * @author æ±Ÿè¹„蹄
 * @date 2024/01/16 10:03
 */
@Data
@ApiModel("员工信息导入")
public class MemberReduceImport {
    @ExcelColumn(name="序号",value = "sn" ,index = 1)
    private Integer sn;
    @ExcelColumn(name="姓名",value = "name"  ,index = 2)
    private String name;
    @ExcelColumn(name="身份证号",value = "idCard"  ,index = 3)
    private String idCard;
    @ApiModelProperty(name="派遣单位" , value = "workTypeName")
    private String duName;
    @ExcelColumn(name="备注",value = "备注")
    private String remark;
    @ApiModelProperty(name="工种" , value = "workTypeName")
    private String workTypeName;
    @ApiModelProperty(name="年龄",value = "age")
    private Integer age;
    @ApiModelProperty(value = "性别")
    private Integer sex;
    @ApiModelProperty(value = "派遣单位主键")
    private Integer duId;
    @ApiModelProperty(value = "所属工种主键")
    private Integer worktypeId;
    @ApiModelProperty(value = "费用")
    private BigDecimal fee;
}
server/service/src/main/java/com/doumee/dao/business/model/ApplyDetail.java
@@ -173,4 +173,15 @@
    @TableField(exist = false)
    private String companyName;
    @ApiModelProperty(value = "保单明细行服务费")
    @TableField(exist = false)
    private BigDecimal detailServerCost;
    @ApiModelProperty(value = "行保险生效止期")
    @TableField(exist = false)
    private Date parentEndTime;
    @ApiModelProperty(value = "行保险生效起期")
    @TableField(exist = false)
    private Date parentStartTime;
}
server/service/src/main/java/com/doumee/service/business/MemberService.java
@@ -4,6 +4,7 @@
import com.doumee.core.model.PageWrap;
import com.doumee.dao.business.dto.MemberImport;
import com.doumee.dao.business.dto.MemberQueryDTO;
import com.doumee.dao.business.dto.MemberReduceImport;
import com.doumee.dao.business.model.Member;
import org.springframework.web.multipart.MultipartFile;
@@ -107,5 +108,6 @@
    List<Member> findListByDTO(MemberQueryDTO memberQueryDTO);
    List<MemberImport> importBatch(MultipartFile file,Integer  solutionId);
    List<MemberReduceImport> importReduceBatch(MultipartFile file, Integer  applyId);
}
server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
@@ -1895,7 +1895,7 @@
                .apply(" t1.BASE_ID in ( select du.id from dispatch_unit du where du.STATUS = 0 and du.ISDELETED = 0 ) ")
        );
        if(!CollectionUtils.isNotEmpty(duSolutionList)){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"数据异常:保险方案下未查询到派遣单位");
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,保险方案下未查询到派遣单位信息,请确保派遣单位和工作配置并审核通过!");
        }
        //查询所有派遣单位下的工种
        List<Integer> duSolutionIdList = duSolutionList.stream().map(i->i.getId()).collect(Collectors.toList());
@@ -1907,7 +1907,7 @@
                .eq(checkNewData,Worktype::getDataType,Constants.TWO)
                .in(DuWorktype::getDuSolutionId,duSolutionIdList));
        if(!CollectionUtils.isNotEmpty(duWorktypeList)){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"数据异常:保险方案下未查询到工种信息");
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,保险方案下未查询到工种信息,请确保派遣单位和工作配置并审核通过!");
        }
        if(CollectionUtils.isNotEmpty(applyDetailList)){
@@ -1934,7 +1934,7 @@
                    member.setCompanyId(insuranceApply.getCompanyId());
                    member.setSex(Constants.getSexByIdCard(applyDetail.getIdcardNo()));
                    if(!IdcardUtil.isValidCard(applyDetail.getIdcardNo())){
                        throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"投保员工信息身份证信息错误["+member.getName()+"]");
                        throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,投保员工【"+member.getName()+"】身份证信息【"+applyDetail.getIdcardNo()+"】错误");
                    }
                    member.setIdcardNo(applyDetail.getIdcardNo());
                    member.setApplyId(insuranceApply.getId());
@@ -1957,7 +1957,7 @@
                        ||Objects.isNull(applyDetail.getDuId())
                        ||Objects.isNull(applyDetail.getWorktypeId())
                ){
                    throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"投保员工信息数据缺失");
                    throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,投保员工信息数据缺失,请按照要求填写员工的有效信息!");
                }
                applyDetail.setCreateDate(new Date());
                applyDetail.setCreator(loginUserInfo.getId());
@@ -2011,18 +2011,18 @@
                //获取计算总天数
                Integer maxDays = DateUtil.calculateBetween(applyDetail.getStartTime(),applyDetail.getEndTime(),0);
                if(Constants.equalsInteger(maxDays,0)||Objects.isNull(applyDetail.getFee())){
                    throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"投保信息异常:总天数与总金额错误");
                    throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"投保信息异常:投保总天数与总金额错误");
                }
                applyDetail.setPrice(
                        applyDetail.getFee().divide(new BigDecimal(maxDays),7,RoundingMode.HALF_UP)
                );
                //验证派遣单位信息是否存在
                if(duSolutionList.stream().filter(d->d.getDispatchUnitId().equals(applyDetail.getDuId())).collect(Collectors.toList()).size()<=Constants.ZERO){
                    throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"【"+applyDetail.getMemberName()+"】员工派遣单位未查询到!");
                    throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"【"+applyDetail.getMemberName()+applyDetail.getIdcardNo()+"】员工派遣单位未查询到!");
                }
                if(duWorktypeList.stream().filter(d->d.getWorkTypeId().equals(applyDetail.getWorktypeId()))
                        .collect(Collectors.toList()).size()<=Constants.ZERO){
                    throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"【"+applyDetail.getMemberName()+"】员工工种信息未查询到!");
                    throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"【"+applyDetail.getMemberName()+applyDetail.getIdcardNo()+"】员工工种信息未查询到!");
                }
            }
            applyDetailJoinMapper.insertBatchSomeColumn(applyDetailList);
server/service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java
@@ -10,12 +10,15 @@
import com.doumee.core.utils.Constants;
import com.doumee.core.utils.DateUtil;
import com.doumee.core.utils.Utils;
import com.doumee.dao.business.InsuranceApplyMapper;
import com.doumee.dao.business.MemberMapper;
import com.doumee.dao.business.SolutionsMapper;
import com.doumee.dao.business.WorktypeMapper;
import com.doumee.dao.business.dto.MemberImport;
import com.doumee.dao.business.dto.MemberQueryDTO;
import com.doumee.dao.business.dto.MemberReduceImport;
import com.doumee.dao.business.dto.WorktypeImport;
import com.doumee.dao.business.join.ApplyDetailJoinMapper;
import com.doumee.dao.business.join.DispatchUnitJoinMapper;
import com.doumee.dao.business.join.MemberJoinMapper;
import com.doumee.dao.business.model.*;
@@ -53,12 +56,16 @@
    @Autowired
    private DispatchUnitJoinMapper dispatchUnitJoinMapper;
    @Autowired
    private ApplyDetailJoinMapper applyDetailJoinMapper;
    @Autowired
    private WorktypeMapper worktypeMapper;
    @Autowired
    private SolutionsMapper solutionsMapper;
    @Autowired
    private InsuranceApplyMapper insuranceApplyMapper;
    @Override
    public Integer create(Member member) {
@@ -359,21 +366,114 @@
    }
    @Override
    public List<MemberImport> importBatch(MultipartFile file,Integer  solutionId){
    public List<MemberReduceImport> importReduceBatch(MultipartFile file, Integer  applyId){
        if(applyId == null  ){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,请选择有效的方案再进行操作!");
        }
        LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        if(!loginUserInfo.getType().equals(Constants.ONE)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非企业人员无法进行该操作");
        }
        List<Member> list =  memberJoinMapper.selectJoinList(Member.class,new MPJLambdaWrapper<Member>()
                .selectAll(Member.class)
                .selectAs(DispatchUnit::getName,Member::getDuName)
                .selectAs(Worktype::getName,Member::getWorkTypeName)
                .leftJoin(DispatchUnit.class,DispatchUnit::getId,Member::getDuId)
                .leftJoin(Worktype.class,Worktype::getId,Member::getWorktypeId)
                .isNotNull(Member::getIdcardNo)
                .eq(Member::getCompanyId,loginUserInfo.getCompanyId())
                .eq(Member::getIsdeleted,Constants.ZERO)
        );
        ExcelImporter ie = null;
        List<MemberReduceImport> dataList =null;
        try {
            ie = new ExcelImporter(file,1,0);
            dataList = ie.getDataList(MemberReduceImport.class,null);
        }  catch (Exception e) {
            e.printStackTrace();
        }
        if(dataList == null || dataList.size() ==0){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,录入数据为空!");
        }
        InsuranceApply insuranceApply = insuranceApplyMapper.selectById(applyId);
        if (Objects.isNull(insuranceApply) || !Constants.equalsInteger(insuranceApply.getCompanyId(),loginUserInfo.getCompanyId())) {
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,保单信息不存在,请刷新页面重试!");
        }
        if (!(Constants.equalsInteger(insuranceApply.getStatus(), Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey())
                ||Constants.equalsInteger(insuranceApply.getStatus(), Constants.InsuranceApplyStatus.WTB_DONE.getKey())
        )) {
            throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(), "对不起,保单当前状态不支持该操作!");
        }
        if (DateUtil.compareDate(insuranceApply.getEndTime(),new Date()) >= Constants.ZERO ) {
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "保单已过保,不支持该操作");
        }
        if (DateUtil.compareDate(insuranceApply.getEndTime(),new Date()) >= Constants.ZERO ) {
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "保单已过保,不支持该操作");
        }
        Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId());
        if(Objects.isNull(solutions)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到保险方案");
        }
        int index = Constants.TWO;
        Map<String,String> idCardMap = new HashMap<>();
        for(MemberReduceImport model : dataList){
            //校验参数是否合法
            validReduceImportParam(model,idCardMap,dataList,index);
            index += 1;
        }
        index = Constants.TWO;
        for(MemberReduceImport model : dataList){
            ApplyDetail detail =applyDetailJoinMapper.selectJoinOne(ApplyDetail.class,new MPJLambdaWrapper<ApplyDetail>()
                            .selectAll(ApplyDetail.class)
                            .selectAs(Worktype::getName,ApplyDetail::getWorkTypeName)
                            .selectAs(DispatchUnit::getName,ApplyDetail::getDuName)
                            .selectAs(InsuranceApply::getStartTime,ApplyDetail::getStartTime)
                            .selectAs(InsuranceApply::getFinalEndTime,ApplyDetail::getEndTime)
                            .selectAs(InsuranceApply::getServerCost,ApplyDetail::getDetailServerCost)
                            .leftJoin(Worktype.class,Worktype::getId,ApplyDetail::getWorktypeId)
                            .leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyDetail::getDuId)
                            .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyDetail::getApplyId)
                            .eq(ApplyDetail::getApplyId,insuranceApply.getId())
                            .eq(ApplyDetail::getApplyId,insuranceApply.getId())
                            .eq(ApplyDetail::getIdcardNo,model.getIdCard())
                            .le(ApplyDetail::getStartTime,DateUtil.getMontageDate(new Date(),1))
                            .ge(ApplyDetail::getEndTime,DateUtil.getMontageDate(new Date(),3)));
            if(detail == null){
                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "当前保单下,员工【" + model.getName()+model.getIdCard() + "】非在保人员,如法进行该操作");
            }
            model.setDuId(detail.getDuId());
            model.setDuName(detail.getDuName());
            model.setWorktypeId(detail.getWorktypeId());
            model.setWorkTypeName(detail.getWorkTypeName());
            model.setFee(
                    Constants.reduceFee(solutions,
                            Objects.isNull(detail.getDetailServerCost())?
                                    solutions.getPrice():solutions.getPrice().add(detail.getDetailServerCost()),detail.getParentStartTime(),detail.getParentEndTime(),detail.getStartTime(),
                            detail.getEndTime()).subtract(detail.getFee()));
            index += 1;
        }
        return dataList;
    }
    private void validReduceImportParam(MemberReduceImport model, Map<String, String> idCardMap, List<MemberReduceImport> dataList, int index) {
        if(StringUtils.isBlank(model.getName())){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据姓名不能为空!");
        }
        if(StringUtils.isBlank(model.getIdCard())){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据身份证号不能为空!");
        }
        if(StringUtils.isBlank(model.getIdCard())||model.getIdCard().length()!=18){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据身份证【"+model.getIdCard()+"】格式不正确!");
        }
        if(!IdcardUtil.isValidCard(model.getIdCard())){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据身份证【"+model.getIdCard()+"】信息不正确!");
        }
        if(Objects.nonNull(idCardMap.get(model.getIdCard()))){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,文档中第"+index+"行数据身份证号【"+model.getIdCard()+"】存在相同数据!");
        }
        idCardMap.put(model.getIdCard(), model.getIdCard());
    }
    @Override
    public List<MemberImport> importBatch(MultipartFile file,Integer  solutionId){
        if(solutionId == null  ){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,请选择有效的方案再进行操作!");
        }
        LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        if(!loginUserInfo.getType().equals(Constants.ONE)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非企业人员无法进行该操作");
        }
        ExcelImporter ie = null;
        List<MemberImport> dataList =null;
        try {
@@ -385,14 +485,14 @@
        if(dataList == null || dataList.size() ==0){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,录入数据为空!");
        }
//        List<String> idCardList = dataList.stream().map(m->m.getIdCard()).collect(Collectors.toList());
//        Set<String> set = new HashSet<>(idCardList);
//        if(idCardList.size() != set.size()){
//            throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"对不起,录入数据存在身份证号相同数据!");
//        }
        List<DispatchUnit> dispatchUnitList = new ArrayList<>();
        if(!Objects.isNull(solutionId)){
            dispatchUnitList  = dispatchUnitJoinMapper.selectJoinList(DispatchUnit.class,
        int index = Constants.TWO;
        Map<String,String> idCardMap = new HashMap<>();
        for(MemberImport model : dataList){
            //校验参数是否合法
            validImportParam(model,idCardMap,dataList,index,solutionId);
            index += 1;
        }
        List<DispatchUnit> dispatchUnitList    = dispatchUnitJoinMapper.selectJoinList(DispatchUnit.class,
                    new MPJLambdaWrapper<DispatchUnit>()
                            .selectAll(DispatchUnit.class)
                            .select("(select b.id from du_solution b where b.isdeleted=0 and b.dispatch_unit_id=t.id and b.solution_id="+solutionId+" limit 1) as du_solution_id" )
@@ -402,70 +502,85 @@
                            .eq(loginUserInfo.getType().equals(Constants.ONE),DispatchUnit::getCompanyId,loginUserInfo.getCompanyId())
                            .exists("select b.id from du_solution b where b.isdeleted=0 and b.dispatch_unit_id=t.id and b.status = 1 and  b.solution_id="+solutionId )
            );
            if(CollectionUtils.isNotEmpty(dispatchUnitList)){
                for (DispatchUnit dispatchUnit:dispatchUnitList) {
                    List<Worktype> worktypeList = worktypeMapper.selectList(new QueryWrapper<Worktype>().lambda()
                            .eq(Worktype::getIsdeleted,Constants.ZERO)
                            .eq(Worktype::getDataType,Constants.TWO)
                            .eq(Worktype::getStatus,Constants.ZERO)
                            .apply("id in ( select  dw.work_type_id from du_worktype dw where dw.status = 1" +
                                    " and  dw.du_solution_id = "+dispatchUnit.getDuSolutionId()+" )")
                    );
                    dispatchUnit.setWorktypeList(worktypeList);
                }
        if(CollectionUtils.isNotEmpty(dispatchUnitList)){
            for (DispatchUnit dispatchUnit:dispatchUnitList) {
                List<Worktype> worktypeList = worktypeMapper.selectList(new QueryWrapper<Worktype>().lambda()
                        .eq(Worktype::getIsdeleted,Constants.ZERO)
                        .eq(Worktype::getDataType,Constants.TWO)
                        .eq(Worktype::getStatus,Constants.ZERO)
                        .apply("id in ( select  dw.work_type_id from du_worktype dw where dw.status = 1" +
                                " and  dw.du_solution_id = "+dispatchUnit.getDuSolutionId()+" )")
                );
                dispatchUnit.setWorktypeList(worktypeList);
            }
        }
        long index = Constants.TWO;
        Map<String,String> idCardMap = new HashMap<>();
        index = Constants.TWO;
        for(MemberImport model : dataList){
            if(StringUtils.isBlank(model.getIdCard())||model.getIdCard().length()!=18){
                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据身份证信息异常!");
            }
            if(!IdcardUtil.isValidCard(model.getIdCard())){
                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据身份证信息异常!");
            }
            if(StringUtils.isBlank(model.getName())){
                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据姓名信息异常!");
            }
            if(Objects.nonNull(idCardMap.get(model.getIdCard()))){
                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据身份证号【"+model.getIdCard()+"】存在相同数据!");
            }
            idCardMap.put(model.getIdCard(), model.getIdCard());
            index = index + Constants.ONE;
            if(CollectionUtils.isNotEmpty(list)){
                Optional<Member>  memberOptional= list.stream().filter(m->m.getIdcardNo().equals(model.getIdCard())).findFirst();
                if(memberOptional.isPresent()){
                    Member member =  memberOptional.get();
                    model.setIdCard(member.getIdcardNo());
                    model.setSex(member.getSex());
                }else{
                    model.setSex(Constants.getSexByIdCard(model.getIdCard()));
                }
            }else{
                model.setSex(Constants.getSexByIdCard(model.getIdCard()));
            }
            if(StringUtils.isNotBlank(model.getDuName())&&CollectionUtils.isNotEmpty(dispatchUnitList)){
                Optional<DispatchUnit>  dispatchUnitOptional= dispatchUnitList.stream().filter(m->m.getName().equals(model.getDuName())).findFirst();
                if(dispatchUnitOptional.isPresent()){
                    DispatchUnit dispatchUnit =  dispatchUnitOptional.get();
                    model.setDuId(dispatchUnit.getId());
                    if(StringUtils.isNotBlank(model.getWorkTypeName())&&CollectionUtils.isNotEmpty(dispatchUnit.getWorktypeList())){
                        Optional<Worktype>  worktypeOptional= dispatchUnit.getWorktypeList().stream().filter(m->m.getName().equals(model.getWorkTypeName())).findFirst();
                        if(worktypeOptional.isPresent()){
                            Worktype worktype = worktypeOptional.get();
                            model.setWorktypeId(worktype.getId());
                        }
            //校验人员是否已经在参保中
            isMemberValidForSolution(model,index,solutionId);
            //检查派遣单位和工种有效性
            dealDuAndWorktype(model,index,dispatchUnitList);
            index += 1;
        }
        return dataList;
    }
    private void isMemberValidForSolution(MemberImport model, int index, Integer solutionId) {
       /* ApplyDetail detail = applyDetailJoinMapper.selectJoinOne(ApplyDetail.class,new MPJLambdaWrapper<ApplyDetail>()
                .last("limit 1"));
        if(detail!=null){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行身份证为【"+model.getIdCard()+"】人员已经在该方案下存在投保记录!");
        }*/
    }
    private void dealDuAndWorktype(MemberImport model, int index, List<DispatchUnit> dispatchUnitList  ) {
        if(CollectionUtils.isNotEmpty(dispatchUnitList)){
            Optional<DispatchUnit>  dispatchUnitOptional= dispatchUnitList.stream().filter(m->m.getName().equals(model.getDuName())).findFirst();
            if(dispatchUnitOptional.isPresent()){
                DispatchUnit dispatchUnit =  dispatchUnitOptional.get();
                model.setDuId(dispatchUnit.getId());
                if(StringUtils.isNotBlank(model.getWorkTypeName())&&CollectionUtils.isNotEmpty(dispatchUnit.getWorktypeList())){
                    Optional<Worktype>  worktypeOptional= dispatchUnit.getWorktypeList().stream().filter(m->m.getName().equals(model.getWorkTypeName())).findFirst();
                    if(worktypeOptional.isPresent()){
                        Worktype worktype = worktypeOptional.get();
                        model.setWorktypeId(worktype.getId());
                    }
                }
            }
            if(Objects.isNull(model.getDuId())){
                model.setWorkTypeName(null);
                model.setDuName(null);
            }else if(Objects.isNull(model.getWorktypeId())){
                model.setWorkTypeName(null);
            }
        }
        return dataList;
        if(Objects.isNull(model.getDuId())){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据派遣单位【"+model.getDuName()+"】不正确!");
        }
        if(Objects.isNull(model.getWorktypeId())){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据工种【"+model.getWorkTypeName()+"】不正确!");
        }
    }
    private void validImportParam(MemberImport model, Map<String, String> idCardMap, List<MemberImport> dataList,int index,Integer solutionId) {
        if(StringUtils.isBlank(model.getName())){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据姓名不能为空!");
        }
        if(StringUtils.isBlank(model.getIdCard())){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据身份证号不能为空!");
        }
        if(StringUtils.isBlank(model.getDuName())){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据派遣单位不能为空!");
        }
        if(StringUtils.isBlank(model.getWorkTypeName())){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据工种不能为空!");
        }
        if(StringUtils.isBlank(model.getIdCard())||model.getIdCard().length()!=18){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据身份证【"+model.getIdCard()+"】格式不正确!");
        }
        if(!IdcardUtil.isValidCard(model.getIdCard())){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据身份证【"+model.getIdCard()+"】信息不正确!");
        }
        if(Objects.nonNull(idCardMap.get(model.getIdCard()))){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,文档中第"+index+"行数据身份证号【"+model.getIdCard()+"】存在相同数据!");
        }
        idCardMap.put(model.getIdCard(), model.getIdCard());
    }