Commit cbacc555 authored by fangxinjiang's avatar fangxinjiang

Merge branch 'develop'

parents 923768da 6707e587
package com.yifu.cloud.plus.v1.yifu.archives.entity; package com.yifu.cloud.plus.v1.yifu.archives.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.alibaba.excel.annotation.ExcelIgnore;
import com.baomidou.mybatisplus.annotation.TableId; import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableName; import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.baomidou.mybatisplus.extension.activerecord.Model; import com.baomidou.mybatisplus.annotation.*;
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.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
/** /**
* 客户数据权限表 * 客户数据权限表
...@@ -21,106 +22,82 @@ import java.time.LocalDateTime; ...@@ -21,106 +22,82 @@ import java.time.LocalDateTime;
* @date 2019-07-19 16:22:22 * @date 2019-07-19 16:22:22
*/ */
@Data @Data
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("t_cutsomer_data_permisson") @TableName("t_cutsomer_data_permisson")
@Schema(description = "客户数据权限表") @Schema(description = "客户数据权限表")
public class TCutsomerDataPermisson extends Model<TCutsomerDataPermisson> { public class TCutsomerDataPermisson implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID) @TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键", name = "id") @Schema(description = "主键", name = "id")
private String id; private String id;
/**
* 是否是数据所有者(0是1否) @Length(max = 1, message = "状态不能超过1个字符")
*/ @ExcelAttribute(name = "状态", maxLength = 1)
@NotBlank(message = "是否是数据所有者(0是1否)不能为空") @Schema(description = "状态0启用1禁用")
@Length(max = 1, message = "是否是数据所有者(0是1否)不能超过1个字符") private String status;
@ExcelAttribute(name = "是否是数据所有者(0是1否)", isNotEmpty = true, errorInfo = "是否是数据所有者(0是1否)不能为空", maxLength = 1)
@Schema(description = "是否是数据所有者(0是1否)", name = "isOwner") @Length(max = 32, message = "备注不能超过32个字符")
private String isOwner; @ExcelAttribute(name = "备注", maxLength = 32)
/** @Schema(description = "备注")
* 客户id private String remark;
*/
@Length(max = 32, message = "客户id不能超过32个字符") @Length(max = 32, message = "项目id不能超过32个字符")
@ExcelAttribute(name = "客户id", maxLength = 32) @ExcelAttribute(name = "项目id", maxLength = 32)
@Schema(description = "客户id", name = "customerId") @Schema(description = "项目id")
private String customerId; private String settleDomainId;
/**
* 合同主体id @Length(max = 50, message = "项目名称不能超过50个字符")
*/ @ExcelAttribute(name = "项目名称", maxLength = 50)
@Length(max = 32, message = "合同主体id不能超过32个字符") @Schema(description = "项目名称")
@ExcelAttribute(name = "合同主体id", maxLength = 32) private String settleDomainName;
@Schema(description = "合同主体id", name = "contractId")
private String contractId; @Length(max = 32, message = "项目编码不能超过32个字符")
/** @ExcelAttribute(name = "项目编码", maxLength = 32)
* 项目id @Schema(description = "项目编码")
*/ private String settleDomainNo;
@Length(max = 32, message = "项目id不能超过32个字符")
@ExcelAttribute(name = "项目id", maxLength = 32) @Schema(description = "创建人-姓名")
@Schema(description = "项目id", name = "settleDomainId") @TableField(fill = FieldFill.INSERT)
private String settleDomainId; @HeadFontStyle(fontHeightInPoints = 11)
/** @ExcelProperty("创建人")
* 授权来源 private String createName;
*/
@NotBlank(message = "授权来源不能为空") @Schema(description = "创建人")
@Length(max = 50, message = "授权来源不能超过50个字符") @TableField(fill = FieldFill.INSERT)
@ExcelAttribute(name = "授权来源", isNotEmpty = true, errorInfo = "授权来源不能为空", maxLength = 50) @ExcelIgnore
@Schema(description = "授权来源", name = "permissonSrc") private String createBy;
private String permissonSrc;
/** @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
* 授权等级 @Schema(description = "创建时间")
*/ @TableField(fill = FieldFill.INSERT)
@NotBlank(message = "授权等级不能为空") @HeadFontStyle(fontHeightInPoints = 11)
@ExcelAttribute(name = "授权等级", isNotEmpty = true, errorInfo = "授权等级不能为空") @ExcelProperty("创建时间")
@Schema(description = "授权等级", name = "permissonLevel") private LocalDateTime createTime;
private Integer permissonLevel;
/**
* 授权人
*/
@NotBlank(message = "授权人不能为空")
@Length(max = 32, message = "授权人不能超过32个字符")
@Schema(description = "授权人", name = "permissionUser")
private String permissionUser;
/**
* 被授权人
*/
@NotBlank(message = "被授权人不能为空") @NotBlank(message = "被授权人不能为空")
@Length(max = 32, message = "被授权人不能超过32个字符") @Length(max = 32, message = "被授权人不能超过32个字符")
@ExcelAttribute(name = "被授权人", isNotEmpty = true, errorInfo = "被授权人不能为空", maxLength = 32) @ExcelAttribute(name = "被授权人", isNotEmpty = true, errorInfo = "被授权人不能为空", maxLength = 32)
@Schema(description = "被授权人", name = "bePermissonUser") @Schema(description = "被授权人")
private String bePermissonUser; private String userId;
/**
* 被授权时间
*/
@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个字符") @ExcelAttribute(name = "登录名", maxLength = 50)
@Schema(description = "是否是客服(0是1否)", name = "isCustomerService") @Schema(description = "登录名")
private String isCustomerService; private String userLoginName;
@Schema(description = "类型0:客户1:合同2:项目", name = "type") @ExcelAttribute(name = "用户名称", maxLength = 50)
@Schema(description = "用户名称(汉字)")
private String userNickName;
@ExcelAttribute(name = "所在部门", maxLength = 50)
@Schema(description = "所在部门")
private String userDeptName;
@ExcelIgnore
@Schema(description = "授权来源0ekp,1mvp,2mvp复制")
private String type; private String type;
/**
* 无参构造方法 @TableField(exist = false)
* @Author pwang @ExcelIgnore
* @Date 2019-11-15 12:12 @Schema(description = "导出选中的行id数组")
* @param private List<String> idList;
* @return
**/
public TCutsomerDataPermisson(){
}
} }
...@@ -144,9 +144,9 @@ public class TEmployeeProject extends BaseEntity { ...@@ -144,9 +144,9 @@ public class TEmployeeProject extends BaseEntity {
private Integer isLeaveEmployee; private Integer isLeaveEmployee;
/** /**
* 已产生未结算费用 0:划转 1:不划转 * 已产生未结算费用 0:不划转 1:划转
*/ */
@Schema(description ="已产生未结算费用(0:划转 1:不划转)") @Schema(description ="已产生未结算费用(0:不划转 1:划转)")
@TableField(exist = false) @TableField(exist = false)
private String unsettleDeal; private String unsettleDeal;
......
...@@ -71,7 +71,7 @@ public class EmployeeXProjectVO extends RowIndex implements Serializable { ...@@ -71,7 +71,7 @@ public class EmployeeXProjectVO extends RowIndex implements Serializable {
@HeadFontStyle(fontHeightInPoints = 11) @HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value ="减项原因") @ExcelProperty(value ="减项原因")
@NotNull(message = "减项原因不能为空") @NotNull(message = "减项原因不能为空")
@ExcelAttribute(name = "减项原因",isNotEmpty = true, errorInfo = "减项原因不能为空",maxLength = 100,isDataId = true,dataType = "reduce_project_reason") @ExcelAttribute(name = "减项原因",isNotEmpty = true, errorInfo = "减项原因不能为空",maxLength = 100,isDataId = true,dataType = "social_reduce_reason")
private String leaveReason; private String leaveReason;
/** /**
......
...@@ -78,7 +78,6 @@ public class TEmpChangeInfoVO implements Serializable { ...@@ -78,7 +78,6 @@ public class TEmpChangeInfoVO implements Serializable {
*/ */
@HeadFontStyle(fontHeightInPoints = 11) @HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value ="已产生未结算费用") @ExcelProperty(value ="已产生未结算费用")
@NotNull(message = "已产生未结算费用不能为空")
private String unsettleDeal; private String unsettleDeal;
/** /**
......
...@@ -6,9 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -6,9 +6,7 @@ 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.entity.TCutsomerDataPermisson;
import com.yifu.cloud.plus.v1.yifu.archives.service.TCutsomerDataPermissonService; 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.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.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.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser; 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.log.annotation.SysLog;
...@@ -16,10 +14,10 @@ import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils; ...@@ -16,10 +14,10 @@ import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
/** /**
...@@ -45,9 +43,21 @@ public class TCutsomerDataPermissonController { ...@@ -45,9 +43,21 @@ public class TCutsomerDataPermissonController {
*/ */
@Operation(description = "简单分页查询") @Operation(description = "简单分页查询")
@GetMapping("/page") @GetMapping("/page")
public R<IPage<TCutsomerDataPermissonVo>> getTCutsomerDataPermissonPage(Page<TCutsomerDataPermissonVo> page, TCutsomerDataPermissonVo tCutsomerDataPermisson) { public R<IPage<TCutsomerDataPermisson>> getTCutsomerDataPermissonPage(Page<TCutsomerDataPermisson> page, TCutsomerDataPermisson tCutsomerDataPermisson) {
return new R<>(tCutsomerDataPermissonService.getTCutsomerDataPermissonPage(page,tCutsomerDataPermisson)); return new R<>(tCutsomerDataPermissonService.getTCutsomerDataPermissonPage(page,tCutsomerDataPermisson));
} }
/**
* 导出list
* @param tCutsomerDataPermisson 客户数据权限表
* @return
*/
@Operation(description = "导出的list")
@GetMapping("/getList")
public R<List<TCutsomerDataPermisson>> getTCutsomerDataPermissonList(TCutsomerDataPermisson tCutsomerDataPermisson) {
return new R<>(tCutsomerDataPermissonService.getTCutsomerDataPermissonList(tCutsomerDataPermisson));
}
/** /**
* @Author fxj * @Author fxj
* @Description 获取实体的权限: type-类型0:客户1:合同2:项目(不传默认2项目) * @Description 获取实体的权限: type-类型0:客户1:合同2:项目(不传默认2项目)
...@@ -55,21 +65,11 @@ public class TCutsomerDataPermissonController { ...@@ -55,21 +65,11 @@ public class TCutsomerDataPermissonController {
* @Param * @Param
* @return * @return
**/ **/
@Operation(description = "获取实体的权限: type-类型0:客户1:合同2:项目(不传默认2项目)") @Operation(description = "获取实体的权限:默认项目")
@GetMapping("/getPermissonByTypeAndId") @GetMapping("/getPermissonByTypeAndId")
public R<IPage<TCutsomerDataPermisson>> getTCutsomerDataPermissonByTypeAndId(String id, String type) { public R<IPage<TCutsomerDataPermisson>> getTCutsomerDataPermissonByTypeAndId(@RequestParam String settleDomainId) {
if(Common.isEmpty(id)){
return R.failed("实体id");
}
TCutsomerDataPermisson tp = new TCutsomerDataPermisson(); TCutsomerDataPermisson tp = new TCutsomerDataPermisson();
tp.setSettleDomainId(settleDomainId);
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))); return new R(tCutsomerDataPermissonService.list(Wrappers.lambdaQuery(tp)));
} }
...@@ -82,8 +82,8 @@ public class TCutsomerDataPermissonController { ...@@ -82,8 +82,8 @@ public class TCutsomerDataPermissonController {
**/ **/
@Operation(description = "权限复制 权限同项目分配客服(wxhr:tsettledomain_assign_customerservice)") @Operation(description = "权限复制 权限同项目分配客服(wxhr:tsettledomain_assign_customerservice)")
@GetMapping("/copy") @GetMapping("/copy")
@PreAuthorize("@pms.hasPermission('wxhr:tsettledomain_assign_customerservice')") //@PreAuthorize("@pms.hasPermission('tsettledomain_assign_customerservice')")
public R insertForCopyCutsomerDataPermisson(String[] srcUser, String[] beUser) { public R<String> insertForCopyCutsomerDataPermisson(String[] srcUser, String[] beUser) {
YifuUser user = SecurityUtils.getUser(); YifuUser user = SecurityUtils.getUser();
R result = tCutsomerDataPermissonService.insertForCopyCutsomerDataPermisson(srcUser, beUser, user); R result = tCutsomerDataPermissonService.insertForCopyCutsomerDataPermisson(srcUser, beUser, user);
if(CommonConstants.SUCCESS.equals(result.getCode())){//权限刷新 if(CommonConstants.SUCCESS.equals(result.getCode())){//权限刷新
...@@ -111,8 +111,10 @@ public class TCutsomerDataPermissonController { ...@@ -111,8 +111,10 @@ public class TCutsomerDataPermissonController {
@Operation(description = "新增") @Operation(description = "新增")
@SysLog("新增客户数据权限表") @SysLog("新增客户数据权限表")
@PostMapping @PostMapping
@PreAuthorize("@pms.hasPermission('wxhr:tcutsomerdatapermisson_add')") //@PreAuthorize("@pms.hasPermission('tcutsomerdatapermisson_add')")
public R save(@RequestBody TCutsomerDataPermisson tCutsomerDataPermisson){ public R<Boolean> save(@RequestBody TCutsomerDataPermisson tCutsomerDataPermisson){
YifuUser user = SecurityUtils.getUser();
settleDomainService.removeSettleCache(user, Arrays.asList(tCutsomerDataPermisson.getUserId()));
return new R<>(tCutsomerDataPermissonService.save(tCutsomerDataPermisson)); return new R<>(tCutsomerDataPermissonService.save(tCutsomerDataPermisson));
} }
...@@ -124,8 +126,10 @@ public class TCutsomerDataPermissonController { ...@@ -124,8 +126,10 @@ public class TCutsomerDataPermissonController {
@Operation(description = "修改") @Operation(description = "修改")
@SysLog("修改客户数据权限表") @SysLog("修改客户数据权限表")
@PutMapping @PutMapping
@PreAuthorize("@pms.hasPermission('wxhr:tcutsomerdatapermisson_edit')") //@PreAuthorize("@pms.hasPermission('tcutsomerdatapermisson_edit')")
public R update(@RequestBody TCutsomerDataPermisson tCutsomerDataPermisson){ public R<Boolean> update(@RequestBody TCutsomerDataPermisson tCutsomerDataPermisson) {
YifuUser user = SecurityUtils.getUser();
settleDomainService.removeSettleCache(user, Arrays.asList(tCutsomerDataPermisson.getUserId()));
return new R<>(tCutsomerDataPermissonService.updateById(tCutsomerDataPermisson)); return new R<>(tCutsomerDataPermissonService.updateById(tCutsomerDataPermisson));
} }
...@@ -134,18 +138,18 @@ public class TCutsomerDataPermissonController { ...@@ -134,18 +138,18 @@ public class TCutsomerDataPermissonController {
* @param id * @param id
* @return R * @return R
*/ */
@Operation(description = "删除(wxhr:tcutsomerdatapermisson_del)") @Operation(description = "删除(tcutsomerdatapermisson_del)")
@SysLog("删除客户数据权限表") @SysLog("删除客户数据权限表")
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
@PreAuthorize("@pms.hasPermission('wxhr:tcutsomerdatapermisson_del')") //@PreAuthorize("@pms.hasPermission('tcutsomerdatapermisson_del')")
public R removeById(@PathVariable String id){ public R<Boolean> removeById(@PathVariable String id){
YifuUser user = SecurityUtils.getUser(); YifuUser user = SecurityUtils.getUser();
TCutsomerDataPermisson tdp = tCutsomerDataPermissonService.getById(id); TCutsomerDataPermisson tdp = tCutsomerDataPermissonService.getById(id);
if(null == tdp){ if(null == tdp){
return new R<>("权限已删除!"); return new R<>(true);
} }
//刷新缓存 //刷新缓存
settleDomainService.removeSettleCache(user, Arrays.asList(tdp.getBePermissonUser())); settleDomainService.removeSettleCache(user, Arrays.asList(tdp.getUserId()));
return new R<>(tCutsomerDataPermissonService.removeById(id)); return new R<>(tCutsomerDataPermissonService.removeById(id));
} }
......
package com.yifu.cloud.plus.v1.yifu.archives.mapper; package com.yifu.cloud.plus.v1.yifu.archives.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; 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.TCutsomerDataPermisson; import com.yifu.cloud.plus.v1.yifu.archives.entity.TCutsomerDataPermisson;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TCutsomerDataPermissonVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -16,24 +17,16 @@ import java.util.List; ...@@ -16,24 +17,16 @@ import java.util.List;
*/ */
@Mapper @Mapper
public interface TCutsomerDataPermissonMapper extends BaseMapper<TCutsomerDataPermisson> { 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 客户数据权限表 * @param tCutsomerDataPermisson 客户数据权限表
* @return * @return
*/ */
List<TCutsomerDataPermissonVo> getTCutsomerDataPermissonPage(@Param("tCutsomerDataPermisson") TCutsomerDataPermissonVo tCutsomerDataPermisson, @Param("page")Long page, @Param("size")Long size); IPage<TCutsomerDataPermisson> getTCutsomerDataPermissonPage(
Page<TCutsomerDataPermisson> page, @Param("tCutsomerDataPermisson") TCutsomerDataPermisson tCutsomerDataPermisson);
String getOwnerIdByIdAndType(@Param("domainId")String domainId, @Param("type")int type); List<TCutsomerDataPermisson> getTCutsomerDataPermissonPage(@Param("tCutsomerDataPermisson") TCutsomerDataPermisson tCutsomerDataPermisson);
/** /**
* 获取当前登录人拥有的所有项目权限 * 获取当前登录人拥有的所有项目权限
...@@ -43,8 +36,4 @@ public interface TCutsomerDataPermissonMapper extends BaseMapper<TCutsomerDataPe ...@@ -43,8 +36,4 @@ public interface TCutsomerDataPermissonMapper extends BaseMapper<TCutsomerDataPe
* @return * @return
**/ **/
List<TCutsomerDataPermisson> selectAllSettleDomainPermissionByUserId(@Param("userId")String userId); List<TCutsomerDataPermisson> selectAllSettleDomainPermissionByUserId(@Param("userId")String userId);
String getCustomerServiceByid(@Param("id")String id);
String getUserByid(@Param("settleId")String settleId);
} }
...@@ -4,10 +4,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -4,10 +4,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; 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.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.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser; import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import java.util.List;
/** /**
* 客户数据权限表 * 客户数据权限表
* *
...@@ -21,44 +22,17 @@ public interface TCutsomerDataPermissonService extends IService<TCutsomerDataPer ...@@ -21,44 +22,17 @@ public interface TCutsomerDataPermissonService extends IService<TCutsomerDataPer
* @param tCutsomerDataPermisson 客户数据权限表 * @param tCutsomerDataPermisson 客户数据权限表
* @return * @return
*/ */
IPage<TCutsomerDataPermissonVo> getTCutsomerDataPermissonPage(Page<TCutsomerDataPermissonVo> page, TCutsomerDataPermissonVo tCutsomerDataPermisson); IPage<TCutsomerDataPermisson> getTCutsomerDataPermissonPage(Page<TCutsomerDataPermisson> page, TCutsomerDataPermisson 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);
/** /**
* 获取所有有权限的用户 * @param tCutsomerDataPermisson
* @Author pwang * @Description: 导出获取list
* @Date 2019-11-28 14:54 * @Author: hgw
* @param settleId * @Date: 2022/10/26 17:23
* @return * @return: java.util.List<com.yifu.cloud.plus.v1.yifu.archives.entity.TCutsomerDataPermisson>
**/ **/
String getUserByid(String settleId); List<TCutsomerDataPermisson> getTCutsomerDataPermissonList(TCutsomerDataPermisson tCutsomerDataPermisson);
/** /**
* 权限复制 将srcUserList里面的所有用户权限(表)赋给 beUser 所有人 * 权限复制 将srcUserList里面的所有用户权限(表)赋给 beUser 所有人
* @Author pwang * @Author pwang
...@@ -68,15 +42,5 @@ public interface TCutsomerDataPermissonService extends IService<TCutsomerDataPer ...@@ -68,15 +42,5 @@ public interface TCutsomerDataPermissonService extends IService<TCutsomerDataPer
* @param user user授权人 * @param user user授权人
* @return * @return
**/ **/
R insertForCopyCutsomerDataPermisson(String[] srcUserList, String[] beUser, YifuUser user); R<String> 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);
} }
...@@ -165,7 +165,7 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper, ...@@ -165,7 +165,7 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
} }
errorMsg = new HashSet<>(); errorMsg = new HashSet<>();
TEmpChangeInfoVO excel = excelVOList.get(i); TEmpChangeInfoVO excel = excelVOList.get(i);
excel.setUnsettleDeal(CommonConstants.IS_NO_CHANGE);
if (Common.isNotNull(excel.getChangeStartMonth()) && excel.getChangeStartMonth().length() > CommonConstants.dingleDigitIntArray[6]) { if (Common.isNotNull(excel.getChangeStartMonth()) && excel.getChangeStartMonth().length() > CommonConstants.dingleDigitIntArray[6]) {
errorMsg.add("划转起始月长度不能超过6位"); errorMsg.add("划转起始月长度不能超过6位");
} }
...@@ -227,7 +227,7 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper, ...@@ -227,7 +227,7 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
updateTEmployeePro.setUnitName(tCustomerInfo.getCustomerName()); updateTEmployeePro.setUnitName(tCustomerInfo.getCustomerName());
} }
updateTEmployeePro.setChangeStartMonth(excel.getChangeStartMonth()); updateTEmployeePro.setChangeStartMonth(excel.getChangeStartMonth());
updateTEmployeePro.setUnsettleDeal(excel.getUnsettleDeal()); updateTEmployeePro.setUnsettleDeal(CommonConstants.IS_NO_CHANGE);
updateList.add(updateTEmployeePro); updateList.add(updateTEmployeePro);
// 记录变更日志 // 记录变更日志
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", tEmployeeProjectOld.getId(), tEmployeeProjectOld, updateTEmployeePro); tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", tEmployeeProjectOld.getId(), tEmployeeProjectOld, updateTEmployeePro);
......
...@@ -2167,7 +2167,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -2167,7 +2167,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
c.setAuditTimeLast(LocalDateTime.now()); c.setAuditTimeLast(LocalDateTime.now());
contractAudit.setAuditStatus("审核通过"); contractAudit.setAuditStatus("审核通过");
contractAudit.setRemark("派单审核通过,同步审核通过合同"); contractAudit.setRemark("派单审核通过,同步审核通过合同");
contractAudit.setRootName("合同审核-派单审核通过"); contractAudit.setRootName("合同审核");
contractServicer.updateInUseStatusById(c.getEmpId(),c.getDeptNo(),c.getId()); contractServicer.updateInUseStatusById(c.getEmpId(),c.getDeptNo(),c.getId());
//审核不同 //审核不同
}else if (CommonConstants.ONE_STRING.equals(vo.getType())){ }else if (CommonConstants.ONE_STRING.equals(vo.getType())){
...@@ -2175,7 +2175,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -2175,7 +2175,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
c.setInUse(CommonConstants.ONE_STRING); c.setInUse(CommonConstants.ONE_STRING);
contractAudit.setAuditStatus("审核不通过"); contractAudit.setAuditStatus("审核不通过");
contractAudit.setRemark("派单审核不通过,同步审核不通过合同"); contractAudit.setRemark("派单审核不通过,同步审核不通过合同");
contractAudit.setRootName("合同审核-派单审核不通过"); contractAudit.setRootName("合同审核");
} }
contractAuditMapper.insert(contractAudit); contractAuditMapper.insert(contractAudit);
contractServicer.updateById(c); contractServicer.updateById(c);
......
...@@ -600,7 +600,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -600,7 +600,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (dictMap == null) { if (dictMap == null) {
return R.failed("获取字典失败!!"); return R.failed("获取字典失败!!");
} }
empReduceMap = dictMap.get("reduce_project_reason"); empReduceMap = dictMap.get("social_reduce_reason");
} }
String leaveReason = ""; String leaveReason = "";
......
...@@ -21,8 +21,10 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; ...@@ -21,8 +21,10 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea; import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AllUserNaVo; import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AllUserNaVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo; import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysUserListVo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TCutsomerDataPermisson; 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.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TCutsomerDataPermissonMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TCutsomerDataPermissonMapper;
...@@ -169,11 +171,11 @@ public class TSettleDomainServiceImpl extends ServiceImpl<TSettleDomainMapper, T ...@@ -169,11 +171,11 @@ public class TSettleDomainServiceImpl extends ServiceImpl<TSettleDomainMapper, T
} }
// 处理服务团队数据权限 2022-09-19 fxj // 处理服务团队数据权限 2022-09-19 fxj
if (Common.isNotNull(tSettleDomain.getServiceTeam())){ if (Common.isNotNull(tSettleDomain.getServiceTeam())){
R<AllUserNaVo> res = upmsDaprUtils.getUserIdsByUserNames(tSettleDomain.getServiceTeam()); R<SysUserListVo> res = upmsDaprUtils.getUserIdsByUserNames(tSettleDomain.getServiceTeam());
if (Common.isNotNull(res) && Common.isNotNull(res.getData()) && Common.isNotNull(res.getData().getUserIds())){ if (Common.isNotNull(res) && Common.isNotNull(res.getData()) && Common.isNotNull(res.getData().getUserList())){
// 先清理缓存 // 先清理缓存
this.removeSettleCache(null,res.getData().getUserIds()); this.removeSettleCache(null,res.getData().getUserIds());
saveForEkp(res.getData().getUserIds(),tSettleDomain.getId()); saveForEkp(res.getData().getUserList(), tSettleDomain);
} }
} }
tSettleDomain.setDeleteFlag(CommonConstants.ZERO_STRING); tSettleDomain.setDeleteFlag(CommonConstants.ZERO_STRING);
...@@ -206,25 +208,28 @@ public class TSettleDomainServiceImpl extends ServiceImpl<TSettleDomainMapper, T ...@@ -206,25 +208,28 @@ public class TSettleDomainServiceImpl extends ServiceImpl<TSettleDomainMapper, T
* @Param * @Param
* @return * @return
**/ **/
public boolean saveForEkp(List<String> userIds, String domainId){ public boolean saveForEkp(List<SysUser> userIds, TSettleDomain domain){
// 1. 先清除现有的这些的项目权限 // 1. 先清除现有的这些的项目权限
permissonMapper.delete(Wrappers.<TCutsomerDataPermisson>query().lambda() permissonMapper.delete(Wrappers.<TCutsomerDataPermisson>query().lambda()
.in(TCutsomerDataPermisson::getBePermissonUser,userIds) .in(TCutsomerDataPermisson::getUserId,userIds)
.eq(TCutsomerDataPermisson::getSettleDomainId,domainId)); .eq(TCutsomerDataPermisson::getSettleDomainId,domain.getId()));
// 2.新增新的项目人员权限 // 2.新增新的项目人员权限
TCutsomerDataPermisson pm; TCutsomerDataPermisson pm;
if (Common.isNotNull(userIds)){ if (Common.isNotNull(userIds)) {
for (String uId:userIds){ for (SysUser user : userIds){
pm = new TCutsomerDataPermisson(); pm = new TCutsomerDataPermisson();
pm.setIsCustomerService(CommonConstants.ZERO_STRING); pm.setStatus(CommonConstants.ZERO_STRING);
pm.setIsOwner(CommonConstants.ONE_STRING); pm.setUserId(user.getUserId());
pm.setPermissonSrc("EKP服务团队"); pm.setUserLoginName(user.getUsername());
pm.setPermissonLevel(CommonConstants.ONE_INT); pm.setUserNickName(user.getNickname());
pm.setBePermissonUser(uId); pm.setUserDeptName(user.getDeptName());
pm.setBePermissionTime(LocalDateTime.now()); pm.setCreateTime(LocalDateTime.now());
pm.setSettleDomainId(domainId); pm.setSettleDomainId(domain.getId());
pm.setPermissionUser(CommonConstants.ONE_STRING); pm.setSettleDomainName(domain.getDepartName());
pm.setType(CommonConstants.TWO_STRING); pm.setSettleDomainNo(domain.getDepartNo());
pm.setCreateBy(CommonConstants.ONE_STRING);
pm.setCreateName("EKP同步");
pm.setType(CommonConstants.ZERO_STRING);
permissonMapper.insert(pm); permissonMapper.insert(pm);
} }
} }
......
...@@ -6,145 +6,78 @@ ...@@ -6,145 +6,78 @@
<resultMap id="tCutsomerDataPermissonMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.TCutsomerDataPermisson"> <resultMap id="tCutsomerDataPermissonMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.TCutsomerDataPermisson">
<id property="id" column="ID"/> <id property="id" column="ID"/>
<result property="isOwner" column="IS_OWNER"/> <result property="status" column="STATUS"/>
<result property="contractId" column="CONTRACT_ID"/> <result property="createBy" column="CREATE_BY"/>
<result property="customerId" column="CUSTOMER_ID"/> <result property="createName" column="CREATE_NAME"/>
<result property="permissonSrc" column="PERMISSON_SRC"/> <result property="createTime" column="CREATE_TIME"/>
<result property="permissonLevel" column="PERMISSON_LEVEL"/> <result property="userId" column="USER_ID"/>
<result property="permissionUser" column="PERMISSION_USER"/> <result property="userLoginName" column="USER_LOGIN_NAME"/>
<result property="bePermissonUser" column="BE_PERMISSON_USER"/> <result property="userNickName" column="USER_NICK_NAME"/>
<result property="bePermissionTime" column="BE_PERMISSION_TIME"/> <result property="userDeptName" column="USER_DEPT_NAME"/>
<result property="remark" column="REMARK"/> <result property="remark" column="REMARK"/>
<result property="type" column="type"/> <result property="type" column="type"/>
<result property="settleDomainId" column="SETTLE_DOMAIN_ID"/> <result property="settleDomainId" column="SETTLE_DOMAIN_ID"/>
</resultMap> <result property="settleDomainName" column="SETTLE_DOMAIN_NAME"/>
<resultMap id="tCutsomerDataPermissonMapVo" type="com.yifu.cloud.plus.v1.yifu.archives.vo.TCutsomerDataPermissonVo"> <result property="settleDomainNo" column="SETTLE_DOMAIN_NO"/>
<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> </resultMap>
<sql id="base_column_list"> <sql id="base_column_list">
a.ID, a.ID
a.IS_OWNER, ,a.STATUS
a.CONTRACT_ID, ,a.REMARK
a.CUSTOMER_ID, ,a.SETTLE_DOMAIN_ID
a.PERMISSON_SRC, ,a.CREATE_BY
a.PERMISSON_LEVEL, ,a.CREATE_NAME
a.PERMISSION_USER, ,a.CREATE_TIME
a.BE_PERMISSON_USER, ,a.USER_ID
a.BE_PERMISSION_TIME, ,a.USER_LOGIN_NAME
a.REMARK, ,a.USER_NICK_NAME
a.SETTLE_DOMAIN_ID, ,a.USER_DEPT_NAME
a.type ,a.TYPE
</sql> ,a.SETTLE_DOMAIN_NAME
,a.SETTLE_DOMAIN_NO
</sql>
<sql id="where_getTCutsomerDataPermissonPage"> <sql id="where_getTCutsomerDataPermissonPage">
<if test="tCutsomerDataPermisson.bePermissonUser != null and tCutsomerDataPermisson.bePermissonUser.trim() != ''"> <if test="tCutsomerDataPermisson != null">
AND a.BE_PERMISSON_USER = #{tCutsomerDataPermisson.bePermissonUser} <if test="tCutsomerDataPermisson.idList != null">
</if> AND a.id in
<if test="tCutsomerDataPermisson.type != null and tCutsomerDataPermisson.type.trim() != ''"> <foreach item="idStr" index="index" collection="tCutsomerDataPermisson.idList" open="(" separator="," close=")">
AND a.type = #{tCutsomerDataPermisson.type} #{idStr}
</if> </foreach>
<if test="tCutsomerDataPermisson.name != null and tCutsomerDataPermisson.name.trim() != ''"> </if>
AND a.name like '%${tCutsomerDataPermisson.name}%' <if test="tCutsomerDataPermisson.userNickName != null and tCutsomerDataPermisson.userNickName.trim() != ''">
</if> AND a.USER_NICK_NAME like concat('%',#{tCutsomerDataPermisson.userNickName},'%')
<if test="tCutsomerDataPermisson.id != null and tCutsomerDataPermisson.id.trim() != ''"> </if>
AND a.ID = #{tCutsomerDataPermisson.id} <if test="tCutsomerDataPermisson.userLoginName != null and tCutsomerDataPermisson.userLoginName.trim() != ''">
</if> AND a.USER_LOGIN_NAME like concat('%',#{tCutsomerDataPermisson.userLoginName},'%')
<if test="tCutsomerDataPermisson.isOwner != null and tCutsomerDataPermisson.isOwner.trim() != ''"> </if>
AND a.IS_OWNER = #{tCutsomerDataPermisson.isOwner} <if test="tCutsomerDataPermisson.userDeptName != null and tCutsomerDataPermisson.userDeptName.trim() != ''">
</if> AND a.USER_DEPT_NAME like concat('%',#{tCutsomerDataPermisson.userDeptName},'%')
<if test="tCutsomerDataPermisson.permissonSrc != null and tCutsomerDataPermisson.permissonSrc.trim() != ''"> </if>
AND a.PERMISSON_SRC = #{tCutsomerDataPermisson.permissonSrc} <if test="tCutsomerDataPermisson.status != null and tCutsomerDataPermisson.status.trim() != ''">
</if> AND a.STATUS = #{tCutsomerDataPermisson.status}
<if test="tCutsomerDataPermisson.permissonLevel != null and tCutsomerDataPermisson.permissonLevel.trim() != ''"> </if>
AND a.PERMISSON_LEVEL = #{tCutsomerDataPermisson.permissonLevel} <if test="tCutsomerDataPermisson.settleDomainName != null and tCutsomerDataPermisson.settleDomainName.trim() != ''">
</if> AND a.SETTLE_DOMAIN_NAME like '%${tCutsomerDataPermisson.settleDomainName}%'
<if test="tCutsomerDataPermisson.permissionUser != null and tCutsomerDataPermisson.permissionUser.trim() != ''"> </if>
AND a.PERMISSION_USER = #{tCutsomerDataPermisson.permissionUser} <if test="tCutsomerDataPermisson.settleDomainNo != null and tCutsomerDataPermisson.settleDomainNo.trim() != ''">
</if> AND a.SETTLE_DOMAIN_NO like '%${tCutsomerDataPermisson.settleDomainNo}%'
<if test="tCutsomerDataPermisson.bePermissionTime != null and tCutsomerDataPermisson.bePermissionTime.trim() != ''"> </if>
AND a.BE_PERMISSION_TIME = #{tCutsomerDataPermisson.bePermissionTime} </if>
</if>
<if test="tCutsomerDataPermisson.remark != null and tCutsomerDataPermisson.remark.trim() != ''">
AND a.REMARK = #{tCutsomerDataPermisson.remark}
</if>
</sql> </sql>
<select id="getTCutsomerDataPermissonPageCount" resultType="java.lang.Long"> <!--分页查询-->
SELECT <select id="getTCutsomerDataPermissonPage" resultMap="tCutsomerDataPermissonMap">
count(1)
FROM view_cutsomer_permisson a
where 1=1
<include refid="where_getTCutsomerDataPermissonPage"/>
</select>
<!--查询-->
<select id="getTCutsomerDataPermissonPage" resultMap="tCutsomerDataPermissonMapVo">
SELECT SELECT
<include refid="base_column_list"/> <include refid="base_column_list"/>
,a.name from t_cutsomer_data_permisson a
,u.nickname
from view_cutsomer_permisson a
left join yifu_cloud.sys_user u on a.PERMISSION_USER = u.user_id
where 1=1 where 1=1
<include refid="where_getTCutsomerDataPermissonPage"/> <include refid="where_getTCutsomerDataPermissonPage"/>
ORDER BY a.BE_PERMISSION_TIME DESC ORDER BY a.CREATE_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>
<!-- 获取当前登录人拥有的所有项目权限 --> <!-- 获取当前登录人拥有的所有项目权限 -->
<select id="selectAllSettleDomainPermissionByUserId" resultMap="tCutsomerDataPermissonMap"> <select id="selectAllSettleDomainPermissionByUserId" resultMap="tCutsomerDataPermissonMap">
SELECT SELECT
<include refid="base_column_list"/> <include refid="base_column_list"/>
FROM t_cutsomer_data_permisson a FROM t_cutsomer_data_permisson a
WHERE 1=1 WHERE a.STATUS = '0' and a.USER_ID = #{userId}
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>
<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> </mapper>
...@@ -392,6 +392,8 @@ public interface CommonConstants { ...@@ -392,6 +392,8 @@ public interface CommonConstants {
// 是否 // 是否
String IS_CHANGE = "划转"; String IS_CHANGE = "划转";
String IS_NO_CHANGE = "不划转";
// 年 // 年
String YEAR = "年"; String YEAR = "年";
// 月 // 月
......
...@@ -424,6 +424,11 @@ public interface ErrorCodes { ...@@ -424,6 +424,11 @@ public interface ErrorCodes {
* 派增异常: 自定义缴纳养老基数不可为空 * 派增异常: 自定义缴纳养老基数不可为空
*/ */
String EMP_DISPATCH_SOCIAL_DIY_NOT_EMPTY = "emp.dispatch.social.diy.not.empty"; String EMP_DISPATCH_SOCIAL_DIY_NOT_EMPTY = "emp.dispatch.social.diy.not.empty";
/**
* 派增异常: 自定义缴纳养老基数或养老起缴日期不可为空
*/
String EMP_DISPATCH_SOCIAL_DIY_MEDICAL_NOT_EMPTY = "emp.dispatch.social.diy.medical_not.empty";
/** /**
* 派增异常: 对应项目编码的项目档案已减项,请去项目档案处复项 * 派增异常: 对应项目编码的项目档案已减项,请去项目档案处复项
*/ */
......
...@@ -155,6 +155,8 @@ socialinfo.list.num.large=\u5F53\u524D\u793E\u4FDD\u5BFC\u5165\u961F\u5217\u4E0D ...@@ -155,6 +155,8 @@ socialinfo.list.num.large=\u5F53\u524D\u793E\u4FDD\u5BFC\u5165\u961F\u5217\u4E0D
emp.dispatch.social.diy.not.empty=\u6D3E\u589E\u5F02\u5E38\uFF1A \u81EA\u5B9A\u4E49\u7F34\u7EB3\u517B\u8001\u57FA\u6570\u4E0D\u53EF\u4E3A\u7A7A emp.dispatch.social.diy.not.empty=\u6D3E\u589E\u5F02\u5E38\uFF1A \u81EA\u5B9A\u4E49\u7F34\u7EB3\u517B\u8001\u57FA\u6570\u4E0D\u53EF\u4E3A\u7A7A
emp.dispatch.social.diy.medical_not.empty=\u6D3E\u589E\u5F02\u5E38\uFF1A \u81EA\u5B9A\u4E49\u7F34\u7EB3\u517B\u8001\u57FA\u6570\u6216\u517B\u8001\u8D77\u7F34\u65E5\u671F\u4E0D\u53EF\u4E3A\u7A7A
emp.dispatch.emp.project.not.used=\u6D3E\u589E\u5F02\u5E38\uFF1A \u5BF9\u5E94\u9879\u76EE\u7F16\u7801\u7684\u9879\u76EE\u6863\u6848\u5DF2\u51CF\u9879\uFF0C\u8BF7\u53BB\u9879\u76EE\u6863\u6848\u5904\u590D\u9879 emp.dispatch.emp.project.not.used=\u6D3E\u589E\u5F02\u5E38\uFF1A \u5BF9\u5E94\u9879\u76EE\u7F16\u7801\u7684\u9879\u76EE\u6863\u6848\u5DF2\u51CF\u9879\uFF0C\u8BF7\u53BB\u9879\u76EE\u6863\u6848\u5904\u590D\u9879
emp.dispatch.emp.not.used=\u6D3E\u589E\u5F02\u5E38\uFF1A \u5BF9\u5E94\u8EAB\u4EFD\u8BC1\u7684\u4EBA\u5458\u6863\u6848\u5DF2\u51CF\u6863 emp.dispatch.emp.not.used=\u6D3E\u589E\u5F02\u5E38\uFF1A \u5BF9\u5E94\u8EAB\u4EFD\u8BC1\u7684\u4EBA\u5458\u6863\u6848\u5DF2\u51CF\u6863
......
...@@ -2,6 +2,7 @@ package com.yifu.cloud.plus.v1.yifu.common.dapr.util; ...@@ -2,6 +2,7 @@ package com.yifu.cloud.plus.v1.yifu.common.dapr.util;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AllUserNaVo; import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AllUserNaVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo; import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysUserListVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants; 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.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
...@@ -59,8 +60,8 @@ public class UpmsDaprUtils { ...@@ -59,8 +60,8 @@ public class UpmsDaprUtils {
* @Param * @Param
* @return * @return
**/ **/
public R<AllUserNaVo> getUserIdsByUserNames(String usernames) { public R<SysUserListVo> getUserIdsByUserNames(String usernames) {
R<AllUserNaVo> allUserVoR = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(),daprUpmsProperties.getAppId(),"/user/inner/getUserIdsByUserNames", usernames, AllUserNaVo.class, SecurityConstants.FROM_IN); R<SysUserListVo> allUserVoR = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(),daprUpmsProperties.getAppId(),"/user/inner/getUserIdsByUserNames", usernames, SysUserListVo.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(allUserVoR)){ if (Common.isEmpty(allUserVoR)){
return R.failed("获取指定用户名对应用户IDs失败!"); return R.failed("获取指定用户名对应用户IDs失败!");
} }
......
...@@ -2,6 +2,7 @@ package com.yifu.cloud.plus.v1.yifu.common.ldap.util; ...@@ -2,6 +2,7 @@ package com.yifu.cloud.plus.v1.yifu.common.ldap.util;
import com.unboundid.ldap.sdk.*; import com.unboundid.ldap.sdk.*;
import com.unboundid.ldap.sdk.controls.SubentriesRequestControl; import com.unboundid.ldap.sdk.controls.SubentriesRequestControl;
import com.unboundid.util.Base64;
import com.yifu.cloud.plus.v1.yifu.common.ldap.config.LdapProperties; import com.yifu.cloud.plus.v1.yifu.common.ldap.config.LdapProperties;
import com.yifu.cloud.plus.v1.yifu.common.ldap.entity.PersonVo; import com.yifu.cloud.plus.v1.yifu.common.ldap.entity.PersonVo;
import com.yifu.cloud.plus.v1.yifu.common.ldap.mapper.PersonAttributesMapper; import com.yifu.cloud.plus.v1.yifu.common.ldap.mapper.PersonAttributesMapper;
...@@ -10,15 +11,10 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -10,15 +11,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.ldap.core.LdapTemplate; import org.springframework.ldap.core.LdapTemplate;
import javax.naming.Context; import java.security.MessageDigest;
import javax.naming.NamingEnumeration; import java.security.NoSuchAlgorithmException;
import javax.naming.NamingException; import java.text.ParseException;
import javax.naming.directory.SearchControls;
import javax.naming.ldap.Control;
import javax.naming.ldap.InitialLdapContext;
import javax.naming.ldap.LdapContext;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List; import java.util.List;
import static org.springframework.ldap.query.LdapQueryBuilder.query; import static org.springframework.ldap.query.LdapQueryBuilder.query;
...@@ -33,10 +29,6 @@ public class LdapUtil { ...@@ -33,10 +29,6 @@ public class LdapUtil {
@Autowired @Autowired
private LdapProperties ldapProperties; private LdapProperties ldapProperties;
private static LdapContext ctx = null;
private static final Control[] connCtls = null;
/** /**
* @return List<SearchResultEntry> * @return List<SearchResultEntry>
* @author huyc * @author huyc
...@@ -64,71 +56,31 @@ public class LdapUtil { ...@@ -64,71 +56,31 @@ public class LdapUtil {
} }
// 校验用户名密码的方法 // 校验用户名密码的方法
public Boolean authenticate(String usr, String pwd) { public Boolean authenticate(String usr, String pwd) throws NoSuchAlgorithmException {
boolean valide;
if (pwd == null || "".equals(pwd)) if (pwd == null || "".equals(pwd))
return false; return false;
if (ctx == null) {
getCtx();
}
String userDN = getUserDN(usr);
if ("".equals(userDN) || userDN == null) {
return false;
}
try {
ctx.addToEnvironment(Context.SECURITY_PRINCIPAL, userDN);
ctx.addToEnvironment(Context.SECURITY_CREDENTIALS, pwd);
ctx.reconnect(connCtls);
valide = true;
closeCtx();
} catch (NamingException e) {
log.error(userDN + " is not authenticated");
valide = false;
}
return valide;
}
public void getCtx() {
if (ctx != null) {
return;
}
Hashtable<String, String> env = new Hashtable<>();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://" + ldapProperties.getUrl() + ":" + ldapProperties.getPort() +
"/" + ldapProperties.getDn());
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, ldapProperties.getUserName());
env.put(Context.SECURITY_CREDENTIALS, ldapProperties.getPassword());
try { try {
// 链接ldap List<SearchResultEntry> entryList = this.getAllPersonNamesWithTraditionalWay();
ctx = new InitialLdapContext(env, connCtls); byte[] ldapPw = new byte[0];
} catch (NamingException e) { for (SearchResultEntry resultEntry: entryList){
e.printStackTrace(); if (resultEntry.getDN().contains("uid="+usr)) {
} String password = resultEntry.getAttributeValue("userPassword");
} if (null != password) {
String ldapPwd1 = password.substring(5);
public void closeCtx() throws NamingException { ldapPw = Base64.decode(ldapPwd1);
if (ctx != null) break;
ctx.close(); } else {
} return false;
}
public String getUserDN(String uid) {
StringBuilder userDN = new StringBuilder();
try {
SearchControls constraints = new SearchControls();
constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
NamingEnumeration<?> en = ctx.search("", "uid=" + uid, constraints);
while (en != null && en.hasMoreElements()) {
Object obj = en.nextElement();
if (obj instanceof javax.naming.directory.SearchResult) {
javax.naming.directory.SearchResult si = (javax.naming.directory.SearchResult) obj;
userDN.append(si.getName());
userDN.append(",").append(ldapProperties.getDn());
} }
} }
} catch (Exception e) { MessageDigest md5 = MessageDigest.getInstance("MD5");
e.printStackTrace(); md5.update(pwd.getBytes());
byte[] m = md5.digest();
return MessageDigest.isEqual(m, ldapPw);
} catch (ParseException e) {
log.error(" is not authenticated");
} }
return userDN.toString(); return false;
} }
} }
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
package com.yifu.cloud.plus.v1.yifu.social.vo; package com.yifu.cloud.plus.v1.yifu.social.vo;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.HeadFontStyle; import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.fasterxml.jackson.annotation.JsonFormat; 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.ExcelAttribute;
...@@ -51,12 +52,6 @@ public class TDispatchAuditExportVo { ...@@ -51,12 +52,6 @@ public class TDispatchAuditExportVo {
@ExcelProperty("身份证号") @ExcelProperty("身份证号")
private String empIdcard; private String empIdcard;
@ExcelAttribute(name = "员工类型", isDataId = true, dataType = ExcelAttributeConstants.EMP_NATRUE)
@Schema(description = "员工类型")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("员工类型")
private String empType;
@ExcelAttribute(name = "客户名称", maxLength = 50) @ExcelAttribute(name = "客户名称", maxLength = 50)
@Schema(description = "客户名称") @Schema(description = "客户名称")
@HeadFontStyle(fontHeightInPoints = 11) @HeadFontStyle(fontHeightInPoints = 11)
...@@ -90,6 +85,7 @@ public class TDispatchAuditExportVo { ...@@ -90,6 +85,7 @@ public class TDispatchAuditExportVo {
/** /**
* 合同起始时间 * 合同起始时间
*/ */
@DateTimeFormat("yyyy-MM-dd")
@ExcelAttribute(name = "合同起始时间", isDate = true) @ExcelAttribute(name = "合同起始时间", isDate = true)
@Schema(description = "合同起始时间" ) @Schema(description = "合同起始时间" )
@HeadFontStyle(fontHeightInPoints = 11) @HeadFontStyle(fontHeightInPoints = 11)
...@@ -107,6 +103,7 @@ public class TDispatchAuditExportVo { ...@@ -107,6 +103,7 @@ public class TDispatchAuditExportVo {
/** /**
* 合同到期时间 * 合同到期时间
*/ */
@DateTimeFormat("yyyy-MM-dd")
@ExcelAttribute(name = "合同到期时间", isDate = true) @ExcelAttribute(name = "合同到期时间", isDate = true)
@Schema(description = "合同到期时间" ) @Schema(description = "合同到期时间" )
@HeadFontStyle(fontHeightInPoints = 11) @HeadFontStyle(fontHeightInPoints = 11)
...@@ -163,6 +160,7 @@ public class TDispatchAuditExportVo { ...@@ -163,6 +160,7 @@ public class TDispatchAuditExportVo {
/** /**
* 离职日期 * 离职日期
*/ */
@DateTimeFormat("yyyy-MM-dd")
@ExcelAttribute(name = "离职日期", isDate = true) @ExcelAttribute(name = "离职日期", isDate = true)
@Schema(description = "离职日期" ) @Schema(description = "离职日期" )
@HeadFontStyle(fontHeightInPoints = 11) @HeadFontStyle(fontHeightInPoints = 11)
...@@ -176,10 +174,28 @@ public class TDispatchAuditExportVo { ...@@ -176,10 +174,28 @@ public class TDispatchAuditExportVo {
@HeadFontStyle(fontHeightInPoints = 11) @HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("减少原因" ) @ExcelProperty("减少原因" )
private String reduceReason; private String reduceReason;
/**
* 社保起缴日期
*/
@DateTimeFormat("yyyy-MM-dd")
@ExcelAttribute(name = "社保起缴日期", isDate = true)
@Schema(description = "社保起缴日期" )
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("社保起缴日期" )
private Date socialStartDate;
/**
* 公积金起缴日期
*/
@DateTimeFormat("yyyy-MM-dd")
@ExcelAttribute(name = "公积金起缴日期", isDate = true)
@Schema(description = "公积金起缴日期" )
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("公积金起缴日期" )
private Date providentStart;
/** /**
* 社保停缴日期 * 社保停缴日期
*/ */
@DateTimeFormat("yyyy-MM-dd")
@ExcelAttribute(name = "社保停缴日期", isDate = true) @ExcelAttribute(name = "社保停缴日期", isDate = true)
@Schema(description = "社保停缴日期" ) @Schema(description = "社保停缴日期" )
@HeadFontStyle(fontHeightInPoints = 11) @HeadFontStyle(fontHeightInPoints = 11)
...@@ -189,6 +205,7 @@ public class TDispatchAuditExportVo { ...@@ -189,6 +205,7 @@ public class TDispatchAuditExportVo {
/** /**
* 公积金停缴日期 * 公积金停缴日期
*/ */
@DateTimeFormat("yyyy-MM-dd")
@ExcelAttribute(name = "公积金停缴日期", isDate = true) @ExcelAttribute(name = "公积金停缴日期", isDate = true)
@Schema(description = "公积金停缴日期" ) @Schema(description = "公积金停缴日期" )
@HeadFontStyle(fontHeightInPoints = 11) @HeadFontStyle(fontHeightInPoints = 11)
......
...@@ -1104,6 +1104,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -1104,6 +1104,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
dispatch.setEmpName(excel.getEmpName()); dispatch.setEmpName(excel.getEmpName());
dispatch.setEmpNational(excel.getEmpNational()); dispatch.setEmpNational(excel.getEmpNational());
dispatch.setEmpType(excel.getEmpType()); dispatch.setEmpType(excel.getEmpType());
dispatch.setTryPeriod(excel.getTryPeriod());
dispatch.setEmpMobile(excel.getEmpMobile()); dispatch.setEmpMobile(excel.getEmpMobile());
dispatch.setType(CommonConstants.ZERO_STRING); dispatch.setType(CommonConstants.ZERO_STRING);
dispatch.setCurrentOperator(user.getNickname()); dispatch.setCurrentOperator(user.getNickname());
...@@ -2130,13 +2131,35 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -2130,13 +2131,35 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
return true; return true;
} }
// 非自定义的 基数 起缴日期不可空 // 非自定义的 基数 起缴日期不可空
if (Common.isNotNull(excel.getSocialHousehold()) if (Common.isNotNull(excel.getSocialHousehold())){
&& !CommonConstants.ONE_STRING.equals(excel.getPaymentType()) if (!CommonConstants.ONE_STRING.equals(excel.getPaymentType())
&& (Common.isEmpty(excel.getRecordBase()) && (Common.isEmpty(excel.getRecordBase())
|| Common.isEmpty(excel.getPensionStart()) || Common.isEmpty(excel.getPensionStart()))
)) { ) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_NOT_EMPTY))); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_NOT_EMPTY)));
return true; return true;
}
if (CommonConstants.ONE_STRING.equals(excel.getPaymentType())
&& (Common.isNullOrZero(excel.getPensionCardinal()) || Common.isEmpty(excel.getPensionStart()))
&& !(
Common.isEmpty(excel.getPensionStart())
&& Common.isNotNull(excel.getWorkInjuryStart())
&& Common.isEmpty(excel.getMedicalStart())
&& Common.isEmpty(excel.getBirthStart())
&& Common.isEmpty(excel.getUnemployStart())
&& Common.isEmpty(excel.getBigailmentStart())
&& Common.isNullOrZero(excel.getPensionCardinal())
&& Common.isNullOrZero(excel.getMedicalCardinal())
&& Common.isNullOrZero(excel.getBirthCardinal())
&& Common.isNullOrZero(excel.getUnemploymentCardinal())
&& !Common.isNullOrZero(excel.getWorkInjuryCardinal())
&& Common.isNullOrZero(excel.getBigailmentCardinal())
)
){
//养老基数为空 兼职工伤除外
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_DIY_MEDICAL_NOT_EMPTY)));
return true;
}
} }
// 兼职工伤 的起缴日期不可为空 // 兼职工伤 的起缴日期不可为空
if (CommonConstants.ONE_STRING.equals(excel.getPaymentType()) if (CommonConstants.ONE_STRING.equals(excel.getPaymentType())
...@@ -2565,6 +2588,15 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -2565,6 +2588,15 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
dispatch.setSettleDomainCode(setInfoVo.getDepartNo()); dispatch.setSettleDomainCode(setInfoVo.getDepartNo());
dispatch.setBelongUnit(setInfoVo.getCustomerId()); dispatch.setBelongUnit(setInfoVo.getCustomerId());
dispatch.setBelongUnitName(setInfoVo.getCustomerName()); dispatch.setBelongUnitName(setInfoVo.getCustomerName());
TEmployeeProject temp = new TEmployeeProject();
temp.setDeptId(dispatch.getSettleDomain());
temp.setEmpId(dispatch.getEmpId());
R<TEmployeeProject> res = archivesDaprUtil.getTEmployeeProjectById(temp);
if (Common.isNotNull(res)){
if (Common.isNotNull(res.getData().getWorkingHours())) {
dispatch.setWorkingHours(res.getData().getWorkingHours());
}
}
} }
StringBuffer temp = new StringBuffer(); StringBuffer temp = new StringBuffer();
if (Common.isNotNull(excel.getSocialReduceDate())){ if (Common.isNotNull(excel.getSocialReduceDate())){
...@@ -2615,6 +2647,9 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -2615,6 +2647,9 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
socialFund.setFundStatus(CommonConstants.FIVE_STRING); socialFund.setFundStatus(CommonConstants.FIVE_STRING);
socialFund.setFundReduceStatus(CommonConstants.ZERO_STRING); socialFund.setFundReduceStatus(CommonConstants.ZERO_STRING);
} }
if (Common.isNotNull(temp.toString())){
temp.deleteCharAt(temp.length()-1);
}
dispatch.setDispatchItem(temp.toString()); dispatch.setDispatchItem(temp.toString());
dispatch.setBelongUnitName(socialFund.getUnitName()); dispatch.setBelongUnitName(socialFund.getUnitName());
dispatch.setBelongUnit(socialFund.getUnitId()); dispatch.setBelongUnit(socialFund.getUnitId());
...@@ -2631,6 +2666,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -2631,6 +2666,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
dispatch.setFileProvince(empVo.getFileProvince()); dispatch.setFileProvince(empVo.getFileProvince());
dispatch.setFileCity(empVo.getFileCity()); dispatch.setFileCity(empVo.getFileCity());
dispatch.setFileTown(empVo.getFileTown()); dispatch.setFileTown(empVo.getFileTown());
dispatch.setContractName(empVo.getContractName());
dispatch.setContractSubName(empVo.getContractSubName());
} }
return dispatch; return dispatch;
} }
......
...@@ -619,7 +619,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -619,7 +619,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
errorMessageList), yfSocialImportThreadPoolExecutor); errorMessageList), yfSocialImportThreadPoolExecutor);
completableFutureList.add(listCompletableFuture); completableFutureList.add(listCompletableFuture);
} }
// 阻塞当前线程,等待所有的线程执行完毕 // 阻塞当前线程,等待所有的线程执行完毕
boolean computeFlag; boolean computeFlag;
do { do {
...@@ -635,12 +634,9 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -635,12 +634,9 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
log.error("社保缴费库数据批量导入异常:" + e); log.error("社保缴费库数据批量导入异常:" + e);
redisUtil.remove(key); redisUtil.remove(key);
} }
// -----------------------------线程池处理list,批量保存社保信息结束--------------------------------
//最后一个推送
log.info("社保批量导入耗时:{}", (System.currentTimeMillis() - start) + "");
redisUtil.remove(key);
} }
} }
redisUtil.remove(key);
} }
} }
...@@ -2333,8 +2329,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -2333,8 +2329,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
socialParam.setFd_3af9ee3aa9c84a(CommonConstants.EMPTY_STRING); socialParam.setFd_3af9ee3aa9c84a(CommonConstants.EMPTY_STRING);
} }
//实缴合计 //实缴合计
if (Common.isNotNull(library.getSumAll())) { if (Common.isNotNull(library.getSocialSum())) {
socialParam.setFd_3af9ee3c6bfc74(library.getSumAll().toString()); socialParam.setFd_3af9ee3c6bfc74(library.getSocialSum().toString());
} else { } else {
socialParam.setFd_3af9ee3c6bfc74(CommonConstants.EMPTY_STRING); socialParam.setFd_3af9ee3c6bfc74(CommonConstants.EMPTY_STRING);
} }
......
...@@ -148,7 +148,6 @@ ...@@ -148,7 +148,6 @@
<resultMap id="exportAuditMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.TDispatchAuditExportVo"> <resultMap id="exportAuditMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.TDispatchAuditExportVo">
<result property="empName" column="EMP_NAME"/> <result property="empName" column="EMP_NAME"/>
<result property="empIdcard" column="EMP_IDCARD"/> <result property="empIdcard" column="EMP_IDCARD"/>
<result property="empType" column="EMP_TYPE"/>
<result property="belongUnitName" column="BELONG_UNIT_NAME"/> <result property="belongUnitName" column="BELONG_UNIT_NAME"/>
<result property="settleDomainName" column="SETTLE_DOMAIN_NAME"/> <result property="settleDomainName" column="SETTLE_DOMAIN_NAME"/>
<result property="type" column="TYPE"/> <result property="type" column="TYPE"/>
...@@ -178,7 +177,9 @@ ...@@ -178,7 +177,9 @@
<result property="personalUnemploymentCardinal" column="PERSONAL_UNEMPLOYMENT_CARDINAL"/> <result property="personalUnemploymentCardinal" column="PERSONAL_UNEMPLOYMENT_CARDINAL"/>
<result property="personalBigailmentMoney" column="PERSONAL_BIGAILMENT_MONEY"/> <result property="personalBigailmentMoney" column="PERSONAL_BIGAILMENT_MONEY"/>
<result property="unitBigailmentMoney" column="UNIT_BIGAILMENT_MONEY"/> <result property="unitBigailmentMoney" column="UNIT_BIGAILMENT_MONEY"/>
<result property="socialStartDate" column="SOCIAL_START_DATE"/>
<result property="providentStart" column="PROVIDENT_START"/>
<result property="unitProvidengCardinal" column="UNIT_PROVIDENG_CARDINAL"/> <result property="unitProvidengCardinal" column="UNIT_PROVIDENG_CARDINAL"/>
<result property="personalProvidentCardinal" column="PERSONAL_PROVIDENT_CARDINAL"/> <result property="personalProvidentCardinal" column="PERSONAL_PROVIDENT_CARDINAL"/>
<result property="unitProvidentPer" column="UNIT_PROVIDENT_PER"/> <result property="unitProvidentPer" column="UNIT_PROVIDENT_PER"/>
...@@ -613,7 +614,6 @@ ...@@ -613,7 +614,6 @@
select select
a.EMP_NAME, a.EMP_NAME,
a.EMP_IDCARD, a.EMP_IDCARD,
a.EMP_TYPE,
a.BELONG_UNIT_NAME, a.BELONG_UNIT_NAME,
a.SETTLE_DOMAIN_NAME, a.SETTLE_DOMAIN_NAME,
a.TYPE, a.TYPE,
...@@ -630,6 +630,7 @@ ...@@ -630,6 +630,7 @@
a.FUND_REDUCE_DATE, a.FUND_REDUCE_DATE,
a.LEAVE_DATE, a.LEAVE_DATE,
a.REDUCE_REASON, a.REDUCE_REASON,
b.SOCIAL_START_DATE,
b.PAYMENT_TYPE, b.PAYMENT_TYPE,
b.RECORD_BASE, b.RECORD_BASE,
b.UNIT_PENSION_CARDINAL, b.UNIT_PENSION_CARDINAL,
...@@ -643,6 +644,7 @@ ...@@ -643,6 +644,7 @@
b.PERSONAL_BIGAILMENT_MONEY, b.PERSONAL_BIGAILMENT_MONEY,
b.UNIT_BIGAILMENT_MONEY, b.UNIT_BIGAILMENT_MONEY,
c.UNIT_PROVIDENG_CARDINAL, c.UNIT_PROVIDENG_CARDINAL,
c.PROVIDENT_START,
c.PERSONAL_PROVIDENT_CARDINAL, c.PERSONAL_PROVIDENT_CARDINAL,
c.UNIT_PROVIDENT_PER, c.UNIT_PROVIDENT_PER,
c.PERSONAL_PROVIDENT_PER c.PERSONAL_PROVIDENT_PER
......
...@@ -174,8 +174,8 @@ ...@@ -174,8 +174,8 @@
<result property="idCardTown" column="ID_CARD_TOWN"/> <result property="idCardTown" column="ID_CARD_TOWN"/>
<result property="idCardAddress" column="ID_CARD_ADDRESS"/> <result property="idCardAddress" column="ID_CARD_ADDRESS"/>
<result property="fileProvince" column="FILE_PROVINCE"/> <result property="fileProvince" column="FILE_PROVINCE"/>
<result property="fileCity" column="FILE__CITY"/> <result property="fileCity" column="FILE_CITY"/>
<result property="fileTown" column="FILE__TOWN"/> <result property="fileTown" column="FILE_TOWN"/>
<result property="post" column="POST"/> <result property="post" column="POST"/>
<result property="tryPeriod" column="TRY_PERIOD"/> <result property="tryPeriod" column="TRY_PERIOD"/>
<result property="workingHours" column="WORKING_HOURS"/> <result property="workingHours" column="WORKING_HOURS"/>
......
package com.yifu.cloud.plus.v1.yifu.admin.api.vo;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Author Hgw
* @Date 2022-10-26 17:09:09
* @Description
* @Version 1.0
*/
@Data
public class SysUserListVo implements Serializable {
private List<SysUser> userList;
private List<String> userIds;
}
...@@ -25,10 +25,7 @@ import com.pig4cloud.plugin.excel.annotation.ResponseExcel; ...@@ -25,10 +25,7 @@ import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
import com.yifu.cloud.plus.v1.yifu.admin.api.dto.UserDTO; import com.yifu.cloud.plus.v1.yifu.admin.api.dto.UserDTO;
import com.yifu.cloud.plus.v1.yifu.admin.api.dto.UserInfo; import com.yifu.cloud.plus.v1.yifu.admin.api.dto.UserInfo;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser; import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AllUserNaVo; import com.yifu.cloud.plus.v1.yifu.admin.api.vo.*;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserExcelVO;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserInfoVO;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserVO;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysUserService; import com.yifu.cloud.plus.v1.yifu.admin.service.SysUserService;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes; import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common; import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
...@@ -45,6 +42,7 @@ import org.springframework.validation.BindingResult; ...@@ -45,6 +42,7 @@ import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.Valid; import javax.validation.Valid;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -257,7 +255,7 @@ public class UserController { ...@@ -257,7 +255,7 @@ public class UserController {
*/ */
@SysLog("登录验证") @SysLog("登录验证")
@PostMapping("/ldapLogin") @PostMapping("/ldapLogin")
public R<Boolean> loginAuthentication(@RequestParam String userName,@RequestParam String password) { public R<Boolean> loginAuthentication(@RequestParam String userName,@RequestParam String password) throws NoSuchAlgorithmException {
return userService.loginAuthentication(userName,password); return userService.loginAuthentication(userName,password);
} }
...@@ -304,8 +302,8 @@ public class UserController { ...@@ -304,8 +302,8 @@ public class UserController {
**/ **/
@Inner @Inner
@PostMapping(value = {"/inner/getUserIdsByUserNames"}) @PostMapping(value = {"/inner/getUserIdsByUserNames"})
public AllUserNaVo getUserIdsByUserNames(@RequestBody String usernames) { public SysUserListVo getUserIdsByUserNames(@RequestBody String usernames) {
AllUserNaVo naVo = new AllUserNaVo(); SysUserListVo naVo = new SysUserListVo();
if (Common.isEmpty(usernames)){ if (Common.isEmpty(usernames)){
return naVo; return naVo;
} }
...@@ -315,9 +313,9 @@ public class UserController { ...@@ -315,9 +313,9 @@ public class UserController {
List<String> userIds = new ArrayList<>(); List<String> userIds = new ArrayList<>();
for (SysUser u:sysUsers){ for (SysUser u:sysUsers){
userIds.add(u.getUserId()); userIds.add(u.getUserId());
} }
naVo.setUserIds(userIds); naVo.setUserIds(userIds);
naVo.setUserList(sysUsers);
} }
return naVo; return naVo;
} }
...@@ -362,4 +360,21 @@ public class UserController { ...@@ -362,4 +360,21 @@ public class UserController {
} }
return userIds.toString(); return userIds.toString();
} }
/**
* @param nickName 用户名称
* @return 上级部门用户列表
*/
@GetMapping("/getSysUserList")
@Operation(summary = "获取所有系统人员", description = "获取所有系统人员")
public R<List<SysUser>> getSysUserList(@RequestParam(required = false) String nickName) {
List<SysUser> sysUserList;
if (Common.isNotNull(nickName)) {
sysUserList = userService.list(Wrappers.<SysUser>query().lambda().like(SysUser::getNickname, nickName));
} else {
sysUserList = userService.list();
}
return R.ok(sysUserList);
}
} }
...@@ -19,6 +19,7 @@ package com.yifu.cloud.plus.v1.yifu.admin.mapper; ...@@ -19,6 +19,7 @@ package com.yifu.cloud.plus.v1.yifu.admin.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDept; import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDept;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -41,4 +42,9 @@ public interface SysDeptMapper extends BaseMapper<SysDept> { ...@@ -41,4 +42,9 @@ public interface SysDeptMapper extends BaseMapper<SysDept> {
List<String> selectDnList(); List<String> selectDnList();
SysDept selectCountId(@Param("deptId")Long deptId);
int updateDeptById(@Param("dept") SysDept dept);
SysDept selectDeptDn(@Param("deptDn")String deptDn);
} }
...@@ -27,6 +27,7 @@ import com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserVO; ...@@ -27,6 +27,7 @@ import com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import java.security.NoSuchAlgorithmException;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
...@@ -132,6 +133,6 @@ public interface SysUserService extends IService<SysUser> { ...@@ -132,6 +133,6 @@ public interface SysUserService extends IService<SysUser> {
* 从ldap中验证登录用户 * 从ldap中验证登录用户
* @return R * @return R
*/ */
R<Boolean> loginAuthentication(String userName, String password); R<Boolean> loginAuthentication(String userName, String password) throws NoSuchAlgorithmException;
} }
...@@ -60,8 +60,6 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl ...@@ -60,8 +60,6 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
private final LdapUtil ldapUtil; private final LdapUtil ldapUtil;
private final SysDeptMapper sysDeptMapper;
private final SysUserMapper sysUserMapper; private final SysUserMapper sysUserMapper;
/** /**
...@@ -188,11 +186,11 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl ...@@ -188,11 +186,11 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
//获取ldap所有的dn //获取ldap所有的dn
List<String> entryDnList = entryList.stream().map(SearchResultEntry::getDN).collect(Collectors.toList()); List<String> entryDnList = entryList.stream().map(SearchResultEntry::getDN).collect(Collectors.toList());
//获取本地dept表中所有的dn //获取本地dept表中所有的dn
List<String> dnList = sysDeptMapper.selectDnList(); List<String> dnList = baseMapper.selectDnList();
List<String> delList = dnList.stream().filter(p-> !entryDnList.contains(p)).collect(Collectors.toList()); List<String> delList = dnList.stream().filter(p-> !entryDnList.contains(p)).collect(Collectors.toList());
//删除ldap中不存在的dn的数据 //删除ldap中不存在的dn的数据
if (!delList.isEmpty()) { if (!delList.isEmpty()) {
sysDeptMapper.delete(Wrappers.<SysDept>query().lambda().in(SysDept::getDeptDn, delList)); baseMapper.delete(Wrappers.<SysDept>query().lambda().in(SysDept::getDeptDn, delList));
} }
List<Map<String,Object>> updUserList = new ArrayList<>(); List<Map<String,Object>> updUserList = new ArrayList<>();
for (SearchResultEntry entry : entryList) { for (SearchResultEntry entry : entryList) {
...@@ -206,35 +204,52 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl ...@@ -206,35 +204,52 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
String deptName = saveDnList.get(0).replace("ou=", ""); String deptName = saveDnList.get(0).replace("ou=", "");
int size = saveDnList.size(); int size = saveDnList.size();
if (size == 1) { if (size == 1) {
SysDept sysDept = this.getOne(Wrappers.<SysDept>query().lambda().eq(SysDept::getDeptDn, dn)); SysDept sysDept = baseMapper.selectDeptDn(dn);
if (null == sysDept) { if (null == sysDept) {
SysDept insertSysDept = new SysDept(); if (StringUtils.isEmpty(userId)) {
insertSysDept.setName(deptName); SysDept ins = baseMapper.selectCountId(Long.valueOf(entry.getAttributeValue("x-ouid")));
insertSysDept.setParentId(0L); if (Common.isNotNull(ins)) {
if (Common.isNotNull(entry.getAttributeValue("x-ouid"))) { ins.setName(deptName);
insertSysDept.setDeptId(Long.valueOf(entry.getAttributeValue("x-ouid"))); ins.setDeptDn(dn);
baseMapper.updateDeptById(ins);
} else {
SysDept insertSysDept = new SysDept();
insertSysDept.setName(deptName);
insertSysDept.setParentId(0L);
insertSysDept.setDeptDn(dn);
if (Common.isNotNull(entry.getAttributeValue("x-ouid"))) {
insertSysDept.setDeptId(Long.valueOf(entry.getAttributeValue("x-ouid")));
}
baseMapper.insert(insertSysDept);
}
} }
insertSysDept.setDeptDn(dn);
this.save(insertSysDept);
} else { } else {
sysDept.setName(deptName); sysDept.setName(deptName);
this.updateDeptById(sysDept); baseMapper.updateDeptById(sysDept);
} }
} else { } else {
try { try {
SysDept sysDept = this.getOne(Wrappers.<SysDept>query().lambda().eq(SysDept::getDeptDn, dn.substring(dn.indexOf("ou=", 2), dn.length()))); SysDept sysDept = this.getOne(Wrappers.<SysDept>query().lambda().eq(SysDept::getDeptDn, dn.substring(dn.indexOf("ou=", 2), dn.length())));
if (null != sysDept) { if (null != sysDept) {
SysDept sysDeptCount = this.getOne(Wrappers.<SysDept>query().lambda().eq(SysDept::getDeptDn, dn)); SysDept sysDeptCount = baseMapper.selectDeptDn(dn);
if (null == sysDeptCount) { if (null == sysDeptCount) {
if (StringUtils.isEmpty(userId)) { if (StringUtils.isEmpty(userId)) {
SysDept insertSysDept = new SysDept(); SysDept ins = baseMapper.selectCountId(Long.valueOf(entry.getAttributeValue("x-ouid")));
insertSysDept.setName(deptName); if (Common.isNotNull(ins)) {
insertSysDept.setParentId(sysDept.getDeptId()); ins.setName(deptName);
insertSysDept.setDeptDn(dn); ins.setDeptDn(dn);
if (Common.isNotNull(entry.getAttributeValue("x-ouid"))) { ins.setParentId(sysDept.getDeptId());
insertSysDept.setDeptId(Long.valueOf(entry.getAttributeValue("x-ouid"))); baseMapper.updateDeptById(ins);
} else {
SysDept insertSysDept = new SysDept();
insertSysDept.setName(deptName);
insertSysDept.setParentId(sysDept.getDeptId());
insertSysDept.setDeptDn(dn);
if (Common.isNotNull(entry.getAttributeValue("x-ouid"))) {
insertSysDept.setDeptId(Long.valueOf(entry.getAttributeValue("x-ouid")));
}
baseMapper.insert(insertSysDept);
} }
this.save(insertSysDept);
} }
} else { } else {
if (!StringUtils.isEmpty(userId)) { if (!StringUtils.isEmpty(userId)) {
...@@ -246,7 +261,8 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl ...@@ -246,7 +261,8 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
}else { }else {
sysDeptCount.setName(deptName); sysDeptCount.setName(deptName);
sysDeptCount.setParentId(sysDept.getDeptId()); sysDeptCount.setParentId(sysDept.getDeptId());
this.updateDeptById(sysDeptCount); sysDeptCount.setDeptDn(dn);
baseMapper.updateDeptById(sysDeptCount);
} }
} }
} }
......
...@@ -55,6 +55,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -55,6 +55,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import java.security.NoSuchAlgorithmException;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -82,8 +83,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl ...@@ -82,8 +83,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
private final LdapUtil ldapUtil; private final LdapUtil ldapUtil;
private final SysUserMapper sysUserMapper;
/** /**
* 保存用户信息 * 保存用户信息
* @param userDto DTO 对象 * @param userDto DTO 对象
...@@ -431,10 +430,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl ...@@ -431,10 +430,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
} }
} }
if (!updateList.isEmpty()) { if (!updateList.isEmpty()) {
sysUserMapper.batchUpdateUser(updateList); baseMapper.batchUpdateUser(updateList);
} }
if (!insertList.isEmpty()) { if (!insertList.isEmpty()) {
sysUserMapper.batchInsertUser(insertList); baseMapper.batchInsertUser(insertList);
} }
} }
List<SearchResultEntry> entryList = ldapUtil.getAllPersonNamesWithTraditionalWay(); List<SearchResultEntry> entryList = ldapUtil.getAllPersonNamesWithTraditionalWay();
...@@ -455,38 +454,55 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl ...@@ -455,38 +454,55 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
userId = dn.substring(4, dn.indexOf(",", 1)); userId = dn.substring(4, dn.indexOf(",", 1));
dn = dn.substring(dn.indexOf(",", 1) + 1); dn = dn.substring(dn.indexOf(",", 1) + 1);
} }
List<String> saveDnList = Arrays.stream(dn.split(",")).filter(e -> (e.contains("ou=") && !e.equals("ou=wanxin"))).collect(Collectors.toList()); List<String> saveDnList = Arrays.asList(dn.split(",")).stream().filter(e -> (e.contains("ou=") && !e.equals("ou=wanxin"))).collect(Collectors.toList());
String deptName = saveDnList.get(0).replace("ou=", ""); String deptName = saveDnList.get(0).replace("ou=", "");
int size = saveDnList.size(); int size = saveDnList.size();
if (size == 1) { if (size == 1) {
SysDept sysDept = sysDeptMapper.selectOne(Wrappers.<SysDept>query().lambda().eq(SysDept::getDeptDn, dn)); SysDept sysDept = sysDeptMapper.selectDeptDn(dn);
if (null == sysDept) { if (null == sysDept) {
SysDept insertSysDept = new SysDept(); if (StringUtils.isEmpty(userId)) {
insertSysDept.setName(deptName); SysDept ins = sysDeptMapper.selectCountId(Long.valueOf(entry.getAttributeValue("x-ouid")));
insertSysDept.setParentId(0L); if (Common.isNotNull(ins)) {
insertSysDept.setDeptDn(dn); ins.setName(deptName);
if (Common.isNotNull(entry.getAttributeValue("x-ouid"))) { ins.setDeptDn(dn);
insertSysDept.setDeptId(Long.valueOf(entry.getAttributeValue("x-ouid"))); sysDeptMapper.updateDeptById(ins);
} else {
SysDept insertSysDept = new SysDept();
insertSysDept.setName(deptName);
insertSysDept.setParentId(0L);
insertSysDept.setDeptDn(dn);
if (Common.isNotNull(entry.getAttributeValue("x-ouid"))) {
insertSysDept.setDeptId(Long.valueOf(entry.getAttributeValue("x-ouid")));
}
sysDeptMapper.insert(insertSysDept);
}
} }
sysDeptMapper.insert(insertSysDept);
} else { } else {
sysDept.setName(deptName); sysDept.setName(deptName);
sysDeptMapper.updateById(sysDept); sysDeptMapper.updateDeptById(sysDept);
} }
} else { } else {
SysDept sysDept = sysDeptMapper.selectOne(Wrappers.<SysDept>query().lambda().eq(SysDept::getDeptDn, dn.substring(dn.indexOf("ou=", 2), dn.length()))); SysDept sysDept = sysDeptMapper.selectOne(Wrappers.<SysDept>query().lambda().eq(SysDept::getDeptDn, dn.substring(dn.indexOf("ou=", 2), dn.length())));
if (null != sysDept) { if (null != sysDept) {
SysDept sysDeptCount = sysDeptMapper.selectOne(Wrappers.<SysDept>query().lambda().eq(SysDept::getDeptDn, dn)); SysDept sysDeptCount = sysDeptMapper.selectDeptDn(dn);
if (null == sysDeptCount) { if (null == sysDeptCount) {
if (StringUtils.isEmpty(userId)) { if (StringUtils.isEmpty(userId)) {
SysDept insertSysDept = new SysDept(); SysDept ins = sysDeptMapper.selectCountId(Long.valueOf(entry.getAttributeValue("x-ouid")));
insertSysDept.setName(deptName); if (Common.isNotNull(ins)) {
insertSysDept.setParentId(sysDept.getDeptId()); ins.setName(deptName);
insertSysDept.setDeptDn(dn); ins.setDeptDn(dn);
if (Common.isNotNull(entry.getAttributeValue("x-ouid"))) { ins.setParentId(sysDept.getDeptId());
insertSysDept.setDeptId(Long.valueOf(entry.getAttributeValue("x-ouid"))); sysDeptMapper.updateDeptById(ins);
} else {
SysDept insertSysDept = new SysDept();
insertSysDept.setName(deptName);
insertSysDept.setParentId(sysDept.getDeptId());
insertSysDept.setDeptDn(dn);
if (Common.isNotNull(entry.getAttributeValue("x-ouid"))) {
insertSysDept.setDeptId(Long.valueOf(entry.getAttributeValue("x-ouid")));
}
sysDeptMapper.insert(insertSysDept);
} }
sysDeptMapper.insert(insertSysDept);
} }
} else { } else {
if (!StringUtils.isEmpty(userId)) { if (!StringUtils.isEmpty(userId)) {
...@@ -497,15 +513,18 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl ...@@ -497,15 +513,18 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
updUserList.add(map); updUserList.add(map);
}else { }else {
sysDeptCount.setName(deptName); sysDeptCount.setName(deptName);
sysDeptCount.setDeptDn(dn);
sysDeptCount.setParentId(sysDept.getDeptId()); sysDeptCount.setParentId(sysDept.getDeptId());
sysDeptMapper.updateById(sysDeptCount); sysDeptMapper.updateDeptById(sysDeptCount);
} }
} }
} }
} }
} }
//更新用户信息 //更新用户信息
sysUserMapper.updateUser(updUserList); if (!updUserList.isEmpty()) {
baseMapper.updateUser(updUserList);
}
}catch (Exception e) { }catch (Exception e) {
log.info("用户部门信息同步异常:" + e.getMessage()); log.info("用户部门信息同步异常:" + e.getMessage());
return R.failed("用户部门信息同步异常!"); return R.failed("用户部门信息同步异常!");
...@@ -518,8 +537,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl ...@@ -518,8 +537,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
* @return R * @return R
*/ */
@Override @Override
public R<Boolean> loginAuthentication(String userName, String password) { public R<Boolean> loginAuthentication(String userName, String password) throws NoSuchAlgorithmException {
if (ldapUtil.authenticate(userName,password)) { if (Boolean.TRUE.equals(ldapUtil.authenticate(userName,password))) {
return R.ok(); return R.ok();
} }
return R.failed("验证不通过"); return R.failed("验证不通过");
......
...@@ -38,4 +38,33 @@ ...@@ -38,4 +38,33 @@
WHERE a.del_flag = 0 WHERE a.del_flag = 0
AND a.dept_dn IS NOT NULL AND a.dept_dn IS NOT NULL
</select> </select>
<select id="selectCountId" resultType="com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDept">
SELECT
*
from sys_dept a
<where>
a.dept_id = #{deptId}
</where>
</select>
<select id="selectDeptDn" resultType="com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDept">
SELECT
*
from sys_dept a
<where>
a.dept_dn = #{deptDn}
</where>
</select>
<update id="updateDeptById">
update sys_dept
<trim prefix="set" suffixOverrides=",">
<if test="dept.name != null">name=#{dept.name},</if>
<if test="dept.parentId != null">parent_id=#{dept.parentId},</if>
<if test="dept.deptDn != null">dept_dn=#{dept.deptDn},</if>
update_time = now()
</trim>
WHERE dept_id=#{dept.deptId}
</update>
</mapper> </mapper>
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