Commit 758cd098 authored by hongguangwu's avatar hongguangwu

合同相关权限

parent fe36ac57
......@@ -67,8 +67,14 @@ public class TEmpContractAlert extends BaseEntity {
@Schema(description ="员工ID")
@ExcelProperty("员工ID")
private String empId;
/**
* 项目id
*/
@ExcelAttribute(name = "项目id" )
@Schema(description ="项目id")
@ExcelProperty("项目id")
private String deptId;
/**
* 项目名称
*/
@ExcelAttribute(name = "项目名称" )
......
......@@ -71,6 +71,9 @@ public class TCertRecordController {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
menuUtil.setAuthSql(user, searchVo);
if (Common.isNotNull(searchVo.getAuthSql()) && searchVo.getAuthSql().contains(CommonConstants.A_DEPT_ID)) {
searchVo.setAuthSql(searchVo.getAuthSql().replace(CommonConstants.A_DEPT_ID, "dept_id"));
}
return R.ok(tCertRecordService.pageDiy(page, searchVo));
}
/**
......@@ -87,6 +90,9 @@ public class TCertRecordController {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
menuUtil.setAuthSql(user, searchVo);
if (Common.isNotNull(searchVo.getAuthSql()) && searchVo.getAuthSql().contains(CommonConstants.A_DEPT_ID)) {
searchVo.setAuthSql(searchVo.getAuthSql().replace(CommonConstants.A_DEPT_ID, "dept_id"));
}
return R.ok(tCertRecordService.getTCertRecordNoPage(searchVo));
}
......
......@@ -22,9 +22,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpContractAlert;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmpContractAlertService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ContractAlertSearchVo;
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,6 +53,7 @@ import java.util.List;
public class TEmpContractAlertController {
private final TEmpContractAlertService tEmpContractAlertService;
private final MenuUtil menuUtil;
/**
* 分页查询
......@@ -59,6 +65,11 @@ public class TEmpContractAlertController {
@GetMapping("/page" )
//@PreAuthorize("@pms.hasPermission('demo_tempcontractalert_get')" )
public R<IPage<TEmpContractAlert>> getTEmpContractAlertPage(Page page, ContractAlertSearchVo searchVo) {
YifuUser user = SecurityUtils.getUser();
menuUtil.setAuthSql(user, searchVo);
if (Common.isNotNull(searchVo.getAuthSql()) && searchVo.getAuthSql().contains(CommonConstants.A_DEPT_ID)) {
searchVo.setAuthSql(searchVo.getAuthSql().replace(CommonConstants.A_DEPT_ID, "dept_id"));
}
return R.ok(tEmpContractAlertService.pageDiy(page, searchVo));
}
/**
......@@ -134,6 +145,11 @@ public class TEmpContractAlertController {
@Operation(description = "导出")
@PostMapping("/export")
public void export(HttpServletResponse response, @RequestBody ContractAlertSearchVo searchVo) {
YifuUser user = SecurityUtils.getUser();
menuUtil.setAuthSql(user, searchVo);
if (Common.isNotNull(searchVo.getAuthSql()) && searchVo.getAuthSql().contains(CommonConstants.A_DEPT_ID)) {
searchVo.setAuthSql(searchVo.getAuthSql().replace(CommonConstants.A_DEPT_ID, "dept_id"));
}
tEmpContractAlertService.listExport(response,searchVo);
}
/**
......
......@@ -26,8 +26,11 @@ 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.ErrorMessage;
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;
......@@ -53,7 +56,7 @@ import java.util.List;
public class TEmployeeContractInfoController {
private final TEmployeeContractInfoService tEmployeeContractInfoService;
private final MenuUtil menuUtil;
/**
* 申请、归档分页查询
*
......@@ -64,6 +67,7 @@ public class TEmployeeContractInfoController {
@Operation(summary = "申请分页查询(全部的数据(后面加上权限:自己创建的))", description = "申请分页查询")
@GetMapping("/applyPage")
public R<IPage<TEmployeeContractInfo>> getApplyPage(Page<TEmployeeContractInfo> page, TEmployeeContractInfo tEmployeeContractInfo) {
this.setAuth(tEmployeeContractInfo);
return new R<>(tEmployeeContractInfoService.getTEmployeeContractInfoPage(page, tEmployeeContractInfo));
}
......@@ -72,9 +76,25 @@ public class TEmployeeContractInfoController {
public R<IPage<TEmployeeContractInfo>> getFilingPage(Page<TEmployeeContractInfo> page, TEmployeeContractInfo tEmployeeContractInfo) {
tEmployeeContractInfo.setIsFilePage(CommonConstants.ONE_INT);
tEmployeeContractInfo.setAuditStatus(CommonConstants.dingleDigitIntArray[2]);
this.setAuth(tEmployeeContractInfo);
return new R<>(tEmployeeContractInfoService.getTEmployeeContractInfoPage(page, tEmployeeContractInfo));
}
/**
* @param tEmployeeContractInfo
* @Description: 加入权限
* @Author: hgw
* @Date: 2022/9/16 16:39
* @return: void
**/
private void setAuth(TEmployeeContractInfo tEmployeeContractInfo) {
YifuUser user = SecurityUtils.getUser();
menuUtil.setAuthSql(user, tEmployeeContractInfo);
if (Common.isNotNull(tEmployeeContractInfo.getAuthSql()) && tEmployeeContractInfo.getAuthSql().contains(CommonConstants.A_DEPT_ID)) {
tEmployeeContractInfo.setAuthSql(tEmployeeContractInfo.getAuthSql().replace(CommonConstants.A_DEPT_ID, "a.SETTLE_DOMAIN"));
}
}
/**
* 合同审核分页查询
*
......@@ -86,6 +106,7 @@ public class TEmployeeContractInfoController {
@GetMapping("/auditPage")
public R<IPage<TEmployeeContractInfo>> getAuditPage(Page<TEmployeeContractInfo> page, TEmployeeContractInfo tEmployeeContractInfo) {
tEmployeeContractInfo.setAuditStatus(CommonConstants.ONE_INT);
this.setAuth(tEmployeeContractInfo);
return new R<>(tEmployeeContractInfoService.getTEmployeeContractInfoPage(page, tEmployeeContractInfo));
}
......@@ -99,6 +120,7 @@ public class TEmployeeContractInfoController {
@Operation(summary = "合同查询(全部的数据)", description = "合同查询")
@GetMapping("/page")
public R<IPage<TEmployeeContractInfo>> gettemployeecontractinfoPage(Page<TEmployeeContractInfo> page, TEmployeeContractInfo tEmployeeContractInfo) {
this.setAuth(tEmployeeContractInfo);
return new R<>(tEmployeeContractInfoService.getTEmployeeContractInfoPage(page, tEmployeeContractInfo));
}
......@@ -263,6 +285,13 @@ public class TEmployeeContractInfoController {
@SysLog("批量导出合同")
@PostMapping("/exportContractInfo")
public void exportContractInfo(@RequestBody(required = false) TEmployeeContractInfo contractInfo, HttpServletResponse response) {
YifuUser user = SecurityUtils.getUser();
if (user != null && !Common.isEmpty(user.getId())) {
menuUtil.setAuthSql(user, contractInfo);
if (Common.isNotNull(contractInfo.getAuthSql()) && contractInfo.getAuthSql().contains(CommonConstants.A_DEPT_ID)) {
contractInfo.setAuthSql(contractInfo.getAuthSql().replace(CommonConstants.A_DEPT_ID, "a.SETTLE_DOMAIN"));
}
}
tEmployeeContractInfoService.exportContractInfo(contractInfo, response);
}
......@@ -276,6 +305,13 @@ public class TEmployeeContractInfoController {
@SysLog("批量导出合同[历史]")
@PostMapping("/exportContractInfoHistory")
public void exportContractInfoHistory(@RequestBody(required = false) TEmployeeContractInfo contractInfo, HttpServletResponse response) {
YifuUser user = SecurityUtils.getUser();
if (user != null && !Common.isEmpty(user.getId())) {
menuUtil.setAuthSql(user, contractInfo);
if (Common.isNotNull(contractInfo.getAuthSql()) && contractInfo.getAuthSql().contains(CommonConstants.A_DEPT_ID)) {
contractInfo.setAuthSql(contractInfo.getAuthSql().replace(CommonConstants.A_DEPT_ID, "a.SETTLE_DOMAIN"));
}
}
tEmployeeContractInfoService.exportContractInfoHistory(contractInfo, response);
}
......
......@@ -22,10 +22,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TCertRecord;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.entity.*;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TCertRecordMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper;
......@@ -37,6 +34,7 @@ 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.LocalDateTimeUtils;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
......@@ -123,9 +121,10 @@ public class TCertRecordServiceImpl extends ServiceImpl<TCertRecordMapper, TCert
public IPage<TCertRecord> pageDiy(Page page, CertRecordSearchVo searchVo) {
LambdaQueryWrapper<TCertRecord> wrapper = buildQueryWrapper(searchVo);
if (Common.isNotNull(searchVo.getAuthSql())) {
wrapper.last(searchVo.getAuthSql());
wrapper.last(searchVo.getAuthSql() + " order by CREATE_TIME desc");
} else {
wrapper.orderByDesc(BaseEntity::getCreateTime);
}
wrapper.orderByDesc(TCertRecord::getCreateTime);
return baseMapper.selectPage(page,wrapper);
}
......@@ -143,6 +142,7 @@ public class TCertRecordServiceImpl extends ServiceImpl<TCertRecordMapper, TCert
}
private LambdaQueryWrapper buildQueryWrapper(CertRecordSearchVo entity){
LambdaQueryWrapper<TCertRecord> wrapper = Wrappers.lambdaQuery();
wrapper.ne(TCertRecord::getId,CommonConstants.ZERO_STRING);
if (ArrayUtil.isNotEmpty(entity.getCreateTimes())) {
wrapper.ge(TCertRecord::getOpenTime, entity.getCreateTimes()[0])
.le(TCertRecord::getOpenTime,
......
......@@ -65,7 +65,11 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM
@Override
public IPage<TEmpContractAlert> pageDiy(Page page, ContractAlertSearchVo searchVo) {
LambdaQueryWrapper<TEmpContractAlert> wrapper = buildQueryWrapper(searchVo);
wrapper.orderByDesc(BaseEntity::getCreateTime);
if (Common.isNotNull(searchVo.getAuthSql())) {
wrapper.last(searchVo.getAuthSql() + " order by CREATE_TIME desc");
} else {
wrapper.orderByDesc(BaseEntity::getCreateTime);
}
return baseMapper.selectPage(page,wrapper);
}
......@@ -76,6 +80,10 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM
if (Common.isNotNull(idList)){
wrapper.in(TEmpContractAlert::getId,idList);
}
wrapper.ne(TEmpContractAlert::getId,CommonConstants.ZERO_STRING);
if (Common.isNotNull(searchVo.getAuthSql())) {
wrapper.last(searchVo.getAuthSql());
}
return baseMapper.selectList(wrapper);
}
......@@ -85,6 +93,9 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM
if (Common.isNotNull(idList)){
wrapper.in(TEmpContractAlert::getId,idList);
}
if (Common.isNotNull(searchVo.getAuthSql())) {
wrapper.last(searchVo.getAuthSql());
}
if (searchVo.getLimitStart() >= 0 && searchVo.getLimitEnd() >= 0){
wrapper.last(" limit "+ searchVo.getLimitStart() +","+ searchVo.getLimitEnd());
}
......@@ -152,6 +163,7 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM
private LambdaQueryWrapper buildQueryWrapper(ContractAlertSearchVo entity){
LambdaQueryWrapper<TEmpContractAlert> wrapper = Wrappers.lambdaQuery();
wrapper.ne(TEmpContractAlert::getId,CommonConstants.ZERO_STRING);
if (ArrayUtil.isNotEmpty(entity.getCreateTimes())) {
wrapper.ge(TEmpContractAlert::getCreateTime, entity.getCreateTimes()[0])
.le(TEmpContractAlert::getCreateTime,
......@@ -309,6 +321,7 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM
alert.setEmpName(contract.getEmpName());
alert.setEmpId(contract.getEmpId());
alert.setEmpCode(contract.getEmpNo());
alert.setDeptId(contract.getSettleDomain());
alert.setProject(contract.getSubjectDepart());
alert.setProjectNo(contract.getDeptNo());
alert.setEmpIdcard(contract.getEmpIdcard());
......
......@@ -394,10 +394,17 @@
SELECT
<include refid="Base_Column_List"/>
FROM t_employee_contract_info a
<if test="tEmployeeContractInfo.authSql != null and tEmployeeContractInfo.authSql.trim() != ''">
left join t_employee_contract_area_res p on a.CREATE_BY=p.USER_ID
</if>
<where>
a.DELETE_FLAG = 0
<include refid="tEmployeeContractInfo_where"/>
<if test="tEmployeeContractInfo.authSql != null and tEmployeeContractInfo.authSql.trim() != ''">
${tEmployeeContractInfo.authSql}
</if>
</where>
GROUP BY a.id
order by a.CREATE_TIME desc
</select>
......@@ -418,10 +425,17 @@
SELECT
<include refid="Base_Export_Column_List"/>
FROM t_employee_contract_info a
<if test="tEmployeeContractInfo.authSql != null and tEmployeeContractInfo.authSql.trim() != ''">
left join t_employee_contract_area_res p on a.CREATE_BY=p.USER_ID
</if>
<where>
a.DELETE_FLAG = 0
<include refid="tEmployeeContractInfo_where"/>
<if test="tEmployeeContractInfo.authSql != null and tEmployeeContractInfo.authSql.trim() != ''">
${tEmployeeContractInfo.authSql}
</if>
</where>
GROUP BY a.id
order by a.CREATE_TIME desc
</select>
......@@ -437,6 +451,9 @@
<where>
a.DELETE_FLAG = 0 and a.AUDIT_TIME_LAST is not null and a.SITUATION != '作废' and a.SITUATION != '终止'
<include refid="tEmployeeContractInfo_where"/>
<if test="tEmployeeContractInfo.authSql != null and tEmployeeContractInfo.authSql.trim() != ''">
${tEmployeeContractInfo.authSql}
</if>
</where>
GROUP BY a.EMP_IDCARD,a.SETTLE_DOMAIN
order by a.CREATE_TIME desc
......
......@@ -37,7 +37,7 @@ public class MenuUtil {
public void setAuthSql(YifuUser user, BaseEntity entity) {
// 普通用户:
if (CommonConstants.ONE_STRING.equals(user.getSystemFlag())) {
if (user != null && Common.isNotNull(user.getId()) && CommonConstants.ONE_STRING.equals(user.getSystemFlag())) {
// 菜单id
String menuId = entity.getMId();
......
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