Commit 3d2ddd99 authored by fangxinjiang's avatar fangxinjiang

人员花名册

parent 1ea9af7b
......@@ -27,6 +27,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
......@@ -40,7 +41,7 @@ import java.util.Date;
@Data
@TableName("t_personnel_roster")
@Schema(description = "")
public class TPersonnelRoster{
public class TPersonnelRoster extends BaseEntity {
/**
* id
......@@ -424,4 +425,14 @@ public class TPersonnelRoster{
@ExcelIgnore
private String dataCreateMonth;
/**
* 项目
*/
@Length(max = 32, message = "项目 不能超过32个字符" )
@ExcelAttribute(name = "项目", maxLength = 32)
@Schema(description = "项目" )
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("项目" )
private String settleDomain;
}
......@@ -21,10 +21,17 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TPersonnelRoster;
import com.yifu.cloud.plus.v1.yifu.archives.service.TPersonnelRosterService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ContractAlertSearchVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TPersonnelRosterExportVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TPersonnelRosterSearchVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.MenuUtil;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
......@@ -48,18 +55,28 @@ import java.util.List;
public class TPersonnelRosterController {
private final TPersonnelRosterService tPersonnelRosterService;
private final MenuUtil menuUtil;
/**
* 简单分页查询
* @param page 分页对象
* @param tPersonnelRoster
* @param searchVo
* @return
*/
@Operation(description = "简单分页查询")
@GetMapping("/page")
public R<IPage<TPersonnelRoster>> getTPersonnelRosterPage(Page<TPersonnelRoster> page, TPersonnelRosterSearchVo tPersonnelRoster) {
return new R<>(tPersonnelRosterService.getTPersonnelRosterPage(page,tPersonnelRoster));
public R<IPage<TPersonnelRoster>> getTPersonnelRosterPage(Page<TPersonnelRoster> page, TPersonnelRosterSearchVo searchVo) {
YifuUser user = SecurityUtils.getUser();
menuUtil.setAuthSql(user, searchVo);
if (Common.isNotNull(searchVo.getAuthSql())) {
if (searchVo.getAuthSql().contains(CommonConstants.A_DEPT_ID)) {
searchVo.setAuthSql(searchVo.getAuthSql().replace(CommonConstants.A_DEPT_ID, "a.SETTLE_DOMAIN"));
}
if (searchVo.getAuthSql().contains("1=2 EXISTS")) {
searchVo.setAuthSql(searchVo.getAuthSql().replace("1=2 EXISTS", "EXISTS"));
}
}
return new R<>(tPersonnelRosterService.getTPersonnelRosterPage(page,searchVo));
}
/**
* 不分页查询
......@@ -68,7 +85,7 @@ public class TPersonnelRosterController {
*/
@Operation(summary = "不分页查询", description = "不分页查询")
@PostMapping("/noPage" )
public R<List<TPersonnelRoster>> getTPersonnelRosterNoPage(@RequestBody TPersonnelRosterSearchVo tPersonnelRoster) {
public R<List<TPersonnelRosterExportVo>> getTPersonnelRosterNoPage(@RequestBody TPersonnelRosterSearchVo tPersonnelRoster) {
return R.ok(tPersonnelRosterService.noPageDiy(tPersonnelRoster));
}
......@@ -131,6 +148,16 @@ public class TPersonnelRosterController {
@Operation(description = "导出 hasPermission('demo_tpersonnelroster-export')")
@PostMapping("/export")
public void export(HttpServletResponse response, @RequestBody TPersonnelRosterSearchVo searchVo) {
YifuUser user = SecurityUtils.getUser();
menuUtil.setAuthSql(user, searchVo);
if (Common.isNotNull(searchVo.getAuthSql())) {
if (searchVo.getAuthSql().contains(CommonConstants.A_DEPT_ID)) {
searchVo.setAuthSql(searchVo.getAuthSql().replace(CommonConstants.A_DEPT_ID, "a.SETTLE_DOMAIN"));
}
if (searchVo.getAuthSql().contains("1=2 EXISTS")) {
searchVo.setAuthSql(searchVo.getAuthSql().replace("1=2 EXISTS", "EXISTS"));
}
}
tPersonnelRosterService.listExport(response,searchVo);
}
......@@ -147,4 +174,17 @@ public class TPersonnelRosterController {
public void everyMonthUpdateRoster() {
tPersonnelRosterService.everyMonthUpdateRoster();
}
private void setAuth(TPersonnelRosterSearchVo searchVo) {
YifuUser user = SecurityUtils.getUser();
menuUtil.setAuthSql(user, searchVo);
if (Common.isNotNull(searchVo.getAuthSql())) {
if (searchVo.getAuthSql().contains(CommonConstants.A_DEPT_ID)) {
searchVo.setAuthSql(searchVo.getAuthSql().replace(CommonConstants.A_DEPT_ID, "dept_id"));
}
if (searchVo.getAuthSql().contains(CommonConstants.A_CREATE_BY)) {
searchVo.setAuthSql(searchVo.getAuthSql().replace(CommonConstants.A_CREATE_BY, "CREATE_BY"));
}
}
}
}
......@@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TPersonnelRoster;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TPersonnelRosterExportVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TPersonnelRosterSearchVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -54,5 +55,5 @@ public interface TPersonnelRosterMapper extends BaseMapper<TPersonnelRoster> {
int noPageCountDiy(@Param("tPersonnelRoster")TPersonnelRosterSearchVo searchVo);
List<TPersonnelRoster> noPageDiy(@Param("tPersonnelRoster")TPersonnelRosterSearchVo searchVo);
List<TPersonnelRosterExportVo> noPageDiy(@Param("tPersonnelRoster")TPersonnelRosterSearchVo searchVo);
}
......@@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TPersonnelRoster;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TPersonnelRosterExportVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TPersonnelRosterSearchVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
......@@ -45,7 +46,7 @@ public interface TPersonnelRosterService extends IService<TPersonnelRoster> {
void listExport(HttpServletResponse response, TPersonnelRosterSearchVo searchVo);
List<TPersonnelRoster> noPageDiy(TPersonnelRosterSearchVo searchVo);
List<TPersonnelRosterExportVo> noPageDiy(TPersonnelRosterSearchVo searchVo);
void everyMonthUpdateRoster();
}
......@@ -26,6 +26,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TPersonnelRoster;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TPersonnelRosterMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TPersonnelRosterService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TPersonnelRosterExportVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TPersonnelRosterSearchVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
......@@ -86,7 +87,7 @@ public class TPersonnelRosterServiceImpl extends ServiceImpl<TPersonnelRosterMap
public void listExport(HttpServletResponse response, TPersonnelRosterSearchVo searchVo){
String fileName = "人员花名册" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表
List<TPersonnelRoster> list = new ArrayList<>();
List<TPersonnelRosterExportVo> list = new ArrayList<>();
long count = noPageCountDiy(searchVo);
ServletOutputStream out = null;
try {
......@@ -96,22 +97,24 @@ public class TPersonnelRosterServiceImpl extends ServiceImpl<TPersonnelRosterMap
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName , CommonConstants.UTF8));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
//EasyExcel.write(out, TEmpBadRecord.class).sheet("不良记录").doWrite(list);
ExcelWriter excelWriter = EasyExcel.write(out, TPersonnelRoster.class).build();
ExcelWriter excelWriter = EasyExcel.write(out, TPersonnelRosterExportVo.class).build();
int index = 0;
if (count > CommonConstants.ZERO_INT){
ExcelUtil<TPersonnelRosterExportVo> util;
WriteSheet writeSheet;
for (int i = 0; i <= count; ) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = noPageDiy(searchVo);
if (Common.isNotNull(list)){
ExcelUtil<TPersonnelRoster> util = new ExcelUtil<>(TPersonnelRoster.class);
for (TPersonnelRoster vo:list){
util = new ExcelUtil<>(TPersonnelRosterExportVo.class);
for (TPersonnelRosterExportVo vo:list){
util.convertEntity(vo,null,null,null);
}
}
if (Common.isNotNull(list)){
WriteSheet writeSheet = EasyExcel.writerSheet(""+index).build();
writeSheet = EasyExcel.writerSheet(""+index).build();
excelWriter.write(list,writeSheet);
index++;
}
......@@ -143,7 +146,7 @@ public class TPersonnelRosterServiceImpl extends ServiceImpl<TPersonnelRosterMap
}
@Override
public List<TPersonnelRoster> noPageDiy(TPersonnelRosterSearchVo searchVo) {
public List<TPersonnelRosterExportVo> noPageDiy(TPersonnelRosterSearchVo searchVo) {
return baseMapper.noPageDiy(searchVo);
}
......
......@@ -66,7 +66,54 @@
<result property="contractCreater" column="CONTRACT_CREATER"/>
<result property="contractCreateTime" column="CONTRACT_CREATE_TIME"/>
<result property="dataCreateMonth" column="DATA_CREATE_MONTH"/>
<result property="settleDomain" column="SETTLE_DOMAIN"/>
</resultMap>
<resultMap id="tPersonnelRosterExportMap" type="com.yifu.cloud.plus.v1.yifu.archives.vo.TPersonnelRosterExportVo">
<id property="id" column="ID"/>
<result property="customerName" column="CUSTOMER_NAME"/>
<result property="departName" column="DEPART_NAME"/>
<result property="departNo" column="DEPART_NO"/>
<result property="businessPrimary" column="BUSINESS_PRIMARY"/>
<result property="businessSecond" column="BUSINESS_SECOND"/>
<result property="businessThird" column="BUSINESS_THIRD"/>
<result property="label" column="LABEL"/>
<result property="businessType" column="BUSINESS_TYPE"/>
<result property="buBelong" column="BU_BELONG"/>
<result property="empType" column="EMP_TYPE"/>
<result property="empName" column="EMP_NAME"/>
<result property="empSex" column="EMP_SEX"/>
<result property="empBirthDate" column="EMP_BIRTH_DATE"/>
<result property="empAge" column="EMP_AGE"/>
<result property="empIdcard" column="EMP_IDCARD"/>
<result property="bankNo" column="BANK_NO"/>
<result property="bankName" column="BANK_NAME"/>
<result property="bankProvince" column="BANK_PROVINCE"/>
<result property="bankCity" column="BANK_CITY"/>
<result property="bankNameSub" column="BANK_NAME_SUB"/>
<result property="empPhone" column="EMP_PHONE"/>
<result property="empProvince" column="EMP_PROVINCE"/>
<result property="empCity" column="EMP_CITY"/>
<result property="empTown" column="EMP_TOWN"/>
<result property="socialProvince" column="SOCIAL_PROVINCE"/>
<result property="socialCity" column="SOCIAL_CITY"/>
<result property="socialTown" column="SOCIAL_TOWN"/>
<result property="contractApplyNo" column="CONTRACT_APPLY_NO"/>
<result property="contractStart" column="CONTRACT_START"/>
<result property="contractEnd" column="CONTRACT_END"/>
<result property="contractType" column="CONTRACT_TYPE"/>
<result property="businessDetail" column="BUSINESS_DETAIL"/>
<result property="signType" column="SIGN_TYPE"/>
<result property="signTerm" column="SIGN_TERM"/>
<result property="contractPartyA" column="CONTRACT_PARTY_A"/>
<result property="contractPost" column="CONTRACT_POST"/>
<result property="contractTaskTime" column="CONTRACT_TASK_TIME"/>
<result property="contractCode" column="CONTRACT_CODE"/>
<result property="contractCreater" column="CONTRACT_CREATER"/>
<result property="contractCreateTime" column="CONTRACT_CREATE_TIME"/>
<result property="dataCreateMonth" column="DATA_CREATE_MONTH"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
a.CUSTOMER_NAME,
......@@ -109,7 +156,8 @@
a.CONTRACT_CODE,
a.CONTRACT_CREATER,
a.CONTRACT_CREATE_TIME,
a.DATA_CREATE_MONTH
a.DATA_CREATE_MONTH,
a.SETTLE_DOMAIN
</sql>
<sql id="tPersonnelRoster_where">
<if test="tPersonnelRoster != null">
......@@ -135,7 +183,7 @@
AND a.BUSINESS_THIRD = #{tPersonnelRoster.businessThird}
</if>
<if test="tPersonnelRoster.label != null and tPersonnelRoster.label.trim() != ''">
AND a.LABEL = #{tPersonnelRoster.label}
AND a.LABEL like CONCAT(#{tPersonnelRoster.label},'%')
</if>
<if test="tPersonnelRoster.businessType != null and tPersonnelRoster.businessType.trim() != ''">
AND a.BUSINESS_TYPE = #{tPersonnelRoster.businessType}
......@@ -239,6 +287,9 @@
<if test="tPersonnelRoster.dataCreateMonth != null and tPersonnelRoster.dataCreateMonth.trim() != ''">
AND a.DATA_CREATE_MONTH = #{tPersonnelRoster.dataCreateMonth}
</if>
<if test="tPersonnelRoster.authSql != null and tPersonnelRoster.authSql.trim() != ''">
${tPersonnelRoster.authSql}
</if>
<if test="tPersonnelRoster.businessTypes != null and tPersonnelRoster.businessTypes.size() > 0">
AND a.BUSINESS_TYPE in
......@@ -271,6 +322,7 @@
1=1
<include refid="tPersonnelRoster_where"/>
</where>
order by a.CONTRACT_CREATE_TIME ASC
</select>
<select id="getTPersonnelRoster" resultMap="tPersonnelRosterMap">
select p.UNIT_NAME as 'CUSTOMER_NAME',p.DEPT_NAME as 'DEPART_NAME',p.DEPT_NO as 'DEPART_NO',
......@@ -282,7 +334,8 @@
c1.CONTRACT_START as 'CONTRACT_START',c1.CONTRACT_END as 'CONTRACT_END',c1.CONTRACT_NAME as 'CONTRACT_TYPE',c1.CONTRACT_SUB_NAME as 'BUSINESS_DETAIL',
c1.SITUATION as 'SIGN_TYPE',c1.CONTRACT_TYPE as 'SIGN_TERM',
c1.CONTRACT_PARTY as 'CONTRACT_PARTY_A',c1.POST as 'CONTRACT_POST',c1.WORKING_HOURS as 'CONTRACT_TASK_TIME',
c1.CONTRACT_NO as 'CONTRACT_CODE',c1.CREATE_NAME as 'CONTRACT_CREATER',c1.CREATE_TIME as 'CONTRACT_CREATE_TIME'
c1.CONTRACT_NO as 'CONTRACT_CODE',c1.CREATE_NAME as 'CONTRACT_CREATER',c1.CREATE_TIME as 'CONTRACT_CREATE_TIME',
d.id as "SETTLE_DOMAIN"
from
(select MAX(c.CREATE_TIME),c.id,c.EMP_IDCARD,c.DEPT_NO from t_employee_contract_info c WHERE c.IN_USE = 0 and c.DELETE_FLAG='0' and c.IS_OBSOLETE='0'
GROUP BY c.DEPT_NO,c.EMP_IDCARD) t
......@@ -317,7 +370,7 @@
</select>
<!--tEmployeeInfo人员档案导出查询改造 fxj 2022-11-02-->
<select id="noPageDiy" resultMap="tPersonnelRosterMap">
<select id="noPageDiy" resultMap="tPersonnelRosterExportMap">
select
<include refid="Base_Column_List"/>
from t_personnel_roster a
......@@ -325,7 +378,7 @@
1=1
<include refid="tPersonnelRoster_where"/>
</where>
order by a.CREATE_TIME desc
order by a.CONTRACT_CREATE_TIME ASC
<if test="tPersonnelRoster != null">
<if test="tPersonnelRoster.limitStart != null">
limit #{tPersonnelRoster.limitStart},#{tPersonnelRoster.limitEnd}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment