Commit 481ed42e authored by huyuchen's avatar huyuchen

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

parents a4091c3b 0b864b12
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.archives.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.time.LocalDateTime;
/**
* 客户数据权限表
*
* @author hgw
* @date 2022-06-20 09:59:17
* @author pwang
* @date 2019-07-19 16:22:22
*/
@Data
@TableName("t_cutsomer_data_permisson")
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("t_cutsomer_data_permisson")
@Schema(description = "客户数据权限表")
public class TCutsomerDataPermisson extends BaseEntity {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private String id;
/**
* 是否是所有者
*/
@Schema(description = "是否是所有者")
private String isOwner;
/**
* 合同主体ID
*/
@Schema(description = "合同主体ID")
private String contractId;
/**
* 客户ID
*/
@Schema(description = "客户ID")
private String customerId;
/**
* 授权来源
*/
@Schema(description = "授权来源")
private String permissonSrc;
/**
* 授权等级
*/
@Schema(description = "授权等级")
private Integer permissonLevel;
/**
* 被授权人
*/
@Schema(description = "被授权人")
private String bePermissonUser;
/**
* 被授权时间
*/
@Schema(description = "被授权时间")
private LocalDateTime bePermissionTime;
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
/**
* 结算主体ID
*/
@Schema(description = "结算主体ID")
private String settleDomainId;
/**
* 被授权的角色
*/
@Schema(description = "被授权的角色")
private String bePermissonRole;
/**
* 被授权的组织机构
*/
@Schema(description = "被授权的组织机构")
private String bePermissonOrgan;
/**
* 授权人
*/
@Schema(description = "授权人")
private String permissionUser;
/**
* 是否客服(0是1否)
*/
@Schema(description = "是否客服(0是1否)")
private String isCustomerService;
/**
* 类型0:客户1:合同2:结算主体
*/
@Schema(description = "类型0:客户1:合同2:结算主体")
private String type;
public class TCutsomerDataPermisson extends Model<TCutsomerDataPermisson> {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键", name = "id")
private String id;
/**
* 是否是数据所有者(0是1否)
*/
@NotBlank(message = "是否是数据所有者(0是1否)不能为空")
@Length(max = 1, message = "是否是数据所有者(0是1否)不能超过1个字符")
@ExcelAttribute(name = "是否是数据所有者(0是1否)", isNotEmpty = true, errorInfo = "是否是数据所有者(0是1否)不能为空", maxLength = 1)
@Schema(description = "是否是数据所有者(0是1否)", name = "isOwner")
private String isOwner;
/**
* 客户id
*/
@Length(max = 32, message = "客户id不能超过32个字符")
@ExcelAttribute(name = "客户id", maxLength = 32)
@Schema(description = "客户id", name = "customerId")
private String customerId;
/**
* 合同主体id
*/
@Length(max = 32, message = "合同主体id不能超过32个字符")
@ExcelAttribute(name = "合同主体id", maxLength = 32)
@Schema(description = "合同主体id", name = "contractId")
private String contractId;
/**
* 结算主体id
*/
@Length(max = 32, message = "结算主体id不能超过32个字符")
@ExcelAttribute(name = "结算主体id", maxLength = 32)
@Schema(description = "结算主体id", name = "settleDomainId")
private String settleDomainId;
/**
* 授权来源
*/
@NotBlank(message = "授权来源不能为空")
@Length(max = 50, message = "授权来源不能超过50个字符")
@ExcelAttribute(name = "授权来源", isNotEmpty = true, errorInfo = "授权来源不能为空", maxLength = 50)
@Schema(description = "授权来源", name = "permissonSrc")
private String permissonSrc;
/**
* 授权等级
*/
@NotBlank(message = "授权等级不能为空")
@ExcelAttribute(name = "授权等级", isNotEmpty = true, errorInfo = "授权等级不能为空")
@Schema(description = "授权等级", name = "permissonLevel")
private Integer permissonLevel;
/**
* 授权人
*/
@NotBlank(message = "授权人不能为空")
@Length(max = 32, message = "授权人不能超过32个字符")
@Schema(description = "授权人", name = "permissionUser")
private String permissionUser;
/**
* 被授权人
*/
@NotBlank(message = "被授权人不能为空")
@Length(max = 32, message = "被授权人不能超过32个字符")
@ExcelAttribute(name = "被授权人", isNotEmpty = true, errorInfo = "被授权人不能为空", maxLength = 32)
@Schema(description = "被授权人", name = "bePermissonUser")
private String bePermissonUser;
/**
* 被授权时间
*/
@NotBlank(message = "被授权时间不能为空")
@ExcelAttribute(name = "被授权时间", isNotEmpty = true, errorInfo = "被授权时间不能为空")
@Schema(description = "被授权时间", name = "bePermissionTime")
private LocalDateTime bePermissionTime;
/**
* 备注
*/
@Length(max = 50, message = "备注不能超过50个字符")
@ExcelAttribute(name = "备注", maxLength = 50)
@Schema(description = "备注", name = "remark")
private String remark;
@Length(max = 1, message = "是否是客服不能超过1个字符")
@Schema(description = "是否是客服(0是1否)", name = "isCustomerService")
private String isCustomerService;
@Schema(description = "类型0:客户1:合同2:结算主体", name = "type")
private String type;
/**
* 无参构造方法
* @Author pwang
* @Date 2019-11-15 12:12
* @param
* @return
**/
public TCutsomerDataPermisson(){
}
}
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TCutsomerDataPermisson;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
/**
* @program: master
* @description: 权限包装类
* @author: pwang
* @create: 2020-06-28 16:26
**/
@Data
@AllArgsConstructor
@Schema(description = "客户数据权限表")
public class TCutsomerDataPermissonVo extends TCutsomerDataPermisson {
@Schema(description = "客户、合同、结算主体名", name = "name")
private String name;
@Schema(description = "授权人姓名", name = "name")
private String permissionUserName;
}
......@@ -72,6 +72,11 @@
<version>5.8.0</version>
<artifactId>hutool-all</artifactId>
</dependency>
<dependency>
<groupId>com.github.abel533</groupId>
<artifactId>mapper</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>
<build>
......
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -22,97 +5,143 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TCutsomerDataPermisson;
import com.yifu.cloud.plus.v1.yifu.archives.service.TCutsomerDataPermissonService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TSettleDomainService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TCutsomerDataPermissonVo;
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.log.annotation.SysLog;
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;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
/**
* 客户数据权限表
*
* @author hgw
* @date 2022-06-20 09:59:17
* @author pwang
* @date 2019-07-19 11:19:53
*/
@RestController
@RequiredArgsConstructor
@AllArgsConstructor
@RequestMapping("/tcutsomerdatapermisson")
@Tag(name = "客户数据权限表管理")
@Tag(name = "客户数据权限表")
public class TCutsomerDataPermissonController {
private final TCutsomerDataPermissonService tCutsomerDataPermissonService;
private final TCutsomerDataPermissonService tCutsomerDataPermissonService;
private final TSettleDomainService settleDomainService;
/**
* 分页查询
*
* @param page 分页对象
* @param tCutsomerDataPermisson 客户数据权限表
* @return
*/
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page")
@PreAuthorize("@pms.hasPermission('demo_tcutsomerdatapermisson_get')")
public R<IPage<TCutsomerDataPermisson>> getTCutsomerDataPermissonPage(Page<TCutsomerDataPermisson> page, TCutsomerDataPermisson tCutsomerDataPermisson) {
return R.ok(tCutsomerDataPermissonService.page(page, Wrappers.query(tCutsomerDataPermisson)));
}
/**
* 简单分页查询
* @param page 分页对象
* @param tCutsomerDataPermisson 客户数据权限表
* @return
*/
@Operation(description = "简单分页查询")
@GetMapping("/page")
public R<IPage<TCutsomerDataPermissonVo>> getTCutsomerDataPermissonPage(Page<TCutsomerDataPermissonVo> page, TCutsomerDataPermissonVo tCutsomerDataPermisson) {
return new R<>(tCutsomerDataPermissonService.getTCutsomerDataPermissonPage(page,tCutsomerDataPermisson));
}
@Operation(description = "获取实体的权限: type-类型0:客户1:合同2:结算主体(不传默认2结算主体)")
@GetMapping("/getPermissonByTypeAndId")
public R<IPage<TCutsomerDataPermisson>> getTCutsomerDataPermissonByTypeAndId(String id, String type) {
if(Common.isEmpty(id)){
return R.failed("实体id");
}
TCutsomerDataPermisson tp = new TCutsomerDataPermisson();
if(CommonConstants.dingleDigitStrArray[0].equals(type)){
tp.setCustomerId(id);
}else if(CommonConstants.dingleDigitStrArray[1].equals(type)){
tp.setContractId(id);
}else{
tp.setSettleDomainId(id);
}
return new R(tCutsomerDataPermissonService.list(Wrappers.lambdaQuery(tp)));
}
/**
*
* @Author pwang
* @Date 2020-03-20 17:42
* @param beUser 要授权的人员组
* @param srcUser 被复制权限人员组
* @return
**/
@Operation(description = "权限复制 权限同结算主体分配客服(wxhr:tsettledomain_assign_customerservice)")
@GetMapping("/copy")
@PreAuthorize("@pms.hasPermission('wxhr:tsettledomain_assign_customerservice')")
public R insertForCopyCutsomerDataPermisson(String[] srcUser, String[] beUser) {
YifuUser user = SecurityUtils.getUser();
R result = tCutsomerDataPermissonService.insertForCopyCutsomerDataPermisson(srcUser, beUser, user);
if(CommonConstants.SUCCESS.equals(result.getCode())){//权限刷新
settleDomainService.removeSettleCache(user, Arrays.asList(beUser));
}
return result ;
}
/**
* 通过id查询客户数据权限表
*
* @param id id
* @return R
*/
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{id}")
@PreAuthorize("@pms.hasPermission('demo_tcutsomerdatapermisson_get')")
public R<TCutsomerDataPermisson> getById(@PathVariable("id") String id) {
return R.ok(tCutsomerDataPermissonService.getById(id));
}
/**
* 通过id查询单条记录
* @param id
* @return R
*/
@Operation(description = "id查询")
@GetMapping("/{id}")
public R<TCutsomerDataPermisson> getById(@PathVariable("id") String id){
return new R<>(tCutsomerDataPermissonService.getById(id));
}
/**
* 新增客户数据权限表
*
* @param tCutsomerDataPermisson 客户数据权限表
* @return R
*/
@Operation(summary = "新增客户数据权限表", description = "新增客户数据权限表")
@SysLog("新增客户数据权限表")
@PostMapping
@PreAuthorize("@pms.hasPermission('demo_tcutsomerdatapermisson_add')")
public R<Boolean> save(@RequestBody TCutsomerDataPermisson tCutsomerDataPermisson) {
return R.ok(tCutsomerDataPermissonService.save(tCutsomerDataPermisson));
}
/**
* 新增记录
* @param tCutsomerDataPermisson
* @return R
*/
@Operation(description = "新增")
@SysLog("新增客户数据权限表")
@PostMapping
@PreAuthorize("@pms.hasPermission('wxhr:tcutsomerdatapermisson_add')")
public R save(@RequestBody TCutsomerDataPermisson tCutsomerDataPermisson){
return new R<>(tCutsomerDataPermissonService.save(tCutsomerDataPermisson));
}
/**
* 修改客户数据权限表
*
* @param tCutsomerDataPermisson 客户数据权限表
* @return R
*/
@Operation(summary = "修改客户数据权限表", description = "修改客户数据权限表")
@SysLog("修改客户数据权限表")
@PutMapping
@PreAuthorize("@pms.hasPermission('demo_tcutsomerdatapermisson_edit')")
public R<Boolean> updateById(@RequestBody TCutsomerDataPermisson tCutsomerDataPermisson) {
return R.ok(tCutsomerDataPermissonService.updateById(tCutsomerDataPermisson));
}
/**
* 修改记录
* @param tCutsomerDataPermisson
* @return R
*/
@Operation(description = "修改")
@SysLog("修改客户数据权限表")
@PutMapping
@PreAuthorize("@pms.hasPermission('wxhr:tcutsomerdatapermisson_edit')")
public R update(@RequestBody TCutsomerDataPermisson tCutsomerDataPermisson){
return new R<>(tCutsomerDataPermissonService.updateById(tCutsomerDataPermisson));
}
/**
* 通过id删除客户数据权限表
*
* @param id id
* @return R
*/
@Operation(summary = "通过id删除客户数据权限表", description = "通过id删除客户数据权限表")
@SysLog("通过id删除客户数据权限表")
@DeleteMapping("/{id}")
@PreAuthorize("@pms.hasPermission('demo_tcutsomerdatapermisson_del')")
public R<Boolean> removeById(@PathVariable String id) {
return R.ok(tCutsomerDataPermissonService.removeById(id));
}
/**
* 通过id删除一条记录
* @param id
* @return R
*/
@Operation(description = "删除(wxhr:tcutsomerdatapermisson_del)")
@SysLog("删除客户数据权限表")
@DeleteMapping("/{id}")
@PreAuthorize("@pms.hasPermission('wxhr:tcutsomerdatapermisson_del')")
public R removeById(@PathVariable String id){
YifuUser user = SecurityUtils.getUser();
TCutsomerDataPermisson tdp = tCutsomerDataPermissonService.getById(id);
if(null == tdp){
return new R<>("权限已删除!");
}
//刷新缓存
settleDomainService.removeSettleCache(user, Arrays.asList(tdp.getBePermissonUser()));
return new R<>(tCutsomerDataPermissonService.removeById(id));
}
}
......@@ -22,14 +22,20 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.service.TSettleDomainService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
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.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;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 结算主体表
......@@ -115,4 +121,22 @@ public class TSettleDomainController {
return R.ok(tSettleDomainService.removeById(id));
}
/**
* 获取登录用户拥有的结算主体信息及单位部分信息
*
* @param
* @return
* @Author fxj
* @Date 2019-08-28
**/
@Operation(description = "获取登录用户拥有的结算主体数据)")
@Inner
@GetMapping("/getSettleDomainIdsByUserId")
public List<String> getSettleDomainIdsByUserId() {
YifuUser user = SecurityUtils.getUser();
if (null == user || null == user.getId()) {
return null;
}
return tSettleDomainService.getSettleDomainIdsByUserId(user.getId());
}
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.archives.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TCutsomerDataPermisson;
import org.apache.ibatis.annotations.Mapper;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TCutsomerDataPermissonVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 客户数据权限表
*
* @author hgw
* @date 2022-06-20 09:59:17
* @author pwang
* @date 2019-07-19 10:39:28
*/
@Mapper
public interface TCutsomerDataPermissonMapper extends BaseMapper<TCutsomerDataPermisson> {
/**
* 分页count
* @Author pwang
* @Date 2020-06-28 15:25
* @param tCutsomerDataPermisson
* @return
**/
long getTCutsomerDataPermissonPageCount( @Param("tCutsomerDataPermisson")TCutsomerDataPermisson tCutsomerDataPermisson);
/**
* 客户数据权限表简单分页查询
* @param tCutsomerDataPermisson 客户数据权限表
* @return
*/
List<TCutsomerDataPermissonVo> getTCutsomerDataPermissonPage(@Param("tCutsomerDataPermisson") TCutsomerDataPermissonVo tCutsomerDataPermisson, @Param("page")Long page, @Param("size")Long size);
String getOwnerIdByIdAndType(@Param("domainId")String domainId, @Param("type")int type);
/**
* 获取当前登录人拥有的所有结算主体权限
* @Author fxj
* @Date 2019-08-26
* @param userId
* @return
**/
List<TCutsomerDataPermisson> selectAllSettleDomainPermissionByUserId(@Param("userId")int userId);
String getCustomerServiceByid(@Param("id")String id);
String getUserByid(@Param("settleId")String settleId);
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.archives.service;
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.TCutsomerDataPermisson;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TCutsomerDataPermissonVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
/**
* 客户数据权限表
*
* @author hgw
* @date 2022-06-20 09:59:17
* @author pwang
* @date 2019-07-19 10:39:28
*/
public interface TCutsomerDataPermissonService extends IService<TCutsomerDataPermisson> {
/**
* 客户数据权限表简单分页查询
* @param tCutsomerDataPermisson 客户数据权限表
* @return
*/
IPage<TCutsomerDataPermissonVo> getTCutsomerDataPermissonPage(Page<TCutsomerDataPermissonVo> page, TCutsomerDataPermissonVo tCutsomerDataPermisson);
/**
* 查询数据所有者id
* @Author pwang
* @Date 2019-07-24 15:31
* @param domainId 实体id
* @param type 实体类型0:单位1:部门2:项目
* @return 返回数据所有者的id串
**/
String findOwnerIdByIdAndType(String domainId,int type);
/**
* 查询数据所有者
* @Author pwang
* @Date 2019-07-24 15:31
* @param domainId 实体id
* @param type 实体类型0:单位1:部门2:项目
* @return 返回数据所有者
**/
YifuUser findOwnerByIdAndType(String domainId, int type);
// /**
// * 获取当前登录人拥有的所有结算主体权限
// * @Author fxj
// * @Date 2019-08-26
// * @param userId
// * @return
// **/
// List<TCutsomerDataPermisson> selectAllSettleDomainPermissionByUserId(int userId);
String getCustomerServiceByid(String id);
/**
* 获取所有有权限的用户
* @Author pwang
* @Date 2019-11-28 14:54
* @param settleId
* @return
**/
String getUserByid(String settleId);
/**
* 权限复制 将srcUserList里面的所有用户权限(表)赋给 beUser 所有人
* @Author pwang
* @Date 2020-03-20 17:50
* @param srcUserList
* @param beUser
* @param user user授权人
* @return
**/
R insertForCopyCutsomerDataPermisson(String[] srcUserList, String[] beUser, YifuUser user);
/**
* 专用方法 不建议调用 存在sql注入风险
* @Author pwang
* @Date 2020-07-02 19:00
* @param sql
* @param beUser
* @param user
* @return
**/
R insertCutsomerDataPermissonBySql(String sql, String beUser, YifuUser user);
}
......@@ -19,6 +19,9 @@ package com.yifu.cloud.plus.v1.yifu.archives.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import java.util.List;
/**
* 结算主体表
......@@ -27,5 +30,15 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
* @date 2022-06-20 10:02:28
*/
public interface TSettleDomainService extends IService<TSettleDomain> {
/**
* 清除userId的结算主体权限缓存
*
* @param user
* @return
* @Author fxj
* @Date 2022-07-11 16:57
**/
void removeSettleCache(YifuUser user, List<String> userId);
List<String> getSettleDomainIdsByUserId(String id);
}
......@@ -162,6 +162,38 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
return R.failed("根据id未找到档案!" + employeeInfo.getId());
}
// 校验手机号:
if (Common.isEmpty(employeeInfo.getEmpPhone())) {
return R.failed("手机号必填!");
} else {
TEmployeeInfo check = new TEmployeeInfo();
check.setDeleteFlag(CommonConstants.STATUS_NORMAL);
check.setEmpPhone(employeeInfo.getEmpPhone());
List<TEmployeeInfo> list = baseMapper.getList(check);
if (list != null && !list.isEmpty()) {
for (TEmployeeInfo e : list) {
if (!e.getEmpIdcard().equals(employeeInfo.getEmpIdcard())) {
return R.failed(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_PHONE_EXIST_ERROR, employeeInfo.getEmpIdcard()));
}
}
}
// 调用校验服务-校验手机号
TCheckMobile checkMobile = new TCheckMobile();
checkMobile.setMobile(employeeInfo.getEmpPhone());
R<TCheckMobile> a = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
, "/tcheckmobile/inner/checkOneMobile", checkMobile, TCheckMobile.class, SecurityConstants.FROM_IN);
if (a != null && a.getData() != null) {
checkMobile = a.getData();
if (checkMobile != null && Common.isNotNull(checkMobile.getStatus())) {
if (!CommonConstants.ONE_STRING.equals(checkMobile.getStatus())) {
return R.failed(checkMobile.getMessage());
}
} else {
return R.failed("校验服务错误,请联系管理员!");
}
}
}
employeeInfo.setUpdateBy(user.getId());
employeeInfo.setUpdateTime(LocalDateTime.now());
......
......@@ -17,12 +17,23 @@
package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TCutsomerDataPermisson;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TCutsomerDataPermissonMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TSettleDomainMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TSettleDomainService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.RedisUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 结算主体表
*
......@@ -32,5 +43,42 @@ import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
public class TSettleDomainServiceImpl extends ServiceImpl<TSettleDomainMapper, TSettleDomain> implements TSettleDomainService {
@Autowired
private RedisUtil redisUtil;
private final TCutsomerDataPermissonMapper permissonMapper;
/**
* @Author fxj
* @Description 清除结算主体缓存
* @Date 17:08 2022/7/11
* @Param
* @return
**/
@Override
public void removeSettleCache(YifuUser user, List<String> userIdList) {
try{
for(String userId : userIdList){
redisUtil.remove(CacheConstants.WXHR_SETTLE_DOMAIN_VOS_BY_USERID +"_"+userId);
}
} catch (Exception e) {
log.error("清除缓存错误:",e);
}
}
@Override
public List<String> getSettleDomainIdsByUserId(String userId) {
List<String> domainIds = new ArrayList<>();
String userKey = CacheConstants.WXHR_SETTLE_DOMAIN_VOS_BY_USERID + "_" + userId;
Object settleDomainVoR = redisUtil.get(userKey);
if (settleDomainVoR != null) {
return (List<String>) settleDomainVoR;
} else {
List<TCutsomerDataPermisson> permissonList = permissonMapper.selectAllSettleDomainPermissionByUserId(Integer.parseInt(userId));
if (Common.isNotNull(permissonList)) {
domainIds = permissonList.stream().map(TCutsomerDataPermisson::getSettleDomainId).collect(Collectors.toList());
redisUtil.set(userKey, domainIds);
}
}
return domainIds;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright (c) 2018-2025, lengleng All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted provided that the following conditions are met:
~
~ Redistributions of source code must retain the above copyright notice,
~ this list of conditions and the following disclaimer.
~ Redistributions in binary form must reproduce the above copyright
~ notice, this list of conditions and the following disclaimer in the
~ documentation and/or other materials provided with the distribution.
~ Neither the name of the yifu4cloud.com developer nor the names of its
~ contributors may be used to endorse or promote products derived from
~ this software without specific prior written permission.
~ Author: lengleng (wangiegie@gmail.com)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.yifu.archives.mapper.TCutsomerDataPermissonMapper">
<resultMap id="tCutsomerDataPermissonMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.TCutsomerDataPermisson">
<id property="id" column="ID"/>
<result property="isOwner" column="IS_OWNER"/>
<result property="contractId" column="CONTRACT_ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="permissonSrc" column="PERMISSON_SRC"/>
<result property="permissonLevel" column="PERMISSON_LEVEL"/>
<result property="bePermissonUser" column="BE_PERMISSON_USER"/>
<result property="bePermissionTime" column="BE_PERMISSION_TIME"/>
<result property="remark" column="REMARK"/>
<result property="settleDomainId" column="SETTLE_DOMAIN_ID"/>
<result property="bePermissonRole" column="BE_PERMISSON_ROLE"/>
<result property="bePermissonOrgan" column="BE_PERMISSON_ORGAN"/>
<result property="permissionUser" column="PERMISSION_USER"/>
<result property="isCustomerService" column="IS_CUSTOMER_SERVICE"/>
<result property="type" column="type"/>
</resultMap>
<resultMap id="tCutsomerDataPermissonMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.TCutsomerDataPermisson">
<id property="id" column="ID"/>
<result property="isOwner" column="IS_OWNER"/>
<result property="contractId" column="CONTRACT_ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="permissonSrc" column="PERMISSON_SRC"/>
<result property="permissonLevel" column="PERMISSON_LEVEL"/>
<result property="permissionUser" column="PERMISSION_USER"/>
<result property="bePermissonUser" column="BE_PERMISSON_USER"/>
<result property="bePermissionTime" column="BE_PERMISSION_TIME"/>
<result property="remark" column="REMARK"/>
<result property="type" column="type"/>
<result property="settleDomainId" column="SETTLE_DOMAIN_ID"/>
</resultMap>
<resultMap id="tCutsomerDataPermissonMapVo" type="com.yifu.cloud.plus.v1.yifu.archives.vo.TCutsomerDataPermissonVo">
<id property="id" column="ID"/>
<result property="isOwner" column="IS_OWNER"/>
<result property="contractId" column="CONTRACT_ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="permissonSrc" column="PERMISSON_SRC"/>
<result property="permissonLevel" column="PERMISSON_LEVEL"/>
<result property="permissionUser" column="PERMISSION_USER"/>
<result property="bePermissonUser" column="BE_PERMISSON_USER"/>
<result property="bePermissionTime" column="BE_PERMISSION_TIME"/>
<result property="remark" column="REMARK"/>
<result property="settleDomainId" column="SETTLE_DOMAIN_ID"/>
<result property="type" column="type"/>
<result property="name" column="name"/>
<result property="permissionUserName" column="nickname"/>
</resultMap>
<sql id="base_column_list">
a.ID,
a.IS_OWNER,
a.CONTRACT_ID,
a.CUSTOMER_ID,
a.PERMISSON_SRC,
a.PERMISSON_LEVEL,
a.PERMISSION_USER,
a.BE_PERMISSON_USER,
a.BE_PERMISSION_TIME,
a.REMARK,
a.SETTLE_DOMAIN_ID,
a.type
</sql>
<sql id="where_getTCutsomerDataPermissonPage">
<if test="tCutsomerDataPermisson.bePermissonUser != null and tCutsomerDataPermisson.bePermissonUser.trim() != ''">
AND a.BE_PERMISSON_USER = #{tCutsomerDataPermisson.bePermissonUser}
</if>
<if test="tCutsomerDataPermisson.type != null and tCutsomerDataPermisson.type.trim() != ''">
AND a.type = #{tCutsomerDataPermisson.type}
</if>
<if test="tCutsomerDataPermisson.name != null and tCutsomerDataPermisson.name.trim() != ''">
AND a.name like '%${tCutsomerDataPermisson.name}%'
</if>
<if test="tCutsomerDataPermisson.id != null and tCutsomerDataPermisson.id.trim() != ''">
AND a.ID = #{tCutsomerDataPermisson.id}
</if>
<if test="tCutsomerDataPermisson.isOwner != null and tCutsomerDataPermisson.isOwner.trim() != ''">
AND a.IS_OWNER = #{tCutsomerDataPermisson.isOwner}
</if>
<if test="tCutsomerDataPermisson.permissonSrc != null and tCutsomerDataPermisson.permissonSrc.trim() != ''">
AND a.PERMISSON_SRC = #{tCutsomerDataPermisson.permissonSrc}
</if>
<if test="tCutsomerDataPermisson.permissonLevel != null and tCutsomerDataPermisson.permissonLevel.trim() != ''">
AND a.PERMISSON_LEVEL = #{tCutsomerDataPermisson.permissonLevel}
</if>
<if test="tCutsomerDataPermisson.permissionUser != null and tCutsomerDataPermisson.permissionUser.trim() != ''">
AND a.PERMISSION_USER = #{tCutsomerDataPermisson.permissionUser}
</if>
<if test="tCutsomerDataPermisson.bePermissionTime != null and tCutsomerDataPermisson.bePermissionTime.trim() != ''">
AND a.BE_PERMISSION_TIME = #{tCutsomerDataPermisson.bePermissionTime}
</if>
<if test="tCutsomerDataPermisson.remark != null and tCutsomerDataPermisson.remark.trim() != ''">
AND a.REMARK = #{tCutsomerDataPermisson.remark}
</if>
</sql>
<select id="getTCutsomerDataPermissonPageCount" resultType="java.lang.Long">
SELECT
count(1)
FROM view_cutsomer_permisson a
where 1=1
<include refid="where_getTCutsomerDataPermissonPage"/>
</select>
<!--查询-->
<select id="getTCutsomerDataPermissonPage" resultMap="tCutsomerDataPermissonMapVo">
SELECT
<include refid="base_column_list"/>
,a.name
,u.nickname
from view_cutsomer_permisson a
left join yifu_cloud.sys_user u on a.PERMISSION_USER = u.user_id
where 1=1
<include refid="where_getTCutsomerDataPermissonPage"/>
ORDER BY a.BE_PERMISSION_TIME DESC
<if test="null != page and null != size">
limit #{page},#{size}
</if>
</select>
<select id="getOwnerIdByIdAndType" resultType="java.lang.String">
SELECT BE_PERMISSON_USER FROM t_cutsomer_data_permisson
WHERE IS_OWNER = '0'
<if test="0==type">
AND CUSTOMER_ID = '${domainId}'
</if>
<if test="1==type">
AND CONTRACT_ID = '${domainId}'
</if>
<if test="2==type">
AND SETTLE_DOMAIN_ID = '${domainId}'
</if>
ORDER BY BE_PERMISSION_TIME ASC
limit 1
</select>
<!-- 获取当前登录人拥有的所有结算主体权限 -->
<select id="selectAllSettleDomainPermissionByUserId" resultMap="tCutsomerDataPermissonMap">
SELECT
<include refid="base_column_list"/>
FROM t_cutsomer_data_permisson
WHERE 1=1
AND SETTLE_DOMAIN_ID IS NOT NULL
AND BE_PERMISSON_USER = '${userId}'
</select>
<select id="getCustomerServiceByid" resultType="java.lang.String">
SELECT
GROUP_CONCAT(distinct BE_PERMISSON_USER )
FROM
t_cutsomer_data_permisson
WHERE
IS_CUSTOMER_SERVICE = '0'
AND SETTLE_DOMAIN_ID = '${id}'
</select>
<select id="getUserByid" resultType="java.lang.String">
SELECT
GROUP_CONCAT(distinct BE_PERMISSON_USER )
FROM
t_cutsomer_data_permisson
WHERE
SETTLE_DOMAIN_ID = '${settleId}'
</select>
</mapper>
......@@ -100,5 +100,9 @@ public interface CacheConstants {
* 区域数据--值
*/
String AREA_VALUE = "area_value:";
/**
* 用户登录的结算主体vo缓存
*/
public static final String WXHR_SETTLE_DOMAIN_VOS_BY_USERID = ServiceNameConstants.ARCHIVES_SERVICE + "_SettleDomainVosByUserId";
}
......@@ -320,4 +320,18 @@ public interface CommonConstants {
// 是否
String IS_CHANGE = "划转";
/**
*是所有者
**/
public static final String IS_OWNER_YES = "0";
/**
*不是所有者
**/
public static final String IS_OWNER_NO = "1";
/**
* 获取登录用户信息失败
**/
public static final String USER_FAIL = "获取登录用户信息失败!";
}
......@@ -41,5 +41,8 @@ public interface ServiceNameConstants {
* provider模块
*/
String PROVIDER_SERVICE = "provider-biz";
/**
* hrms-archives模块
*/
String ARCHIVES_SERVICE = "yifu-archives";
}
package com.yifu.cloud.plus.v1.yifu.common.dapr.util;
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.dapr.config.DaprArchivesProperties;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @Author fxj
* @Date 2022/7/11
* @Description
* @Version 1.0
*/
@Log4j2
@Component
@EnableConfigurationProperties(DaprArchivesProperties.class)
public class SettleDomainUtil {
@Autowired
private DaprArchivesProperties daprArchivesProperties;
public R<List<String>> getSettleDomainIdsByUserId(){
R<List<String>> res = HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl(),daprArchivesProperties.getAppId(),"/tsettledomain/getSettleDomainIdsByUserId","", Object.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(res)){
return R.failed("获取用户项目权限失败!");
}
return res;
}
}
......@@ -7,12 +7,10 @@ import com.yifu.cloud.plus.v1.job.entity.SysScheduleJob;
import com.yifu.cloud.plus.v1.job.service.SysScheduleJobService;
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.util.RedisUtil;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
......
......@@ -10,7 +10,7 @@
<version>1.0.0</version>
</parent>
<artifactId>demo</artifactId>
<artifactId>yifu-social</artifactId>
<packaging>pom</packaging>
<!--项目子模块-->
......
......@@ -17,11 +17,6 @@
<dependencies>
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-check-api</artifactId>
<version>1.0.0</version>
</dependency>
<!-- seata 依赖 -->
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
......@@ -72,6 +67,12 @@
<version>5.8.0</version>
<artifactId>hutool-all</artifactId>
</dependency>
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-social-api</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
......
......@@ -47,7 +47,6 @@ import java.util.List;
@RequiredArgsConstructor
@RequestMapping("/sysbasesetinfo")
@Tag(name = "基数设置表管理")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class SysBaseSetInfoController {
private final SysBaseSetInfoService sysBaseSetInfoService;
......
......@@ -46,7 +46,6 @@ import java.util.List;
@RequiredArgsConstructor
@RequestMapping("/syspayproportion")
@Tag(name = "公积金政策对应的缴费比例表管理")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class SysPayProportionController {
private final SysPayProportionService sysPayProportionService;
......
......@@ -26,10 +26,8 @@ import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialLog;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialLogService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
......@@ -46,7 +44,6 @@ import java.util.List;
@RequiredArgsConstructor
@RequestMapping("/tsociallog")
@Tag(name = "社保变更记录表管理")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class TSocialLogController {
private final TSocialLogService tSocialLogService;
......
......@@ -256,4 +256,17 @@ public class UserController {
public R<Boolean> loginAuthentication(@RequestParam String userName,@RequestParam String password) {
return userService.loginAuthentication(userName,password);
}
/**
* 获取对象基本信息
*
* @param id
* @Author fxj
* @Date 2022-07-11 16:42
**/
@Inner
@GetMapping("/getSimpleUser/{id}")
public SysUser getSimpleUser(@PathVariable Integer id) {
return userService.getById(id);
}
}
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