Commit 72069ce1 authored by huyuchen's avatar huyuchen

Merge remote-tracking branch 'origin/master'

parents 282df9c1 7ffc2a20
#!/bin/bash
#k8s升级所有版本,滚动更新
cd ../
thisPath=`pwd`
#鉴权
cd $thisPath"/yifu-auth"
sh build-test.sh
#登录基础服务
cd $thisPath"/yifu-upms/yifu-upms-biz"
sh build-test.sh
#档案服务
cd $thisPath"/yifu-archives/yifu-archives-biz"
sh build-test.sh
#校验身份证、银行卡、手机号服务
cd $thisPath"/yifu-check/yifu-check-biz"
sh build-test.sh
#商险服务
cd $thisPath"/yifu-insurances/yifu-insurances-biz"
sh build-test.sh
#定时任务服务
cd $thisPath"/yifu-job/yifu-job-biz"
sh build-test.sh
#订单服务
cd $thisPath"/yifu-order/yifu-order-biz"
sh build-test.sh
#薪资服务
cd $thisPath"/yifu-salary/yifu-salary-biz"
sh build-test.sh
#社保服务
cd $thisPath"/yifu-social/yifu-social-biz"
sh build-test.sh
#!/bin/bash
#k8s升级所有版本,滚动更新
cd ../
thisPath=`pwd`
#档案服务
cd $thisPath"/yifu-archives/yifu-archives-biz"
sh build-test.sh
#校验身份证、银行卡、手机号服务
cd $thisPath"/yifu-check/yifu-check-biz"
sh build-test.sh
#商险服务
cd $thisPath"/yifu-insurances/yifu-insurances-biz"
sh build-test.sh
#定时任务服务
cd $thisPath"/yifu-job/yifu-job-biz"
sh build-test.sh
#订单服务
cd $thisPath"/yifu-order/yifu-order-biz"
sh build-test.sh
#薪资服务
cd $thisPath"/yifu-salary/yifu-salary-biz"
sh build-test.sh
#社保服务
cd $thisPath"/yifu-social/yifu-social-biz"
sh build-test.sh
#B端服务
#cd $thisPath"/yifu-business/yifu-business-biz"
#sh build-test.sh
......@@ -57,7 +57,7 @@ spec: # 资源规范字段
value: Asia/Shanghai
resources: #资源配置限制
limits: # 最大使用
memory: "2048Mi"
memory: "4048Mi"
#cpu: 300m # CPU,1核心 = 1000m
requests: # 容器运行时,最低资源需求,也就是说最少需要多少资源容器才能正常运行
#cpu: 100m
......
......@@ -102,6 +102,7 @@
<module>yifu-insurances</module>
<module>yifu-salary</module>
<module>yifu-order</module>
<module>yifu-mail</module>
</modules>
<dependencyManagement>
......
......@@ -125,4 +125,15 @@ public class ArchivesConstants {
* 项目 获取区域数据失败:
*/
public static final String SETTLE_DOMAIN_CHECK_AREA_NOT_EXISTS = "获取区域数据失败:";
/**
* 合同审核意见不可为空
*/
public static final String CONTRACT_AUDIT_STATUS_NOT_EMPTY = "审核意见必填!";
/**
* 审核说明不可超过200字
*/
public static final String CONTRACT_AUDIT_REMARK_TOO_LONG = "审核说明不可超过200字!";
}
......@@ -384,6 +384,12 @@ public class TEmployeeContractInfo extends BaseEntity {
@Schema(description = "审核状态(0:待提交;1:待审核;2审核通过;3审核不通过)")
private Integer auditStatus;
/**
* 审核人
*/
@Schema(description = "审核人")
private String auditUserName;
/**
* 最新审核通过时间
*/
......
......@@ -122,6 +122,20 @@ public class TEmployeeInfo extends BaseEntity {
@Max(value = 200, message = "年龄不可超过200")
private Integer empAge;
/**
* 年龄查询开始
*/
@Schema(description = "年龄查询开始")
@TableField(exist = false)
private int empAgeStart;
/**
* 年龄查询结束
*/
@Schema(description = "年龄查询结束")
@TableField(exist = false)
private int empAgeEnd;
/**
* 婚姻状态
*/
......@@ -319,16 +333,16 @@ public class TEmployeeInfo extends BaseEntity {
* 1、派单处社保或公积金状态为待审核、待办理、办理中,项目档案处社保或公积金状态为处理中; 0,1=1
* 2、派单处社保或公积金状态为审核不通过或办理失败,项目档案处社保状态为无社保,公积金状态为无公积金; 9,4=0
* 3、派单处社保状态为部分办理失败,项目档案处社保状态为部分购买
* 4、派单处社保或公积金状态为办理成功,项目档案处社保或公积金状态为正常 3=2
* 4、派单处社保或公积金状态为办理成功,项目档案处社保或公积金状态为正常 3=3
* 派减:
* 1、派减状态为待审核、待办理、审核不通过、办理失败,项目档案处社保或公积金状态不变; 5,6,8 =2
* 2、派减状态为办理成功,项目档案处社保或公积金状态变为已派减 7=3
* 1、派减状态为待审核、待办理、审核不通过、办理失败,项目档案处社保或公积金状态不变; 5,6,8 =3
* 2、派减状态为办理成功,项目档案处社保或公积金状态变为已派减 7=4
* 人员档案处社保或公积金状态根据身份证+项目进行整合:
* 社保状态优先级:正常>部分购买>处理中>已派减>无社保
* 公积金状态优先级:正常>处理中>已派减>无公积金
* 公积金状态(字典)0初始状态
*/
@Schema(description = "公积金状态(字典)0初始状态:0 无公积金 1 处理中 2.正常 3.已派减")
@Schema(description = "公积金状态(字典)0初始状态:0 无公积金 1 处理中 2.部分购买 3.正常 4.已派减")
private Integer fundStatus;
/**
......
......@@ -366,6 +366,9 @@ public class TEmployeeProject extends BaseEntity {
/**
* 员工合同状态(字典)
* 0 无合同
* 2 不在用
* 1 在用
*/
@Schema(description = "员工合同状态(字典)0初始状态")
@ExcelAttribute(name = "合同状态", isDataId = true,dataType = ExcelAttributeConstants.PERSONNEL_STATE)
......
......@@ -213,9 +213,9 @@ public class TSettleDomain extends BaseEntity {
private Integer town;
/**
* 服务状态:0正常 1停止服务
* 服务状态:0正常 1停止服务 2冻结
*/
@Schema(description = "服务状态:0正常 1停止服务")
@Schema(description = "服务状态:0正常 1停止服务 2冻结")
private String stopFlag;
/**
......
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Author fxj
* @Date 2022/12/12
* @Description
* @Version 1.0
*/
@Data
public class EmpContractAuditVo implements Serializable {
/**
* 审核状态(0:待提交;1:待审核;2审核通过;3审核不通过)
*/
@Schema(description = "审核状态(0:待提交;1:待审核;2审核通过;3审核不通过)")
private Integer auditStatus;
/**
* 审核原因
*/
@Schema(description = "审核说明,前端传参用,字段不存数据库,数据库存审核记录")
@TableField(exist = false)
private String auditRemark;
/**
* 待审核IDS
*/
private List<String> ids;
}
......@@ -71,6 +71,11 @@ public class EmployeeExportVO extends BaseEntity {
@DateTimeFormat("yyyy-MM-dd")
private LocalDateTime validityEnd;
@ExcelProperty(value = "年龄")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelAttribute(name = "年龄")
private Integer empAge;
@ExcelAttribute(name = "婚姻状况", isDataId = true,dataType = ExcelAttributeConstants.EMP_MARRIED)
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "婚姻状况")
......
......@@ -443,12 +443,12 @@ public class EmployeeProjectExportParamVO extends BaseEntity {
private String projectSource;
/**
* 项目档案状态(0草稿、1已审核)
* 项目档案状态
*/
@ExcelAttribute(name ="项目档案状态", readConverterExp = "0=草稿,1=已审核")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value ="项目档案状态")
private String status;
@ExcelAttribute(name = "项目档案状态")
private String projectStatusReplace;
/**
* 社保-省
......
......@@ -127,7 +127,7 @@ public class EmployeeProjectExportVO {
/**
* 身份证-省
*/
@ExcelAttribute(name = "户籍所在省", isArea = true)
@ExcelAttribute(name = "户籍所在省")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "户籍所在省")
private String idProvince;
......@@ -137,7 +137,7 @@ public class EmployeeProjectExportVO {
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "户籍所在市")
@ExcelAttribute(name = "户籍所在市", isArea = true, parentField = "idProvince")
@ExcelAttribute(name = "户籍所在市")
private String idCity;
/**
......@@ -145,7 +145,7 @@ public class EmployeeProjectExportVO {
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "户籍所在县")
@ExcelAttribute(name = "户籍所在县", isArea = true, parentField = "idCity")
@ExcelAttribute(name = "户籍所在县")
private String idTown;
/**
......@@ -161,7 +161,7 @@ public class EmployeeProjectExportVO {
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "档案所在省")
@ExcelAttribute(name = "档案所在省", isArea = true)
@ExcelAttribute(name = "档案所在省")
private String fileProvince;
/**
......@@ -169,7 +169,7 @@ public class EmployeeProjectExportVO {
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "档案所在市")
@ExcelAttribute(name = "档案所在市", isArea = true, parentField = "fileProvince")
@ExcelAttribute(name = "档案所在市")
private String fileCity;
/**
......@@ -177,7 +177,7 @@ public class EmployeeProjectExportVO {
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "档案所在县")
@ExcelAttribute(name = "档案所在县", isArea = true, parentField = "fileCity")
@ExcelAttribute(name = "档案所在县")
private String fileTown;
/**
......@@ -243,10 +243,11 @@ public class EmployeeProjectExportVO {
/**
* 人员档案状态(0草稿、1已审核)
* , readConverterExp = "0=草稿,1=已审核"
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "人员档案状态")
@ExcelAttribute(name = "人员档案状态", readConverterExp = "0=草稿,1=已审核")
@ExcelAttribute(name = "人员档案状态")
private String proStatus;
/**
......@@ -429,7 +430,7 @@ public class EmployeeProjectExportVO {
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value ="近3个月发薪")
@ExcelAttribute(name = "近3个月发薪", readConverterExp = "0=无,1=是,2=否")
@ExcelAttribute(name = "近3个月发薪", isDataId = true,dataType = ExcelAttributeConstants.FILE_SALARY_STATUS)
private String salaryStatus;
/**
......@@ -441,12 +442,12 @@ public class EmployeeProjectExportVO {
private String projectSource;
/**
* 项目档案状态(0草稿、1已审核
* 项目档案状态(0=正常,1=已减项
*/
@ExcelAttribute(name ="项目档案状态", readConverterExp = "0=草稿,1=已审核")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value ="项目档案状态")
private String status;
@ExcelAttribute(name = "项目档案状态")
private String projectStatus;
/**
* 项目档案创建人
......
......@@ -85,9 +85,9 @@ public class ProjectSetInfoVo implements Serializable {
private String businessThirdType;
/**
* 服务状态:0正常 1停止服务
* 服务状态:0正常 1停止服务 2冻结
*/
@Schema(description = "服务状态:0正常 1停止服务")
@Schema(description = "服务状态:0正常 1停止服务 2冻结")
private String stopFlag;
/**
......
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
/**
* @Author fxj
* @Date 2022/11/23
* @Description
* @Version 1.0
*/
@Data
public class TSettleDomainDataVo implements Serializable {
/**
* 项目编码
*/
@Schema(description = "项目编码")
private String departNo;
/**
* 项目档案在档人数
*/
@Schema(description = "项目档案在档人数")
private long projectNum;
/**
* 合同在用数
*/
@Schema(description = "合同在用数")
private long contractNum;
/**
* 社保在保人数
*/
@Schema(description = "社保在保人数")
private long socialNum;
/**
* 公积金在保人数
*/
@Schema(description = "公积金在保人数")
private long fundNum;
}
......@@ -192,9 +192,9 @@ public class TSettleDomainEkpVo implements Serializable {
private Integer town;
/**
* 服务状态:0正常 1停止服务
* 服务状态:0正常 1停止服务 2冻结
*/
@Schema(description = "服务状态:0正常 1停止服务")
@Schema(description = "服务状态:0正常 1停止服务 2冻结")
private String stopFlag;
/**
......
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import lombok.Data;
import java.util.List;
......@@ -13,10 +14,17 @@ public class TSettleDomainListVo {
*/
private List<TSettleDomainSelectVo> listSelectVO;
private Map<String,TSettleDomainSelectVo> mapSlectVo;
private Map<String,TSettleDomainSelectVo> mapSelectVo;
private Map<String,TSettleDomain> mapVO;
/**
* 合同主体IDS
*/
private List<String> deptIds;
/**
* 合同主体项目编码
*/
private List<String> deptNos;
}
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
/**
* @Author fxj
* @Date 2022/11/23
* @Description
* @Version 1.0
*/
@Data
public class TSettleDomainUpdVo implements Serializable {
/**
* 项目编码
*/
@Schema(description = "项目编码")
private String departNo;
/**
* 服务状态:0正常 1停止服务 2冻结
*/
@Schema(description = "服务状态:0正常 1停止服务 2冻结")
private String stopFlag;
}
package com.yifu.cloud.plus.v1.yifu.archives.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* Description: 允许跨域以
*
* @author fxju
* @since JDK 1.8
*/
@Slf4j
@Configuration
public class CorsConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
//是否发送Cookie
.allowCredentials(true)
//放行哪些原始域
.allowedOriginPatterns("*")
.allowedMethods(new String[]{"GET", "POST", "PUT", "DELETE"})
.allowedHeaders("*")
.exposedHeaders("*");
}
}
......@@ -30,9 +30,15 @@ public class EmployeeConstants {
public static final String FILE_ROVINCE_MUST = "更新档案市,档案省必填";
public static final String FILE_CITY_MUST = "更新档案县,档案市必填";
public static final String DEPT_NO_ERROR = "项目编码错误";
public static final String DEPT_NO_EXIST = "根据项目编码未找到项目";
public static final String DEPT_NO_EXIST = "未找到对应的项目,请核实";
public static final String CHECK_ERROR = "校验服务错误,请联系管理员!";
public static final String CHECK_NO_RESPONSE = "校验服务器未返回,请联系管理员!";
// 拦截合同使用
public static final String SITUATION_ONE = "正常签订";
public static final String SITUATION_TWO = "正常续签";
public static final String SITUATION_THREE = "离职再入职";
public static final String SITUATION_SIX = "作废";
public static final String SITUATION_SEVEN = "终止";
public static final String EMPID_NOT_EMPTY = "员工ID、项目ID不可为空;";
......@@ -53,7 +59,10 @@ public class EmployeeConstants {
public static final String CONTRACT_REDUCE_INFO_NOT_EMPTY = "签订类型为终止时,离职日期和终止原因必填";
public static final String CONTRACT_REDUCE_REASON_NOT_EMPTY = "终止原因为其他时,原因说明必填";
/**
* 对应项目编码已停止合作
*/
public static final String EMP_DISPATCH_SETTLEDOMAIN_STOP = "对应项目编码不存在或者已停止合作";
/**
* 无数据可更新
**/
......
......@@ -126,8 +126,8 @@ public class TEmpChangeInfoController {
@Operation(description = "分页查询")
@GetMapping("/getAllDeptPage" )
public R<IPage<TSettleDomain>> getItemNamePage(Page page,@RequestParam(required = false) String departName
, @RequestParam(required = false) String customerId) {
return new R<>(tEmpChangeInfoService.getAllDeptPage(page, departName, customerId));
, @RequestParam(required = false) String customerId, @RequestParam(required = false) String flag) {
return new R<>(tEmpChangeInfoService.getAllDeptPage(page, departName, customerId,flag));
}
/**
......
......@@ -19,8 +19,10 @@ package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.constants.ArchivesConstants;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeContractInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpContractAuditVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ErrorVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TEmployeeContractSearchVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
......@@ -28,6 +30,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.MenuUtil;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
......@@ -218,15 +221,43 @@ public class TEmployeeContractInfoController {
@PostMapping("/auditContract")
@PreAuthorize("@pms.hasPermission('temployeecontractinfo_audit')")
public R<String> auditContract(@RequestBody TEmployeeContractInfo tEmployeeContractInfo) {
YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(user)){
return R.failed(CommonConstants.USER_FAIL);
}
if (Common.isEmpty(tEmployeeContractInfo.getAuditStatus())) {
return R.failed("审核意见必填!");
return R.failed(ArchivesConstants.CONTRACT_AUDIT_STATUS_NOT_EMPTY);
}
if (Common.isNotNull(tEmployeeContractInfo.getAuditRemark()) && tEmployeeContractInfo.getAuditRemark().length() > 200) {
return R.failed("审核说明不可超过200字!");
return R.failed(ArchivesConstants.CONTRACT_AUDIT_REMARK_TOO_LONG);
}
return tEmployeeContractInfoService.auditContract(tEmployeeContractInfo);
return tEmployeeContractInfoService.auditContract(tEmployeeContractInfo,user);
}
/**
* @Author fxj
* @Description 批量审核员工合同
* @Date 16:21 2022/12/12
**/
@Operation(summary = "审核-员工合同(主键:ID;审核意见auditStatus(2审核通过;3审核不通过);审核说明auditRemark;)权限temployeecontractinfo_audit", description = "审核-员工合同")
@SysLog("批量审核员工合同")
@PostMapping("/auditContractBatch")
@PreAuthorize("@pms.hasPermission('temployeecontractinfo_audit')")
public R<List<ErrorMessage>> auditContractBatch(@RequestBody EmpContractAuditVo contractAuditVo) {
YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(user)){
return R.failed(CommonConstants.USER_FAIL);
}
if (Common.isEmpty(contractAuditVo.getIds())) {
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
}
if (Common.isEmpty(contractAuditVo.getAuditStatus())) {
return R.failed(ArchivesConstants.CONTRACT_AUDIT_STATUS_NOT_EMPTY);
}
if (Common.isNotNull(contractAuditVo.getAuditRemark()) && contractAuditVo.getAuditRemark().length() > 200) {
return R.failed(ArchivesConstants.CONTRACT_AUDIT_REMARK_TOO_LONG);
}
return tEmployeeContractInfoService.auditContractBatch(contractAuditVo,user);
}
/**
* 审核员工合同
* 审核通过后,变为在用,项目内其他的合同不再用
......@@ -342,11 +373,15 @@ public class TEmployeeContractInfoController {
@SysLog("批量导出合同审核")
@PostMapping("/exportAuditContractInfo")
@PreAuthorize("@pms.hasPermission('employee_export_contract_audit')")
public void exportAuditContractInfo(@RequestBody(required = false) TEmployeeContractSearchVo contractInfo, HttpServletResponse response) {
public void exportAuditContractInfo(@RequestBody(required = false) TEmployeeContractSearchVo contractInfo,
@RequestParam(required = false,name = "mId") String mId,
HttpServletResponse response) {
if (Common.isEmpty(contractInfo)){
contractInfo = new TEmployeeContractSearchVo();
}
contractInfo.setMId(mId);
contractInfo.setAuditStatus(CommonConstants.ONE_INT);
contractInfo.setMId(mId);
this.setAuth(contractInfo);
tEmployeeContractInfoService.exportAuditContractInfo(contractInfo, response);
}
......
......@@ -24,6 +24,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpStatusVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportParamVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainDataVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.UpProjectSocialFundVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
......@@ -339,4 +340,17 @@ public class TEmployeeProjectController {
public Boolean updateEmployeeSalaryStatus(@RequestBody EmpStatusVo vo) {
return tEmployeeProjectService.updateEmployeeSalaryStatus(vo);
}
/**
* 查询项目对应的数据
* @author hyc
* @param deptNoList
* @date 2022-12-12 17:45
* @return R
*/
@Operation(summary = "查询项目对应的数据", description = "查询项目对应的数据")
@PostMapping("/selectSettleMentData")
public R<List<TSettleDomainDataVo>> selectSettleMentData(@RequestBody List<String> deptNoList) {
return tEmployeeProjectService.selectSettleMentData(deptNoList);
}
}
......@@ -22,13 +22,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TCustomerInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TDepartSettlementInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.service.TDepartSettlementInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TSettleDomainService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.*;
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.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
......@@ -42,8 +42,8 @@ import org.springframework.web.bind.annotation.*;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
/**
......@@ -72,7 +72,19 @@ public class TSettleDomainController {
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page")
public R<IPage<TSettleDomain>> getTSettleDomainPage(Page<TSettleDomain> page, TSettleDomain tSettleDomain) {
return R.ok(tSettleDomainService.page(page, Wrappers.query(tSettleDomain)));
return R.ok(tSettleDomainService.getPage(page, tSettleDomain));
}
/**
* 不分页查询
*
* @param tSettleDomain 项目表
* @return
*/
@Operation(summary = "不分页查询", description = "不分页查询")
@GetMapping("/noPage")
public R<List<TSettleDomain>> getTSettleDomainNoPage(TSettleDomain tSettleDomain) {
return R.ok(tSettleDomainService.getList(tSettleDomain));
}
......@@ -144,6 +156,7 @@ public class TSettleDomainController {
public TSettleDomainListVo getSettleDomainIdsByUserId(@RequestBody String userId) {
TSettleDomainListVo vo = new TSettleDomainListVo();
vo.setDeptIds(tSettleDomainService.getSettleDomainIdsByUserId(userId));
vo.setDeptNos(tSettleDomainService.getSettleDomainNosByUserId(userId));
return vo;
}
......@@ -171,6 +184,9 @@ public class TSettleDomainController {
List<TSettleDomainSelectVo> list = tSettleDomainService.selectAllSettleDomainSelectVos();
TSettleDomainListVo listVo = new TSettleDomainListVo();
listVo.setListSelectVO(list);
if (Common.isNotNull(list)){
listVo.setMapSelectVo(list.stream().collect(Collectors.toMap(TSettleDomain::getDepartNo, k->k)));
}
return listVo;
}
......@@ -229,6 +245,21 @@ public class TSettleDomainController {
return tSettleDomainService.getSetInfoByCodes(codes);
}
/**
* @Author fxj
* @Description 通过项目编码获取项目及客户信息
* @Date 10:49 2022/7/20
* @Param
* @return
**/
@Operation(description = "通过项目编码获取项目及客户信息")
@SysLog("通过项目编码获取项目及客户信息")
@Inner
@PostMapping("/getSettleInfoByCodes")
public TSettleDomainListVo getSettleInfoByCodes(@RequestBody List<String> codes) {
return tSettleDomainService.getSettleInfoByCodes(codes);
}
/**
* @param id 项目主键
* @Description: 通过id获取结算主体及单位部分信息
......@@ -267,7 +298,7 @@ public class TSettleDomainController {
/**
* 修改项目表--EKP调用接口
* @author hyc
* @param list 项目表
* @param jsonStr 项目表
* @return R
*/
@Operation(summary = "修改项目表--EKP调用接口", description = "修改项目表--EKP调用接口")
......@@ -294,4 +325,22 @@ public class TSettleDomainController {
return R.ok(tSettleDomainService.getUnitPage(page, idNameNo));
}
/**
* 修改项目表--EKP调用接口
* @author hyc
* @param jsonStr
* @return R
*/
@Operation(summary = "更新项目服务状态--EKP调用接口", description = "更新项目服务状态--EKP调用接口")
@SysLog("更新项目服务状态--EKP调用接口")
@PostMapping("/updateProjectStopStatus")
public R updateProjectStopStatus(@RequestBody String jsonStr) {
try {
jsonStr = URLDecoder.decode(jsonStr, CommonConstants.UTF8).replace("=", "");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
List<TSettleDomainUpdVo> list= JSONObject.parseArray(jsonStr, TSettleDomainUpdVo.class);
return tSettleDomainService.updateProjectStopStatus(list);
}
}
......@@ -56,12 +56,6 @@ public interface TEmployeeProjectMapper extends BaseMapper<TEmployeeProject> {
IPage<TEmployeeProject> getTEmployeeProjectInfoPage(Page page, @Param("tEmployeeProject") TEmployeeProject tEmployeeProject);
/**
* 获得导出的项目档案列表
* @param tEmployeeProject
* @return
*/
List<EmployeeProjectExportVO> getTEmployeeProjectExportPage(@Param("tEmployeeProject") EmployeeProjectExportParamVO tEmployeeProject);
// getTEmployeeProjectExportPage 改造
List<EmployeeProjectExportVO> noPageDiy(@Param("tEmployeeProject")EmployeeProjectExportParamVO searchVo);
......
......@@ -40,6 +40,8 @@ public interface TSettleDomainMapper extends BaseMapper<TSettleDomain> {
IPage<TSettleDomain> getPage(Page<TSettleDomain> page, @Param("tSettleDomain") TSettleDomain tSettleDomain);
List<TSettleDomain> getPage(@Param("tSettleDomain") TSettleDomain tSettleDomain);
IPage<IdNameNoVo> getUnitPage(Page<IdNameNoVo> page, @Param("idNameNoVo") IdNameNoVo idNameNoVo);
/**
* @param departNo
......@@ -74,4 +76,6 @@ public interface TSettleDomainMapper extends BaseMapper<TSettleDomain> {
* @return
**/
List<ProjectSetInfoVo> getSetInfoByCodes(@Param(value = "codes") List<String> codes);
List<TSettleDomain> getSettleInfoByCodes(@Param(value = "codes") List<String> codes);
}
......@@ -70,5 +70,5 @@ public interface TEmpChangeInfoService extends IService<TEmpChangeInfo> {
*/
R<List<TCustomerInfo>> getAllUint(String customerName);
IPage<TSettleDomain> getAllDeptPage(Page page, String deptName, String customerId);
IPage<TSettleDomain> getAllDeptPage(Page page, String deptName, String customerId,String flag);
}
......@@ -21,11 +21,13 @@ 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.TEmployeeContractInfo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpContractAuditVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeContractExportVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ErrorVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TEmployeeContractSearchVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
......@@ -98,12 +100,13 @@ public interface TEmployeeContractInfoService extends IService<TEmployeeContract
/**
* @param tEmployeeContractInfo
* @param user
* @Description: 审核
* @Author: hgw
* @Date: 2022/7/1 10:23
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<String> auditContract(TEmployeeContractInfo tEmployeeContractInfo);
R<String> auditContract(TEmployeeContractInfo tEmployeeContractInfo, YifuUser user);
/**
* @param id
......@@ -175,4 +178,6 @@ public interface TEmployeeContractInfoService extends IService<TEmployeeContract
* @return
**/
void exportAuditContractInfo(TEmployeeContractSearchVo contractInfo, HttpServletResponse response);
R<List<ErrorMessage>> auditContractBatch(EmpContractAuditVo contractAuditVo, YifuUser user);
}
......@@ -25,6 +25,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpStatusVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportParamVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainDataVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.UpProjectSocialFundVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
......@@ -224,4 +225,7 @@ public interface TEmployeeProjectService extends IService<TEmployeeProject> {
* @return: void
**/
void everyDayUpdateEmployeContractStatus();
R<List<TSettleDomainDataVo>> selectSettleMentData(List<String> deptNoList);
}
......@@ -21,10 +21,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.vo.IdNameNoVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.SetInfoVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainEkpVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.*;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
......@@ -38,8 +35,25 @@ import java.util.List;
*/
public interface TSettleDomainService extends IService<TSettleDomain> {
/**
* @param page
* @param tSettleDomain
* @Description: 分页列表
* @Author: hgw
* @Date: 2022/12/1 14:22
* @return: com.baomidou.mybatisplus.core.metadata.IPage<com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain>
**/
IPage<TSettleDomain> getPage(Page<TSettleDomain> page, TSettleDomain tSettleDomain);
/**
* @param tSettleDomain
* @Description: 全部list
* @Author: hgw
* @Date: 2022/12/1 14:22
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain>
**/
List<TSettleDomain> getList(TSettleDomain tSettleDomain);
/**
* @param page
* @param idNameNoVo
......@@ -62,8 +76,15 @@ public interface TSettleDomainService extends IService<TSettleDomain> {
List<String> getSettleDomainIdsByUserId(String id);
/**
* 获取用户所拥有的项目编码
*/
List<String> getSettleDomainNosByUserId(String id);
SetInfoVo getSetInfoByCodes(List<String> codes);
TSettleDomainListVo getSettleInfoByCodes(List<String> codes);
/**
* 通过id获取项目及单位部分信息
* @param
......@@ -87,4 +108,6 @@ public interface TSettleDomainService extends IService<TSettleDomain> {
R updateProjectInfo(List<TSettleDomainEkpVo> list);
R updateProjectStopStatus(List<TSettleDomainUpdVo> list);
}
......@@ -272,6 +272,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
if (null == employeeContractInfo) {
//新增合同
TEmployeeContractInfo newEmployeeContractInfo = new TEmployeeContractInfo();
newEmployeeContractInfo.setAuditUserName(user.getNickname());
saveTEmployeeContractInfo(newEmployeeContractInfo, fddContractAttachInfo, settleDomain, fddContractTemplate, tEmployeeInfo, tCustomerInfo, tEmployeeProject);
//更新合同id
updateContractId(fddContractInfo, fddContractAttachInfo, newEmployeeContractInfo);
......@@ -281,6 +282,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
employeeContractInfoMapper.updateById(employeeContractInfo);
//新增合同
TEmployeeContractInfo newEmployeeContractInfo2 = new TEmployeeContractInfo();
newEmployeeContractInfo2.setAuditUserName(user.getNickname());
saveTEmployeeContractInfo(newEmployeeContractInfo2, fddContractAttachInfo, settleDomain, fddContractTemplate, tEmployeeInfo, tCustomerInfo, tEmployeeProject);
//更新合同id
updateContractId(fddContractInfo, fddContractAttachInfo, newEmployeeContractInfo2);
......@@ -308,6 +310,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
//新增合同
TEmployeeContractInfo newEmployeeContractInfo1 = new TEmployeeContractInfo();
newEmployeeContractInfo1.setAuditUserName(user.getNickname());
saveTEmployeeContractInfo(newEmployeeContractInfo1, fddContractAttachInfo, settleDomain, fddContractTemplate, tEmployeeInfo, tCustomerInfo, project);
//更新合同id
updateContractId(fddContractInfo, fddContractAttachInfo, newEmployeeContractInfo1);
......@@ -345,6 +348,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
//新增合同
TEmployeeContractInfo newEmployeeContractInfo1 = new TEmployeeContractInfo();
newEmployeeContractInfo1.setAuditUserName(user.getNickname());
saveTEmployeeContractInfo(newEmployeeContractInfo1, fddContractAttachInfo, settleDomain, fddContractTemplate, newEmployeeInfo, tCustomerInfo, newTEmpProject);
//更新合同id
updateContractId(fddContractInfo, fddContractAttachInfo, newEmployeeContractInfo1);
......
......@@ -104,6 +104,9 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
TSettleDomain tSettleDomain = tSettleDomainMapper.selectOne(Wrappers.<TSettleDomain>query().lambda()
.eq(TSettleDomain::getDepartNo, tEmpChangeInfo.getDeptNo()).eq(TSettleDomain::getDepartName, tEmpChangeInfo.getNewSettle())
.eq(TSettleDomain::getDeleteFlag, CommonConstants.ZERO_STRING).eq(TSettleDomain::getStopFlag, CommonConstants.ZERO_STRING));
if (Common.isEmpty(tSettleDomain)) {
return R.failed("对应项目编码的项目已停止合作");
}
TEmployeeProject tEmployeeProjectOld = tEmployeeProjectService.getById(updateTEmployeeProject.getId());
updateTEmployeeProject.setDeptNo(tEmpChangeInfo.getDeptNo());
updateTEmployeeProject.setDeptId(tEmpChangeInfo.getDeptId());
......@@ -154,7 +157,7 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
List<ErrorMessage> errorMessageList = (List<ErrorMessage>) bindingResult.getTarget();
Map<Long,ErrorMessage> errorMsgMap = new HashMap<>();
if (Common.isNotNull(errorMessageList)){
errorMessageList.stream().forEach(errorMessage -> errorMsgMap.put(errorMessage.getLineNum(),errorMessage));
errorMessageList.forEach(errorMessage -> errorMsgMap.put(errorMessage.getLineNum(),errorMessage));
}
List<TEmployeeProject> updateList = new ArrayList<>();
......@@ -162,7 +165,7 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) {
// 已有验证报错直接下一个
if (Common.isNotNull(errorMsgMap.get(i+2))){
if (Common.isNotNull(errorMsgMap.get((long)i+2))){
continue;
}
errorMsg = new HashSet<>();
......@@ -177,10 +180,9 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
if (excel.getUnsettleDeal().equals(CommonConstants.IS_CHANGE)) {
if (Common.isEmpty(excel.getChangeStartMonth())) {
errorMsg.add("划转起始月不能为空");
} else if (PATTERN.matcher(excel.getChangeStartMonth()).matches()) {
if (Integer.parseInt(excel.getChangeStartMonth()) > Integer.parseInt(DateUtil.getThisMonth())) {
} else if (PATTERN.matcher(excel.getChangeStartMonth()).matches() &&
Integer.parseInt(excel.getChangeStartMonth()) > Integer.parseInt(DateUtil.getThisMonth())) {
errorMsg.add("划转起始月要小于等于当前月");
}
}
}
......@@ -199,7 +201,7 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
.eq(TEmployeeProject::getDeleteFlag,CommonConstants.STATUS_NORMAL)
.eq(TEmployeeProject::getProjectStatus,CommonConstants.ZERO_INT));
if (Common.isNotNull(tEmployeeProject)) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.CHECKS_CHANGE_EMP_PROJECT, excel.getNewSettleCode()));
errorMsg.add(MsgUtils.getMessage(ErrorCodes.PROJECT_NEW_SEARCH_NOT_EXIST, excel.getNewSettleCode()));
}
// 数据合法情况
if (CollUtil.isEmpty(errorMsg)) {
......@@ -313,12 +315,12 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
* @Date 2022-07-26
*/
@Override
public IPage<TSettleDomain> getAllDeptPage(Page page, String deptName, String customerId) {
LambdaQueryWrapper<TSettleDomain> wrapper = buildQueryWrapper(deptName, customerId);
public IPage<TSettleDomain> getAllDeptPage(Page page, String deptName, String customerId,String flag) {
LambdaQueryWrapper<TSettleDomain> wrapper = buildQueryWrapper(deptName, customerId,flag);
return tSettleDomainMapper.selectPage(page,wrapper);
}
private LambdaQueryWrapper buildQueryWrapper(String deptName, String customerId) {
private LambdaQueryWrapper buildQueryWrapper(String deptName, String customerId,String flag) {
LambdaQueryWrapper<TSettleDomain> wrapper = Wrappers.lambdaQuery();
if (Common.isNotNull(deptName)) {
wrapper.like(TSettleDomain::getDepartName, deptName);
......@@ -327,7 +329,9 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
wrapper.eq(TSettleDomain::getCustomerId, customerId);
}
wrapper.eq(TSettleDomain::getDeleteFlag, CommonConstants.ZERO_STRING);
wrapper.eq(TSettleDomain::getStopFlag, CommonConstants.ZERO_STRING);
if (Common.isEmpty(flag)) {
wrapper.eq(TSettleDomain::getStopFlag, CommonConstants.ZERO_STRING);
}
return wrapper;
}
}
......@@ -670,6 +670,13 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (Common.isEmpty(fileSource)) {
return R.failed("人员档案来源必填!(4人员档案新建、5项目档案新建、1社保/公积金、3商险、2薪酬)");
}
TSettleDomain tSettleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda()
.eq(TSettleDomain::getDepartNo, employeeInfo.getDeptNo())
.eq(TSettleDomain::getDeleteFlag, CommonConstants.ZERO_STRING)
.eq(TSettleDomain::getStopFlag, CommonConstants.ZERO_STRING));
if (Common.isEmpty(tSettleDomain)) {
return R.failed("对应项目编码的项目已停止合作");
}
TEmployeeInfo check = new TEmployeeInfo();
check.setEmpName(employeeInfo.getEmpName());
check.setEmpIdcard(employeeInfo.getEmpIdcard());
......@@ -950,6 +957,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
String idCard;
// 个性化校验逻辑
List<String> deptNoList = new ArrayList<>();
TSettleDomain settleDomain;
for (int i = 0; i < excelVOList.size(); i++) {
errorMsg = new HashSet<>();
// 判空
......@@ -985,7 +993,6 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (!deptNoList.isEmpty()) {
List<TSettleDomain> deptList = tSettleDomainService.list(Wrappers.<TSettleDomain>query().lambda()
.eq(TSettleDomain::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TSettleDomain::getStopFlag, CommonConstants.STATUS_NORMAL)
.in(TSettleDomain::getDepartNo, deptNoList)
);
if (deptList == null || deptList.isEmpty()) {
......@@ -1105,6 +1112,14 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
saveList.add(saveEmp);
}
} else {
settleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda()
.eq(TSettleDomain::getDepartNo, excel.getDeptNo())
.eq(TSettleDomain::getDeleteFlag, CommonConstants.ZERO_STRING)
.eq(TSettleDomain::getStopFlag, CommonConstants.ZERO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isEmpty(settleDomain)) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.PROJECT_SEARCH_NOT_EXIST, excel.getEmpIdcard()));
}
// 档案不存在
// 校验身份证实名
TCheckIdCard checkIdCard = new TCheckIdCard();
......@@ -2219,7 +2234,6 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
.eq(TEmployeeContractInfo::getDeleteFlag,CommonConstants.ZERO_INT)
.eq(TEmployeeContractInfo::getId,vo.getContractId())
.eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ONE_INT)
.eq(TEmployeeContractInfo::getDispatchFlag,CommonConstants.ONE_STRING)
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(c)){
TEmployeeContractAudit contractAudit = new TEmployeeContractAudit();
......@@ -2229,6 +2243,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
contractAudit.setCreateName(c.getCreateName());
contractAudit.setCreateTime(LocalDateTime.now());
//审核通过
c.setAuditUserName(c.getCreateBy());
if (CommonConstants.ZERO_STRING.equals(vo.getType())){
c.setAuditStatus(CommonConstants.TWO_INT);
c.setInUse(CommonConstants.ZERO_STRING);
......
......@@ -72,6 +72,11 @@ public class TSettleDomainServiceImpl extends ServiceImpl<TSettleDomainMapper, T
return baseMapper.getPage(page, tSettleDomain);
}
@Override
public List<TSettleDomain> getList(TSettleDomain tSettleDomain) {
return baseMapper.getPage(tSettleDomain);
}
@Override
public IPage<IdNameNoVo> getUnitPage(Page<IdNameNoVo> page, IdNameNoVo idNameNoVo) {
return baseMapper.getUnitPage(page, idNameNoVo);
......@@ -89,6 +94,7 @@ public class TSettleDomainServiceImpl extends ServiceImpl<TSettleDomainMapper, T
try{
for(String userId : userIdList){
redisUtil.remove(CacheConstants.WXHR_SETTLE_DOMAIN_VOS_BY_USERID +"_"+userId);
redisUtil.remove(CacheConstants.WXHR_SETTLE_DOMAIN_NOS_BY_USERID +"_"+userId);
}
} catch (Exception e) {
log.error("清除缓存错误:",e);
......@@ -112,6 +118,28 @@ public class TSettleDomainServiceImpl extends ServiceImpl<TSettleDomainMapper, T
return domainIds;
}
/**
* 获取用户所拥有的项目编码
*
* @param userId 用户id
*/
@Override
public List<String> getSettleDomainNosByUserId(String userId) {
List<String> domainNos = new ArrayList<>();
String userKey = CacheConstants.WXHR_SETTLE_DOMAIN_NOS_BY_USERID + "_" + userId;
Object settleDomainVoR = redisUtil.get(userKey);
if (settleDomainVoR != null) {
return (List<String>) settleDomainVoR;
} else {
List<TCutsomerDataPermisson> permissonList = permissonMapper.selectAllSettleDomainPermissionByUserId(userId);
if (Common.isNotNull(permissonList)) {
domainNos = permissonList.stream().map(TCutsomerDataPermisson::getSettleDomainNo).collect(Collectors.toList());
redisUtil.set(userKey, domainNos);
}
}
return domainNos;
}
/**
* @param settleDomainSelectVo
* @Author: wangan
......@@ -193,6 +221,39 @@ public class TSettleDomainServiceImpl extends ServiceImpl<TSettleDomainMapper, T
}
}
@Override
public R updateProjectStopStatus(List<TSettleDomainUpdVo> list) {
if (Common.isNotNull(list)) {
TSettleDomain settleDomain;
for (TSettleDomainUpdVo settleDomainUpdVo : list) {
if (Common.isEmpty(settleDomainUpdVo.getDepartNo()) ||
Common.isEmpty(settleDomainUpdVo.getStopFlag())) {
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
}
if (!CommonConstants.ONE_STRING.equals(settleDomainUpdVo.getStopFlag()) &&
!CommonConstants.TWO_STRING.equals(settleDomainUpdVo.getStopFlag()) &&
!CommonConstants.ZERO_STRING.equals(settleDomainUpdVo.getStopFlag())) {
return R.failed("服务状态传参错误");
}
settleDomain = baseMapper.selectOne(Wrappers.<TSettleDomain>query().lambda()
.eq(TSettleDomain::getDepartNo, settleDomainUpdVo.getDepartNo())
.eq(TSettleDomain::getDeleteFlag, CommonConstants.ZERO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isEmpty(settleDomain)) {
return R.failed("不存在该项目");
}
if (settleDomain.getStopFlag().equals(settleDomainUpdVo.getStopFlag())) {
return R.failed("不可重复变更项目服务状态");
}
settleDomain.setStopFlag(settleDomainUpdVo.getStopFlag());
baseMapper.updateById(settleDomain);
}
return R.ok();
}else {
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
}
}
private String checkInfo(TSettleDomain domain) {
if (Common.isEmpty(domain.getId())){
return ArchivesConstants.SETTLE_DOMAIN_ID_NOT_EMPTY;
......@@ -323,6 +384,16 @@ public class TSettleDomainServiceImpl extends ServiceImpl<TSettleDomainMapper, T
return setMap;
}
@Override
public TSettleDomainListVo getSettleInfoByCodes(List<String> codes) {
List<TSettleDomain> voList = baseMapper.getSettleInfoByCodes(codes);
TSettleDomainListVo setMap = new TSettleDomainListVo();
if (Common.isNotNull(voList)){
setMap.setMapVO(voList.stream().collect(Collectors.toMap(TSettleDomain::getDepartNo, k->k)));
}
return setMap;
}
/**
* @Author fxj
* @Description 更新EKP对应MVP 项目权限,已有权限不做删除处理
......
......@@ -26,7 +26,7 @@ mybatis-plus:
logic-not-delete-value: 0
configuration:
map-underscore-to-camel-case: true
#log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# spring security 配置
security:
......
......@@ -238,6 +238,9 @@
#{idStr}
</foreach>
</if>
<if test="tEmployeeContractInfo.auditUserName != null and tEmployeeContractInfo.auditUserName.trim() != ''">
AND a.AUDIT_USER_NAME like concat('%',#{tEmployeeContractInfo.auditUserName},'%')
</if>
<if test="tEmployeeContractInfo.id != null and tEmployeeContractInfo.id.trim() != ''">
AND a.ID = #{tEmployeeContractInfo.id}
</if>
......@@ -374,10 +377,7 @@
AND a.CREATE_BY = #{tEmployeeContractInfo.createBy}
</if>
<if test="tEmployeeContractInfo.createName != null and tEmployeeContractInfo.createName.trim() != ''">
AND a.CREATE_NAME = #{tEmployeeContractInfo.createName}
</if>
<if test="tEmployeeContractInfo.createTime != null">
AND a.CREATE_TIME = #{tEmployeeContractInfo.createTime}
AND a.CREATE_NAME like concat('%',#{tEmployeeContractInfo.createName},'%')
</if>
<if test="tEmployeeContractInfo.updateBy != null and tEmployeeContractInfo.updateBy.trim() != ''">
AND a.UPDATE_BY = #{tEmployeeContractInfo.updateBy}
......@@ -386,7 +386,6 @@
AND a.UPDATE_TIME = #{tEmployeeContractInfo.updateTime}
</if>
<if test="tEmployeeContractInfo.unitNo != null and tEmployeeContractInfo.unitNo.trim() != ''">
AND a.UNIT_NO = #{tEmployeeContractInfo.unitNo}
</if>
......
......@@ -82,6 +82,7 @@
<result property="empNatrue" column="EMP_NATRUE"/>
<result property="empName" column="EMP_NAME"/>
<result property="empIdcard" column="EMP_IDCARD"/>
<result property="empAge" column="EMP_AGE"/>
<result property="validityStart" column="VALIDITY_START"/>
<result property="validityEnd" column="VALIDITY_END"/>
<result property="empMarriStatus" column="EMP_MARRI_STATUS"/>
......@@ -329,8 +330,11 @@
<if test="tEmployeeInfo.empBirthday != null">
AND a.EMP_BIRTHDAY = #{tEmployeeInfo.empBirthday}
</if>
<if test="tEmployeeInfo.empAge != null">
AND a.EMP_AGE = #{tEmployeeInfo.empAge}
<if test="tEmployeeInfo.empAgeStart >0">
AND a.EMP_AGE >= #{tEmployeeInfo.empAgeStart}
</if>
<if test="tEmployeeInfo.empAgeEnd >0">
AND a.EMP_AGE <![CDATA[ <= ]]> #{tEmployeeInfo.empAgeEnd}
</if>
<if test="tEmployeeInfo.empMarriStatus != null and tEmployeeInfo.empMarriStatus.trim() != ''">
AND a.EMP_MARRI_STATUS = #{tEmployeeInfo.empMarriStatus}
......@@ -952,6 +956,7 @@
a.EMP_NATRUE,
a.EMP_NAME,
a.EMP_IDCARD,
a.EMP_AGE,
a.VALIDITY_START,
a.VALIDITY_END,
a.EMP_MARRI_STATUS,
......
......@@ -60,6 +60,7 @@
<resultMap id="tEmployeeProjectExportMap" type="com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO">
<result property="empCode" column="EMP_CODE"/>
<result property="projectStatus" column="PROJECT_STATUS"/>
<result property="proEmpNatrue" column="PROEMP_NATRUE"/>
<result property="empNatrue" column="EMP_NATRUE"/>
<result property="empName" column="EMP_NAME"/>
......@@ -103,7 +104,6 @@
<result property="empNatrue" column="EMP_NATRUE"/>
<result property="proCreateName" column="PROCREATE_NAME"/>
<result property="proCreateTime" column="PROCREATE_TIME"/>
<result property="status" column="STATUS"/>
<result property="fileProvince" column="FILE_PROVINCE"/>
<result property="fileCity" column="FILE_CITY"/>
<result property="fileTown" column="FILE_TOWN"/>
......@@ -194,28 +194,28 @@
a.TRY_PERIOD,
a.PROJECT_SOURCE,
a.CONTRACT_STATUS,
b.STATUS AS PROSTATUS,
if(b.STATUS=0,'草稿','已审核') AS PROSTATUS,
b.CREATE_NAME AS PROCREATE_NAME,
b.CREATE_TIME AS PROCREATE_TIME,
b.EMP_PHONE,
a.INSURANCE_STATUS,
a.SOCIAL_STATUS,
a.FUND_STATUS,
b.FILE_PROVINCE,
b.FILE_CITY,
b.FILE_TOWN,
a.SOCIAL_PROVINCE,
a.SOCIAL_CITY,
a.SOCIAL_TOWN,
a4.AREA_NAME FILE_PROVINCE,
a5.AREA_NAME FILE_CITY,
a6.AREA_NAME FILE_TOWN,
a7.AREA_NAME SOCIAL_PROVINCE,
a8.AREA_NAME SOCIAL_CITY,
a9.AREA_NAME SOCIAL_TOWN,
a.SALARY_STATUS,
b.VALIDITY_START,
b.VALIDITY_END,
b.EMP_MARRI_STATUS,
b.EMP_NATIONAL,
b.POLITICAL_STATUS,
b.ID_PROVINCE,
b.ID_CITY,
b.ID_TOWN,
a1.AREA_NAME ID_PROVINCE,
a2.AREA_NAME ID_CITY,
a3.AREA_NAME ID_TOWN,
b.EMP_REGIS_TYPE,
b.IS_COLLEGE,
b.HIGN_EDUCATION,
......@@ -224,7 +224,7 @@
b.ADMISSION_DATE,
b.GRADUTION_DATE,
b.REMARK,
a.STATUS,
if(a.STATUS='0','草稿',IF(a.PROJECT_STATUS=1,'已减项','已审核')) PROJECT_STATUS,
a.CREATE_NAME,
a.CREATE_TIME,
b.EMP_EMAIL,
......@@ -435,6 +435,9 @@
<if test="tEmployeeProject.empIdcard != null and tEmployeeProject.empIdcard.trim() != ''">
AND a.EMP_IDCARD like concat('%',#{tEmployeeProject.empIdcard},'%')
</if>
<if test="tEmployeeProject.projectStatusReplace != null and tEmployeeProject.projectStatusReplace.trim() != ''">
AND a.PROJECT_STATUS = #{tEmployeeProject.projectStatusReplace}
</if>
<if test="tEmployeeProject.bankName != null and tEmployeeProject.bankName.trim() != ''">
AND a.BANK_NAME = #{tEmployeeProject.bankName}
</if>
......@@ -799,21 +802,6 @@
</where>
order by a.CREATE_TIME desc
</select>
<!--tEmployeeInfo导出查询-->
<select id="getTEmployeeProjectExportPage" resultMap="tEmployeeProjectExportMap">
SELECT
<include refid="Base_Export_List"/>
FROM t_employee_project a
left join t_employee_info b on a.EMP_ID = b.id
<where>
a.DELETE_FLAG = '0'
<include refid="exportTEmployeeProject_where"/>
<if test="tEmployeeProject.authSql != null and tEmployeeProject.authSql.trim() != ''">
${tEmployeeProject.authSql}
</if>
</where>
order by a.CREATE_TIME desc
</select>
<!--tEmployeeInfo导出查询改造 fxj 2022-11-03-->
<select id="noPageDiy" resultMap="tEmployeeProjectExportMap">
......@@ -821,6 +809,15 @@
<include refid="Base_Export_List"/>
FROM t_employee_project a
left join t_employee_info b on a.EMP_ID = b.id
LEFT JOIN sys_area a1 on a1.id=b.ID_PROVINCE
LEFT JOIN sys_area a2 on a2.id=b.ID_CITY
LEFT JOIN sys_area a3 on a3.id=b.ID_TOWN
LEFT JOIN sys_area a4 on a4.id=b.FILE_PROVINCE
LEFT JOIN sys_area a5 on a5.id=b.FILE_CITY
LEFT JOIN sys_area a6 on a6.id=b.FILE_TOWN
LEFT JOIN sys_area a7 on a7.id=a.SOCIAL_PROVINCE
LEFT JOIN sys_area a8 on a8.id=a.SOCIAL_CITY
LEFT JOIN sys_area a9 on a9.id=a.SOCIAL_TOWN
<where>
a.DELETE_FLAG = '0'
<include refid="exportTEmployeeProject_where"/>
......
......@@ -211,10 +211,14 @@
<if test="tSettleDomain.deleteFlag != null and tSettleDomain.deleteFlag.trim() != ''">
and a.DELETE_FLAG = #{tSettleDomain.deleteFlag}
</if>
<if test="tSettleDomain.stopFlag != null and tSettleDomain.stopFlag.trim() != ''">
and a.STOP_FLAG = #{tSettleDomain.stopFlag}
<if test="tSettleDomain.stopFlag != null and tSettleDomain.stopFlag.trim() != '' and tSettleDomain.stopFlag == 0">
and a.STOP_FLAG = '0'
</if>
<if test="tSettleDomain.stopFlag != null and tSettleDomain.stopFlag.trim() != '' and tSettleDomain.stopFlag == 1">
and (a.STOP_FLAG = '1' or a.STOP_FLAG = '2')
</if>
</if>
order by CREATE_TIME desc
</select>
<select id="getUnitPage" resultType="com.yifu.cloud.plus.v1.yifu.archives.vo.IdNameNoVo">
......@@ -287,8 +291,7 @@
a.INVOICE_TITLE_INSURANCE,
a.BPO_FLAG
FROM t_settle_domain a
where 1=1
and a.DELETE_FLAG = '0'
where a.DELETE_FLAG = '0'
<if test="codes != null and codes.size() > 0">
and a.DEPART_NO in
<foreach collection="codes" item="param" index="index" open="(" close=")" separator=",">
......@@ -297,4 +300,18 @@
</if>
</select>
<select id="getSettleInfoByCodes" resultMap="tSettleDomainMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_settle_domain a
where 1=1
and a.DELETE_FLAG = '0'
<if test="codes != null and codes.size() > 0">
and a.DEPART_NO in
<foreach collection="codes" item="param" index="index" open="(" close=")" separator=",">
#{param}
</foreach>
</if>
</select>
</mapper>
package com.yifu.cloud.plus.v1.yifu.auth.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* Description: 允许跨域以
*
* @author fxju
* @since JDK 1.8
*/
@Slf4j
@Configuration
public class CorsConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
//是否发送Cookie
.allowCredentials(true)
//放行哪些原始域
.allowedOriginPatterns("*")
.allowedMethods(new String[]{"GET", "POST", "PUT", "DELETE"})
.allowedHeaders("*")
.exposedHeaders("*");
}
}
......@@ -80,7 +80,7 @@ public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
.failureHandler(authenticationFailureHandler()).and().logout()
.logoutSuccessHandler(logoutSuccessHandler()).deleteCookies("JSESSIONID").invalidateHttpSession(true)
.and()
.authorizeRequests().antMatchers("/**/login","/token/**", "/actuator/**", "/mobile/**", "/oauth/token").permitAll()
.authorizeRequests().antMatchers("/**/login","/token/**", "/actuator/**", "/mobile/**", "/oauth/token","/weixin/callback").permitAll()
.anyRequest().authenticated().and().csrf().disable();
}
......
......@@ -18,34 +18,54 @@ package com.yifu.cloud.plus.v1.yifu.auth.endpoint;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.auth.util.LoginTool;
import com.yifu.cloud.plus.v1.yifu.auth.util.weixin.callback.WeixinLoginCallback;
import com.yifu.cloud.plus.v1.yifu.auth.util.weixin.model.WeixinError;
import com.yifu.cloud.plus.v1.yifu.auth.util.weixin.model.WeixinUserInfo;
import com.yifu.cloud.plus.v1.yifu.auth.vo.WxUserVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.util.SpringContextHolder;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprUpmsProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.common.security.util.AuthUtils;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cache.CacheManager;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.HttpHeaders;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.authentication.event.LogoutSuccessEvent;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import org.springframework.security.oauth2.common.OAuth2RefreshToken;
import org.springframework.security.oauth2.provider.AuthorizationRequest;
import org.springframework.security.oauth2.provider.ClientDetails;
import org.springframework.security.oauth2.provider.ClientDetailsService;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.security.oauth2.common.exceptions.InvalidClientException;
import org.springframework.security.oauth2.provider.*;
import org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestValidator;
import org.springframework.security.oauth2.provider.token.AuthorizationServerTokenServices;
import org.springframework.security.oauth2.provider.token.TokenStore;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -56,8 +76,12 @@ import java.util.stream.Collectors;
@RestController
@RequiredArgsConstructor
@RequestMapping("/token")
@EnableConfigurationProperties(DaprUpmsProperties.class)
@Tag(name = "获取Token")
public class YifuTokenEndpoint {
private final DaprUpmsProperties daprUpmsProperties;
private final ClientDetailsService clientDetailsService;
private final TokenStore tokenStore;
......@@ -66,6 +90,36 @@ public class YifuTokenEndpoint {
private final CacheManager cacheManager;
private final PasswordEncoder passwordEncoder;
private final AuthorizationServerTokenServices defaultAuthorizationServerTokenServices;
/**
* 构建userdetails
*
* @param result 用户信息
* @return
*/
private UserDetails getUserDetails(R<UserInfo> result) {
if (result == null || result.getData() == null) {
throw new UsernameNotFoundException("用户不存在");
}
UserInfo info = result.getData();
// 获取资源
Set<String> dbAuthsSet = new HashSet<>(Arrays.asList(info.getPermissions()));
Collection<? extends GrantedAuthority> authorities
= AuthorityUtils.createAuthorityList(dbAuthsSet.toArray(new String[0]));
SysUser user = info.getSysUser();
// 构造security用户
YifuUser thisUser = new YifuUser(user.getUserId(), user.getDeptId(),user.getDeptName(), user.getUsername(),
user.getNickname(),user.getSystemFlag(), SecurityConstants.BCRYPT + user.getPassword(),
user.getPhone(), true, true, true,
CommonConstants.STATUS_NORMAL.equals(user.getLockFlag()),
user.getUserGroup(),authorities, user.getLdapDn());
thisUser.setClientRoleMap(info.getClientRoleMap());
return thisUser;
}
/**
* 认证页面
* @param modelAndView
......@@ -165,4 +219,90 @@ public class YifuTokenEndpoint {
return R.ok(result);
}
/**
* 微信扫码回调登录业务处理
* @param code
* @param state 客户端加密串
* @param type 0 或空 取值配置 1 取值传参
* @return
*/
@GetMapping(value = "/weixin/callback")
@ResponseBody
public String wxCallback(HttpServletRequest request,@RequestParam String code, String state, String type, String appid , String secret) {
return LoginTool.loginTwo(code, appid, secret, getCallback(request, state));
}
private WeixinLoginCallback getCallback(HttpServletRequest request, String state) {
return new WeixinLoginCallback() {
@Override
public String handle(WeixinUserInfo userInfo) {
if (null != userInfo && null != userInfo.getOpenid()) {
SysUser user = new SysUser();
user.setWxOpenid(userInfo.getOpenid());
R<UserInfo> result = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId()
, "/user/inner/getSysUserByWxOpenId", user, UserInfo.class, SecurityConstants.FROM_IN);
OAuth2AccessToken oAuth2AccessToken = null;
if (null != result && null != result.getData() && result.getData().getSysUser() != null) {
SysUser sysUser = result.getData().getSysUser();
if (!CommonConstants.ZERO_STRING.equals(sysUser.getLockFlag())) {
return JSON.toJSONString(R.failed("用户".concat(sysUser.getNickname()).concat("账号:").concat(sysUser.getUsername()).concat("已被锁定,请联系管理员。")));
}
UserDetails userDetails = getUserDetails(result);
try {
String header = request.getHeader(com.yifu.cloud.plus.v1.yifu.auth.constants.SecurityConstants.CLIENT_HEADER_KEY_NEW);
if(Common.isEmpty(header)){
header = request.getHeader(com.yifu.cloud.plus.v1.yifu.auth.constants.SecurityConstants.CLIENT_HEADER_KEY);
//兼容老逻辑
if(Common.isEmpty(header)){
header = request.getHeader(HttpHeaders.AUTHORIZATION);
}
}
if (Common.isEmpty(header)) {
throw new InvalidClientException("请求头中client信息为空");
}
String[] tokens = AuthUtils.extractAndDecodeHeader(header);
assert tokens.length == 2;
String clientId = tokens[0];
ClientDetails clientDetails = clientDetailsService.loadClientByClientId(clientId);
//校验secret
if (!passwordEncoder.matches(tokens[1], clientDetails.getClientSecret())) {
throw new InvalidClientException("Given client ID does not match authenticated client");
}
TokenRequest tokenRequest = new TokenRequest(MapUtil.newHashMap(), clientId, clientDetails.getScope(), "mobile");
//校验scope
new DefaultOAuth2RequestValidator().validateScope(tokenRequest, clientDetails);
OAuth2Request oAuth2Request = tokenRequest.createOAuth2Request(clientDetails);
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken
(userDetails, userDetails.getPassword());
OAuth2Authentication oAuth2Authentication = new OAuth2Authentication(oAuth2Request, authentication);
oAuth2AccessToken = defaultAuthorizationServerTokenServices.createAccessToken(oAuth2Authentication);
} catch (Exception e) {
log.info("客户端解析出错。");
return JSON.toJSONString(R.failed("无此客户端"));
}
WxUserVo wxUserVo = new WxUserVo();
wxUserVo.setOauth2AccessToken(oAuth2AccessToken);
wxUserVo.setWeixinUserInfo(userInfo);
wxUserVo.setUser(sysUser);
return JSON.toJSONString(R.ok(wxUserVo));
} else {
return JSON.toJSONString(R.other(userInfo, "该用户未注册", CommonConstants.REGISTERED));
}
}
//查询用户
log.info("登录成功业务处理");
return JSON.toJSONString(R.failed("openid为空"));
}
@Override
public String errer(WeixinError error) {
log.info("登录失败业务处理");
log.error(error.getErrmsg());
return JSON.toJSONString(R.failed(error.getErrmsg()));
}
};
}
}
package com.yifu.cloud.plus.v1.yifu.auth;
import org.springframework.context.annotation.Configuration;
@Configuration
public class AuthBeanAutoConfiguration {
}
package com.yifu.cloud.plus.v1.yifu.auth.util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.client.RestTemplate;
/**
* 三方登录服务接入
* @author daijie_jay
* @since 2017年11月29日
*/
public abstract class AbstractLoginService<T extends LoginProperties> implements LoginService {
protected static final String REDIRECT = "redirect:";
@Autowired
protected RestTemplate restTemplate;
@Autowired
protected T properties;
public String getRedirectUrl() {
return REDIRECT + properties.getRedirectUri();
}
public String getErrorUrl() {
return REDIRECT + properties.getErrorUri();
}
@SuppressWarnings("unchecked")
@Override
public T getProperties(){
return properties;
}
@Override
public String loadAuthPage() {
return this.loadAuthPage(null);
}
}
package com.yifu.cloud.plus.v1.yifu.auth.util;
public interface LoginCallback<T, E> {
/**
* 登录成功后逻辑处理,处理结束如果有则返回错误信息
* @param userInfo 第三方用户实体
*/
public String handle(T userInfo);
/**
* 登录失败后逻辑处理 ,处理结束如果有则返回错误信息
* @param error 第三方错误实体
*/
public String errer(E error);
}
package com.yifu.cloud.plus.v1.yifu.auth.util;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
/**
* 登录属性配置初始化
*/
// @Component
public class LoginProperties {
/*public String appid = "wxcb81e4a2ad8d9012";
public String appsecret = "546f366801ad42fec8e67393ed484879";*/
public String appid = "wxfb3a14ee64c87046";
public String appsecret = "e2143c5a1f635e039122de27f29354fe";
public String redirectUri = "https://www.ngrok.xiaomiqiu.cn/admin/hi";
public String errorUri = "/error";
public String callbackUri = "https://www.ngrok.xiaomiqiu.cn/oauth/weixin/callback";
/*@Value("${weixin.login.appid}")
protected String appid;
@Value("${weixin.login.appsecret}")
protected String appsecret;
@Value("${weixin.login.redirectUri}")
protected String redirectUri;
@Value("${weixin.login.errorUri}")
protected String errorUri;
@Value("${weixin.login.callbackUri}")
protected String callbackUri;*/
public String getAppid() {
return appid;
}
public void setAppid(String appid) {
this.appid = appid;
}
public String getAppsecret() {
return appsecret;
}
public void setAppsecret(String appsecret) {
this.appsecret = appsecret;
}
public String getRedirectUri() {
return redirectUri;
}
public void setRedirectUri(String redirectUri) {
this.redirectUri = redirectUri;
}
public String getErrorUri() {
return errorUri;
}
public void setErrorUri(String errorUri) {
this.errorUri = errorUri;
}
public String getCallbackUri() {
return callbackUri;
}
public void setCallbackUri(String callbackUri) {
this.callbackUri = callbackUri;
}
}
package com.yifu.cloud.plus.v1.yifu.auth.util;
/**
* 返回结果
*/
public interface LoginResult {
/**
* 是否正常返回
* @return Boolean
*/
Boolean getResult();
}
package com.yifu.cloud.plus.v1.yifu.auth.util;
/**
* 三方登录服务接入
*/
public interface LoginService {
public <T extends LoginProperties> T getProperties();
/**
* 加载第三方授权页
* @return String
*/
String loadAuthPage();
/**
* 加载第三方授权页
* @param state 数据声明
* @return String
*/
String loadAuthPage(String state);
}
package com.yifu.cloud.plus.v1.yifu.auth.util;
import com.yifu.cloud.plus.v1.yifu.auth.util.weixin.WeixinLoginTool;
import com.yifu.cloud.plus.v1.yifu.auth.util.weixin.callback.WeixinLoginCallback;
@SuppressWarnings("unchecked")
public class LoginTool {
/**
* 支持前端传惨 appid secret 兼容 多个公众号的情况
* @param appAuthCode
* @param appid
* @param secret
* @param callback
* @return
*/
public static String loginTwo(String appAuthCode, String appid ,String secret, LoginCallback callback){
return WeixinLoginTool.login(appAuthCode,appid,secret, (WeixinLoginCallback) callback);
}
}
package com.yifu.cloud.plus.v1.yifu.auth.util.annotation;
import com.yifu.cloud.plus.v1.yifu.auth.AuthBeanAutoConfiguration;
import com.yifu.cloud.plus.v1.yifu.auth.util.config.WeixinLoginBeanAutoConfiguration;
import com.yifu.cloud.plus.v1.yifu.auth.util.weixin.WeixinLoginTool;
import org.springframework.context.annotation.Import;
import java.lang.annotation.*;
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Import({AuthBeanAutoConfiguration.class, WeixinLoginBeanAutoConfiguration.class, WeixinLoginTool.class})
public @interface EnableWeixinLogin {
}
package com.yifu.cloud.plus.v1.yifu.auth.util.config;
import com.yifu.cloud.plus.v1.yifu.auth.util.weixin.WeixinLoignProperties;
import com.yifu.cloud.plus.v1.yifu.auth.util.weixin.callback.WeixinLoginCallbackController;
import com.yifu.cloud.plus.v1.yifu.auth.util.weixin.service.WeixinLoginService;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 微信登录自动装置
*/
//@Configuration
// @EnableConfigurationProperties({WeixinLoignProperties.class})
public class WeixinLoginBeanAutoConfiguration {
@Bean("weixinLoginService")
public WeixinLoginService loginService() {
return new WeixinLoginService();
}
@Bean
public WeixinLoginCallbackController loginCallbackController() {
return new WeixinLoginCallbackController();
}
}
package com.yifu.cloud.plus.v1.yifu.auth.util.weixin;
/**
* 微信登录常量配置
*/
public class WeixinLoginConstants {
public static final String HOST_API = "https://api.weixin.qq.com";
/**
* 临时code获取accessToken
*/
public static final String ACCESS_TOKEN = "/sns/oauth2/access_token";
/**
* 获取用户信息
*/
public static final String USER_INFO = "/sns/userinfo";
}
package com.yifu.cloud.plus.v1.yifu.auth.util.weixin;
import com.yifu.cloud.plus.v1.yifu.auth.util.LoginResult;
import com.yifu.cloud.plus.v1.yifu.auth.util.weixin.callback.WeixinLoginCallback;
import com.yifu.cloud.plus.v1.yifu.auth.util.weixin.model.WeixinAccessToken;
import com.yifu.cloud.plus.v1.yifu.auth.util.weixin.model.WeixinError;
import com.yifu.cloud.plus.v1.yifu.auth.util.weixin.model.WeixinUserInfo;
import com.yifu.cloud.plus.v1.yifu.auth.util.weixin.service.WeixinLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 微信登录工具
*/
@Component
public class WeixinLoginTool {
private static WeixinLoginService wxLoginService;
@Autowired
public void setWeixinLoginService(WeixinLoginService wxLoginService) {
WeixinLoginTool.wxLoginService = wxLoginService;
}
/**
* 微信登录
* 实用于已得到微信临时code
* @param appAuthCode 临时code
* @param callback 回调函数
* @return String
*/
public static String login(String appAuthCode, WeixinLoginCallback callback){
LoginResult result = wxLoginService.getAccessToken(appAuthCode);
if(result.getResult()){
WeixinAccessToken accessToken = (WeixinAccessToken) result;
result = wxLoginService.getWxUserInfo(accessToken);
if(result.getResult()){
WeixinUserInfo userInfo = (WeixinUserInfo) result;
return callback.handle(userInfo);
}
}
return callback.errer((WeixinError) result);
}
/**
* 微信登录
* 实用于已得到微信临时code
* @param appAuthCode 临时code
* @param callback 回调函数
* @return String
*/
public static String login(String appAuthCode, String appid ,String secret, WeixinLoginCallback callback){
LoginResult result = wxLoginService.getAccessToken(appAuthCode,appid,secret);
if(result.getResult()){
WeixinAccessToken accessToken = (WeixinAccessToken) result;
result = wxLoginService.getWxUserInfo(accessToken);
if(result.getResult()){
WeixinUserInfo userInfo = (WeixinUserInfo) result;
return callback.handle(userInfo);
}
}
return callback.errer((WeixinError) result);
}
}
package com.yifu.cloud.plus.v1.yifu.auth.util.weixin;
import com.yifu.cloud.plus.v1.yifu.auth.util.LoginProperties;
import org.springframework.stereotype.Component;
/**
* 微信登录属性配置初始化
*/
@Component
public class WeixinLoignProperties extends LoginProperties {
private String token;
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
}
package com.yifu.cloud.plus.v1.yifu.auth.util.weixin.callback;
import com.yifu.cloud.plus.v1.yifu.auth.util.LoginCallback;
import com.yifu.cloud.plus.v1.yifu.auth.util.weixin.model.WeixinError;
import com.yifu.cloud.plus.v1.yifu.auth.util.weixin.model.WeixinUserInfo;
/**
* 微信登录回调
*/
public interface WeixinLoginCallback extends LoginCallback<WeixinUserInfo, WeixinError> {
}
package com.yifu.cloud.plus.v1.yifu.auth.util.weixin.callback;
import com.yifu.cloud.plus.v1.yifu.auth.util.weixin.WeixinLoginTool;
import org.springframework.web.bind.annotation.RequestParam;
/**
* 微信登录扫描回调
*/
/*@Controller*/
public class WeixinLoginCallbackController {
/**
* 处理回调业务
* @param code 临时code
* @param state 数据声明
* @param callback 回调函数
* @return String
*/
/*@GetMapping(value = WeixinLoginConstants.LOGIN_CALLBACK)*/
public String callback(@RequestParam String code, String state, WeixinLoginCallback callback){
return WeixinLoginTool.login(code, callback);
}
}
package com.yifu.cloud.plus.v1.yifu.auth.util.weixin.model;
import com.yifu.cloud.plus.v1.yifu.auth.util.LoginResult;
/**
* 微信认证权限的实体
*/
public class WeixinAccessToken implements LoginResult {
//接口调用凭证
private String access_token;
//access_token接口调用凭证超时时间,单位(秒)
private Long expires_in;
//用户刷新access_token
private String refresh_token;
//授权用户唯一标识
private String openid;
//用户授权的作用域,使用逗号(,)分隔
private String scope;
public String getAccess_token() {
return access_token;
}
public void setAccess_token(String access_token) {
this.access_token = access_token;
}
public Long getExpires_in() {
return expires_in;
}
public void setExpires_in(Long expires_in) {
this.expires_in = expires_in;
}
public String getRefresh_token() {
return refresh_token;
}
public void setRefresh_token(String refresh_token) {
this.refresh_token = refresh_token;
}
public String getOpenid() {
return openid;
}
public void setOpenid(String openid) {
this.openid = openid;
}
public String getScope() {
return scope;
}
public void setScope(String scope) {
this.scope = scope;
}
@Override
public Boolean getResult() {
return true;
}
}
package com.yifu.cloud.plus.v1.yifu.auth.util.weixin.model;
import com.yifu.cloud.plus.v1.yifu.auth.util.LoginResult;
/**
* 错误信息
*/
public class WeixinError implements LoginResult {
private String errcode;
private String errmsg;
public String getErrcode() {
return errcode;
}
public void setErrcode(String errcode) {
this.errcode = errcode;
}
public String getErrmsg() {
return errmsg;
}
public void setErrmsg(String errmsg) {
this.errmsg = errmsg;
}
@Override
public Boolean getResult() {
return false;
}
}
package com.yifu.cloud.plus.v1.yifu.auth.util.weixin.model;
import com.yifu.cloud.plus.v1.yifu.auth.util.LoginResult;
import java.util.List;
/**
* 用户信息
*/
public class WeixinUserInfo implements LoginResult {
//普通用户的标识,对当前开发者帐号唯一
private String openid;
//普通用户昵称
private String nickname;
//普通用户性别,1为男性,2为女性
private Integer sex;
//普通用户个人资料填写的省份
private String province;
//普通用户个人资料填写的城市
private String city;
//国家,如中国为CN
private String country;
//用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像),用户没有头像时该项为空
private String headimgurl;
//用户特权信息,json数组,如微信沃卡用户为(chinaunicom)
private List<String> privilege;
//用户统一标识。针对一个微信开放平台帐号下的应用,同一用户的unionid是唯一的。
private String unionid;
public String getOpenid() {
return openid;
}
public void setOpenid(String openid) {
this.openid = openid;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public Integer getSex() {
return sex;
}
public void setSex(Integer sex) {
this.sex = sex;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getHeadimgurl() {
return headimgurl;
}
public void setHeadimgurl(String headimgurl) {
this.headimgurl = headimgurl;
}
public List<String> getPrivilege() {
return privilege;
}
public void setPrivilege(List<String> privilege) {
this.privilege = privilege;
}
public String getUnionid() {
return unionid;
}
public void setUnionid(String unionid) {
this.unionid = unionid;
}
@Override
public Boolean getResult() {
return true;
}
}
package com.yifu.cloud.plus.v1.yifu.auth.util.weixin.service;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.yifu.cloud.plus.v1.yifu.auth.util.AbstractLoginService;
import com.yifu.cloud.plus.v1.yifu.auth.util.LoginResult;
import com.yifu.cloud.plus.v1.yifu.auth.util.weixin.WeixinLoginConstants;
import com.yifu.cloud.plus.v1.yifu.auth.util.weixin.WeixinLoignProperties;
import com.yifu.cloud.plus.v1.yifu.auth.util.weixin.model.WeixinAccessToken;
import com.yifu.cloud.plus.v1.yifu.auth.util.weixin.model.WeixinError;
import com.yifu.cloud.plus.v1.yifu.auth.util.weixin.model.WeixinUserInfo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
/**
* 微信登录服务
*/
@Service
public class WeixinLoginService extends AbstractLoginService<WeixinLoignProperties> {
private static final Logger logger = LoggerFactory.getLogger(WeixinLoginService.class);
public LoginResult getAccessToken(String code) {
StringBuilder uri = new StringBuilder();
uri.append(WeixinLoginConstants.HOST_API + WeixinLoginConstants.ACCESS_TOKEN + "?appid=");
uri.append(properties.getAppid());
uri.append("&secret=").append(properties.getAppsecret());
uri.append("&code=" + code).append("&grant_type=authorization_code");
try {
String url = uri.toString();
String result = restTemplate.getForObject(url, String.class);
JSONObject json = JSONUtil.parseObj(result);
if(json.getStr("access_token") != null){
WeixinAccessToken accessToken = new WeixinAccessToken();
accessToken.setAccess_token(json.getStr("access_token"));
accessToken.setOpenid(json.getStr("open_id"));
accessToken.setExpires_in(json.getLong("expires_in"));
accessToken.setRefresh_token(json.getStr("refresh_token"));
accessToken.setScope(json.getStr("scope"));
return accessToken;
}else{
WeixinError error = new WeixinError();
error.setErrcode(json.getStr("errcode"));
error.setErrmsg(json.getStr("errmsg"));
return error;
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return null;
}
public LoginResult getAccessToken(String code,String appid ,String secret) {
StringBuilder uri = new StringBuilder();
uri.append(WeixinLoginConstants.HOST_API + WeixinLoginConstants.ACCESS_TOKEN + "?appid=");
if (Common.isNotNull(appid) && Common.isNotNull(secret)){
uri.append(appid);
uri.append("&secret=").append(secret);
}else {
uri.append(properties.getAppid());
uri.append("&secret=").append(properties.getAppsecret());
}
uri.append("&code=" + code).append("&grant_type=authorization_code");
try {
String url = uri.toString();
String result = restTemplate.getForObject(url, String.class);
JSONObject json = JSONUtil.parseObj(result);
if(json.getStr("access_token") != null){
WeixinAccessToken accessToken = new WeixinAccessToken();
accessToken.setAccess_token(json.getStr("access_token"));
accessToken.setOpenid(json.getStr("open_id"));
accessToken.setExpires_in(json.getLong("expires_in"));
accessToken.setRefresh_token(json.getStr("refresh_token"));
accessToken.setScope(json.getStr("scope"));
return accessToken;
}else{
WeixinError error = new WeixinError();
error.setErrcode(json.getStr("errcode"));
error.setErrmsg(json.getStr("errmsg"));
return error;
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return null;
}
public LoginResult getWxUserInfo(WeixinAccessToken accessToken) {
StringBuilder uri = new StringBuilder();
uri.append(WeixinLoginConstants.HOST_API + WeixinLoginConstants.USER_INFO + "?access_token=");
uri.append(accessToken.getAccess_token());
uri.append("&openid=" + accessToken.getOpenid());
uri.append("&lang=zh_CN");
try {
String result = restTemplate.getForObject(uri.toString(), String.class);
WeixinUserInfo userInfo = JSONUtil.toBean(result, WeixinUserInfo.class);
if(userInfo != null && null != userInfo.getOpenid()){
return userInfo;
}else{
WeixinError error = JSONUtil.toBean(result, WeixinError.class);
return error;
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return null;
}
@Override
public String loadAuthPage(String state) {
return null;
}
}
package com.yifu.cloud.plus.v1.yifu.auth.vo;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser;
import com.yifu.cloud.plus.v1.yifu.auth.util.weixin.model.WeixinUserInfo;
import lombok.Data;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
/**
* @program: master
* @description: 微信返回包装类
* @author: pwang
* @create: 2020-08-10 21:11
**/
@Data
public class WxUserVo {
private OAuth2AccessToken oauth2AccessToken;
private WeixinUserInfo weixinUserInfo;
private SysUser user;
}
......@@ -36,3 +36,10 @@ spring:
prefer-file-system-access: true
suffix: .ftl
template-loader-path: classpath:/templates/
weixin:
login:
appid: wxfb3a14ee64c87046
appsecret: e2143c5a1f635e039122de27f29354fe
redirectUri: https://www.ngrok.xiaomiqiu.cn/admin/hi
errorUri: /error
callbackUri: https://www.ngrok.xiaomiqiu.cn/oauth/weixin/callback
......@@ -8,7 +8,9 @@ package com.yifu.cloud.plus.v1.check.constant;
*/
public interface ChecksConstants {
String NACOS_CHECK_CONFIG_ERROR="nacos中checks.yaml的配置canCheck未开启!";
String NACOS_CHECK_CONFIG_ERROR="校验服务验证开关关闭!";
String CHECK_CONFIG_ACCESS="校验服务验证关闭,自动放行!";
String CODE="code";
......
......@@ -13,6 +13,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
......@@ -39,8 +40,10 @@ public class ChecksUtil {
// 1.调用身份信息校验api
checkIdCardMethod(checkIdCard);
} else {
checkIdCard.setIsTrue(CommonConstants.ZERO_INT);
checkIdCard.setReason(ChecksConstants.NACOS_CHECK_CONFIG_ERROR);
//checkIdCard.setIsTrue(CommonConstants.ZERO_INT);
//checkIdCard.setReason(ChecksConstants.NACOS_CHECK_CONFIG_ERROR);
checkIdCard.setIsTrue(CommonConstants.ONE_INT);
checkIdCard.setReason(ChecksConstants.CHECK_CONFIG_ACCESS);
}
}
/**
......@@ -52,10 +55,23 @@ public class ChecksUtil {
public static R<Map<String,TCheckMobile>> checkMobile(String mobiles, boolean canCheck) {
Map<String,TCheckMobile> checkMobiles = new HashMap<>();
if (canCheck) {
// 1.调用身份信息校验api
// 1.调用手机信息校验api
return checkMobileMethod(mobiles,checkMobiles);
} else {
return R.failed(ChecksConstants.NACOS_CHECK_CONFIG_ERROR);
TCheckMobile checkMobile;
List<String> mobileList = Common.initStrToList(mobiles,CommonConstants.COMMA_STRING);
Map<String,TCheckMobile> resMap = new HashMap<>();
if (Common.isNotNull(mobileList)){
for (String m:mobileList){
checkMobile = new TCheckMobile();
checkMobile.setMobile(m);
checkMobile.setStatus(CommonConstants.ONE_STRING);
checkMobile.setType(CommonConstants.ONE_STRING);
checkMobile.setMessage(ChecksConstants.CHECK_CONFIG_ACCESS);
resMap.put(m,checkMobile);
}
}
return R.ok(resMap);
}
}
/**
......@@ -67,10 +83,17 @@ public class ChecksUtil {
**/
public static R<TCheckBankNo> checkBankNoTwo(String name, String cardNo, boolean canCheck) {
if (canCheck) {
// 1.调用身份信息校验api
// 1.调用银行卡信息校验api
return checkBankNoTwoMethod(name,cardNo);
} else {
return R.failed(ChecksConstants.NACOS_CHECK_CONFIG_ERROR);
TCheckBankNo checkBankNo = new TCheckBankNo();
checkBankNo.setBankNo(cardNo);
checkBankNo.setName(name);
checkBankNo.setMessage(ChecksConstants.CHECK_CONFIG_ACCESS);
checkBankNo.setResult("01");
checkBankNo.setType(CommonConstants.ONE_STRING);
checkBankNo.setRemark(ChecksConstants.CHECK_CONFIG_ACCESS);
return R.ok(checkBankNo);
}
}
......
......@@ -104,5 +104,11 @@
<version>3.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>4.5.30</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
......@@ -36,7 +36,7 @@ public class AsyncConfig implements AsyncConfigurer {
* 1)<!-- 线程池维护线程的最少数量,即使没有任务需要执行,也会一直存活 -->
* 2)<!-- 设置allowCoreThreadTimeout=true(默认false)时,核心线程会超时关闭 -->
*/
taskExecutor.setCorePoolSize(10);
taskExecutor.setCorePoolSize(2);
/**
* <!-- 允许的空闲时间,当线程空闲时间达到keepAliveTime时,线程会退出,直到线程数量=corePoolSize -->
* <!-- 如果allowCoreThreadTimeout=true,则会直到线程数量=0 -->
......@@ -47,7 +47,7 @@ public class AsyncConfig implements AsyncConfigurer {
* <!-- 当线程数>=corePoolSize,且任务队列已满时。线程池会创建新线程来处理任务 -->
* <!-- 当线程数=maxPoolSize,且任务队列已满时,线程池会拒绝处理任务而抛出异常,异常见下
*/
taskExecutor.setMaxPoolSize(25);
taskExecutor.setMaxPoolSize(5);
/**
* <!-- 缓存队列(阻塞队列)当核心线程数达到最大时,新任务会放在队列中排队等待执行 -->
*/
......
......@@ -131,5 +131,9 @@ public interface CacheConstants {
* 用户登录的项目vo缓存
*/
public static final String WXHR_SETTLE_DOMAIN_VOS_BY_USERID = ServiceNameConstants.ARCHIVES_SERVICE + "_SettleDomainVosByUserId";
/**
* 缓存用户所拥有的项目编码
*/
public static final String WXHR_SETTLE_DOMAIN_NOS_BY_USERID = ServiceNameConstants.ARCHIVES_SERVICE + "_SettleDomainNosByUserId";
}
......@@ -133,6 +133,7 @@ public interface CommonConstants {
String FIVE_STRING = "5";
String TWELVE_STRING = "12";
int TWELVE_INT = 12;
String THIRTEEN_STRING = "13";
......@@ -156,6 +157,10 @@ public interface CommonConstants {
* number 5000
*/
int FIVES_INT = 5000;
/**
* number 5000
*/
int TEN_THOUSAND_INT = 10000;
/**
* number 1
......@@ -200,7 +205,7 @@ public interface CommonConstants {
* @Author pwang
* @Date 2019-08-02 16:39
**/
int[] dingleDigitIntArray = {0,1,2,3,4,5,6,7,8,9};
int[] dingleDigitIntArray = {0,1,2,3,4,5,6,7,8,9,10,11,12};
/**
* 个位数字串(阿里编码规约不允许直接使用‘魔法值’)
* @Author pwang
......@@ -501,4 +506,35 @@ public interface CommonConstants {
// 权限使用的
public static final String A_DEPT_ID = "a.dept_id";
public static final String A_CREATE_BY = "a.CREATE_BY";
String SETTLE_DOMAIN_GET_ERROR = "获取结算主体信息失败!";
/**
* c端机构节点 code
* @Author hgw
* @Date 2022-12-13 11:05:24
**/
public static final String WX_C_ORG_CODE = "00294";
/**
* c端机构节点 id
* @Author hgw
* @Date 2022-12-13 11:05:33
**/
public static final long WX_C_ORG_ID = 294;
/**
* c端机构节点 name
* @Author hgw
* @Date 2022-12-13 11:05:33
**/
public static final String WX_C_ORG_NAME = "C端用户";
// C端前缀
public static final String C_PREFIX = CacheConstants.DEFAULT_CODE_KEY.concat("_C_");
/**
* 用户未注册
*/
public static final Integer REGISTERED = 3;
}
......@@ -28,6 +28,8 @@ public class ExcelAttributeConstants {
public static final String SOCIAL_ECURITY_STATE = "social_ecurity_state";
// 公积金状态
public static final String FUND_STATUS = "fund_status";
// 档案近3个月发薪状态
public static final String FILE_SALARY_STATUS = "file_salary_status";
// 减档原因
public static final String DOWNSHIFT_REASON = "downshift_reason";
......
......@@ -299,12 +299,20 @@ public interface ErrorCodes {
* 人员在该项目下存在进行中/未完结的服务
*/
String ARCHIVES_PROJECT_CHANGE_NOT_EXIST = "archives.project.change.not.exist";
/**
* 人员在该项目下存在存在在用或待审核、待提交的合同,不允许减项
*/
String ARCHIVES_PROJECT_CHANGE_CONTRACT_EXIST = "archives.project.change.contract.exist";
/**
* 人员在原项目中存在在途的服务,请先终止后,再进行划转
*/
String QT_PROJECT_CHANGE_NOT_EXIST = "qt.project.change.not.exist";
/**
* 未找到对应的项目,请核实
* 未找到对应的新项目或者新项目已停止合作,请核实
*/
String PROJECT_NEW_SEARCH_NOT_EXIST = "project.new.search.not.exist";
/**
* 未找到对应的项目或者项目已停止合作,请核实
*/
String PROJECT_SEARCH_NOT_EXIST = "project.search.not.exist";
/**
......@@ -478,7 +486,7 @@ public interface ErrorCodes {
*/
String EMP_DISPATCH_EMP_NOT_EMPTY = "emp.dispatch.emp.not.empty";
/**
* 派增异常: 对应项目编码已停止合作
* 派增异常:对应项目编码的项目已冻结/已停止合作
*/
String EMP_DISPATCH_SETTLEDOMAIN_STOP = "emp.dispatch.settleDomain.stop";
/**
......@@ -514,6 +522,10 @@ public interface ErrorCodes {
*/
String EMP_DISPATCH_SOCIAL_PAYMENT_TYPE_NOT_SAME = "emp.dispatch.social.payment.type.same";
String SOCIAL_HOLD_IS_EMPTY = "social.hold.is.empty";
String FUND_HOLD_IS_EMPTY = "fund.hold.is.empty";
String ARCHIVES_IMPORT_EMP_TRUE = "archives.import.emp.true";
/**
......
......@@ -62,6 +62,10 @@ public class Common {
return null == obj || "".equals(obj) || "null".equals(obj);
}
public static boolean isEmpty(Map obj) {
return (null == obj || obj.size() == 0);
}
public static boolean isEmpty(List obj) {
return (null == obj || obj.size() == 0);
}
......
......@@ -723,15 +723,7 @@ public class ExcelUtil <T> implements Serializable {
} else {
return errorInfo(attr, "_必须为数字且最多两位小数", i);
}
}/* else if (attr.min() == 0) {
if (Common.isNumber(c)) {
if (attr.isFloat()){
if (Float.valueOf(c).compareTo(attr.min()) < CommonConstants.ZERO_INT) {
return errorInfo(attr, "_小于最小值", i);
}
}
}
}*/
}
}
return null;
}
......
......@@ -88,6 +88,13 @@ public class R<T> implements Serializable {
return restResult(data, CommonConstants.FAIL, msg);
}
public static <T> R<T> other(int code, String msg) {
return restResult(null, code, msg);
}
public static <T> R<T> other(T data, String msg, int code) {
return restResult(data, code, msg);
}
private static <T> R<T> restResult(T data, int code, String msg) {
R<T> apiResult = new R<>();
apiResult.setCode(code);
......
package com.yifu.cloud.plus.v1.yifu.common.core.util;
import lombok.extern.slf4j.Slf4j;
import java.security.SecureRandom;
import java.util.Random;
/**
* @description: 随机数工具
* @author: hgw
* @create: 2022-12-12 17:51:35
**/
@Slf4j
public class RandomUtil {
private RandomUtil() {
throw new IllegalStateException("Utility class");
}
/**
* 获取六位随机数
*
* @return
* @Author pwang
* @Date 2020-08-24 17:26
**/
public static String getSix() {
log.info("获取随机数开始>>>>>>>>>");
Random rad = new SecureRandom();
log.info("获取随机数结束<<<<<<<<<");
String result = rad.nextInt(1000000) + "";
if (result.length() != 6) {
return getSix();
}
return result;
}
}
package com.yifu.cloud.plus.v1.yifu.common.core.util.alisms;
import lombok.Data;
/**
* @program: master
* @description: 阿里短信服务返回结果
* @author: fxj
* @create: 2022-12-12
**/
@Data
public class AliSmsResult {
/**
* 成功的code
* @Author fxj
* @Date 2022-12-12
**/
public static final String SUCCESS_CODE = "OK";
//发送回执ID,可根据该ID在接口QuerySendDetails中查询具体的发送状态。
private String bizId;
/**
* 请求状态码。
* 返回OK代表请求成功。
* 其他错误码详见错误码列表。
**/
private String code;
//状态码的描述。
private String message;
//请求ID。
private String requestId;
}
package com.yifu.cloud.plus.v1.yifu.common.core.util.alisms;
import lombok.Data;
/**
* 节日祝福 参数封装对象
* @Author fxj
* @Date 2021-05-07
* @return
**/
@Data
public class ParamVo {
private String name;
private String zhengjian;
private String time;
}
package com.yifu.cloud.plus.v1.yifu.common.core.util.alisms;
import lombok.Data;
import java.io.Serializable;
@Data
public class QuerySendResult implements Serializable {
private int totalCount;
private String message;
private String requestId;
private String code;
private SmsSendDetailDTOs smsSendDetailDTOs;
}
package com.yifu.cloud.plus.v1.yifu.common.core.util.alisms;
import lombok.Data;
import java.io.Serializable;
/**
* 短信发送回执结果
* @Author fxj
* @Date 2021-05-08
* @return
**/
@Data
public class SmsSendDetailDTO implements Serializable {
private String sendDate;
private String outId;
/**
* 短信发送状态,包括:
* 1:等待回执。
* 2:发送失败。
* 3:发送成功。
**/
private Integer sendStatus;
private String receiveDate;
private String errCode;
private String templateCode;
private String content;
private String phoneNum;
}
package com.yifu.cloud.plus.v1.yifu.common.core.util.alisms;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class SmsSendDetailDTOs implements Serializable {
private List<SmsSendDetailDTO> smsSendDetailDTO;
}
package com.yifu.cloud.plus.v1.yifu.common.core.util.alisms;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.aliyuncs.CommonRequest;
import com.aliyuncs.CommonResponse;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.profile.DefaultProfile;
import lombok.extern.slf4j.Slf4j;
/**
* @program: master
* @description: 阿里云短信工具
* @author: pwang
* @create: 2020-08-24 11:44
**/
@Slf4j
public class SmsUtil {
private static final String ACCESS_KEY_ID = "LTAI4G1h6voBYGPCV4RNmqMo";
private static final String ACCESS_KEY_SECRET = "1e4TWryIdScpsIqPxXZynGNMASdCkl";
private static final String ERROR_INFO = "调取阿里云服务异常";
private SmsUtil() { throw new IllegalStateException("Utility class");}
/**
* 短信发送方法
* @Author fxj
* @Date 2022-12-12
* @param phone
* @param code
* @param signName
* @return 正确结果{"Message":"OK","RequestId":"38FA1BE1-52C1-4833-9211-AD55CF264988","BizId":"342207398251524244^0","Code":"OK"}
**/
public static AliSmsResult sendSms(String phone,String code,String signName) {
DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", ACCESS_KEY_ID, ACCESS_KEY_SECRET);
IAcsClient client = new DefaultAcsClient(profile);
JSONObject exceptionResult = new JSONObject();
CommonRequest request = new CommonRequest();
request.setSysMethod(MethodType.POST);
request.setSysDomain("dysmsapi.aliyuncs.com");
request.setSysVersion("2017-05-25");
request.setSysAction("SendSms");
request.putQueryParameter("RegionId", "cn-hangzhou");
request.putQueryParameter("PhoneNumbers", phone);
request.putQueryParameter("SignName", signName);
request.putQueryParameter("TemplateCode", "SMS_200465275");
request.putQueryParameter("TemplateParam", "{\"code\":\""+code+"\"}");
try {
CommonResponse response = client.getCommonResponse(request);
return JSON.parseObject(response.getData(),AliSmsResult.class);
} catch (Exception e) {
log.error(ERROR_INFO,e);
exceptionResult.put("Message", ERROR_INFO);
exceptionResult.put("Code", "ERROR");
return exceptionResult.toJavaObject(AliSmsResult.class);
}
}
/**
* 发送皖信人力云的短信方法
* @Author fxj
* @Date 2022-12-12
* @param phone
* @param code
* @return 错误示例 {"Message":"模板不合法(不存在或被拉黑)","RequestId":"D7923A5B-AE30-481C-84D4-56BB0F230848","Code":"isv.SMS_TEMPLATE_ILLEGAL"}
**/
public static AliSmsResult sendSms(String phone,String code) {
return sendSms(phone,code,"皖信人力云");
}
}
package com.yifu.cloud.plus.v1.yifu.common.core.util.alisms;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import java.util.ArrayList;
import java.util.List;
public class YiFuSmsTookit {
private YiFuSmsTookit() { throw new IllegalStateException("Utility class");}
/**
* 批量发送提前校验或封装签名
* @Author fxj
* @Date 2021-05-07
* @param phones
* @param templateParams
* @param signName
* @param templateCode
* @return
**/
public static AliSmsResult sendBatchSms(List<String> phones,
List<String> templateParams,
String signName,
String templateCode){
if (null == phones || null == templateParams){
return getSmsResult(CommonConstants.FAIL.toString(),"电话和变量参数不可为空!");
}
if (phones.size() != templateParams.size()){
return getSmsResult(CommonConstants.FAIL.toString(),"电话号码与变量参数数据不一致!");
}
List<String> signNames= new ArrayList<>();
List<ParamVo> templateParamList = new ArrayList<>();
for (int i=0;i<phones.size();i++){
signNames.add(signName);
}
ParamVo paramVo = null;
for (String param:templateParams){
paramVo = new ParamVo();
paramVo.setName(param);
templateParamList.add(paramVo);
}
return YiFuSmsUtil.sendBatchSms(phones,templateParamList, signNames,templateCode);
}
/**
* 批量发送提前校验或封装签名
* @Author fxj
* @Date 2021-05-07
* @param phones
* @param templateParamList
* @param signName
* @param templateCode
* @return
**/
public static AliSmsResult sendBusBatchSms(List<String> phones,
List<ParamVo> templateParamList,
String signName,
String templateCode){
if (null == phones || null == templateParamList){
return getSmsResult(CommonConstants.FAIL.toString(),"电话和变量参数不可为空!");
}
List<String> signNames= new ArrayList<>();
if (phones.size() != templateParamList.size()){
return getSmsResult(CommonConstants.FAIL.toString(),"电话号码与变量参数数据不一致!");
}
for (int i=0;i<phones.size();i++){
signNames.add(signName);
}
return YiFuSmsUtil.sendBatchSms(phones,templateParamList, signNames,templateCode);
}
private static AliSmsResult getSmsResult(String code,String msg){
AliSmsResult aliSmsResult = new AliSmsResult();
aliSmsResult.setCode(code);
aliSmsResult.setMessage(msg);
return aliSmsResult;
}
public static void main(String[] args) {
List<String> list = new ArrayList<>();
list.add("18909690612");
list.add("18909690533");
YiFuSmsUtil.querySendDetails(list,"","20210509",null,null);
}
}
package com.yifu.cloud.plus.v1.yifu.common.core.util.alisms;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.aliyuncs.CommonRequest;
import com.aliyuncs.CommonResponse;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.profile.DefaultProfile;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import lombok.extern.slf4j.Slf4j;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @program: master
* @description: 阿里云短信工具 - 安徽易服 的阿里云短信
* @author: fang
* @create: 2021-05-07
**/
@Slf4j
public class YiFuSmsUtil {
private static final String ACCESS_KEY_ID = "LTAIDh9goA3jgpun";
private static final String ACCESS_KEY_SECRET = "eN8EHPAZxglNfcUCMhAT02cy93omLa";
private static final String ERROR_INFO = "调取阿里云服务异常";
private static final String REGIONID = "cn-hangzhou";
private static final String SYS_DOMAIN = "dysmsapi.aliyuncs.com";
private static final String SYS_VERSION = "2017-05-25";
private static final String MESSAGE = "Message";
private static final String CODE = "Code";
private YiFuSmsUtil() { throw new IllegalStateException("Utility class");}
/**
* 防寒、防暑、节假日短信 单条发送
* @Author fxj
* @Date 2021-05-07
* @param phone
* @param templateParam
* @param signName
* @param templateCode
* @return
* 错误示例 {"Message":"模板不合法(不存在或被拉黑)","RequestId":"D7923A5B-AE30-481C-84D4-56BB0F230848","Code":"isv.SMS_TEMPLATE_ILLEGAL"}
* 正确结果{"Message":"OK","RequestId":"38FA1BE1-52C1-4833-9211-AD55CF264988","BizId":"342207398251524244^0","Code":"OK"}
**/
public static AliSmsResult sendSms(String phone,String templateParam,String signName,String templateCode){
DefaultProfile profile = DefaultProfile.getProfile(REGIONID, ACCESS_KEY_ID, ACCESS_KEY_SECRET);
IAcsClient client = new DefaultAcsClient(profile);
JSONObject exceptionResult = new JSONObject();
CommonRequest request = new CommonRequest();
request.setSysMethod(MethodType.POST);
request.setSysDomain(SYS_DOMAIN);
request.setSysVersion(SYS_VERSION);
request.setSysAction("SendSms");
request.putQueryParameter("RegionId", REGIONID);
request.putQueryParameter("PhoneNumbers", phone);
request.putQueryParameter("SignName", signName);
request.putQueryParameter("TemplateCode", templateCode);
request.putQueryParameter("TemplateParam", "{\"name\":\""+templateParam+"\"}");
try {
CommonResponse response = client.getCommonResponse(request);
return JSON.parseObject(response.getData(),AliSmsResult.class);
} catch (Exception e) {
log.error(ERROR_INFO,e);
exceptionResult.put(MESSAGE, ERROR_INFO);
exceptionResult.put(CODE, e.getMessage());
return exceptionResult.toJavaObject(AliSmsResult.class);
}
}
/**
* 防寒、防暑、节假日短信 批量发送
* @Author fxj
* @Date 2021-05-07
* @param phones
* @param templateParams
* @param signNames
* @param templateCode
* @return
* 错误示例 {"Message":"模板不合法(不存在或被拉黑)","RequestId":"D7923A5B-AE30-481C-84D4-56BB0F230848","Code":"isv.SMS_TEMPLATE_ILLEGAL"}
* 正确结果{"Message":"OK","RequestId":"38FA1BE1-52C1-4833-9211-AD55CF264988","BizId":"342207398251524244^0","Code":"OK"}
**/
public static AliSmsResult sendBatchSms(List<String> phones,
List<ParamVo> templateParams,
List<String> signNames,
String templateCode){
DefaultProfile profile = DefaultProfile.getProfile(REGIONID, ACCESS_KEY_ID, ACCESS_KEY_SECRET);
IAcsClient client = new DefaultAcsClient(profile);
JSONObject exceptionResult = new JSONObject();
CommonRequest request = new CommonRequest();
request.setSysMethod(MethodType.POST);
request.setSysDomain(SYS_DOMAIN);
request.setSysVersion(SYS_VERSION);
request.setSysAction("SendBatchSms");
request.putQueryParameter("PhoneNumberJson", JSONObject.toJSONString(phones));
request.putQueryParameter("SignNameJson", JSONObject.toJSONString(signNames));
request.putQueryParameter("TemplateCode", templateCode);
request.putQueryParameter("TemplateParamJson", JSONObject.toJSONString(templateParams));
try {
CommonResponse response = client.getCommonResponse(request);
return JSON.parseObject(response.getData(),AliSmsResult.class);
} catch (Exception e) {
log.error(ERROR_INFO,e);
exceptionResult.put(MESSAGE, ERROR_INFO);
exceptionResult.put(CODE, e.getMessage());
return exceptionResult.toJavaObject(AliSmsResult.class);
}
}
public static QuerySendResult querySendDetail(String phone, String bizId, String sendDate, String pageSize, String curPage){
DefaultProfile profile = DefaultProfile.getProfile(REGIONID, ACCESS_KEY_ID, ACCESS_KEY_SECRET);
IAcsClient client = new DefaultAcsClient(profile);
JSONObject exceptionResult = new JSONObject();
CommonRequest request = new CommonRequest();
request.setSysMethod(MethodType.POST);
request.setSysDomain(SYS_DOMAIN);
request.setSysVersion(SYS_VERSION);
request.setSysAction("QuerySendDetails");
request.putQueryParameter("PhoneNumber", phone);
request.putQueryParameter("BizId", bizId);
request.putQueryParameter("SendDate", sendDate);
request.putQueryParameter("PageSize", null==pageSize?"10":pageSize);
request.putQueryParameter("CurrentPage", null ==curPage?"1":curPage);
try {
CommonResponse response = client.getCommonResponse(request);
return JSON.parseObject(response.getData(),QuerySendResult.class);
} catch (Exception e) {
log.error(ERROR_INFO,e);
exceptionResult.put(MESSAGE, ERROR_INFO);
exceptionResult.put(CODE, e.getMessage());
return exceptionResult.toJavaObject(QuerySendResult.class);
}
}
public static Map<String,SmsSendDetailDTO> querySendDetails(List<String> phones, String bizId, String sendDate, String pageSize, String curPage){
DefaultProfile profile = DefaultProfile.getProfile(REGIONID, ACCESS_KEY_ID, ACCESS_KEY_SECRET);
IAcsClient client = new DefaultAcsClient(profile);
JSONObject exceptionResult = new JSONObject();
CommonRequest request = new CommonRequest();
request.setSysMethod(MethodType.POST);
request.setSysDomain(SYS_DOMAIN);
request.setSysVersion(SYS_VERSION);
request.setSysAction("QuerySendDetails");
request.putQueryParameter("BizId", bizId);
request.putQueryParameter("SendDate", sendDate);
request.putQueryParameter("PageSize", null==pageSize?"10":pageSize);
request.putQueryParameter("CurrentPage", null ==curPage?"1":curPage);
Map<String,SmsSendDetailDTO> smsSendDetailMap = new HashMap<>();
try {
if (Common.isNotEmpty(phones)){
CommonResponse response;
QuerySendResult sendResult;
for (String phone:phones){
request.putQueryParameter("PhoneNumber", phone);
response = client.getCommonResponse(request);
sendResult =JSON.parseObject(response.getData(),QuerySendResult.class);
if (null != sendResult &&
null != sendResult.getSmsSendDetailDTOs() &&
Common.isNotNull(sendResult.getSmsSendDetailDTOs().getSmsSendDetailDTO())){
smsSendDetailMap.put(phone,sendResult.getSmsSendDetailDTOs().getSmsSendDetailDTO().get(0));
}
}
}
} catch (Exception e) {
log.error(ERROR_INFO,e);
exceptionResult.put(MESSAGE, ERROR_INFO);
exceptionResult.put(CODE, e.getMessage());
}
return smsSendDetailMap;
}
}
package com.yifu.cloud.plus.v1.yifu.common.core.util.http;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
/**
* 获取http会话数据的工具类
*
* @author daijie
* @since 2017年6月5日
*/
public class HttpConversationUtil {
private static Logger logger = LoggerFactory.getLogger(HttpConversationUtil.class);
/**
* 获取当前请求会话
* @return HttpServletRequest
*/
public static HttpServletRequest getRequest(){
return ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
}
/**
* 获取当前响应会话
* @return HttpServletResponse
*/
public static HttpServletResponse getResponse(){
return ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getResponse();
}
/**
* 获取当前请求会话IP
* @return String
*/
public static String getIP(){
String ip = getRequest().getHeader("x-forwarded-for");
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)){
ip = getRequest().getHeader("Proxy-Client-IP");
}
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)){
ip = getRequest().getHeader("WL-Proxy-Client-IP");
}
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)){
ip = getRequest().getRemoteAddr();
}
return ip.equals("0:0:0:0:0:0:0:1")?"127.0.0.1":ip;
}
/**
* 获取请求Body转换为json字符串
*
* @return String
*/
public static String getBodyString() {
StringBuilder sb = new StringBuilder();
InputStream inputStream = null;
BufferedReader reader = null;
try {
inputStream = getRequest().getInputStream();
reader = new BufferedReader(new InputStreamReader(inputStream, Charset.forName("UTF-8")));
String line = "";
while ((line = reader.readLine()) != null) {
sb.append(line);
}
} catch (IOException e) {
logger.info("未读取到请求body中数据");
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
logger.info("未读取到请求body中数据");
}
}
}
return sb.toString();
}
/**
* 得到所有的参数的值
* @return Map
*/
public static Map<String,Object> handelRequest(){
Map<String,Object> obj = new HashMap<String,Object>();
Enumeration<String> coll = getRequest().getParameterNames();
while(coll.hasMoreElements()){
String key = coll.nextElement();
obj.put(key, getRequest().getParameter(key)==null?"":getRequest().getParameter(key) );
}
if(obj.get("pageSize")!=null || obj.get("pageNumber")!=null){
int pageSize = Integer.valueOf(obj.get("pageSize").toString());
int pageNumber = Integer.valueOf(obj.get("pageNumber").toString());
int startIndex = (pageNumber - 1) * pageSize;
obj.put("startIndex", startIndex);
obj.put("pageSize", pageSize);
obj.put("pageNumber", pageNumber);
}
return obj;
}
}
package com.yifu.cloud.plus.v1.yifu.common.core.util.http.htapi;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
/**
* 仿JS 编码 解码
* @Author fxj
* @Date 2020-11-13
* @return
**/
public class EncodingUtil {
public static String decodeURIComponent(String s) {
if (s == null) {
return null;
}
String result = null;
try {
result = URLDecoder.decode(s, CommonConstants.UTF8);
}
// This exception should never occur.
catch (UnsupportedEncodingException e) {
result = s;
}
return result;
}
public static String encodeURIComponent(String s) {
String result = null;
try {
result = URLEncoder.encode(s, CommonConstants.UTF8)
.replaceAll("\\+", "%20")
.replaceAll("\\%21", "!")
.replaceAll("\\%27", "'")
.replaceAll("\\%28", "(")
.replaceAll("\\%29", ")")
.replaceAll("\\%7E", "~");
}
// This exception should never occur.
catch (UnsupportedEncodingException e) {
result = s;
}
return result;
}
private EncodingUtil() {
super();
}
}
package com.yifu.cloud.plus.v1.yifu.common.core.util.http.htapi;
import lombok.Data;
import java.io.Serializable;
/**
* API 返回结果
* @Author fxj
* @Date 2020-11-13
* @return
**/
@Data
public class ResultBean implements Serializable {
/**
* API返回结果
**/
private String ENCMSG;
}
......@@ -17,10 +17,13 @@
package com.yifu.cloud.plus.v1.yifu.common.core.vo;
import lombok.Getter;
import lombok.Setter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* @author lengleng
......@@ -91,4 +94,11 @@ public class YifuUser extends User {
this.ldapDn = ldapDn;
}
/**
* key是客户端id,val是角色id数组
*/
@Getter
@Setter
private Map<String, List<Integer>> clientRoleMap;
}
......@@ -97,10 +97,13 @@ archives.project.emp.not.exist=\u8BE5\u4EBA\u5458\u65E0\u5BF9\u5E94\u7684\u9879\
archives.project.change.not.exist=\u4EBA\u5458\u5728\u8BE5\u9879\u76EE\u4E0B\u5B58\u5728\u8FDB\u884C\u4E2D/\u672A\u5B8C\u7ED3\u7684\u670D\u52A1
archives.project.change.contract.exist=\u4EBA\u5458\u5728\u8BE5\u9879\u76EE\u4E0B\u5B58\u5728\u5728\u7528\u6216\u5F85\u5BA1\u6838\u3001\u5F85\u63D0\u4EA4\u7684\u5408\u540C\uFF0C\u4E0D\u5141\u8BB8\u51CF\u9879
archives.project.emp.lose.fee.not.empty=\u4E0D\u826F\u8BB0\u5F55\u8D39\u7528\u635F\u5931\u548C\u5176\u4ED6\u635F\u5931\u4E0D\u53EF\u540C\u65F6\u4E3A\u7A7A
qt.project.change.not.exist=\u4EBA\u5458\u5728\u539F\u9879\u76EE\u4E2D\u5B58\u5728\u5728\u9014\u7684\u670D\u52A1\uFF0C\u8BF7\u5148\u7EC8\u6B62\u540E\uFF0C\u518D\u8FDB\u884C\u5212\u8F6C
project.search.not.exist=\u672A\u627E\u5230\u5BF9\u5E94\u7684\u9879\u76EE\uFF0C\u8BF7\u6838\u5B9E
project.search.not.exist=\u672A\u627E\u5230\u5BF9\u5E94\u7684\u9879\u76EE\u6216\u8005\u9879\u76EE\u5DF2\u505C\u6B62\u5408\u4F5C\uFF0C\u8BF7\u6838\u5B9E
project.new.search.not.exist=\u672A\u627E\u5230\u5BF9\u5E94\u7684\u65B0\u9879\u76EE\u6216\u8005\u65B0\u9879\u76EE\u5DF2\u505C\u6B62\u5408\u4F5C\uFF0C\u8BF7\u6838\u5B9E
change.strat.month.exit=\u5212\u8F6C\u8D77\u59CB\u6708\u4E0D\u80FD\u4E3A\u7A7A
change.less.month.exit=\u5212\u8F6C\u8D77\u59CB\u6708\u8981\u5C0F\u4E8E\u7B49\u4E8E\u5F53\u524D\u6708
......@@ -205,6 +208,10 @@ emp.dispatch.emp.contract.sub.name.not.empty=\u6D3E\u589E\u5F02\u5E38\uFF1A \u54
emp.dispatch.social.record.base.not.exist=\u6D3E\u589E\u5F02\u5E38\uFF1A\u5907\u6848\u57FA\u6570\u4E0D\u53EF\u4E3A\u7A7A
social.hold.is.empty=\u793E\u4FDD\u6237\u4E0D\u80FD\u4E3A\u7A7A
fund.hold.is.empty=\u516C\u79EF\u91D1\u6237\u4E0D\u80FD\u4E3A\u7A7A
......
......@@ -38,6 +38,12 @@
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-insurances-api</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-salary-api</artifactId>
......
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.common.dapr.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
/*
*
*
* @author fxj
* @date 2022-05-23 14:28
**/
@Data
@Component
@PropertySource("classpath:daprConfig.properties")
@ConfigurationProperties(value = "dapr.mail", ignoreInvalidFields = false)
public class DaprMailProperties {
String appUrl;
String appId;
String appPort;
String httpPort;
String grpcPort;
String metricsPort;
}
......@@ -59,7 +59,20 @@ public class ArchivesDaprUtil {
}
return res;
}
/**
* @Author huyc
* @Description 通过项目编码获取项目及客户信息
* @Date 21:18 2022/7/20
* @Param
* @return
**/
public R<TSettleDomainListVo> getSettleInfoByCodes(List<String> codes){
R<TSettleDomainListVo> res = HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl(),daprArchivesProperties.getAppId(),"/tsettledomain/getSettleInfoByCodes",JSON.toJSONString(codes), TSettleDomainListVo.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(res)){
return R.failed("通过项目编码获取项目及客户信息失败!");
}
return res;
}
/**
* @Author fxj
* @Description 获取派单校验需要的档案信息
......
......@@ -108,10 +108,11 @@ public class HttpDaprUtil {
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("Authorization", null);
HttpEntity<String> entity = new HttpEntity(param, headers);
String urlBuffer = stringBuffer.toString();
try {
res = restTemplate.postForEntity(URI.create(stringBuffer.toString()),entity, cs);
res = restTemplate.postForEntity(URI.create(urlBuffer),entity, cs);
} catch (Exception e) {
log.error("日志保存异常:",e);
log.error("日志保存异常:" + URI.create(urlBuffer),e);
return R.failed("获取信息失败:" + e.getMessage());
}
if (null != res && CommonConstants.SUCCESS == res.getStatusCodeValue()) {
......
package com.yifu.cloud.plus.v1.yifu.common.dapr.util;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprCheckProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprMailProperties;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
/**
* @Author fxj
* @Description 邮件发送工具类
* @Date 17:53 2022/12/1
**/
@Log4j2
@EnableConfigurationProperties(DaprMailProperties.class)
public class MailDaprUtil {
@Autowired
private DaprCheckProperties daprCheckProperties;
/**
* @Author fxj
* @Description 身份证&姓名一致性校验
* @Date 21:15 2022/7/18
* @Param
* @return
**/
/*public R<TCheckIdCard> checkIdCardSingle(TCheckIdCard tCheckIdCard){
R<TCheckIdCard> res = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(),daprCheckProperties.getAppId(),"/tcheckidcard/inner/checkIdCardSingle",JSON.toJSONString(tCheckIdCard), TCheckIdCard.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(res)){
return R.failed("校验身份证信息失败!");
}
return res;
}*/
}
......@@ -37,8 +37,9 @@ public class MenuUtil {
public void setAuthSql(YifuUser user, BaseEntity entity) {
// 普通用户:
log.error("userINfo:"+ user.getUserGroup() +"}"+user.getId() +"|" + entity.getMId());
if (user != null && Common.isNotNull(user.getId()) && CommonConstants.ONE_STRING.equals(user.getSystemFlag())) {
log.error("userINfo:"+ user.getUserGroup() +"}"+user.getId() +"|" + entity.getMId());
// 菜单id
String menuId = entity.getMId();
if (Common.isEmpty(menuId)) {
......
package com.yifu.cloud.plus.v1.yifu.common.dapr.util;
import com.alibaba.fastjson.JSON;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprSalaryProperties;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpSocialViewVo;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import java.util.List;
/**
* @Author fxj
* @Date 2022/8/17
......@@ -17,5 +22,14 @@ public class SalaryDaprUtil {
@Autowired
private DaprSalaryProperties daprProperties;
/**
* @Author huyc
* @Description 更新结算信息
* @Date 17:38 2022/12/26
* @Param
* @return
**/
public void updateSalarySettleStatus(List<EkpSocialViewVo> infoVo) {
HttpDaprUtil.invokeMethodPost(daprProperties.getAppUrl(),daprProperties.getAppId(),"/tincome/inner/updateSalarySettleStatus", JSON.toJSONString(infoVo), EkpSocialViewVo.class, SecurityConstants.FROM_IN);
}
}
......@@ -5,6 +5,8 @@ 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.DaprSocialProperties;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpInsuranceViewVo;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpSocialViewVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.HaveSalaryNoSocialSearchVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.HaveSalaryNoSocialVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TPaymentVo;
......@@ -133,4 +135,26 @@ public class SocialDaprUtils {
public void deleteById(TIncomeDetail infoVo) {
HttpDaprUtil.invokeMethodPost(daprProperties.getAppUrl(),daprProperties.getAppId(),"/tincomedetail/inner/deleteById", JSON.toJSONString(infoVo), TIncomeDetail.class, SecurityConstants.FROM_IN);
}
/**
* @Author huyc
* @Description 更新结算信息
* @Date 17:38 2022/12/26
* @Param
* @return
**/
public void updateSocialSettleStatus(List<EkpSocialViewVo> infoVo) {
HttpDaprUtil.invokeMethodPost(daprProperties.getAppUrl(),daprProperties.getAppId(),"/tpaymentinfo/inner/updateSocialSettleStatus", JSON.toJSONString(infoVo), EkpSocialViewVo.class, SecurityConstants.FROM_IN);
}
/**
* @Author huyc
* @Description 更新结算信息
* @Date 17:38 2022/12/26
* @Param
* @return
**/
public void updateIncomeSettleStatus(List<EkpInsuranceViewVo> infoVo) {
HttpDaprUtil.invokeMethodPost(daprProperties.getAppUrl(),daprProperties.getAppId(),"/tincome/inner/updateIncomeSettleStatus", JSON.toJSONString(infoVo), EkpInsuranceViewVo.class, SecurityConstants.FROM_IN);
}
}
......@@ -26,5 +26,19 @@ public class EkpInsuranceProperties {
String insuranceLoginName;
String insuranceFocSubject;
String insuranceDocSubject;
/**
* ekp修改接口描述
*/
String insuranceUpdateDocSubject;
/**
* ekp修改FdModelId
*/
String insuranceUpdateFdModelId;
/**
* ekp修改FdFlowId
*/
String insuranceUpdateFdFlowId;
}
......@@ -3,8 +3,10 @@ package com.yifu.cloud.plus.v1.yifu.ekp.util;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.ekp.config.EkpInsuranceProperties;
import com.yifu.cloud.plus.v1.yifu.ekp.constant.EkpConstants;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EKPInsurancePushParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpInteractiveParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpUpdateParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.TInsuranceSettlePushParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
......@@ -44,7 +46,7 @@ public class EkpInsuranceUtil {
//指向EKP的接口url
//把ModelingAppModelParameterAddForm转换成MultiValueMap
MultiValueMap<String,Object> wholeForm = new LinkedMultiValueMap<>();
wholeForm.add("docSubject",ekpInsuranceProperties.getInsuranceFocSubject());
wholeForm.add("docSubject",ekpInsuranceProperties.getInsuranceDocSubject());
wholeForm.add("docCreator", "{\"LoginName\":\"admin\"}");
wholeForm.add("docStatus", ekpInsuranceProperties.getInsuranceDocStatus());
wholeForm.add("fdModelId", ekpInsuranceProperties.getInsuranceFdModelId());
......@@ -73,6 +75,50 @@ public class EkpInsuranceUtil {
}
}
/**
* 商险修改信息推送ekp
*
* @author licancan
* @param param
* @return {@link String}
*/
public String sendUpdateToEkp(EkpUpdateParam param){
log.info("推送EKP开始--商险修改");
RestTemplate yourRestTemplate = new RestTemplate();
try{
String formValues = new ObjectMapper().writeValueAsString(param);
//指向EKP的接口url
//把ModelingAppModelParameterAddForm转换成MultiValueMap
MultiValueMap<String,Object> wholeForm = new LinkedMultiValueMap<>();
wholeForm.add("docSubject",ekpInsuranceProperties.getInsuranceUpdateDocSubject());
wholeForm.add("docCreator", "{\"LoginName\":\"admin\"}");
wholeForm.add("docStatus", ekpInsuranceProperties.getInsuranceDocStatus());
wholeForm.add("fdModelId", ekpInsuranceProperties.getInsuranceUpdateFdModelId());
wholeForm.add("fdFlowId", ekpInsuranceProperties.getInsuranceUpdateFdFlowId());
wholeForm.add("formValues", formValues);
log.info("wholeForm:" + wholeForm);
HttpHeaders headers = new HttpHeaders();
//如果EKP对该接口启用了Basic认证,那么客户端需要加入
//addAuth(headers,"yourAccount"+":"+"yourPassword");是VO,则使用APPLICATION_JSON
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
//必须设置上传类型,如果入参是字符串,使用MediaType.TEXT_PLAIN;如果
HttpEntity<MultiValueMap<String,Object>> entity = new HttpEntity<MultiValueMap<String,Object>>(wholeForm,headers);
//有返回值的情况 VO可以替换成具体的JavaBean
ResponseEntity<String> obj = yourRestTemplate.exchange(ekpInsuranceProperties.getInsuranceUrl(), HttpMethod.POST, entity, String.class);
String body = obj.getBody();
if (StringUtils.isBlank(body)){
log.error(EkpConstants.SEND_FAILED);
return null;
}else{
log.info(EkpConstants.SEND_SUCCESS + body);
return body;
}
}catch (Exception e){
log.error(EkpConstants.SEND_FAILED +":", e);
return null;
}
}
/**
* 将类转换成EKP要求的格式
*
......
......@@ -153,4 +153,9 @@ public class EkpPushFundParam implements Serializable {
**/
private String fd_3b43922217c6f8;
/**
* 公积金创建人姓名
**/
private String fd_3b5cc487bb46fa;
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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