Commit 904b21e5 authored by huyuchen's avatar huyuchen

数据权限修改

parent 390ebbd1
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.List;
......@@ -16,7 +15,7 @@ import java.util.List;
*/
@Data
@Tag(name = "订单商险列表查询")
public class InsuredOrderParam implements Serializable {
public class InsuredOrderParam extends BaseEntity {
/**
* 订单编号
*/
......
......@@ -15,12 +15,11 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainListVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.CheckDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.MenuUtil;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.SocialDaprUtils;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprArchivesProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.*;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.ekp.constant.EkpConstants;
import com.yifu.cloud.plus.v1.yifu.ekp.util.EkpInsuranceUtil;
......@@ -104,6 +103,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
@Resource
private MenuUtil menuUtil;
@Resource
private DaprArchivesProperties daprArchivesProperties;
/***********************商险办理********************************/
/**
......@@ -5863,16 +5864,28 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
@Override
public R getOrderInsuredListPage(Page<InsuredOrderListVo> page, InsuredOrderParam param) {
YifuUser user = SecurityUtils.getUser();
List<String> deptNoList = getDeptNoList(user);
Page<InsuredOrderListVo> pageList = new Page<>();
if(CollectionUtils.isEmpty(deptNoList)){
return R.ok(pageList);
}
param.setDeptNoList(deptNoList);
String orderNo = param.getOrderNo();
if (StringUtils.isBlank(orderNo)) {
return R.failed(InsurancesConstants.ORDER_NO_IS_EMPTY);
}
String sql;
// 获取人员项目权限
R<TSettleDomainListVo> res = HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl()
, daprArchivesProperties.getAppId(), "/tsettledomain/getSettleDomainIdsByUserId"
, user.getId(), TSettleDomainListVo.class, SecurityConstants.FROM_IN);
StringBuilder deptStr = new StringBuilder();
if (res != null && CommonConstants.SUCCESS == res.getCode()
&& res.getData() != null && res.getData().getDeptIds() != null
&& !res.getData().getDeptIds().isEmpty()) {
for (String deptId : res.getData().getDeptIds()) {
deptStr.append(",'").append(deptId).append("'");
}
}
sql = "and (1=2 or a.dept_id in ('0'#settleDomainId))";
sql = sql.replace("#settleDomainId", deptStr.toString());
param.setAuthSql(sql);
//查询所有保单信息
IPage<InsuredOrderListVo> orderInsuredList = baseMapper.getOrderInsuredListPage(page, param);
return R.ok(orderInsuredList);
......
......@@ -978,6 +978,9 @@
<if test="param.endDate != null ">
AND a.CREATE_TIME <![CDATA[ <= ]]> concat(#{param.endDate}, ' 23:59:59')
</if>
<if test="param.authSql != null and param.authSql.trim() != ''">
${param.authSql}
</if>
<if test="param.deptNoList != null">
and a.DEPT_NO in
<foreach collection="param.deptNoList" index="index" item="item" open="(" separator="," close=")">
......@@ -1023,13 +1026,17 @@
<if test="param.endDate != null ">
AND refund.CREATE_TIME <![CDATA[ <= ]]> concat(#{param.endDate}, ' 23:59:59')
</if>
<if test="param.authSql != null and param.authSql.trim() != ''">
${param.authSql}
</if>
<if test="param.deptNoList != null">
and a.DEPT_NO in
<foreach collection="param.deptNoList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
)order by createTime desc
)
order by createTime desc
</select>
</mapper>
......@@ -28,10 +28,9 @@ public interface TOrderMapper extends BaseMapper<TOrder> {
* @author licancan
* @param page
* @param param
* @param userName
* @return {@link IPage<OrderListVO>}
*/
IPage<OrderListVO> getOrderPageList(Page<OrderListParam> page,@Param("param") OrderListParam param,@Param("userName") String userName);
IPage<OrderListVO> getOrderPageList(Page<OrderListParam> page,@Param("param") OrderListParam param);
/**
* 导出勾选查询结果
......
......@@ -8,11 +8,14 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainListVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.OSSUtil;
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.config.DaprUpmsProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.MenuUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.ekp.util.EkpOrderUtil;
......@@ -68,6 +71,8 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
private MenuUtil menuUtil;
@Resource
private ArchivesDaprUtil archivesDaprUtil;
@Resource
private DaprUpmsProperties daprUpmsProperties;
/**
* 订单列表分页查询
......@@ -81,7 +86,20 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
public IPage<OrderListVO> getOrderPageList(Page<OrderListParam> page, OrderListParam param) {
YifuUser user = SecurityUtils.getUser();
menuUtil.setAuthSql(user, param);
IPage<OrderListVO> orderList = baseMapper.getOrderPageList(page,param,user.getUsername());
if (Common.isNotNull(param.getAuthSql()) && param.getAuthSql().contains("#create_name")) {
param.setAuthSql(param.getAuthSql().replace("#create_name", user.getUsername()));
}
if (Common.isNotNull(param.getAuthSql()) && param.getAuthSql().contains("#create_depts")) {
String userIds = "0";
R<String> userIdR = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl()
,daprUpmsProperties.getAppId(),"/user/inner/getUserIdByDeptIds",user.getDeptId()
, String.class, SecurityConstants.FROM_IN);
if (userIdR != null && CommonConstants.SUCCESS == userIdR.getCode()) {
userIds = userIdR.getData();
}
param.setAuthSql(param.getAuthSql().replace("#create_depts", userIds));
}
IPage<OrderListVO> orderList = baseMapper.getOrderPageList(page,param);
return orderList;
}
......
......@@ -38,8 +38,8 @@
a.DEPT_NO as deptNo,
a.ORDER_STATUS as orderStatus
from t_order a
left join t_order_handler h on h.ORDER_NO = a.ORDER_NO
where a.DELETE_FLAG = 0
and #{userName} in (SELECT HANDLE_USER FROM t_order_handler h WHERE h.ORDER_NO = a.ORDER_NO)
<if test="param.orderNo != null and param.orderNo.trim() != ''">
and a.ORDER_NO = #{param.orderNo}
</if>
......
......@@ -20,10 +20,14 @@ package com.yifu.cloud.plus.v1.yifu.salary.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainListVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
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.config.DaprArchivesProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
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;
......@@ -66,6 +70,8 @@ public class TSalaryAccountController {
private final MenuUtil menuUtil;
private final DaprArchivesProperties daprArchivesProperties;
/**
* 简单分页查询
*
......@@ -82,6 +88,37 @@ public class TSalaryAccountController {
return new R<>(tSalaryAccountService.getTSalaryAccountPage(page, tSalaryAccount));
}
/**
* 简单分页查询
*
* @param page 分页对象
* @param tSalaryAccount 工资报账主表(工资条)
* @return
*/
@Operation(description = "简单分页查询")
@GetMapping("/pageOrder")
public R<IPage<TSalaryAccount>> getTSalaryAccountPageOrder(Page<TSalaryAccount> page, TSalaryAccountSearchVo tSalaryAccount) {
tSalaryAccount.setDeleteFlag(CommonConstants.ZERO_INT);
YifuUser user = SecurityUtils.getUser();
String sql;
// 获取人员项目权限
R<TSettleDomainListVo> res = HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl()
, daprArchivesProperties.getAppId(), "/tsettledomain/getSettleDomainIdsByUserId"
, user.getId(), TSettleDomainListVo.class, SecurityConstants.FROM_IN);
StringBuilder deptStr = new StringBuilder();
if (res != null && CommonConstants.SUCCESS == res.getCode()
&& res.getData() != null && res.getData().getDeptIds() != null
&& !res.getData().getDeptIds().isEmpty()) {
for (String deptId : res.getData().getDeptIds()) {
deptStr.append(",'").append(deptId).append("'");
}
}
sql = "and (1=2 or a.dept_id in ('0'#settleDomainId))";
sql = sql.replace("#settleDomainId", deptStr.toString());
tSalaryAccount.setAuthSql(sql);
return new R<>(tSalaryAccountService.getTSalaryAccountPage(page, tSalaryAccount));
}
/**
* 不分页查询
*
......
......@@ -19,11 +19,15 @@ package com.yifu.cloud.plus.v1.yifu.social.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainListVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
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.config.DaprArchivesProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
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.util.SecurityUtils;
......@@ -60,6 +64,8 @@ public class TDispatchInfoController {
private final MenuUtil menuUtil;
private final DaprArchivesProperties daprArchivesProperties;
/**
* 简单分页查询
* @param page 分页对象
......@@ -114,6 +120,44 @@ public class TDispatchInfoController {
return new R<>(tDispatchInfoService.getTDispatchInfoPage(page,tDispatchInfo));
}
/**
* 简单分页查询--申请
* @param page 分页对象
* @param tDispatchInfo 派单信息记录表--申请
* @return
*/
@Operation(description = "简单分页查询--申请")
@GetMapping("/pageApplyOrder")
public R<IPage<TDispatchInfoPageVo>> getTDispatchApplyPageOrder(Page<TDispatchInfo> page, TDispatchInfoSearchVo tDispatchInfo) {
YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(user)) {
return R.failed(CommonConstants.USER_FAIL);
}
tDispatchInfo.setCreateBy(user.getId());
tDispatchInfo.setDeleteFlag(CommonConstants.ZERO_STRING);
String sql;
// 获取人员项目权限
R<TSettleDomainListVo> res = HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl()
, daprArchivesProperties.getAppId(), "/tsettledomain/getSettleDomainIdsByUserId"
, user.getId(), TSettleDomainListVo.class, SecurityConstants.FROM_IN);
StringBuilder deptStr = new StringBuilder();
if (res != null && CommonConstants.SUCCESS == res.getCode()
&& res.getData() != null && res.getData().getDeptIds() != null
&& !res.getData().getDeptIds().isEmpty()) {
for (String deptId : res.getData().getDeptIds()) {
deptStr.append(",'").append(deptId).append("'");
}
}
sql = "and (1=2 or a.dept_id in ('0'#settleDomainId))";
sql = sql.replace("#settleDomainId", deptStr.toString());
tDispatchInfo.setAuthSql(sql);
if (Common.isNotNull(tDispatchInfo.getAuthSql()) && tDispatchInfo.getAuthSql().contains(CommonConstants.A_DEPT_ID)) {
tDispatchInfo.setAuthSql(tDispatchInfo.getAuthSql().replace(CommonConstants.A_DEPT_ID, "a.SETTLE_DOMAIN"));
}
return new R<>(tDispatchInfoService.getTDispatchInfoPage(page, tDispatchInfo));
}
/**
* 简单分页查询--审核
* @param page 分页对象
......
......@@ -564,7 +564,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
executeImportSocialList(user, atomicLine, list, areaMap, areaMap2,
paymentInfoPensionMap, paymentInfoBigMap, paymentInfoBirMap,
paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap,
CommonConstants.ONE_INT, errorMessageList), yfSocialImportThreadPoolExecutor);
errorMessageList), yfSocialImportThreadPoolExecutor);
completableFutureList.add(listCompletableFuture);
}
......@@ -577,7 +577,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
executeImportSocialList(user, atomicLine, finalList, areaMap, areaMap2,
paymentInfoPensionMap, paymentInfoBigMap, paymentInfoBirMap,
paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap,
CommonConstants.ONE_INT, errorMessageList), yfSocialImportThreadPoolExecutor);
errorMessageList), yfSocialImportThreadPoolExecutor);
completableFutureList.add(listCompletableFuture);
lastIdx = 1;
......@@ -587,12 +587,11 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
if (i % partSize == 0) {
lastIdx = i;
List<TPaymentInfoVo> finalTempList = tempList;
final int idx = i - partSize + 2;
CompletableFuture.supplyAsync(() ->
executeImportSocialList(user, atomicLine, finalTempList, areaMap, areaMap2,
paymentInfoPensionMap, paymentInfoBigMap, paymentInfoBirMap,
paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap,
idx, errorMessageList), yfSocialImportThreadPoolExecutor);
errorMessageList), yfSocialImportThreadPoolExecutor);
tempList = new ArrayList<>();
}
}
......@@ -613,12 +612,11 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
List<TPaymentInfoVo> finalTempList = tempList;
int finalLastIdx = lastIdx + 1;
CompletableFuture<List<ErrorMessage>> listCompletableFuture = CompletableFuture.supplyAsync(() ->
executeImportSocialList(user, atomicLine, finalTempList, areaMap, areaMap2,
paymentInfoPensionMap, paymentInfoBigMap, paymentInfoBirMap,
paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap,
finalLastIdx, errorMessageList), yfSocialImportThreadPoolExecutor);
errorMessageList), yfSocialImportThreadPoolExecutor);
completableFutureList.add(listCompletableFuture);
}
......@@ -689,7 +687,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
* @param areaMap
* @param areaMap2
* @param paymentInfoPensionMap
* @param idx
* @description:
* @author: huyc
* @date: 2022/7/25
......@@ -706,13 +703,13 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
ConcurrentHashMap<String, TPaymentInfo> paymentInfoMedicalMap,
ConcurrentHashMap<String, TPaymentInfo> paymentInfoUnEmpMap,
ConcurrentHashMap<String, TPaymentInfo> paymentInfoInjuryMap,
int idx, List<ErrorMessage> errorMessageList) {
int i = idx;
List<ErrorMessage> errorMessageList) {
if (Common.isNotNull(list)) {
TPaymentInfo paymentInfo = null;
TSocialFundInfo socialInfo = null;
TSocialFundInfo socialInfo;
TSocialInfo tSocialInfo;
String temp;
int res = -1;
int res;
List<TSocialFundInfo> socialInfoList = socialFundInfoMapper.selectList(Wrappers.<TSocialFundInfo>query().lambda()
.in(TSocialFundInfo::getEmpIdcard, Common.listObjectToStrList(list, ExcelAttributeConstants.EMPIDCARD)));
......@@ -720,12 +717,12 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
//已存在的社保数据
HashMap<String, TSocialFundInfo> socialMap = new HashMap<>();
if (Common.isNotNull(socialInfoList)) {
for (TSocialFundInfo tSocialInfo : socialInfoList) {
socialMap.put(tSocialInfo.getEmpIdcard()
+ CommonConstants.DOWN_LINE_STRING + tSocialInfo.getSocialProvince()
+ CommonConstants.DOWN_LINE_STRING + tSocialInfo.getSocialCity()
+ CommonConstants.DOWN_LINE_STRING + (null == tSocialInfo.getSocialTown()
? "null" : tSocialInfo.getSocialTown()), tSocialInfo);
for (TSocialFundInfo tSocialInfo1 : socialInfoList) {
socialMap.put(tSocialInfo1.getEmpIdcard()
+ CommonConstants.DOWN_LINE_STRING + tSocialInfo1.getSocialProvince()
+ CommonConstants.DOWN_LINE_STRING + tSocialInfo1.getSocialCity()
+ CommonConstants.DOWN_LINE_STRING + (null == tSocialInfo1.getSocialTown()
? "null" : tSocialInfo1.getSocialTown()), tSocialInfo1);
}
}
......@@ -733,7 +730,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
for (TPaymentInfoVo infoVo : list) {
atomicLine.incrementAndGet();
++i;
if (Common.isNotNull(infoVo.getEmpIdcard())) {
infoVo.setEmpIdcard(infoVo.getEmpIdcard().replace("x", "X"));
}
......@@ -925,11 +921,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "已存在对应员工身份证" + infoVo.getEmpIdcard()
+ "的单位生育缴费数据,请勿重复导入!"));
continue;
} else {
paymentInfo = null;
}
TSocialInfo tSocialInfo = socialInfoMapper.selectOne(Wrappers.<TSocialInfo>query().lambda()
tSocialInfo = socialInfoMapper.selectOne(Wrappers.<TSocialInfo>query().lambda()
.eq(TSocialInfo::getEmpIdcard, infoVo.getEmpIdcard()).groupBy(TSocialInfo::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL));
......
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