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")
public AjaxResult staffListWithDepart() {
return AjaxResult.success(iFtStaffInfoDaoService.selectStaffInfoWithDepart());
public AjaxResult staffListWithDepart(FtStaffInfoDao ftStaffInfoDao) {
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.utils.StringUtils;
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.FtSubsidyDao;
import com.ruoyi.system.fantang.service.IFtStaffSubsidyDaoService;
import com.ruoyi.system.fantang.vo.FtStaffSubsidyVo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
@ -107,4 +112,33 @@ public class FtStaffSubsidyDaoController extends BaseController {
public AjaxResult remove(@PathVariable Long[] subsidyIds) {
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;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.system.fantang.vo.FtStaffInfoVo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
@ -26,7 +26,7 @@ import java.util.Date;
@NoArgsConstructor
@Accessors(chain = true)
@TableName("ft_staff_info")
public class FtStaffInfoDao {
public class FtStaffInfoDao {
private static final long serialVersionUID = 1L;
@ -42,6 +42,11 @@ public class FtStaffInfoDao {
*/
private Long departId;
/**
* 科室名
*/
private String departName;
/**
* 姓名
*/
@ -129,4 +134,7 @@ public class FtStaffInfoDao {
private Boolean loginFlag;
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> {
@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();
// @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(FtStaffInfoDao ftStaffInfoDao);
@Update("update ft_staff_info set token=#{token}, login_flag=1 where staff_id=#{staff_id}")
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.ruoyi.system.fantang.domain.FtStaffSubsidyDao;
import org.apache.ibatis.annotations.Insert;
import java.util.List;
/**
* 补贴流水查看Mapper接口
@ -11,4 +14,5 @@ import com.ruoyi.system.fantang.domain.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> {
List<FtStaffInfoDao> selectStaffInfoWithDepart();
List<FtStaffInfoDao> selectStaffInfoWithDepart(FtStaffInfoDao ftStaffInfoDao);
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.ruoyi.system.fantang.domain.FtStaffSubsidyDao;
import java.util.List;
/**
* 补贴流水查看Service接口
*
@ -11,4 +13,5 @@ import com.ruoyi.system.fantang.domain.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 {
@Override
public List<FtStaffInfoDao> selectStaffInfoWithDepart() {
public List<FtStaffInfoDao> selectStaffInfoWithDepart(FtStaffInfoDao ftStaffInfoDao) {
return this.baseMapper.selectStaffInfoWithDepart();
return this.baseMapper.selectStaffInfoWithDepart(ftStaffInfoDao);
}
@Override

View File

@ -6,6 +6,8 @@ import com.ruoyi.system.fantang.mapper.FtStaffSubsidyDaoMapper;
import com.ruoyi.system.fantang.service.IFtStaffSubsidyDaoService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 补贴流水查看Service业务层处理
*
@ -15,4 +17,8 @@ import org.springframework.stereotype.Service;
@Service
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="tel" column="tel"/>
</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>

View File

@ -14,5 +14,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="orderId" column="order_id" />
</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>

View File

@ -9,10 +9,11 @@ export function listStaffInfo(query) {
})
}
export function staffListWithDepart() {
export function staffListWithDepart(query) {
return request({
url: '/fantang/staffInfo/staffListWithDepart',
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) {
return request({
@ -50,4 +59,4 @@ export function exportStaffSubsidy(query) {
method: 'get',
params: query
})
}
}

View File

@ -141,14 +141,44 @@
<!-- 补贴发放弹出层-->
<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-column prop="departName" label="科室" width="200" align="center"
:filters="[{ text: '家', value: '家' }, { text: '公司', value: '公司' }]"
:filter-method="filterDepart">
<template slot-scope="scope">
</template>
</el-table-column>
<el-table-column prop="departName" 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">
<template slot-scope="scope">
@ -163,7 +193,7 @@
</el-table-column>
</el-table>
<br>
<el-button type="primary">发放补贴</el-button>
<el-button type="primary" @click="submitGiveOut">发放补贴</el-button>
</el-dialog>
<!-- 添加或修改补贴管理对话框 -->
@ -203,12 +233,16 @@
<script>
import {addSubsidy, delSubsidy, exportSubsidy, getSubsidy, listSubsidy, updateSubsidy} from "@/api/fantang/subsidy";
import {staffListWithDepart} from "@/api/fantang/staffInfo";
import {listDepart} from "@/api/fantang/depart";
import {submitGiveOutSubsidy} from "@/api/fantang/staffSubsidy";
export default {
name: "Subsidy",
components: {},
data() {
return {
giveOutDate: null,
departOptions: [],
staffData: [],
//
showPopupSubsidyGiveOut: false,
@ -241,6 +275,10 @@ export default {
createAt: null,
createBy: null
},
//
giveOutQueryParams: {
departId: null,
},
//
form: {},
//
@ -257,6 +295,8 @@ export default {
}
};
},
created() {
this.getList();
this.getDicts("ft_subsidy").then(response => {
@ -271,7 +311,12 @@ export default {
//
clickSubsidyGiveOut(row) {
this.getAllStaffList();
this.showPopupSubsidyGiveOut = true;
const subsidyId = row.subsidyId
getSubsidy(subsidyId).then(response => {
this.form = response.data;
})
},
//
formatFlag(row) {
@ -289,13 +334,20 @@ export default {
this.total = response.total;
this.loading = false;
});
},
getAllStaffList() {
staffListWithDepart().then(response => {
this.staffData = response.data;
for (let i = 0; i < this.staffData.length; i++) {
this.staffData[i].giveOutFlag = true;
}
console.log(this.staffData);
// for (let i = 0; i < this.staffData.length; i++) {
// this.staffData[i].giveOutFlag = true;
// }
console.log('staffData-->', this.staffData);
})
listDepart().then(response => {
this.departOptions = response.rows;
})
},
//
typeFormat(row, column) {
@ -325,6 +377,34 @@ export default {
this.queryParams.pageNum = 1;
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() {
this.resetForm("queryForm");