Merge remote-tracking branch 'origin/master' into master

This commit is contained in:
czx 2020-12-21 17:54:46 +08:00
commit bb45ccb720
15 changed files with 210 additions and 23 deletions

View File

@ -58,8 +58,8 @@ public class FtStaffInfoDaoController extends BaseController {
} }
@GetMapping("/staffListWithDepart") @GetMapping("/staffListWithDepart")
public AjaxResult staffListWithDepart() { public AjaxResult staffListWithDepart(FtStaffInfoDao ftStaffInfoDao) {
return AjaxResult.success(iFtStaffInfoDaoService.selectStaffInfoWithDepart()); return AjaxResult.success(iFtStaffInfoDaoService.selectStaffInfoWithDepart(ftStaffInfoDao));
} }
/** /**

View File

@ -9,14 +9,19 @@ import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.fantang.domain.FtStaffInfoDao;
import com.ruoyi.system.fantang.domain.FtStaffSubsidyDao; import com.ruoyi.system.fantang.domain.FtStaffSubsidyDao;
import com.ruoyi.system.fantang.domain.FtSubsidyDao;
import com.ruoyi.system.fantang.service.IFtStaffSubsidyDaoService; import com.ruoyi.system.fantang.service.IFtStaffSubsidyDaoService;
import com.ruoyi.system.fantang.vo.FtStaffSubsidyVo;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -107,4 +112,33 @@ public class FtStaffSubsidyDaoController extends BaseController {
public AjaxResult remove(@PathVariable Long[] subsidyIds) { public AjaxResult remove(@PathVariable Long[] subsidyIds) {
return toAjax(iFtStaffSubsidyDaoService.removeByIds(Arrays.asList(subsidyIds)) ? 1 : 0); return toAjax(iFtStaffSubsidyDaoService.removeByIds(Arrays.asList(subsidyIds)) ? 1 : 0);
} }
/**
* 发放员工补贴
*/
@PostMapping("/submitGiveOutSubsidy")
public AjaxResult submitGiveOutSubsidy(@RequestBody FtStaffSubsidyVo ftStaffSubsidyVo) {
FtSubsidyDao subsidy = ftStaffSubsidyVo.getSubsidy();
List<FtStaffInfoDao> staffData = ftStaffSubsidyVo.getStaffData();
Date giveOutDate = ftStaffSubsidyVo.getGiveOutDate();
List<FtStaffSubsidyDao> ftStaffSubsidyDaoList = new ArrayList<>();
for (FtStaffInfoDao staffDatum : staffData) {
if (staffDatum.getGiveOutFlag()){
FtStaffSubsidyDao ftStaffSubsidyDao = new FtStaffSubsidyDao();
ftStaffSubsidyDao.setStaffId(staffDatum.getStaffId());
ftStaffSubsidyDao.setSubsidyType(subsidy.getType());
ftStaffSubsidyDao.setIncomeType("1");
ftStaffSubsidyDao.setPrice(subsidy.getPrice());
ftStaffSubsidyDao.setConsumAt(giveOutDate);
ftStaffSubsidyDaoList.add(ftStaffSubsidyDao);
}
}
iFtStaffSubsidyDaoService.insertBatchStaffSubsidy(ftStaffSubsidyDaoList);
return AjaxResult.success("发放成功");
}
} }

View File

@ -1,10 +1,10 @@
package com.ruoyi.system.fantang.domain; package com.ruoyi.system.fantang.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.system.fantang.vo.FtStaffInfoVo;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@ -42,6 +42,11 @@ public class FtStaffInfoDao {
*/ */
private Long departId; private Long departId;
/**
* 科室名
*/
private String departName;
/** /**
* 姓名 * 姓名
*/ */
@ -129,4 +134,7 @@ public class FtStaffInfoDao {
private Boolean loginFlag; private Boolean loginFlag;
private String expired; private String expired;
@TableField(exist = false)
private Boolean giveOutFlag = true;
} }

View File

@ -15,8 +15,8 @@ import java.util.List;
*/ */
public interface FtStaffInfoDaoMapper extends BaseMapper<FtStaffInfoDao> { public interface FtStaffInfoDaoMapper extends BaseMapper<FtStaffInfoDao> {
@Select("SELECT a.*, b.depart_name from ft_staff_info a LEFT JOIN ft_depart b on a.depart_id = b.depart_id where staff_type = 1") // @Select("SELECT a.*, b.depart_name from ft_staff_info a LEFT JOIN ft_depart b on a.depart_id = b.depart_id where staff_type = 1")
List<FtStaffInfoDao> selectStaffInfoWithDepart(); List<FtStaffInfoDao> selectStaffInfoWithDepart(FtStaffInfoDao ftStaffInfoDao);
@Update("update ft_staff_info set token=#{token}, login_flag=1 where staff_id=#{staff_id}") @Update("update ft_staff_info set token=#{token}, login_flag=1 where staff_id=#{staff_id}")
void updateLoginStatus(FtStaffInfoDao dao); void updateLoginStatus(FtStaffInfoDao dao);

View File

@ -2,6 +2,9 @@ package com.ruoyi.system.fantang.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.fantang.domain.FtStaffSubsidyDao; import com.ruoyi.system.fantang.domain.FtStaffSubsidyDao;
import org.apache.ibatis.annotations.Insert;
import java.util.List;
/** /**
* 补贴流水查看Mapper接口 * 补贴流水查看Mapper接口
@ -11,4 +14,5 @@ import com.ruoyi.system.fantang.domain.FtStaffSubsidyDao;
*/ */
public interface FtStaffSubsidyDaoMapper extends BaseMapper<FtStaffSubsidyDao> { public interface FtStaffSubsidyDaoMapper extends BaseMapper<FtStaffSubsidyDao> {
Integer insertBatchStaffSubsidy(List<FtStaffSubsidyDao> ftStaffSubsidyDaoList);
} }

View File

@ -14,7 +14,7 @@ import java.util.List;
*/ */
public interface IFtStaffInfoDaoService extends IService<FtStaffInfoDao> { public interface IFtStaffInfoDaoService extends IService<FtStaffInfoDao> {
List<FtStaffInfoDao> selectStaffInfoWithDepart(); List<FtStaffInfoDao> selectStaffInfoWithDepart(FtStaffInfoDao ftStaffInfoDao);
AjaxResult login(String tel, String password); AjaxResult login(String tel, String password);

View File

@ -3,6 +3,8 @@ package com.ruoyi.system.fantang.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.system.fantang.domain.FtStaffSubsidyDao; import com.ruoyi.system.fantang.domain.FtStaffSubsidyDao;
import java.util.List;
/** /**
* 补贴流水查看Service接口 * 补贴流水查看Service接口
* *
@ -11,4 +13,5 @@ import com.ruoyi.system.fantang.domain.FtStaffSubsidyDao;
*/ */
public interface IFtStaffSubsidyDaoService extends IService<FtStaffSubsidyDao> { public interface IFtStaffSubsidyDaoService extends IService<FtStaffSubsidyDao> {
Integer insertBatchStaffSubsidy(List<FtStaffSubsidyDao> ftStaffSubsidyDaoList);
} }

View File

@ -21,9 +21,9 @@ import java.util.List;
public class FtStaffInfoDaoServiceImpl extends ServiceImpl<FtStaffInfoDaoMapper, FtStaffInfoDao> implements IFtStaffInfoDaoService { public class FtStaffInfoDaoServiceImpl extends ServiceImpl<FtStaffInfoDaoMapper, FtStaffInfoDao> implements IFtStaffInfoDaoService {
@Override @Override
public List<FtStaffInfoDao> selectStaffInfoWithDepart() { public List<FtStaffInfoDao> selectStaffInfoWithDepart(FtStaffInfoDao ftStaffInfoDao) {
return this.baseMapper.selectStaffInfoWithDepart(); return this.baseMapper.selectStaffInfoWithDepart(ftStaffInfoDao);
} }
@Override @Override

View File

@ -6,6 +6,8 @@ import com.ruoyi.system.fantang.mapper.FtStaffSubsidyDaoMapper;
import com.ruoyi.system.fantang.service.IFtStaffSubsidyDaoService; import com.ruoyi.system.fantang.service.IFtStaffSubsidyDaoService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* 补贴流水查看Service业务层处理 * 补贴流水查看Service业务层处理
* *
@ -15,4 +17,8 @@ import org.springframework.stereotype.Service;
@Service @Service
public class FtStaffSubsidyDaoServiceImpl extends ServiceImpl<FtStaffSubsidyDaoMapper, FtStaffSubsidyDao> implements IFtStaffSubsidyDaoService { public class FtStaffSubsidyDaoServiceImpl extends ServiceImpl<FtStaffSubsidyDaoMapper, FtStaffSubsidyDao> implements IFtStaffSubsidyDaoService {
@Override
public Integer insertBatchStaffSubsidy(List<FtStaffSubsidyDao> ftStaffSubsidyDaoList) {
return this.baseMapper.insertBatchStaffSubsidy(ftStaffSubsidyDaoList);
}
} }

View File

@ -0,0 +1,23 @@
package com.ruoyi.system.fantang.vo;
import com.ruoyi.system.fantang.domain.FtStaffInfoDao;
import com.ruoyi.system.fantang.domain.FtSubsidyDao;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class FtStaffSubsidyVo {
private Date giveOutDate;
private List<FtStaffInfoDao> staffData;
private FtSubsidyDao subsidy;
}

View File

@ -23,4 +23,11 @@
<result property="sex" column="sex"/> <result property="sex" column="sex"/>
<result property="tel" column="tel"/> <result property="tel" column="tel"/>
</resultMap> </resultMap>
<select id="selectStaffInfoWithDepart" parameterType="FtStaffInfoDao"
resultType="FtStaffInfoDao">
SELECT a.*, b.depart_name from ft_staff_info a LEFT JOIN ft_depart b on a.depart_id = b.depart_id where staff_type = 1 and a.flag = 1
<if test="departId != null">and b.depart_id = #{departId}</if>
</select>
</mapper> </mapper>

View File

@ -14,5 +14,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="orderId" column="order_id" /> <result property="orderId" column="order_id" />
</resultMap> </resultMap>
<insert id="insertBatchStaffSubsidy" parameterType="list">
insert into ft_staff_subsidy (staff_id, subsidy_type, income_type, price, consum_at) values
<foreach collection="list" item="item" separator=",">
(
#{item.staffId},
#{item.subsidyType},
#{item.incomeType},
#{item.price},
#{item.consumAt}
)
</foreach>
</insert>
</mapper> </mapper>

View File

@ -9,10 +9,11 @@ export function listStaffInfo(query) {
}) })
} }
export function staffListWithDepart() { export function staffListWithDepart(query) {
return request({ return request({
url: '/fantang/staffInfo/staffListWithDepart', url: '/fantang/staffInfo/staffListWithDepart',
method: 'get', method: 'get',
params : query
}) })
} }

View File

@ -35,6 +35,15 @@ export function updateStaffSubsidy(data) {
}) })
} }
// 发放员工补贴
export function submitGiveOutSubsidy(data) {
return request({
url: '/fantang/staffSubsidy/submitGiveOutSubsidy',
method: 'post',
data: data
})
}
// 删除补贴流水查看 // 删除补贴流水查看
export function delStaffSubsidy(subsidyId) { export function delStaffSubsidy(subsidyId) {
return request({ return request({

View File

@ -141,14 +141,44 @@
<!-- 补贴发放弹出层--> <!-- 补贴发放弹出层-->
<el-dialog title="选择发放员工" :visible.sync="showPopupSubsidyGiveOut" width="1000px" align="center"> <el-dialog title="选择发放员工" :visible.sync="showPopupSubsidyGiveOut" width="1000px" align="center">
<el-form :model="giveOutQueryParams" ref="giveOutQueryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-row :gutter="10">
<el-col :span="4"></el-col>
<el-col :span="8">
<el-form-item label="科室" prop="departId">
<el-select v-model="giveOutQueryParams.departId" placeholder="请选择科室" @change="handleGiveOutQueryChange"
clearable>
<el-option
v-for="item in departOptions"
:key="item.departName"
:label="item.departName"
:value="item.departId">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<span>发放日期 </span>
<!-- <el-date-picker-->
<!-- v-model="giveOutDate"-->
<!-- value-format="yyyy-MM-dd"-->
<!-- type="daterange"-->
<!-- range-separator="至"-->
<!-- start-placeholder="开始日期"-->
<!-- end-placeholder="结束日期">-->
<!-- </el-date-picker>-->
<el-date-picker
v-model="giveOutDate"
value-format="yyyy-MM-dd"
type="date"
placeholder="请选择发放日期">
</el-date-picker>
</el-col>
</el-row>
</el-form>
<br>
<el-table :data="staffData"> <el-table :data="staffData">
<el-table-column prop="departName" label="科室" width="200" align="center" <el-table-column prop="departName" label="科室" width="150" align="center"></el-table-column>
:filters="[{ text: '家', value: '家' }, { text: '公司', value: '公司' }]"
:filter-method="filterDepart">
<template slot-scope="scope">
</template>
</el-table-column>
<el-table-column prop="name" label="姓名" width="150" align="center"></el-table-column> <el-table-column prop="name" label="姓名" width="150" align="center"></el-table-column>
<el-table-column prop="giveOutFlag" label="是否发放补贴" width="300" align="center"> <el-table-column prop="giveOutFlag" label="是否发放补贴" width="300" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
@ -163,7 +193,7 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<br> <br>
<el-button type="primary">发放补贴</el-button> <el-button type="primary" @click="submitGiveOut">发放补贴</el-button>
</el-dialog> </el-dialog>
<!-- 添加或修改补贴管理对话框 --> <!-- 添加或修改补贴管理对话框 -->
@ -203,12 +233,16 @@
<script> <script>
import {addSubsidy, delSubsidy, exportSubsidy, getSubsidy, listSubsidy, updateSubsidy} from "@/api/fantang/subsidy"; import {addSubsidy, delSubsidy, exportSubsidy, getSubsidy, listSubsidy, updateSubsidy} from "@/api/fantang/subsidy";
import {staffListWithDepart} from "@/api/fantang/staffInfo"; import {staffListWithDepart} from "@/api/fantang/staffInfo";
import {listDepart} from "@/api/fantang/depart";
import {submitGiveOutSubsidy} from "@/api/fantang/staffSubsidy";
export default { export default {
name: "Subsidy", name: "Subsidy",
components: {}, components: {},
data() { data() {
return { return {
giveOutDate: null,
departOptions: [],
staffData: [], staffData: [],
// //
showPopupSubsidyGiveOut: false, showPopupSubsidyGiveOut: false,
@ -241,6 +275,10 @@ export default {
createAt: null, createAt: null,
createBy: null createBy: null
}, },
//
giveOutQueryParams: {
departId: null,
},
// //
form: {}, form: {},
// //
@ -257,6 +295,8 @@ export default {
} }
}; };
}, },
created() { created() {
this.getList(); this.getList();
this.getDicts("ft_subsidy").then(response => { this.getDicts("ft_subsidy").then(response => {
@ -271,7 +311,12 @@ export default {
// //
clickSubsidyGiveOut(row) { clickSubsidyGiveOut(row) {
this.getAllStaffList();
this.showPopupSubsidyGiveOut = true; this.showPopupSubsidyGiveOut = true;
const subsidyId = row.subsidyId
getSubsidy(subsidyId).then(response => {
this.form = response.data;
})
}, },
// //
formatFlag(row) { formatFlag(row) {
@ -289,13 +334,20 @@ export default {
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
}); });
},
getAllStaffList() {
staffListWithDepart().then(response => { staffListWithDepart().then(response => {
this.staffData = response.data; this.staffData = response.data;
for (let i = 0; i < this.staffData.length; i++) { // for (let i = 0; i < this.staffData.length; i++) {
this.staffData[i].giveOutFlag = true; // this.staffData[i].giveOutFlag = true;
} // }
console.log(this.staffData); console.log('staffData-->', this.staffData);
}) })
listDepart().then(response => {
this.departOptions = response.rows;
})
}, },
// //
typeFormat(row, column) { typeFormat(row, column) {
@ -325,6 +377,34 @@ export default {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
this.getList(); this.getList();
}, },
submitGiveOut() {
if (new Date() < this.giveOutDate) {
let giveOutSubmitData = {
giveOutDate: this.giveOutDate,
staffData: this.staffData,
subsidy: this.form
}
submitGiveOutSubsidy(giveOutSubmitData).then(res => {
this.msgSuccess("发放成功")
})
}else {
this.msgError("发放日期必须大于当前日期")
}
},
handleGiveOutQueryChange() {
// console.log("change")
staffListWithDepart(this.giveOutQueryParams).then(response => {
this.staffData = response.data;
// for (let i = 0; i < this.staffData.length; i++) {
// this.staffData[i].giveOutFlag = true;
// }
console.log(this.staffData);
})
},
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm("queryForm"); this.resetForm("queryForm");