Commit 37452b3a authored by fangxinjiang's avatar fangxinjiang

Merge branch 'develop'

parents 53c6c67a 3a9956cc
......@@ -70,6 +70,12 @@ public class TCertRecord extends BaseEntity {
private String empIdcard;
/**
* 项目id
*/
@ExcelAttribute(name = "项目id" )
@Schema(description ="项目id")
private String deptId;
/**
* 项目名称
*/
@ExcelAttribute(name = "项目名称" )
......
......@@ -348,7 +348,7 @@ public class TSettleDomain extends BaseEntity {
@Schema(description = "公积金类型0:缴费库;1:预估库")
private String fundType;
/**
* 商险结算类型0 合并 1 单独
* 商险结算类型0 合并(预估) 1 单独(实缴)
*/
@ExcelAttribute(name = "商险结算类型0 合并 1 单独")
@ExcelProperty("商险结算类型0 合并 1 单独")
......
......@@ -16,18 +16,13 @@
*/
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.time.LocalDate;
/**
* 员工合同-批量更新的VO
......
......@@ -22,6 +22,7 @@ import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
......@@ -38,7 +39,7 @@ import java.util.List;
*/
@Data
@ColumnWidth(15)
public class EmployeeProjectExportVO{
public class EmployeeProjectExportVO extends BaseEntity {
private static final long serialVersionUID = 1L;
......
......@@ -37,7 +37,12 @@ public class TCertRecordVo implements Serializable {
@ExcelAttribute(name = "员工身份证" )
@Schema(description ="员工身份证")
private String empIdcard;
/**
* 项目id
*/
@ExcelAttribute(name = "项目id" )
@Schema(description ="项目id")
private String deptId;
/**
* 项目名称
*/
......
......@@ -23,8 +23,13 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TCertRecord;
import com.yifu.cloud.plus.v1.yifu.archives.service.TCertRecordService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.CertRecordSearchVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TCertRecordVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.MenuUtil;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
......@@ -50,7 +55,7 @@ import java.util.List;
public class TCertRecordController {
private final TCertRecordService tCertRecordService;
private final MenuUtil menuUtil;
/**
* 分页查询
* @param page 分页对象
......@@ -61,6 +66,11 @@ public class TCertRecordController {
@GetMapping("/page" )
//@PreAuthorize("@pms.hasPermission('demo_tcertrecord_get')" )
public R<IPage<TCertRecord>> getTCertRecordPage(Page page, CertRecordSearchVo searchVo) {
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
menuUtil.setAuthSql(user, searchVo);
return R.ok(tCertRecordService.pageDiy(page, searchVo));
}
/**
......@@ -72,6 +82,11 @@ public class TCertRecordController {
@GetMapping("/noPage" )
//@PreAuthorize("@pms.hasPermission('demo_tcertrecord_get')" )
public R<List<TCertRecord>> getTCertRecordNoPage(CertRecordSearchVo searchVo) {
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
menuUtil.setAuthSql(user, searchVo);
return R.ok(tCertRecordService.getTCertRecordNoPage(searchVo));
}
......
......@@ -19,7 +19,6 @@ 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.EmployeeConstants;
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.ErrorVO;
......
......@@ -20,18 +20,15 @@ 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.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuth;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.*;
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.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.dapr.util.MenuUtil;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
......@@ -40,9 +37,6 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.support.SimpleValueWrapper;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
......@@ -68,10 +62,7 @@ public class TEmployeeInfoController {
private final TEmployeeInfoService tEmployeeInfoService;
// 缓存信息
private final CacheManager cacheManager;
private final DaprUpmsProperties daprUpmsProperties;
private final MenuUtil menuUtil;
/**
* 分页查询
......@@ -87,67 +78,14 @@ public class TEmployeeInfoController {
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
// 普通用户:
if (CommonConstants.ONE_STRING.equals(user.getSystemFlag())) {
// 菜单id
String menuId = "1536922631616278529";
String linkId = user.getId();
int linkType = 1; // 用户
SysDataAuth sysDataAuth = new SysDataAuth();
sysDataAuth.setLinkId(linkId);
sysDataAuth.setLinkType(linkType);
// 获取缓存菜单权限的步骤:
Cache cache = cacheManager.getCache(CacheConstants.DATA_AUTH_DETAILS + linkType);
Object obj = null;
if (cache != null) {
obj = cache.get(linkId + CommonConstants.DOWN_LINE_STRING + menuId);
if (Common.isEmpty(obj)) {
HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId()
, "/dataAuth/refreshAuth", sysDataAuth, TEmployeeInfo.class, SecurityConstants.FROM_IN);
obj = cache.get(linkId + CommonConstants.DOWN_LINE_STRING + menuId);
if (Common.isEmpty(obj)) {
linkId = user.getUserGroup();
linkType = 0; // 用户组
cache = cacheManager.getCache(CacheConstants.DATA_AUTH_DETAILS + linkType);
if (cache != null) {
obj = cache.get(linkId + CommonConstants.DOWN_LINE_STRING + menuId);
if (Common.isEmpty(obj)) {
sysDataAuth.setLinkId(linkId);
sysDataAuth.setLinkType(linkType);
HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId()
, "/dataAuth/refreshAuth", sysDataAuth, TEmployeeInfo.class, SecurityConstants.FROM_IN);
obj = cache.get(linkId + CommonConstants.DOWN_LINE_STRING + menuId);
}
}
}
}
}
if (Common.isNotNull(obj)) {
SimpleValueWrapper objs = (SimpleValueWrapper) obj;
if (objs != null) {
String sql = String.valueOf(objs.get());
if (sql.contains("#deptId")) {
// TODO - 需要关联部门表
}
if (sql.contains("#create_by")) {
sql = sql.replace("#create_by", user.getId());
}
if (sql.contains("#settleDomainId")) {
// TODO - 获取人员项目权限
// sql = sql.replace("#settleDomainId", ",'1','2' ")
sql = sql.replace("or a.settle_domain_id in ('0'#settleDomainId) ", "");
}
if (sql.contains("#deptId")) {
// TODO - 获取人员部门权限
// sql = sql.replace("#settleDomainId", ",'1','2' ")
sql = sql.replace(" or dept.dept_id = #deptId ", "");
}
return R.ok(tEmployeeInfoService.getPage(page, tEmployeeInfo, sql));
}
}
if (Common.isEmpty(tEmployeeInfo.getMId())) {
tEmployeeInfo.setMId("1536922631616278529");
}
return R.ok(tEmployeeInfoService.getPage(page, tEmployeeInfo, null));
menuUtil.setAuthSql(user, tEmployeeInfo);
if (Common.isNotNull(tEmployeeInfo.getAuthSql()) && tEmployeeInfo.getAuthSql().contains(CommonConstants.A_DEPT_ID)) {
tEmployeeInfo.setAuthSql(tEmployeeInfo.getAuthSql().replace(CommonConstants.A_DEPT_ID, "b.id"));
}
return R.ok(tEmployeeInfoService.getPage(page, tEmployeeInfo));
}
/**
......@@ -164,67 +102,14 @@ public class TEmployeeInfoController {
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
// 普通用户:
if (CommonConstants.ONE_STRING.equals(user.getSystemFlag())) {
// 菜单id
String menuId = "1536952884128591873";
String linkId = user.getId();
int linkType = 1; // 用户
SysDataAuth sysDataAuth = new SysDataAuth();
sysDataAuth.setLinkId(linkId);
sysDataAuth.setLinkType(linkType);
// 获取缓存菜单权限的步骤:
Cache cache = cacheManager.getCache(CacheConstants.DATA_AUTH_DETAILS + linkType);
Object obj = null;
if (cache != null) {
obj = cache.get(linkId + CommonConstants.DOWN_LINE_STRING + menuId);
if (Common.isEmpty(obj)) {
HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId()
, "/dataAuth/refreshAuth", sysDataAuth, TEmployeeInfo.class, SecurityConstants.FROM_IN);
obj = cache.get(linkId + CommonConstants.DOWN_LINE_STRING + menuId);
if (Common.isEmpty(obj)) {
linkId = user.getUserGroup();
linkType = 0; // 用户组
cache = cacheManager.getCache(CacheConstants.DATA_AUTH_DETAILS + linkType);
if (cache != null) {
obj = cache.get(linkId + CommonConstants.DOWN_LINE_STRING + menuId);
if (Common.isEmpty(obj)) {
sysDataAuth.setLinkId(linkId);
sysDataAuth.setLinkType(linkType);
HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId()
, "/dataAuth/refreshAuth", sysDataAuth, TEmployeeInfo.class, SecurityConstants.FROM_IN);
obj = cache.get(linkId + CommonConstants.DOWN_LINE_STRING + menuId);
}
}
}
}
}
if (Common.isNotNull(obj)) {
SimpleValueWrapper objs = (SimpleValueWrapper) obj;
if (objs != null) {
String sql = String.valueOf(objs.get());
if (sql.contains("#deptId")) {
// TODO - 需要关联部门表
}
if (sql.contains("#create_by")) {
sql = sql.replace("#create_by", user.getId());
}
if (sql.contains("#settleDomainId")) {
// TODO - 获取人员项目权限
// sql = sql.replace("#settleDomainId", ",'1','2' ")
sql = sql.replace("or a.settle_domain_id in ('0'#settleDomainId) ", "");
}
if (sql.contains("#deptId")) {
// TODO - 获取人员部门权限
// sql = sql.replace("#settleDomainId", ",'1','2' ")
sql = sql.replace(" or dept.dept_id = #deptId ", "");
}
return R.ok(tEmployeeInfoService.getLeavePage(page, tEmployeeInfo, sql));
}
}
if (Common.isEmpty(tEmployeeInfo.getMId())) {
tEmployeeInfo.setMId("1536952884128591873");
}
return R.ok(tEmployeeInfoService.getLeavePage(page, tEmployeeInfo, null));
menuUtil.setAuthSql(user, tEmployeeInfo);
if (Common.isNotNull(tEmployeeInfo.getAuthSql()) && tEmployeeInfo.getAuthSql().contains(CommonConstants.A_DEPT_ID)) {
tEmployeeInfo.setAuthSql(tEmployeeInfo.getAuthSql().replace(CommonConstants.A_DEPT_ID, "b.id"));
}
return R.ok(tEmployeeInfoService.getLeavePage(page, tEmployeeInfo));
}
......@@ -418,6 +303,13 @@ public class TEmployeeInfoController {
// @ResponseExcel
@PostMapping("/exportEmployee")
public void exportEmployee(@RequestBody(required = false) TEmployeeInfo employeeInfo, HttpServletResponse response) {
YifuUser user = SecurityUtils.getUser();
if (user != null && Common.isEmpty(user.getId())) {
menuUtil.setAuthSql(user, employeeInfo);
if (Common.isNotNull(employeeInfo.getAuthSql()) && employeeInfo.getAuthSql().contains(CommonConstants.A_DEPT_ID)) {
employeeInfo.setAuthSql(employeeInfo.getAuthSql().replace(CommonConstants.A_DEPT_ID, "b.id"));
}
}
tEmployeeInfoService.exportEmployee(employeeInfo, response);
}
......@@ -432,6 +324,13 @@ public class TEmployeeInfoController {
// @ResponseExcel
@PostMapping("/exportLeaveEmployee")
public void exportLeaveEmployee(@RequestBody(required = false) TEmployeeInfo employeeInfo, HttpServletResponse response) {
YifuUser user = SecurityUtils.getUser();
if (user != null && Common.isEmpty(user.getId())) {
menuUtil.setAuthSql(user, employeeInfo);
if (Common.isNotNull(employeeInfo.getAuthSql()) && employeeInfo.getAuthSql().contains(CommonConstants.A_DEPT_ID)) {
employeeInfo.setAuthSql(employeeInfo.getAuthSql().replace(CommonConstants.A_DEPT_ID, "b.id"));
}
}
tEmployeeInfoService.exportLeaveEmployee(employeeInfo, response);
}
......
......@@ -22,15 +22,17 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.EmpDispatchAddVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.UpProjectSocialFundVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.UpdateEmpVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.MenuUtil;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
......@@ -59,6 +61,8 @@ public class TEmployeeProjectController {
private final TEmployeeProjectService tEmployeeProjectService;
private final MenuUtil menuUtil;
/**
* @param empId 人员档案id
* @Description: 根据人员档案id获取项目list
......@@ -84,6 +88,11 @@ public class TEmployeeProjectController {
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page" )
public R<IPage<TEmployeeProject>> getTEmployeeProjectPage(Page page, TEmployeeProject tEmployeeProject) {
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
menuUtil.setAuthSql(user, tEmployeeProject);
return R.ok(tEmployeeProjectService.getTEmployeeProjectInfoPage(page,tEmployeeProject));
}
......@@ -254,6 +263,10 @@ public class TEmployeeProjectController {
@PostMapping("/export")
public void export(HttpServletResponse response, @RequestParam(name = "idstr", required = false)String idstr,
@RequestBody List<String> exportFields, EmployeeProjectExportVO projectDTO) {
YifuUser user = SecurityUtils.getUser();
if (user != null && Common.isEmpty(user.getId())) {
menuUtil.setAuthSql(user, projectDTO);
}
tEmployeeProjectService.listExportProject(response,projectDTO,idstr,exportFields);
}
......
......@@ -39,9 +39,9 @@ import java.util.List;
@Mapper
public interface TEmployeeInfoMapper extends BaseMapper<TEmployeeInfo> {
IPage<TEmployeeInfo> getPage(Page<TEmployeeInfo> page, @Param("tEmployeeInfo") TEmployeeInfo tEmployeeInfo, @Param("sql") String sql);
IPage<TEmployeeInfo> getPage(Page<TEmployeeInfo> page, @Param("tEmployeeInfo") TEmployeeInfo tEmployeeInfo);
IPage<TEmployeeInfo> getLeavePage(Page<TEmployeeInfo> page, @Param("tEmployeeInfo") TEmployeeInfo tEmployeeInfo, @Param("sql") String sql);
IPage<TEmployeeInfo> getLeavePage(Page<TEmployeeInfo> page, @Param("tEmployeeInfo") TEmployeeInfo tEmployeeInfo);
List<TEmployeeInfo> getList(@Param("tEmployeeInfo") TEmployeeInfo tEmployeeInfo);
......
......@@ -24,7 +24,6 @@ import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.*;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.springframework.validation.BindingResult;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
......@@ -47,7 +46,7 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
* @Date: 2022/6/20 20:46
* @return: com.baomidou.mybatisplus.core.metadata.IPage<com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo>
**/
IPage<TEmployeeInfo> getPage(Page<TEmployeeInfo> page, TEmployeeInfo employeeInfo, String sql);
IPage<TEmployeeInfo> getPage(Page<TEmployeeInfo> page, TEmployeeInfo employeeInfo);
/**
* @Description: 离职库分页
......@@ -55,7 +54,7 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
* @Date: 2022/7/4 17:38
* @return: com.baomidou.mybatisplus.core.metadata.IPage<com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo>
**/
IPage<TEmployeeInfo> getLeavePage(Page<TEmployeeInfo> page, TEmployeeInfo employeeInfo, String sql);
IPage<TEmployeeInfo> getLeavePage(Page<TEmployeeInfo> page, TEmployeeInfo employeeInfo);
/**
* @param employeeInfo
......
......@@ -92,6 +92,7 @@ public class TCertRecordServiceImpl extends ServiceImpl<TCertRecordMapper, TCert
vo.setPost(project.getPost());
vo.setProjectName(project.getDeptName());
vo.setProjectCode(project.getDeptNo());
vo.setDeptId(project.getDeptId());
// 最新合同时间
if (Common.isNotNull(last)){
if (Common.isNotNull(last.getContractStart())){
......@@ -121,6 +122,9 @@ public class TCertRecordServiceImpl extends ServiceImpl<TCertRecordMapper, TCert
@Override
public IPage<TCertRecord> pageDiy(Page page, CertRecordSearchVo searchVo) {
LambdaQueryWrapper<TCertRecord> wrapper = buildQueryWrapper(searchVo);
if (Common.isNotNull(searchVo.getAuthSql())) {
wrapper.last(searchVo.getAuthSql());
}
wrapper.orderByDesc(TCertRecord::getCreateTime);
return baseMapper.selectPage(page,wrapper);
}
......@@ -132,6 +136,9 @@ public class TCertRecordServiceImpl extends ServiceImpl<TCertRecordMapper, TCert
if (Common.isNotNull(idList)){
wrapper.in(TCertRecord::getId,idList);
}
if (Common.isNotNull(searchVo.getAuthSql())) {
wrapper.last(searchVo.getAuthSql());
}
return baseMapper.selectList(wrapper);
}
private LambdaQueryWrapper buildQueryWrapper(CertRecordSearchVo entity){
......
......@@ -17,7 +17,7 @@
package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
......@@ -609,7 +609,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(inputStream, EmployeeContractUpdateVO.class, new ReadListener<EmployeeContractUpdateVO>() {
EasyExcelFactory.read(inputStream, EmployeeContractUpdateVO.class, new ReadListener<EmployeeContractUpdateVO>() {
/**
* 单次缓存的数据量
*/
......@@ -728,7 +728,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(inputStream, EmployeeContractVO.class, new ReadListener<EmployeeContractVO>() {
EasyExcelFactory.read(inputStream, EmployeeContractVO.class, new ReadListener<EmployeeContractVO>() {
/**
* 单次缓存的数据量
*/
......@@ -925,7 +925,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
response.setCharacterEncoding(CommonConstants.UTF8);
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, CommonConstants.UTF8));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcel.write(out, EmployeeContractExportVO.class).includeColumnFiledNames(contractInfo.getExportFields())
EasyExcelFactory.write(out, EmployeeContractExportVO.class).includeColumnFiledNames(contractInfo.getExportFields())
.sheet("员工合同").doWrite(list);
out.flush();
} catch (Exception e) {
......@@ -965,7 +965,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
response.setCharacterEncoding(CommonConstants.UTF8);
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, CommonConstants.UTF8));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcel.write(out, EmployeeContractExportVO.class).includeColumnFiledNames(contractInfo.getExportFields())
EasyExcelFactory.write(out, EmployeeContractExportVO.class).includeColumnFiledNames(contractInfo.getExportFields())
.sheet("员工合同【合并历史】").doWrite(list);
out.flush();
} catch (Exception e) {
......
......@@ -88,13 +88,13 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
@Override
public IPage<TEmployeeInfo> getPage(Page<TEmployeeInfo> page, TEmployeeInfo employeeInfo, String sql) {
return baseMapper.getPage(page, employeeInfo, sql);
public IPage<TEmployeeInfo> getPage(Page<TEmployeeInfo> page, TEmployeeInfo employeeInfo) {
return baseMapper.getPage(page, employeeInfo);
}
@Override
public IPage<TEmployeeInfo> getLeavePage(Page<TEmployeeInfo> page, TEmployeeInfo employeeInfo, String sql) {
return baseMapper.getLeavePage(page, employeeInfo, sql);
public IPage<TEmployeeInfo> getLeavePage(Page<TEmployeeInfo> page, TEmployeeInfo employeeInfo) {
return baseMapper.getLeavePage(page, employeeInfo);
}
@Override
......
......@@ -1419,14 +1419,6 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
return str;
}
public boolean saveCheck(EmployeeXProjectVO employeeXProjectVO, TEmployeeProject tEmployeeProject) {
if (employeeXProjectVO.getDeptNo().equals(tEmployeeProject.getDeptNo()) &&
employeeXProjectVO.getEmpIdcard().equals(tEmployeeProject.getEmpIdcard())) {
return true;
}
return false;
}
/**
* @Description: 更新社保公积金状态 : 0 无社保|无公积金 1 处理中 2.部分购买 3.正常 4.已派减
* 派增:
......
......@@ -50,5 +50,6 @@
<result property="openTime" column="OPEN_TIME"/>
<result property="introductionUnit" column="INTRODUCTION_UNIT"/>
<result property="socialTime" column="SOCIAL_TIME"/>
<result property="deptId" column="DEPT_ID"/>
</resultMap>
</mapper>
......@@ -126,7 +126,7 @@
FROM t_cutsomer_data_permisson a
WHERE 1=1
AND SETTLE_DOMAIN_ID IS NOT NULL
AND BE_PERMISSON_USER = ${userId}
AND BE_PERMISSON_USER = '${userId}'
</select>
<select id="getCustomerServiceByid" resultType="java.lang.String">
SELECT
......
......@@ -491,9 +491,16 @@
select
<include refid="baseParam"/>
from t_employee_info a
<if test="tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.contains('b.id') ">
left join t_employee_project b on a.id=b.EMP_ID
</if>
where a.DELETE_FLAG = '0'
<include refid="employeeInfo_where"/>
${sql}
<if test="tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.trim() != ''">
and b.DELETE_FLAG = '0'
${tEmployeeInfo.authSql}
</if>
GROUP BY a.id
order by a.CREATE_TIME desc
</select>
......@@ -513,7 +520,9 @@
left join t_employee_project b on a.id = b.EMP_ID
where a.DELETE_FLAG = '0' and b.DELETE_FLAG = '0'
<include refid="employeeInfo_where"/>
${sql}
<if test="tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.trim() != ''">
${tEmployeeInfo.authSql}
</if>
group by a.id order by a.CREATE_TIME desc
) b
where 1=1
......@@ -624,6 +633,9 @@
<where>
a.DELETE_FLAG = '0' and b.DELETE_FLAG = '0'
<include refid="employeeInfo_where"/>
<if test="tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.trim() != ''">
${tEmployeeInfo.authSql}
</if>
</where>
GROUP BY a.id order by a.CREATE_TIME desc
</select>
......@@ -644,6 +656,9 @@
<where>
a.DELETE_FLAG = '0' and b.DELETE_FLAG = '0'
<include refid="employeeInfo_where"/>
<if test="tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.trim() != ''">
${tEmployeeInfo.authSql}
</if>
</where>
GROUP BY a.id order by a.CREATE_TIME desc
) b
......
......@@ -780,7 +780,10 @@
left join t_employee_info b on a.EMP_ID = b.id
<where>
a.DELETE_FLAG = '0'
<include refid="tEmployeeProject_where"/>
<include refid="tEmployeeProject_where"/>
<if test="tEmployeeProject.authSql != null and tEmployeeProject.authSql.trim() != ''">
${tEmployeeProject.authSql}
</if>
</where>
order by a.CREATE_TIME desc
</select>
......@@ -793,6 +796,10 @@
<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>
</mapper>
......@@ -249,9 +249,9 @@
a.DEPART_NO,
a.DEPART_NAME,
a.INSURANCE_SETTLE_TYPE,
c.ID AS 'customerId',
c.CUSTOMER_NAME as 'customerName',
c.CUSTOMER_CODE as 'customerCode',
a.CUSTOMER_ID AS 'customerId',
a.CUSTOMER_NAME as 'customerName',
a.CUSTOMER_NO as 'customerCode',
a.BUSINESS_PRIMARY_TYPE,
a.BUSINESS_SECOND_TYPE,
a.BUSINESS_THIRD_TYPE,
......@@ -259,7 +259,6 @@
a.INVOICE_TITLE_SALARY,
a.INVOICE_TITLE_INSURANCE
FROM t_settle_domain a
LEFT JOIN t_customer_info c ON a.CUSTOMER_ID = c.ID
where 1=1
<if test="codes != null and codes.size() > 0">
and a.DEPART_NO in
......
......@@ -112,7 +112,7 @@ public class YifuClientLoginSuccessHandler implements AuthenticationSuccessHandl
//非管理员获取 b端项目权限
/*if(ServiceNameConstants.CLIENT_ID_HR_B.equals(clientId) && !SecurityUtils.isHaveAllOrg(clientId,user)){
if(Common.isEmpty(user.getSettleIdList())){
throw new InvalidException("该用户("+user.getNickName()+")没有项目权限!请联系管理员开通!");
throw new InvalidException("该用户("+user.getNickName()+")没有项目权限!请联系管理员开通!")
}
}*/
......
......@@ -47,10 +47,6 @@ security:
- /v3/api-docs
- /actuator/**
- /swagger-ui/**
- /**/insuranceDetail/updateInsuranceSettle
- /**/insuranceDetail/urgentUpdateIsUse
- /insuranceDetail/urgentUpdateIsUse
- /insuranceDetail/updateInsuranceSettle
# Spring 相关
......
......@@ -194,7 +194,10 @@ public class ChecksUtil {
params.put(ChecksConstants.ID_NUM, idNum);
String result = HttpUtils.post(API_URL, params);
// 解析json,并返回结果
return jsonParser.parse(result).getAsJsonObject();
if (Common.isNotNull(result)){
return jsonParser.parse(result).getAsJsonObject();
}
return null;
}
/**
......@@ -210,7 +213,10 @@ public class ChecksUtil {
params.put(ChecksConstants.MOBILES, mobiles);
String result = HttpUtils.post(API_URL_MOBILE, params);
// 解析json,并返回结果
return jsonParser.parse(result).getAsJsonObject();
if (Common.isNotNull(result)){
return jsonParser.parse(result).getAsJsonObject();
}
return null;
}
private static JsonObject invokeBankNo(String name, String idNum, String cardNo, String mobile) {
......@@ -225,7 +231,10 @@ public class ChecksUtil {
}
String result = HttpUtils.post(API_URL_BANK_NO, params);
// 解析json,并返回结果
return jsonParser.parse(result).getAsJsonObject();
if (Common.isNotNull(result)){
return jsonParser.parse(result).getAsJsonObject();
}
return null;
}
private static JsonObject invokeBankNoTwoAuth(String name,String cardNo) {
......@@ -236,6 +245,9 @@ public class ChecksUtil {
params.put(ChecksConstants.CARD_NO, cardNo);
String result = HttpUtils.post(API_URL_BANK_NO_TWO, params);
// 解析json,并返回结果
return jsonParser.parse(result).getAsJsonObject();
if (Common.isNotNull(result)){
return jsonParser.parse(result).getAsJsonObject();
}
return null;
}
}
......@@ -328,6 +328,8 @@ public interface CommonConstants {
String PARAM_IS_NOT_ERROR = "传参异常,请检查参数";
int EXCEL_EXPORT_LIMIT = 60000;
String USER = "用户";
/**
* multipart/form-data
* @Author fxj
......@@ -490,4 +492,6 @@ public interface CommonConstants {
public static final String XLSX = ".xlsx";
public static final String ERROR_IMPORT = "执行异常";
// 权限使用的
public static final String A_DEPT_ID = "a.dept_id";
}
......@@ -69,6 +69,8 @@ public class ValidityConstants {
/** 最多200位 规则 */
public static final String PATTERN_200 = "[\\s\\S]{1,200}$";
public static String NUMBER_OF_DECIMAL_PLACE= "^[1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*$";
/** 不超过两位小数的正数 */
public static final String POSITIVE_INTEGER_PATTERN_TWO_FLOAT = "^[+]?([0-9]+(.[0-9]{1,2})?)$";
/** 身份证规则(x只能大写) */
......
......@@ -12,7 +12,10 @@
<artifactId>yifu-common-dapr</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-common-mybatis</artifactId>
</dependency>
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-upms-api</artifactId>
......
......@@ -31,20 +31,6 @@ import java.util.Map;
public class ArchivesDaprUtil {
@Autowired
private DaprArchivesProperties daprArchivesProperties;
/**
* @Author fxj
* @Description 获取登录用户对应的计算主体权限
* @Date 21:15 2022/7/18
* @Param
* @return
**/
public R<List<String>> getSettleDomainIdsByUserId(){
R<List<String>> res = HttpDaprUtil.invokeMethodGet(daprArchivesProperties.getAppUrl(),daprArchivesProperties.getAppId(),"/tsettledomain/getSettleDomainIdsByUserId","", Object.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(res)){
return R.failed("获取用户项目权限失败!");
}
return res;
}
/**
* @Author fxj
* @Description 获取派单校验需要的档案信息
......
package com.yifu.cloud.plus.v1.yifu.common.dapr.util;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuth;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainListVo;
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.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprArchivesProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprUpmsProperties;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.support.SimpleValueWrapper;
/**
* @author hgw
* 2022-9-13 16:14:34
* @Description 公共获取菜单权限的工具
*/
@EnableConfigurationProperties({DaprUpmsProperties.class,DaprArchivesProperties.class})
@RequiredArgsConstructor
@Slf4j
public class MenuUtil {
// 缓存信息
private final CacheManager cacheManager;
private final DaprUpmsProperties daprUpmsProperties;
private final DaprArchivesProperties daprArchivesProperties;
private static final String START_STR = "start";
public void setAuthSql(YifuUser user, BaseEntity entity) {
// 普通用户:
if (CommonConstants.ONE_STRING.equals(user.getSystemFlag())) {
// 菜单id
String menuId = entity.getMId();
if (Common.isNotNull(menuId)) {
String linkId = user.getId();
int linkType = 1; // 用户
SysDataAuth sysDataAuth = new SysDataAuth();
sysDataAuth.setLinkId(linkId);
sysDataAuth.setLinkType(linkType);
// 获取缓存菜单权限的步骤:
Cache cache = cacheManager.getCache(CacheConstants.DATA_AUTH_DETAILS + linkType);
Object obj = null;
if (cache != null) {
obj = cache.get(linkId + CommonConstants.DOWN_LINE_STRING + menuId);
if (Common.isEmpty(obj)) {
HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId()
, "/dataAuth/refreshAuth", sysDataAuth, SysDataAuth.class, SecurityConstants.FROM_IN);
obj = cache.get(linkId + CommonConstants.DOWN_LINE_STRING + menuId);
if (Common.isEmpty(obj)) {
linkId = user.getUserGroup();
linkType = 0; // 用户组
cache = cacheManager.getCache(CacheConstants.DATA_AUTH_DETAILS + linkType);
if (cache != null) {
obj = cache.get(linkId + CommonConstants.DOWN_LINE_STRING + menuId);
if (Common.isEmpty(obj)) {
sysDataAuth.setLinkId(linkId);
sysDataAuth.setLinkType(linkType);
HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId()
, "/dataAuth/refreshAuth", sysDataAuth, SysDataAuth.class, SecurityConstants.FROM_IN);
obj = cache.get(linkId + CommonConstants.DOWN_LINE_STRING + menuId);
}
}
}
}
}
if (Common.isNotNull(obj)) {
SimpleValueWrapper objs = (SimpleValueWrapper) obj;
if (objs != null) {
String sql = String.valueOf(objs.get());
if (sql.contains("#create_by")) {
sql = sql.replace("#create_by", user.getId());
}
if (sql.contains("#settleDomainId")) {
// 获取人员项目权限
R<TSettleDomainListVo> res = HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl()
, daprArchivesProperties.getAppId(),"/tsettledomain/getSettleDomainIdsByUserId"
, user.getId(), TSettleDomainListVo.class, SecurityConstants.FROM_IN);
StringBuilder deptStr = new StringBuilder();
if (res != null && CommonConstants.SUCCESS != res.getCode()
&& res.getData() != null && res.getData().getDeptIds() != null
&& !res.getData().getDeptIds().isEmpty()) {
for (String deptId : res.getData().getDeptIds()) {
deptStr.append(",'").append(deptId).append("'");
}
}
//sql = sql.replace("or a.settle_domain_id in ('0'#settleDomainId) ", "")
sql = sql.replace("#settleDomainId", deptStr.toString());
}
String userIds = "0";
if (sql.contains(START_STR)) {
String deptIds = StringUtils.substringBetween(sql,START_STR, "end");
R<String> userIdR = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl()
,daprUpmsProperties.getAppId(),"/user/inner/getUserIdByDeptIds",deptIds
, String.class, SecurityConstants.FROM_IN);
if (userIdR != null && CommonConstants.SUCCESS == userIdR.getCode()) {
userIds = userIdR.getData();
}
sql = sql.replace(START_STR, "").replace("end", "")
.replace(deptIds, userIds);
}
if (sql.contains("#deptId")) {
R<String> userIdR = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl()
,daprUpmsProperties.getAppId(),"/user/inner/getUserIdByDeptIds"
,String.valueOf(user.getDeptId()), String.class, SecurityConstants.FROM_IN);
if (userIdR != null && CommonConstants.SUCCESS == userIdR.getCode()) {
userIds = userIdR.getData();
}
sql = sql.replace("#deptId", userIds);
//sql = sql.replace(" or dept.dept_id = #deptId ", "")
}
entity.setAuthSql(sql);
}
}
}
}
}
}
......@@ -3,4 +3,5 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.yifu.cloud.plus.v1.yifu.common.dapr.util.UpmsDaprUtils,\
com.yifu.cloud.plus.v1.yifu.common.dapr.util.CheckDaprUtil,\
com.yifu.cloud.plus.v1.yifu.common.dapr.util.SocialDaprUtils,\
com.yifu.cloud.plus.v1.yifu.common.dapr.util.MenuUtil,\
com.yifu.cloud.plus.v1.yifu.common.dapr.util.SalaryDaprUtil
......@@ -47,7 +47,6 @@ public class EkpFundUtil {
//wholeForm.add("formValues", new String(formValues.getBytes("UTF-8"),"ISO-8859-1"));
wholeForm.add("formValues", formValues);
//wholeForm.add("formValues", new String("{\"fd_3adfe6af71a1cc\":\"王五\", \"fd_3adfe658c6229e\":\"2019-03-26\", \"fd_3adfe6592b4158\":\"这里内容\"}".getBytes("UTF-8"),"ISO-8859-1") );
System.out.println("wholeForm:"+wholeForm);
HttpHeaders headers = new HttpHeaders();
//如果EKP对该接口启用了Basic认证,那么客户端需要加入
//addAuth(headers,"yourAccount"+":"+"yourPassword");是VO,则使用APPLICATION_JSON
......
package com.yifu.cloud.plus.v1.yifu.ekp.util;
import cn.hutool.json.JSONObject;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.ekp.config.EkpIncomeProperties;
import com.yifu.cloud.plus.v1.yifu.ekp.constant.EkpConstants;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpIncomeParam;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpIncomeParamManage;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpIncomeParamRisk;
import io.micrometer.core.instrument.util.StringUtils;
......
......@@ -38,28 +38,19 @@ public class EkpInsuranceUtil {
* 注意key的书写格式,类似EL表达式的方式,属性关系用'.', 列表和数组关系用[],Map关系用["xxx"]
*/
public String sendToEkp(EkpInteractiveParam param){
log.info("推送EKP开始");
RestTemplate yourRestTemplate = new RestTemplate();
EKPInsurancePushParam pushParam = insuranceDetail2PushParam(param);
try{
String formValues = new ObjectMapper().writeValueAsString(pushParam);
log.info("formValues:"+formValues);
//指向EKP的接口url
//把ModelingAppModelParameterAddForm转换成MultiValueMap
JSONObject loginName = new JSONObject();
loginName.append("LoginName",ekpInsuranceProperties.getInsuranceLoginName());
String loginData = new ObjectMapper().writeValueAsString(loginName);
MultiValueMap<String,Object> wholeForm = new LinkedMultiValueMap<>();
//wholeForm.add("docSubject", new String(docSubject.getBytes("UTF-8"),"ISO-8859-1") );
wholeForm.add("docSubject",ekpInsuranceProperties.getInsuranceFocSubject());
wholeForm.add("docCreator", "{\"LoginName\":\"admin\"}");
//wholeForm.add("docCreator", loginData);
wholeForm.add("docStatus", ekpInsuranceProperties.getInsuranceDocStatus());
wholeForm.add("fdModelId", ekpInsuranceProperties.getInsuranceFdModelId());
wholeForm.add("fdFlowId", ekpInsuranceProperties.getInsuranceFdFlowId());
//wholeForm.add("formValues", new String(formValues.getBytes("UTF-8"),"ISO-8859-1"));
wholeForm.add("formValues", formValues);
//wholeForm.add("formValues", new String("{\"fd_3adfe6af71a1cc\":\"王五\", \"fd_3adfe658c6229e\":\"2019-03-26\", \"fd_3adfe6592b4158\":\"这里内容\"}".getBytes("UTF-8"),"ISO-8859-1") );
HttpHeaders headers = new HttpHeaders();
//如果EKP对该接口启用了Basic认证,那么客户端需要加入
//addAuth(headers,"yourAccount"+":"+"yourPassword");是VO,则使用APPLICATION_JSON
......@@ -67,14 +58,14 @@ public class EkpInsuranceUtil {
//必须设置上传类型,如果入参是字符串,使用MediaType.TEXT_PLAIN;如果
HttpEntity<MultiValueMap<String,Object>> entity = new HttpEntity<MultiValueMap<String,Object>>(wholeForm,headers);
//有返回值的情况 VO可以替换成具体的JavaBean
log.info("推送EKP开始,formValues:"+formValues);
ResponseEntity<String> obj = yourRestTemplate.exchange(ekpInsuranceProperties.getInsuranceUrl(), HttpMethod.POST, entity, String.class);
log.info("obj:"+obj);
String body = obj.getBody();
if (StringUtils.isBlank(body)){
log.error("交易失败"+body);
log.error("交易失败:"+obj);
return null;
}else{
log.info("交易成功:"+body);
log.info("交易成功:"+obj);
return body;
}
}catch (Exception e){
......
......@@ -47,7 +47,6 @@ public class EkpSocialUtil {
//wholeForm.add("formValues", new String(formValues.getBytes("UTF-8"),"ISO-8859-1"));
wholeForm.add("formValues", formValues);
//wholeForm.add("formValues", new String("{\"fd_3adfe6af71a1cc\":\"王五\", \"fd_3adfe658c6229e\":\"2019-03-26\", \"fd_3adfe6592b4158\":\"这里内容\"}".getBytes("UTF-8"),"ISO-8859-1") );
System.out.println("wholeForm:"+wholeForm);
HttpHeaders headers = new HttpHeaders();
//如果EKP对该接口启用了Basic认证,那么客户端需要加入
//addAuth(headers,"yourAccount"+":"+"yourPassword");是VO,则使用APPLICATION_JSON
......
......@@ -26,4 +26,8 @@ public class EkpIncomeParamManage extends EkpIncomeParam {
* 收款单号
**/
private String fd_3aeae58b14691c;
/**
* 管理费ID
**/
private String fd_3b13dae9bd70f8;
}
......@@ -26,4 +26,8 @@ public class EkpIncomeParamRisk extends EkpIncomeParam {
* 收款单号
**/
private String fd_3aeae59b70fe5a;
/**
* 风险金ID
**/
private String fd_3b13dac4c03022;
}
......@@ -64,5 +64,17 @@ public class BaseEntity implements Serializable {
@TableField(fill = FieldFill.INSERT_UPDATE)
@ExcelIgnore
private LocalDateTime updateTime;
/**
* 菜单ID 获取查询权限使用
*/
@TableField(exist = false)
private String mId;
/**
* 权限sql
*/
@TableField(exist = false)
@ExcelIgnore
private String authSql;
}
......@@ -1096,6 +1096,26 @@ public class InsurancesConstants {
*/
public static final String SETTLE_ID_ATYPISM = "结算id不一致";
/**
* 获取项目信息失败
*/
public static final String GET_DEPT_DETAIL_ERROR = "获取项目信息失败:";
/**
* 获取项目信息失败
*/
public static final String ERROR_LIST = "errorList";
/**
* 获取项目信息失败
*/
public static final String SUCCESS_LIST = "successList";
/**
* OSS文件上传接口异常:
*/
public static final String OSS_ERROR = "OSS文件上传接口异常:";
......
......@@ -47,6 +47,12 @@ public class TInsuranceDetail extends BaseEntity {
@Schema(description = "项目编码")
private String deptNo;
/**
* 项目id
*/
@Schema(description = "项目id")
private String deptId;
/**
* 投保岗位
*/
......
package com.yifu.cloud.plus.v1.yifu.insurances.util;
import com.google.common.base.Optional;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ValidityConstants;
import java.math.BigDecimal;
import java.util.regex.Matcher;
......@@ -13,7 +15,6 @@ import java.util.regex.Pattern;
* @Description 提供精确的浮点数运算(包括加、减、乘、除、四舍五入)工具类
**/
public class BigDecimalUtils {
static Pattern p= Pattern.compile("^[1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*$");
/**
* BigDecimal的加法运算封装
* @author : shijing
......@@ -50,7 +51,7 @@ public class BigDecimalUtils {
Integer r = b1;
if (null != bn) {
for (Integer b : bn) {
r += Optional.fromNullable(b).or(0);
r += Optional.fromNullable(b).or(CommonConstants.ZERO_INT);
}
}
return r > 0 ? r : 0;
......@@ -87,7 +88,7 @@ public class BigDecimalUtils {
r = r.subtract((null == b ? BigDecimal.ZERO : b));
}
}
return isZero ? (r.compareTo(BigDecimal.ZERO) == -1 ? BigDecimal.ZERO : r) : r;
return isZero ? (r.compareTo(BigDecimal.ZERO) == CommonConstants.ONE_INT_NEGATE ? BigDecimal.ZERO : r) : r;
}
/**
......@@ -105,10 +106,10 @@ public class BigDecimalUtils {
Integer r = b1;
if (null != bn) {
for (Integer b : bn) {
r -= Optional.fromNullable(b).or(0);
r -= Optional.fromNullable(b).or(CommonConstants.ZERO_INT);
}
}
return null != r && r > 0 ? r : 0;
return null != r && r > CommonConstants.ZERO_INT ? r : CommonConstants.ZERO_INT;
}
/**
......@@ -151,7 +152,7 @@ public class BigDecimalUtils {
return defaultValue;
}
try {
return BigDecimal.valueOf(b1.doubleValue()).divide(BigDecimal.valueOf(b2.doubleValue()), 2, BigDecimal.ROUND_HALF_UP);
return BigDecimal.valueOf(b1.doubleValue()).divide(BigDecimal.valueOf(b2.doubleValue()), CommonConstants.TWO_INT, BigDecimal.ROUND_HALF_UP);
} catch (Exception e) {
return defaultValue;
}
......@@ -190,7 +191,7 @@ public class BigDecimalUtils {
if (null == b1 || null == b2) {
return BigDecimal.ZERO;
}
return BigDecimal.valueOf(b1.doubleValue()).multiply(BigDecimal.valueOf(b2.doubleValue())).setScale(2, BigDecimal.ROUND_HALF_UP);
return BigDecimal.valueOf(b1.doubleValue()).multiply(BigDecimal.valueOf(b2.doubleValue())).setScale( CommonConstants.TWO_INT, BigDecimal.ROUND_HALF_UP);
}
public static <T extends Number> BigDecimal safeMultiply(T b1, T b2, T b3) {
if (null == b1 || null == b2 || null == b3) {
......@@ -249,7 +250,7 @@ public class BigDecimalUtils {
if (null == bigDecimal){
return true;
}
if (bigDecimal.compareTo(BigDecimal.ZERO) == 0){
if (bigDecimal.compareTo(BigDecimal.ZERO) == CommonConstants.ZERO_INT){
return true;
}
return false;
......@@ -265,7 +266,7 @@ public class BigDecimalUtils {
if (null == b1) {
return BigDecimal.ZERO;
}
return BigDecimal.valueOf(b1.doubleValue()).setScale(2, BigDecimal.ROUND_HALF_UP);
return BigDecimal.valueOf(b1.doubleValue()).setScale(CommonConstants.TWO_INT, BigDecimal.ROUND_HALF_UP);
}
/**
......@@ -274,16 +275,16 @@ public class BigDecimalUtils {
* @return
*/
public static boolean isBigDecimal(String str){
if(str==null || str.trim().length() == 0){
if(str==null || str.trim().length() == CommonConstants.ZERO_INT){
return false;
}
char[] chars = str.toCharArray();
int sz = chars.length;
int i = (chars[0] == '-') ? 1 : 0;
int i = (chars[CommonConstants.ZERO_INT] == '-') ? CommonConstants.ONE_INT : CommonConstants.ZERO_INT;
if(i == sz){
return false;
}
if(chars[i] == '.'){
if(chars[i] == CommonConstants.SPOT_CHAR){
//除了负号,第一位不能为'小数点'
return false;
}
......@@ -333,6 +334,7 @@ public class BigDecimalUtils {
* @return double
*/
public static BigDecimal getNumberOfDecimalPlace(String str, int point) {
Pattern p= Pattern.compile(ValidityConstants.NUMBER_OF_DECIMAL_PLACE);
Matcher m=p.matcher(str);
boolean b=m.matches();
if(b){
......
......@@ -122,7 +122,7 @@ public class ValidityUtil {
* @param email 邮箱(电子邮件)
* @return boolean
*/
public static boolean validateEamil(final String email){
public static boolean validateEmail(final String email){
if(Common.isEmpty(email)){
return Boolean.FALSE ;
}
......@@ -169,11 +169,11 @@ public class ValidityUtil {
return Boolean.FALSE ;
}
BigDecimal bigDecimalMoney= new BigDecimal(money);
boolean max = bigDecimalMoney.compareTo(CommonConstants.MONEY_MAX) >0;
boolean max = bigDecimalMoney.compareTo(CommonConstants.MONEY_MAX) >CommonConstants.ZERO_INT;
if(max){
return Boolean.FALSE ;
}
boolean min = bigDecimalMoney.compareTo(CommonConstants.MONEY_MIN) <=0;
boolean min = bigDecimalMoney.compareTo(CommonConstants.MONEY_MIN) <=CommonConstants.ZERO_INT;
if(min){
return Boolean.FALSE ;
}
......@@ -202,7 +202,7 @@ public class ValidityUtil {
*/
public static boolean validateMoneyMax(final String money) {
BigDecimal bigDecimalMoney= new BigDecimal(money);
boolean max = bigDecimalMoney.compareTo(CommonConstants.MONEY_MAX) >0;
boolean max = bigDecimalMoney.compareTo(CommonConstants.MONEY_MAX) >CommonConstants.ZERO_INT;
if(max){
return Boolean.FALSE ;
}
......@@ -345,7 +345,7 @@ public class ValidityUtil {
if (!validateMobile(phone)){
return Boolean.FALSE;
}
String initializeInfo = "用户".concat(phone.substring(phone.length()-6, phone.length()));
String initializeInfo = CommonConstants.USER.concat(phone.substring(phone.length()-CommonConstants.SIX_INT, phone.length()));
if (!str.trim().equals(initializeInfo)){
return Boolean.FALSE;
}
......@@ -393,13 +393,13 @@ public class ValidityUtil {
return false;
}
if(numStr==""){
if(CommonConstants.EMPTY_STRING.equals(numStr)){
return false;
}
//验证是否是float型
if(numStr.contains(".")){
if(numStr.indexOf('.')==numStr.lastIndexOf('.')){
StringTokenizer st=new StringTokenizer(numStr,".");
if(numStr.contains(CommonConstants.SPOT)){
if(numStr.indexOf(CommonConstants.SPOT_CHAR)==numStr.lastIndexOf(CommonConstants.SPOT_CHAR)){
StringTokenizer st=new StringTokenizer(numStr,CommonConstants.SPOT);
while(st.hasMoreElements()){
String splitStr= st.nextToken();
for(int i=splitStr.length();--i>=0;){
......@@ -429,15 +429,15 @@ public class ValidityUtil {
return false;
}
if(numStr==""){
if(CommonConstants.EMPTY_STRING.equals(numStr)){
return false;
}
//验证是否是float型
if(numStr.contains(".")){
if(numStr.contains(CommonConstants.SPOT)){
return false;
}else{
//验证是否是int型
for(int i=numStr.length();--i>=0;){
for(int i=numStr.length();--i>=CommonConstants.ZERO_INT;){
if(!Character.isDigit(numStr.charAt(i))){
return false;
}
......
......@@ -18,6 +18,11 @@ import java.time.LocalDate;
public class InsuranceBatchParam implements Serializable {
private static final long serialVersionUID = -2689686777914935788L;
/**
* 项目id
*/
@Schema(description = "项目id")
private String deptId;
/**
* 项目编码
*/
......
......@@ -28,6 +28,12 @@ public class InsuranceReplaceParam implements Serializable {
@Schema(description = "员工身份证号")
private String empIdcardNo;
/**
* 项目id
*/
@Schema(description = "项目id")
private String deptId;
/**
* 项目编码
*/
......
......@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Sets;
import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ProjectSetInfoVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.SetInfoVo;
......@@ -17,6 +18,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.CheckDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.SocialDaprUtils;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.ekp.constant.EkpConstants;
......@@ -78,6 +80,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
@Resource
private ArchivesDaprUtil archivesDaprUtil;
@Resource
private CheckDaprUtil checkDaprUtil;
@Resource
private TInsuranceSettleService tInsuranceSettleService;
@Resource
private TInsuranceOperateService tInsuranceOperateService;
......@@ -347,8 +351,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
List<InsuranceBatchParam> listSuccess = map.get("listSuccess");
List<TInsuranceDetail> detailList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(listSuccess)){
TInsuranceDetail detail;
for (InsuranceBatchParam success : listSuccess) {
TInsuranceDetail detail = new TInsuranceDetail();
detail = new TInsuranceDetail();
BeanCopyUtils.copyProperties(success,detail);
//购买类型,默认为「批增」
detail.setBuyType(CommonConstants.THREE_INT);
......@@ -427,6 +432,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
newDetail.setEmpName(success.getReplaceEmpName());
newDetail.setEmpIdcardNo(success.getReplaceEmpIdcardNo());
newDetail.setDeptNo(success.getReplaceDeptNo());
newDetail.setDeptId(success.getDeptId());
//替换项目的结算方式
newDetail.setSettleType(success.getSettleType());
newDetail.setPost(success.getPost());
......@@ -543,7 +549,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return R.failed(InsurancesConstants.EMP_IDCARD_NO_NOT_LEGITIMATE);
}
//校验身份合法
/*TCheckIdCard checkIdCard = new TCheckIdCard();
TCheckIdCard checkIdCard = new TCheckIdCard();
checkIdCard.setName(param.getEmpName());
checkIdCard.setIdCard(param.getEmpIdcardNo());
R<TCheckIdCard> tCheckIdCardR = checkDaprUtil.checkIdCardSingle(checkIdCard);
......@@ -552,7 +558,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (CommonConstants.ONE_INT != data.getIsTrue()){
return R.failed(InsurancesConstants.EMP_ID_CARD_NO_NOT_FIT);
}
}*/
}
if(!LocalDateUtil.isDate(param.getPolicyStart(),LocalDateUtil.NORM_DATE_PATTERN)){
return R.failed(InsurancesConstants.POLICY_START_PARSE_ERROR);
......@@ -713,7 +719,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return R.failed(InsurancesConstants.EMP_IDCARD_NO_NOT_LEGITIMATE);
}
//校验身份合法
/*TCheckIdCard checkIdCard = new TCheckIdCard();
TCheckIdCard checkIdCard = new TCheckIdCard();
checkIdCard.setName(param.getEmpName());
checkIdCard.setIdCard(param.getEmpIdcardNo());
R<TCheckIdCard> tCheckIdCardR = checkDaprUtil.checkIdCardSingle(checkIdCard);
......@@ -722,7 +728,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (CommonConstants.ONE_INT != data.getIsTrue()){
return R.failed(InsurancesConstants.EMP_ID_CARD_NO_NOT_FIT);
}
}*/
}
TInsuranceReplace one = tInsuranceReplaceService.getOne(Wrappers.<TInsuranceReplace>query().lambda()
.eq(TInsuranceReplace::getToInsuranceDetailId, byId.getId())
......@@ -923,6 +929,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
detail.setHandledTime(LocalDateTime.now());
detail.setUpdateBy(user.getId());
detail.setUpdateTime(LocalDateTime.now());
if (Common.isNotNull(jsonObject)){
detail.setDeptId(jsonObject.getId());
}
detailList.add(detail);
}
}
......@@ -963,16 +972,24 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (CollectionUtils.isNotEmpty(list)){
//根据项目编码获取项目名称
List<String> collectList = list.stream().map(e -> e.getDeptNo()).distinct().collect(Collectors.toList());
R<SetInfoVo> setInfoByCodesList = archivesDaprUtil.getSetInfoByCodes(collectList);
if (null != setInfoByCodesList && setInfoByCodesList.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodesList.getData())) {
Map<String, ProjectSetInfoVo> data = setInfoByCodesList.getData().getProjectSetInfoVoMap();
for (InsuranceExportListVO record : list) {
ProjectSetInfoVo jsonObject = data.get(record.getDeptNo());
if (null != jsonObject){
record.setProjectName(Optional.ofNullable(jsonObject.getDepartName()).orElse(""));
record.setInvoiceTitle(Optional.ofNullable(jsonObject.getInvoiceTitleInsurance()).orElse(""));
try{
R<SetInfoVo> setInfoByCodesList = archivesDaprUtil.getSetInfoByCodes(collectList);
if (null != setInfoByCodesList && setInfoByCodesList.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodesList.getData())) {
Map<String, ProjectSetInfoVo> data = setInfoByCodesList.getData().getProjectSetInfoVoMap();
for (InsuranceExportListVO record : list) {
ProjectSetInfoVo jsonObject = data.get(record.getDeptNo());
if (null != jsonObject){
record.setProjectName(Optional.ofNullable(jsonObject.getDepartName()).orElse(""));
record.setInvoiceTitle(Optional.ofNullable(jsonObject.getInvoiceTitleInsurance()).orElse(""));
}
}
}
}catch (Exception e){
for (InsuranceExportListVO record : list) {
record.setProjectName(CommonConstants.EMPTY_STRING);
record.setInvoiceTitle(CommonConstants.EMPTY_STRING);
}
log.error(InsurancesConstants.GET_DEPT_DETAIL_ERROR+e);
}
insuranceExportList.removeAll(listVOS);
insuranceExportList.addAll(crossMerger(list,listVOS));
......@@ -992,6 +1009,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @author licancan
*/
@Override
@Transactional(value = "insurancesTransactionManager" ,rollbackFor = {Exception.class})
public R<List<InsuranceListVO>> rollBackInsurance(YifuUser user, List<InsuranceHandleParam> paramList) {
//解析参数里的商险id
List<String> idList = paramList.stream().map(e -> e.getId()).distinct().collect(Collectors.toList());
......@@ -1125,7 +1143,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
//已投保退回,收入数据同步处理
try{
updateInsuranceInfo(detail,settle);
updateInsuranceInfo(detail);
}catch (Exception e){
log.error("收入数据同步处理失败:"+e);
}
......@@ -1159,12 +1177,13 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @author licancan
*/
@Override
@Transactional(value = "insurancesTransactionManager" ,rollbackFor = {Exception.class})
public R<List<InsuranceHandleImportParam>> insuranceHandleImport(YifuUser user, List<InsuranceHandleImportParam> param) {
Map<String, List<InsuranceHandleImportParam>> map = insuranceChangeCheck(param, user,false);
//检验成功的数据
List<InsuranceHandleImportParam> successList = map.get("successList");
List<InsuranceHandleImportParam> successList = map.get(InsurancesConstants.SUCCESS_LIST);
//校验失败的数据
List<InsuranceHandleImportParam> errorList = map.get("errorList");
List<InsuranceHandleImportParam> errorList = map.get(InsurancesConstants.ERROR_LIST);
if (CollectionUtils.isNotEmpty(successList)){
//投保成功的数据
List<InsuranceHandleImportParam> collectSuccess = successList.stream().filter(e -> InsurancesConstants.SUCCESS.equals(e.getHandType())).collect(Collectors.toList());
......@@ -1207,6 +1226,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @author licancan
*/
@Override
@Transactional(value = "insurancesTransactionManager" ,rollbackFor = {Exception.class})
public R<List<InsuranceListVO>> successfulInsurance(YifuUser user, List<InsuranceHandleParam> paramList) {
ThreadPoolExecutor threadPool = new ThreadPoolExecutor(50, 50, 100, TimeUnit.SECONDS, new LinkedBlockingQueue<>(10));
//解析参数里的商险id
......@@ -1416,6 +1436,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.orderByDesc(TInsuranceDetail::getUpdateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
BigDecimal actualMoney;
actualMoney = detail.getActualPremium();
if (StringUtils.isNotBlank(success.getInvoiceNo())){
detail.setInvoiceNo(success.getInvoiceNo());
//如果发票号不为空,将替换类型的发票号也全部更新
......@@ -1492,10 +1514,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
});
}
//如果当前实缴信息已推送,且金额与本次不一致,则推送实缴更新
if(settle.getIsActualPush() == CommonConstants.ONE_INT
&& (new BigDecimal(success.getActualPremium()).compareTo(detail.getActualPremium()) != 0)){
BigDecimal bigDecimal = new BigDecimal(success.getActualPremium());
boolean b = bigDecimal.compareTo(detail.getActualPremium()) == CommonConstants.ZERO_INT;
if(CommonConstants.ONE_INT == settle.getIsActualPush() && b){
//推送保费更新
settle.setActualPremium(new BigDecimal(success.getActualPremium()));
settle.setActualPremium(bigDecimal);
settle.setIsActualPush(CommonConstants.ZERO_INT);
settle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(settle);
......@@ -1509,15 +1532,14 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
tInsuranceSettleService.updateById(settle);
}
});
}else if(settle.getIsActualPush() == CommonConstants.ONE_INT
&& (new BigDecimal(success.getActualPremium()).compareTo(detail.getActualPremium()) == 0)){
}else{
//推送保费更新
settle.setActualPremium(new BigDecimal(success.getActualPremium()));
settle.setActualPremium(bigDecimal);
settle.setIsActualPush(CommonConstants.ZERO_INT);
settle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(settle);
//调EKP更新实际保费
detail.setActualPremium(new BigDecimal(success.getActualPremium()));
detail.setActualPremium(bigDecimal);
threadPool.execute(() ->{
String s = pushEstimate(detail,CommonConstants.FOUR_INT);
if(StringUtils.isNotBlank(s)){
......@@ -1610,9 +1632,99 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
this.updateById(detail);
detailList.add(detail);
try {
if (detail.getBuyType() != CommonConstants.FOUR_INT) {
//生成收入数据
createInsuranceInfo(detail);
if (detail.getBuyType() != CommonConstants.FOUR_INT &&
CommonConstants.ONE_INT == detail.getSettleType()) {
if (new BigDecimal(success.getActualPremium()).compareTo(actualMoney) != 0) {
//获取项目信息
TSettleDomain settleDomain = new TSettleDomain();
List<TSettleDomainSelectVo> settleDomainR = null;
R<TSettleDomainListVo> listVo = null;
listVo = archivesDaprUtil.selectSettleDomainSelectVoByNo(detail.getDeptNo());
if (Common.isNotNull(listVo)) {
TSettleDomainListVo tSettleDomainListVo = listVo.getData();
if (Common.isNotNull(tSettleDomainListVo) && Common.isNotEmpty(tSettleDomainListVo.getListSelectVO())) {
settleDomainR = tSettleDomainListVo.getListSelectVO();
for (TSettleDomainSelectVo vo :settleDomainR) {
BeanUtils.copyProperties(vo,settleDomain);
}
}
}
BigDecimal gMoney = BigDecimal.ZERO;
Boolean isBl = false;
if (Common.isNotNull(settleDomain)) {
// 含有商险,则计算收入
if (settleDomain.getMrSettleType().equals(CommonConstants.TWO_STRING)) {
if (Common.isNotNull(settleDomain.getManageServerItem()) && settleDomain.getManageServerItem()
.contains(CommonConstants.THREE_STRING) && CommonConstants.ZERO_STRING.equals(settleDomain.getManagementTag())) {
if (CommonConstants.ONE_STRING.equals(settleDomain.getManagementType())) {
gMoney = BigDecimalUtils.safeMultiply(actualMoney,
settleDomain.getManagementFee().divide(new BigDecimal("100"),
CommonConstants.FIVE_INT, BigDecimal.ROUND_HALF_UP));
isBl = true;
}
//判断是否存在当月的商险收入数据
TIncomeDetail incomeDetail = new TIncomeDetail();
incomeDetail.setSourceId(detail.getId());
if (isBl) {
incomeDetail.setMoney(gMoney);
}else {
incomeDetail.setMoney(actualMoney);
}
incomeDetail.setFeeType(CommonConstants.ONE_STRING);
//判断是否存在当月的商险收入数据
R<TIncomeDetailReturnVo> detailInfoList = socialDaprUtils.getTIncomeDetailList(incomeDetail);
if (Common.isNotNull(detailInfoList) && detailInfoList.getCode() == CommonConstants.SUCCESS
&& detailInfoList.getData().getDetailList().size() > 0) {
//生成红冲数据
for (TIncomeDetail detailInfo : detailInfoList.getData().getDetailList()) {
TIncomeDetail detail1 = new TIncomeDetail();
BeanCopyUtils.copyProperties(detailInfo, detail1);
detail1.setId(CommonConstants.NULL);
detail1.setRedData(CommonConstants.ONE_STRING);
detail1.setMoney(detailInfo.getMoney().negate());
socialDaprUtils.createTIncomeDetail(detail1);
break;
}
}
}
if (Common.isNotNull(settleDomain.getRiskServerItem()) && settleDomain.getRiskServerItem()
.contains(CommonConstants.THREE_STRING) && CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
if (CommonConstants.ONE_STRING.equals(settleDomain.getRiskFundType())) {
gMoney = BigDecimalUtils.safeMultiply(actualMoney,
settleDomain.getRiskFundFee().divide(new BigDecimal("100"),
CommonConstants.FIVE_INT, BigDecimal.ROUND_HALF_UP));
isBl = true;
}
//判断是否存在当月的商险收入数据
TIncomeDetail incomeDetail = new TIncomeDetail();
incomeDetail.setSourceId(detail.getId());
incomeDetail.setFeeType(CommonConstants.TWO_STRING);
if (isBl) {
incomeDetail.setMoney(gMoney);
}else {
incomeDetail.setMoney(actualMoney);
}
//判断是否存在当月的商险收入数据
R<TIncomeDetailReturnVo> detailInfoList = socialDaprUtils.getTIncomeDetailList(incomeDetail);
if (Common.isNotNull(detailInfoList) && detailInfoList.getCode() == CommonConstants.SUCCESS
&& detailInfoList.getData().getDetailList().size() > 0) {
//生成红冲数据
for (TIncomeDetail detailInfo : detailInfoList.getData().getDetailList()) {
TIncomeDetail detail1 = new TIncomeDetail();
BeanCopyUtils.copyProperties(detailInfo, detail1);
detail1.setId(CommonConstants.NULL);
detail1.setRedData(CommonConstants.ONE_STRING);
detail1.setMoney(detailInfo.getMoney().negate());
socialDaprUtils.createTIncomeDetail(detail1);
break;
}
}
}
}
}
//生成收入数据
createInsuranceInfo(detail);
}
}
}catch (Exception e){
log.error("收入数据同步处理失败:"+e);
......@@ -1788,7 +1900,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
//校验身份合法
/*TCheckIdCard checkIdCard = new TCheckIdCard();
TCheckIdCard checkIdCard = new TCheckIdCard();
checkIdCard.setName(param.getEmpName());
checkIdCard.setIdCard(param.getEmpIdcardNo());
R<TCheckIdCard> tCheckIdCardR = checkDaprUtil.checkIdCardSingle(checkIdCard);
......@@ -1799,10 +1911,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param);
continue;
}
}*/
}
//根据项目编码查询项目是否存在
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(Arrays.asList(param.getDeptNo()));
try{
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(Arrays.asList(param.getDeptNo()));
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
if (MapUtils.isEmpty(data)){
......@@ -1828,6 +1941,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
}catch (Exception e){
log.error(InsurancesConstants.GET_DEPT_DETAIL_ERROR+e);
param.setErrorMessage(InsurancesConstants.GET_DEPT_DETAIL_ERROR);
listResult.add(param);
continue;
}
//校验当前项目是否在权限范围内
if(!deptNoList.stream().anyMatch(u ->u.equals(param.getDeptNo()))){
param.setErrorMessage(InsurancesConstants.DEPT_NO_NOT_IN_USER_DEPT_LIST);
......@@ -2152,7 +2271,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
//校验身份合法
/*TCheckIdCard checkIdCard = new TCheckIdCard();
TCheckIdCard checkIdCard = new TCheckIdCard();
checkIdCard.setName(param.getEmpName());
checkIdCard.setIdCard(param.getEmpIdcardNo());
R<TCheckIdCard> tCheckIdCardR = checkDaprUtil.checkIdCardSingle(checkIdCard);
......@@ -2163,35 +2282,44 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param);
continue;
}
}*/
}
//根据项目编码查询项目是否存在
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(Arrays.asList(param.getDeptNo()));
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
if (MapUtils.isEmpty(data)){
param.setErrorMessage(InsurancesConstants.DEPT_NO_IS_NOT_EXIST);
listResult.add(param);
continue;
}else {
ProjectSetInfoVo projectSetInfoVo = data.get(param.getDeptNo());
if (null == projectSetInfoVo){
try{
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(Arrays.asList(param.getDeptNo()));
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
if (MapUtils.isEmpty(data)){
param.setErrorMessage(InsurancesConstants.DEPT_NO_IS_NOT_EXIST);
listResult.add(param);
continue;
}else {
//结算类型,根据项目编码获取,并冗余到明细记录中
String settleType = projectSetInfoVo.getInsuranceSettleType();
if (StringUtils.isEmpty(settleType)){
param.setErrorMessage(InsurancesConstants.PROJECT_NOT_FIND_SETTLE_TYPE);
ProjectSetInfoVo projectSetInfoVo = data.get(param.getDeptNo());
if (null == projectSetInfoVo){
param.setErrorMessage(InsurancesConstants.DEPT_NO_IS_NOT_EXIST);
listResult.add(param);
continue;
}else {
param.setSettleType(Integer.parseInt(settleType));
//结算类型,根据项目编码获取,并冗余到明细记录中
String settleType = projectSetInfoVo.getInsuranceSettleType();
if (StringUtils.isEmpty(settleType)){
param.setErrorMessage(InsurancesConstants.PROJECT_NOT_FIND_SETTLE_TYPE);
listResult.add(param);
continue;
}else {
param.setSettleType(Integer.parseInt(settleType));
}
param.setDeptId(projectSetInfoVo.getId());
}
}
}
}catch (Exception e){
log.error("查询项目信息出错:"+e);
param.setErrorMessage(InsurancesConstants.GET_DEPT_DETAIL_ERROR);
listResult.add(param);
continue;
}
//校验当前项目是否在权限范围内
if(!deptNoList.stream().anyMatch(u ->u.equals(param.getDeptNo()))){
param.setErrorMessage(InsurancesConstants.DEPT_NO_NOT_IN_USER_DEPT_LIST);
......@@ -2521,7 +2649,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
//校验身份合法
/*TCheckIdCard checkIdCard = new TCheckIdCard();
TCheckIdCard checkIdCard = new TCheckIdCard();
checkIdCard.setName(param.getReplaceEmpName());
checkIdCard.setIdCard(param.getReplaceEmpIdcardNo());
R<TCheckIdCard> tCheckIdCardR = checkDaprUtil.checkIdCardSingle(checkIdCard);
......@@ -2532,7 +2660,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param);
continue;
}
}*/
}
if (param.getEmpName().equals(param.getReplaceEmpName()) && param.getEmpIdcardNo().equals(param.getReplaceEmpIdcardNo())){
param.setErrorMessage(InsurancesConstants.REPLACE_EMP_INFO_SAME);
......@@ -2540,33 +2668,40 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
continue;
}
//根据项目编码查询项目是否存在
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(Arrays.asList(param.getReplaceDeptNo()));
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
if (MapUtils.isEmpty(data)){
param.setErrorMessage(InsurancesConstants.REPLACE_DEPT_NO_IS_NOT_EXIST);
listResult.add(param);
continue;
}else {
ProjectSetInfoVo projectSetInfoVo = data.get(param.getReplaceDeptNo());
if (null == projectSetInfoVo){
try{
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(Arrays.asList(param.getReplaceDeptNo()));
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
if (MapUtils.isEmpty(data)){
param.setErrorMessage(InsurancesConstants.REPLACE_DEPT_NO_IS_NOT_EXIST);
listResult.add(param);
continue;
}else {
//结算类型,根据项目编码获取,并冗余到明细记录中
String settleType = projectSetInfoVo.getInsuranceSettleType();
if (StringUtils.isEmpty(settleType)){
param.setErrorMessage(InsurancesConstants.REPLACE_PROJECT_NOT_FIND_SETTLE_TYPE);
ProjectSetInfoVo projectSetInfoVo = data.get(param.getReplaceDeptNo());
if (null == projectSetInfoVo){
param.setErrorMessage(InsurancesConstants.REPLACE_DEPT_NO_IS_NOT_EXIST);
listResult.add(param);
continue;
}else {
param.setSettleType(Integer.parseInt(settleType));
//结算类型,根据项目编码获取,并冗余到明细记录中
String settleType = projectSetInfoVo.getInsuranceSettleType();
if (StringUtils.isEmpty(settleType)){
param.setErrorMessage(InsurancesConstants.REPLACE_PROJECT_NOT_FIND_SETTLE_TYPE);
listResult.add(param);
continue;
}else {
param.setSettleType(Integer.parseInt(settleType));
param.setDeptId(projectSetInfoVo.getId());
}
}
}
}
}catch (Exception e){
log.error("查询项目信息出错:"+e);
param.setErrorMessage(InsurancesConstants.GET_DEPT_DETAIL_ERROR);
listResult.add(param);
continue;
}
//原数据查重校验:姓名 + 身份证号 + 项目编码 + 保险公司 + 险种名称 + 保单开始时间 + 保单结束时间
TInsuranceDetail detail = this.baseMapper.selectOne(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getEmpName, param.getEmpName())
......@@ -3008,6 +3143,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
private void setProjectNameByDeptNo(List<InsuranceListVO> insuranceList) {
if (CollectionUtils.isNotEmpty(insuranceList)){
List<String> collect = insuranceList.stream().map(e -> e.getDeptNo()).distinct().collect(Collectors.toList());
try{
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
......@@ -3018,6 +3154,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
}catch (Exception e){
for (InsuranceListVO record : insuranceList) {
record.setProjectName(CommonConstants.EMPTY_STRING);
}
}
}
}
......@@ -3031,7 +3172,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @param displayFlag 是否显示 0不显示/1显示
* @return void
*/
@Transactional(value = "insurancesTransactionManager" ,rollbackFor = {Exception.class})
public void addOperate(List<TInsuranceDetail> detailList,YifuUser user,String operateDesc,String remark,Integer displayFlag){
if (CollectionUtils.isNotEmpty(detailList)){
List<TInsuranceOperate> operateList = new ArrayList<>();
......@@ -3155,7 +3295,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return R.failed(InsurancesConstants.IMPORT_TOO_LONG);
}
Map<String, List<InsuranceRefundCheck>> refundMap = checkInsuranceRefundList(insuranceRefundCheckList,user);
List<InsuranceRefundCheck> successList = refundMap.get("successList");
List<InsuranceRefundCheck> successList = refundMap.get(InsurancesConstants.SUCCESS_LIST);
List<TInsuranceOperate> operateList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(successList)){
for (InsuranceRefundCheck refund : successList){
......@@ -3193,7 +3333,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
tInsuranceOperateService.saveBatch(operateList);
List<InsuranceRefundCheck> errorList = refundMap.get("errorList");
List<InsuranceRefundCheck> errorList = refundMap.get(InsurancesConstants.ERROR_LIST);
return R.ok(errorList,"校验完成");
}
......@@ -3230,6 +3370,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
}
return insuranceList;
}
......@@ -3250,7 +3391,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return R.ok(insuredList);
}
param.setDeptNoList(deptList);
param.setDeptNoList(deptList);
insuredList = this.baseMapper.getInsuredList(param);
if (CollectionUtils.isNotEmpty(insuredList)){
if(insuredList.size() > CommonConstants.EXPORT_TWENTY_THOUSAND){
......@@ -3258,18 +3398,24 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
//根据项目编码获取项目名称
List<String> collect = insuredList.stream().map(InsuredListVo::getDeptNo).distinct().collect(Collectors.toList());
try{
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
for (InsuredListVo record : insuredList) {
//购买月数
record.setBuyMonth(LocalDateUtil.betweenMonth(record.getPolicyStart().toString(),record.getPolicyEnd().toString()));
ProjectSetInfoVo jsonObject = data.get(record.getDeptNo());
if (null != jsonObject){
record.setBuyMonth(LocalDateUtil.betweenMonth(record.getPolicyStart().toString(), record.getPolicyEnd().toString()));
ProjectSetInfoVo jsonObject = data.get(record.getDeptNo());
if (null != jsonObject) {
record.setProjectName(Optional.ofNullable(jsonObject.getDepartName()).orElse(""));
}
}
}
}catch (Exception e){
for (InsuredListVo record : insuredList) {
record.setProjectName(CommonConstants.EMPTY_STRING);
}
}
}
return R.ok(insuredList);
}
......@@ -3294,18 +3440,23 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (CollectionUtils.isNotEmpty(insuranceRefundPageList.getRecords())){
//根据项目编码获取项目名称
List<String> collect = insuranceRefundPageList.getRecords().stream().map(InsuranceRefundListVo::getDeptNo).distinct().collect(Collectors.toList());
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
for (InsuranceRefundListVo record : insuranceRefundPageList.getRecords()) {
//购买月数
record.setBuyMonth(LocalDateUtil.betweenMonth(record.getPolicyStart().toString(),record.getPolicyEnd().toString()));
ProjectSetInfoVo jsonObject = data.get(record.getDeptNo());
if (null != jsonObject){
record.setProjectName(Optional.ofNullable(jsonObject.getDepartName()).orElse(""));
try {
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
for (InsuranceRefundListVo record : insuranceRefundPageList.getRecords()) {
//购买月数
record.setBuyMonth(LocalDateUtil.betweenMonth(record.getPolicyStart().toString(),record.getPolicyEnd().toString()));
ProjectSetInfoVo jsonObject = data.get(record.getDeptNo());
if (null != jsonObject){
record.setProjectName(Optional.ofNullable(jsonObject.getDepartName()).orElse(""));
}
}
}
}catch (Exception e){
log.error(InsurancesConstants.GET_DEPT_DETAIL_ERROR+e);
}
}
return R.ok(insuranceRefundPageList);
}
......@@ -3562,8 +3713,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return R.failed(InsurancesConstants.IMPORT_TOO_LONG);
}
Map<String, List<InsuranceHandleImportParam>> map = insuranceChangeCheck(insuranceRefundImportList, user,true);
List<InsuranceHandleImportParam> successList = map.get("successList");
List<InsuranceHandleImportParam> errorList = map.get("errorList");
List<InsuranceHandleImportParam> successList = map.get(InsurancesConstants.SUCCESS_LIST);
List<InsuranceHandleImportParam> errorList = map.get(InsurancesConstants.ERROR_LIST);
//减员退回
List<TInsuranceOperate> operateList =new ArrayList<>(16);
if (CollectionUtils.isNotEmpty(successList)) {
......@@ -3627,8 +3778,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return R.failed(InsurancesConstants.IMPORT_TOO_LONG);
}
Map<String, List<SettleMonthChangeCheckParam>> map = settleMonthChangeCheck(settleMonthCheckList, user);
List<SettleMonthChangeCheckParam> successList = map.get("successList");
List<SettleMonthChangeCheckParam> errorList = map.get("errorList");
List<SettleMonthChangeCheckParam> successList = map.get(InsurancesConstants.SUCCESS_LIST);
List<SettleMonthChangeCheckParam> errorList = map.get(InsurancesConstants.ERROR_LIST);
List<SettleMonthChangeCheckParam> ekpList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(successList)){
for (SettleMonthChangeCheckParam settleMonthChangeCheckParam : successList) {
......@@ -3714,7 +3865,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return R.failed(InsurancesConstants.IMPORT_TOO_LONG);
}
Map<String, List<DeptChangeCheckParam>> stringListMap = deptChangeCheck(deptChangeCheckList,user);
List<DeptChangeCheckParam> successList = stringListMap.get("successList");
List<DeptChangeCheckParam> successList = stringListMap.get(InsurancesConstants.SUCCESS_LIST);
List<TInsuranceOperate> operateList = new ArrayList<>(16);
if(CollectionUtils.isNotEmpty(successList)){
threadPool.execute(() -> {
......@@ -4433,7 +4584,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
});
}
tInsuranceOperateService.saveBatch(operateList);
List<DeptChangeCheckParam> errorList = stringListMap.get("errorList");
List<DeptChangeCheckParam> errorList = stringListMap.get(InsurancesConstants.ERROR_LIST);
return R.ok(errorList,InsurancesConstants.IMPORT_SUCCESS);
}
......@@ -4523,7 +4674,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
public R updateRefundMoney(List<RefundMoneyParam> paramList) {
YifuUser user = SecurityUtils.getUser();
Map<String, List<RefundMoneyParam>> map = refundMoneyCheck(paramList);
List<RefundMoneyParam> successList = map.get("successList");
List<RefundMoneyParam> successList = map.get(InsurancesConstants.SUCCESS_LIST);
if (CollectionUtils.isNotEmpty(successList)){
for (RefundMoneyParam param : successList) {
TInsuranceRefund insuranceRefund = new TInsuranceRefund();
......@@ -4536,7 +4687,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
tInsuranceRefundService.updateRefundMoney(insuranceRefund);
}
}
return R.ok(map.get("errorList"));
return R.ok(map.get(InsurancesConstants.ERROR_LIST));
}
/**
......@@ -4718,8 +4869,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
successList.add(param);
}
}
map.put("successList",successList);
map.put("errorList",errorList);
map.put(InsurancesConstants.SUCCESS_LIST,successList);
map.put(InsurancesConstants.ERROR_LIST,errorList);
return map;
};
/**
......@@ -4782,8 +4933,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
param.setId(tInsuranceRefundDetail.getInsDetailId());
successList.add(param);
}
map.put("errorList",errorList);
map.put("successList",successList);
map.put(InsurancesConstants.ERROR_LIST,errorList);
map.put(InsurancesConstants.SUCCESS_LIST,successList);
return map;
}
/**
......@@ -4993,8 +5144,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
param.setId(insuranceDetail.getId());
successList.add(param);
}
map.put("errorList",errorList);
map.put("successList",successList);
map.put(InsurancesConstants.ERROR_LIST,errorList);
map.put(InsurancesConstants.SUCCESS_LIST,successList);
return map;
}
......@@ -5215,8 +5366,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
param.setId(detailId);
successList.add(param);
}
map.put("successList",successList);
map.put("errorList",errorList);
map.put(InsurancesConstants.SUCCESS_LIST,successList);
map.put(InsurancesConstants.ERROR_LIST,errorList);
return map;
}
......@@ -5522,8 +5673,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
param.setId(insuranceDetail.getId());
successList.add(param);
}
map.put("errorList",errorList);
map.put("successList",successList);
map.put(InsurancesConstants.ERROR_LIST,errorList);
map.put(InsurancesConstants.SUCCESS_LIST,successList);
return map;
}
......@@ -5636,7 +5787,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
List<InsuranceListByIdCardVo> records = insuranceListByIdCard.getRecords();
if (CollectionUtils.isNotEmpty(records)){
for (InsuranceListByIdCardVo record : records) {
record.setBuyMonth(LocalDateUtil.betweenMonth(record.getPolicyStart().toString(),record.getPolicyEnd().toString()));
record.setBuyMonth(LocalDateUtil.betweenMonth(record.getPolicyStart().toString(), record.getPolicyEnd().toString()));
}
insuranceListByIdCard.setRecords(records);
}
......@@ -5645,6 +5796,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
@Override
@Transactional(value = "insurancesTransactionManager" ,rollbackFor = {Exception.class})
public R<List<InsuranceAddParam>> addOrderInsurance(InsuranceListOrderParam paramList) {
String orderNo = paramList.getOrderNo();
if (StringUtils.isBlank(orderNo)) {
......@@ -5654,6 +5806,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
@Override
@Transactional(value = "insurancesTransactionManager" ,rollbackFor = {Exception.class})
public R<List<InsuranceBatchParam>> batchOrderInsurance(InsuranceOrderBatchParam paramList) {
String orderNo = paramList.getOrderNo();
if (StringUtils.isBlank(orderNo)) {
......@@ -5663,6 +5816,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
@Override
@Transactional(value = "insurancesTransactionManager" ,rollbackFor = {Exception.class})
public R<List<InsuranceReplaceParam>> replaceOrderInsurance(InsuranceOrderReplaceParam paramList) {
String orderNo = paramList.getOrderNo();
if (StringUtils.isBlank(orderNo)) {
......@@ -5949,6 +6103,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
//判断是否存在当月的商险收入数据
Boolean isExist = false;
List<TIncomeDetail> incomeDetailList = new ArrayList<>();
TIncomeDetail incomeDetail = new TIncomeDetail();
incomeDetail.setEmpIdcard(insuranceDetail.getEmpIdcardNo());
incomeDetail.setCreateMonth(DateUtil.getYearAndMonth(insuranceDetail.getHandledTime(),0));
......@@ -5957,9 +6112,18 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
R<TIncomeDetailReturnVo> detailList = socialDaprUtils.getTIncomeDetailList(incomeDetail);
if(Common.isNotNull(detailList) && detailList.getCode() == CommonConstants.SUCCESS
&& detailList.getData().getDetailList().size() > 0){
incomeDetailList = detailList.getData().getDetailList();
isExist = true;
}
//预估或者实缴保费
BigDecimal fee;
if (CommonConstants.ONE_INT == insuranceDetail.getSettleType()) {
fee = insuranceDetail.getActualPremium();
} else {
fee = insuranceDetail.getEstimatePremium();
}
//判断是否为按人次收费
int isSum = 0;
if (Common.isNotNull(settleDomain)) {
......@@ -5971,7 +6135,16 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType())) {
//预估模式只有按人次和人数收费
if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
isSum = 1;
if (Common.isNotNull(incomeDetailList)) {
for (TIncomeDetail incomeDetailSum: incomeDetailList) {
if (!(incomeDetailSum.getSourceId().equals(insuranceDetail.getId()) &&
CommonConstants.ONE_STRING.equals(incomeDetailSum.getFeeType()) &&
CommonConstants.ONE_STRING.equals(incomeDetailSum.getMrSettleType()))) {
isSum = 1;
break;
}
}
}
}
if (!isExist || isSum == 1) {
createIncomeInsurance(insuranceDetail, settleDomain, CommonConstants.ONE_STRING,
......@@ -5979,16 +6152,28 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
settleDomain.getManagementFee());
}
} else {
BigDecimal gMoney = BigDecimal.ZERO;
BigDecimal gMoney;
if (CommonConstants.TWO_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
isSum = 2;
if (Common.isNotNull(incomeDetailList)) {
for (TIncomeDetail incomeDetailSum: incomeDetailList) {
if (incomeDetailSum.getSourceId().equals(insuranceDetail.getId()) &&
CommonConstants.ONE_STRING.equals(incomeDetailSum.getFeeType()) &&
CommonConstants.TWO_STRING.equals(incomeDetailSum.getMrSettleType()) &&
CommonConstants.THREE_STRING.equals(incomeDetailSum.getFeeMode())) {
isSum = 6;
break;
} else {
isSum = 2;
}
}
}
} else {
gMoney = BigDecimalUtils.safeMultiply(insuranceDetail.getActualPremium(),
settleDomain.getManagementFee().divide(new BigDecimal("100"),
CommonConstants.THREE_INT, BigDecimal.ROUND_HALF_UP));
isSum = 2;
gMoney = BigDecimalUtils.safeMultiply(fee, settleDomain.getManagementFee().divide(
new BigDecimal("100"), CommonConstants.FIVE_INT, BigDecimal.ROUND_HALF_UP));
}
if (!isExist || isSum == 2) {
createIncomeInsurance(insuranceDetail, settleDomain, CommonConstants.ONE_STRING,
......@@ -6000,32 +6185,54 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (Common.isNotNull(settleDomain.getRiskServerItem()) && settleDomain.getRiskServerItem()
.contains(CommonConstants.THREE_STRING)) {
//预估模式
if (CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType()) &&
CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
if (CommonConstants.THREE_STRING.equals(settleDomain.getRiskFundType())) {
isSum = 3;
}
if (!isExist || isSum == 3) {
createIncomeInsurance(insuranceDetail, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(),
settleDomain.getRiskFundFee());
}
} else {
if (CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
BigDecimal money = BigDecimal.ZERO;
if (CommonConstants.TWO_STRING.equals(settleDomain.getRiskFundType())) {
money = settleDomain.getRiskFundFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
money = settleDomain.getRiskFundFee();
isSum = 4;
} else {
money = BigDecimalUtils.safeMultiply(insuranceDetail.getActualPremium(),
settleDomain.getRiskFundFee().divide(new BigDecimal("100"),
CommonConstants.THREE_INT, BigDecimal.ROUND_HALF_UP));
if (CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
if (CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType())) {
if (CommonConstants.THREE_STRING.equals(settleDomain.getRiskFundType())) {
if (Common.isNotNull(incomeDetailList)) {
for (TIncomeDetail incomeDetailSum: incomeDetailList) {
if (!(incomeDetailSum.getSourceId().equals(insuranceDetail.getId()) &&
CommonConstants.TWO_STRING.equals(incomeDetailSum.getFeeType()) &&
CommonConstants.ONE_STRING.equals(incomeDetailSum.getMrSettleType()))) {
isSum = 3;
break;
}
}
}
}
if (!isExist || isSum == 4) {
if (!isExist || isSum == 3) {
createIncomeInsurance(insuranceDetail, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(), money);
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(),
settleDomain.getRiskFundFee());
}
} else {
if (CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
BigDecimal money;
if (CommonConstants.TWO_STRING.equals(settleDomain.getRiskFundType())) {
money = settleDomain.getRiskFundFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getRiskFundType())) {
money = settleDomain.getRiskFundFee();
if (Common.isNotNull(incomeDetailList)) {
for (TIncomeDetail incomeDetailSum: incomeDetailList) {
if (incomeDetailSum.getSourceId().equals(insuranceDetail.getId()) &&
CommonConstants.TWO_STRING.equals(incomeDetailSum.getFeeType()) &&
CommonConstants.TWO_STRING.equals(incomeDetailSum.getMrSettleType()) &&
CommonConstants.THREE_STRING.equals(incomeDetailSum.getFeeMode())) {
isSum = 5;
break;
} else {
isSum = 4;
}
}
}
} else {
isSum = 4;
money = BigDecimalUtils.safeMultiply(fee, settleDomain.getRiskFundFee().divide(
new BigDecimal("100"), CommonConstants.FIVE_INT, BigDecimal.ROUND_HALF_UP));
}
if (!isExist || isSum == 4) {
createIncomeInsurance(insuranceDetail, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(), money);
}
}
}
}
......@@ -6049,8 +6256,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
detail.setDataCreateMonth(DateUtil.addMonth(0));
detail.setSourceId(insuranceDetail.getId());
detail.setSourceType(CommonConstants.THREE_STRING);
detail.setCreateMonth(DateUtil.getYearAndMonth(insuranceDetail.getHandledTime(),0));
detail.setPayMonth(insuranceDetail.getSettleMonth().replace("-",""));
detail.setCreateMonth(DateUtil.addMonth(0));
detail.setPayMonth(DateUtil.addMonth(0));
detail.setMoney(money);
detail.setFeeType(feeType);
detail.setFeeMode(feeMode);
......@@ -6062,7 +6269,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
//更新收入信息
public void updateInsuranceInfo(TInsuranceDetail insuranceDetail,TInsuranceSettle settle) {
public void updateInsuranceInfo(TInsuranceDetail insuranceDetail) {
TIncomeDetail incomeDetail = new TIncomeDetail();
incomeDetail.setSourceId(insuranceDetail.getId());
R<TIncomeDetailReturnVo> detailList = socialDaprUtils.getTIncomeDetailList(incomeDetail);
......
......@@ -63,15 +63,14 @@ public class TInsuranceEnclosureServiceImpl extends ServiceImpl<TInsuranceEnclos
if (file.getSize() > (CommonConstants.FIFTY_INT*CommonConstants.BYTE*CommonConstants.BYTE)){
return R.failed(InsurancesConstants.INSURANCE_ENCLOSURE_SIZE_ERROR);
}
String enclosureName = Objects.requireNonNull(file.getOriginalFilename()).substring(0,file.getOriginalFilename().lastIndexOf("."));
String fileName = System.currentTimeMillis() + "_" + file.getOriginalFilename();
String fileName = System.currentTimeMillis() + CommonConstants.DOWN_LINE_STRING + file.getOriginalFilename();
//filePath不传默认存储空间的根目录
//支持的附件格式
String key = "";
if (!Common.isNotNull(filePath)) {
key = fileName;
} else {
key = filePath + "/" + fileName;
key = filePath + CommonConstants.SLASH_SPLIT_LINE_STRING + fileName;
}
boolean flag = ossUtil.uploadFileByStream(file.getInputStream(), key, null);
if (flag) {
......@@ -92,7 +91,7 @@ public class TInsuranceEnclosureServiceImpl extends ServiceImpl<TInsuranceEnclos
try {
this.save(insuranceEnclosure);
} catch (Exception e) {
log.error("OSS文件上传接口异常:" + e.getMessage());
log.error(InsurancesConstants.OSS_ERROR + e.getMessage());
ossUtil.deleteObject(null, key);
return R.failed("failed:" + e.getMessage());
}
......
......@@ -39,7 +39,6 @@ security:
- /v3/api-docs
- /actuator/**
- /swagger-ui/**
- /insuranceDetail/updateInsuranceSettle
- /insuranceDetail/urgentUpdateIsUse
......
......@@ -56,6 +56,7 @@
<result property="orderNo" column="ORDER_NO" jdbcType="VARCHAR"/>
<result property="createUserDeptId" column="CREATE_USER_DEPT_ID" jdbcType="VARCHAR"/>
<result property="createUserDeptName" column="CREATE_USER_DEPT_NAME" jdbcType="VARCHAR"/>
<result property="deptId" column="DEPT_ID" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
ID,EMP_NAME,
......@@ -135,6 +136,9 @@
<if test="param.startDate != null and param.startDate.trim() != '' and param.endDate != null and param.endDate.trim() != ''">
and detail.CREATE_TIME <![CDATA[ >= ]]> concat(#{param.startDate}, ' 00:00:00') and detail.CREATE_TIME <![CDATA[ <= ]]> concat(#{param.endDate}, ' 23:59:59')
</if>
<if test="param.authSql != null and param.authSql.trim() != ''">
${tEmployeeInfo.authSql}
</if>
ORDER BY detail.BUY_HANDLE_STATUS,detail.CREATE_TIME DESC
</select>
<!--投保不分页查询-->
......
......@@ -64,7 +64,7 @@ public class TConfigSalaryController {
@Operation(description = "简单分页查询")
@GetMapping("/page")
public R<IPage<TConfigSalary>> getTConfigSalaryPage(Page<TConfigSalary> page, TConfigSalary tConfigSalary) {
return new R<>(tConfigSalaryService.getTConfigSalaryPage(page, tConfigSalary));
return tConfigSalaryService.getTConfigSalaryPage(page, tConfigSalary);
}
......
......@@ -3,6 +3,7 @@ package com.yifu.cloud.plus.v1.yifu.salary.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TConfigSalary;
/**
......@@ -19,7 +20,7 @@ public interface TConfigSalaryService extends IService<TConfigSalary> {
* @param tConfigSalary 工资报账配置
* @return
*/
IPage<TConfigSalary> getTConfigSalaryPage(Page<TConfigSalary> page, TConfigSalary tConfigSalary);
R<IPage<TConfigSalary>> getTConfigSalaryPage(Page<TConfigSalary> page, TConfigSalary tConfigSalary);
}
......@@ -34,26 +34,23 @@ public class TConfigSalaryServiceImpl extends ServiceImpl<TConfigSalaryMapper, T
* @return
*/
@Override
public IPage<TConfigSalary> getTConfigSalaryPage(Page<TConfigSalary> page, TConfigSalary tConfigSalary){
public R<IPage<TConfigSalary>> getTConfigSalaryPage(Page<TConfigSalary> page, TConfigSalary tConfigSalary){
YifuUser user = SecurityUtils.getUser();
TSettleDomainListVo vo = null;
if (Common.isNotNull(user)) {
R<TSettleDomainListVo> domainListVoR = archivesDaprUtil.getSettleDomainIdsByUserId(user.getId());
if (Common.isEmpty(domainListVoR)) {
throw new RuntimeException("调用结算服务失败");
return R.failed("调用结算服务失败");
}
if (CommonConstants.SUCCESS != domainListVoR.getCode()) {
throw new RuntimeException("调用结算服务返回失败");
return R.failed("调用结算服务返回失败");
}
vo = domainListVoR.getData();
if (Common.isEmpty(vo) || !Common.isNotEmpty(vo.getDeptIds())) {
throw new RuntimeException("无项目权限");
}
}
if (Common.isEmpty(vo)){
return baseMapper.getTConfigSalaryPage(page, tConfigSalary, vo.getDeptIds());
if (Common.isNotNull(vo)){
return R.ok(baseMapper.getTConfigSalaryPage(page, tConfigSalary, vo.getDeptIds()));
}
return baseMapper.getTConfigSalaryPage(page, tConfigSalary, null);
return R.ok(baseMapper.getTConfigSalaryPage(page, tConfigSalary, null));
}
}
......@@ -472,7 +472,7 @@
,'' fd_3adfee1ff1ca6a
,'' fd_3adfee203f86b2
,ifnull(a.ACTUAL_SALARY,'0') fd_3adfee20fe5ba4
,'' fd_3adfee21802434
,ifnull(a.RELAY_SALARY,'0') - ifnull(ifnull(withholidingPersonSocial.SALARY_MONEY,personalSocial.SALARY_MONEY),'0') - ifnull(ifnull(withholidingPersonFund.SALARY_MONEY,personalFund.SALARY_MONEY),'') fd_3adfee21802434
,'' fd_3adfee4ba5ad36
,'' fd_3adfee4c0c59ee
,'' fd_3adfee5dd14866
......
......@@ -377,6 +377,14 @@ public class TPaymentInfo extends BaseEntity {
@ExcelProperty("推送状态 0已推送 1未推送")
private String pushStatus;
/**
* 收入状态
*/
@ExcelAttribute(name = "收入状态 0已生成 1未生成" )
@Schema(description ="收入状态 0已生成 1未生成")
@ExcelProperty("收入状态 0已生成 1未生成")
private String incomeStatus;
/**
* 单位社保补缴利息
*/
......
......@@ -131,14 +131,7 @@ public class IncomeExportVo implements Serializable {
@Schema(description = "数据生成时间")
@ExcelProperty("数据生成时间")
private Date createTime;
/**
* 数据生成月份
*/
@Length(max = 6, message = "数据生成时间 不能超过6 个字符")
@ExcelAttribute(name = "数据生成时间", maxLength = 6)
@Schema(description = "数据生成时间")
@ExcelProperty("数据生成时间")
private String dataCreateMonth;
/**
* 推送状态:0未推送1已推送
*/
......
......@@ -16,6 +16,7 @@
*/
package com.yifu.cloud.plus.v1.yifu.social.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncome;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
......@@ -55,4 +56,9 @@ public class TIncomeSearchVo extends TIncome {
@Schema(description = "查询limit 数据条数")
private int limitEnd;
/**
* 菜单ID 获取查询权限使用
*/
@TableField(exist = false)
private String mId;
}
......@@ -31,7 +31,6 @@ public class OTAStrategyShardingAlgorithm implements StandardShardingAlgorithm<L
String tableSuffix = value.format(yyyy);
String logicTableName = preciseShardingValue.getLogicTableName();
String table = logicTableName.concat("_").concat(tableSuffix);
System.out.println("OrderStrategy.doSharding table name: " + table);
return collection.stream().filter(s -> s.equals(table)).findFirst().orElseThrow(() -> new RuntimeException("逻辑分表不存在"));
}
......@@ -53,7 +52,6 @@ public class OTAStrategyShardingAlgorithm implements StandardShardingAlgorithm<L
Set<String> queryRangeTables = extracted(logicTableName, valueRange.lowerEndpoint(), valueRange.upperEndpoint());
ArrayList<String> tables = new ArrayList<>(collection);
tables.retainAll(queryRangeTables);
System.out.println(JSON.toJSONString(tables));
return tables;
}
......
......@@ -381,4 +381,18 @@ public class TPaymentInfoController {
public TPaymentVo getPaymentSocialAndFound(@RequestBody TPaymentInfo info) {
return tPaymentInfoService.getPaymentSocialAndFound(info);
}
/**
* @Description: 手动推送社保缴费库明细的数据
* @Author: huyc
* @Date: 2022/8/30
* @return: void
**/
@Operation(summary = "手动推送社保缴费库明细的数据", description = "手动推送社保缴费库明细的数据")
@SysLog("手动推送社保缴费库明细的数据")
@PostMapping("/pushPaymentSocialFundInfo")
public R<Boolean> pushPaymentSocialFundInfo() {
tPaymentInfoService.pushPaymentSocialFundInfo();
return R.ok();
}
}
......@@ -117,6 +117,8 @@ public interface TPaymentInfoMapper extends BaseMapper<TPaymentInfo> {
void updatePaymentSocialAndFound(@Param("infoVo") UpdateSocialFoundVo infoVo);
void updateByIncome(@Param("id")String id);
/**
* 更新社保推送
* @Author huyc
......
......@@ -128,4 +128,8 @@ public interface TForecastLibraryService extends IService<TForecastLibrary> {
void createForecastInfo();
void createForecastFundInfo();
void pushForecastInfo(List<TForecastLibrary> library);
void pushForecastFundInfo(List<TForecastLibrary> library);
}
......@@ -57,6 +57,14 @@ public interface TIncomeService extends IService<TIncome> {
**/
boolean saveDetail(TIncomeDetail tIncomeDetail);
/**
* @Description: 新增收入明细-详情表,同时统计;
* @Author: huyc
* @Date: 2022/9/9 11:42
* @return:
**/
void saveBathDetail(List<TIncomeDetail> tIncomeDetail);
void pushDetail();
}
......@@ -140,4 +140,6 @@ public interface TPaymentInfoService extends IService<TPaymentInfo> {
TPaymentVo getPaymentSocialAndFound(TPaymentInfo info);
void pushPaymentSocialFundInfo();
}
......@@ -3153,6 +3153,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
for (int i = 0; i < monthDiff; i++) {
//获取所有的预估数据
List<TForecastLibrary> libraryFundInfoList = null;
List<TForecastLibrary> libraryFundInfoList1 = new ArrayList<>();
libraryFundInfoList = forecastLibraryService.list(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, sf.getEmpIdcard())
.eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT)
......@@ -3162,9 +3163,16 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
for (TForecastLibrary library :libraryFundInfoList) {
//办理成功生成收入
createIncomeInfo(library);
if (CommonConstants.ZERO_INT == library.getDataPush()) {
libraryFundInfoList1.add(library);
}
}
if (Common.isNotNull(libraryFundInfoList1)) {
forecastLibraryService.pushForecastFundInfo(libraryFundInfoList1);
}
}
}
}
dis.setFundHandleRemark(ServiceUtil.ifNullToEmpty(handleRemark));
if (CommonConstants.ZERO_INT == flag) {
......@@ -4029,7 +4037,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
}
//判断是否存在当月的社保或公积金收入数据
//判断是否存在当月的公积金收入数据
Boolean isExist = false;
TIncomeDetail incomeDetail = new TIncomeDetail();
incomeDetail.setEmpIdcard(library.getEmpIdcard());
......@@ -4047,6 +4055,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
}
int isSum = 0;
if (Common.isNotNull(settleDomain)) {
// 含有社保,则计算收入
if (Common.isNotNull(settleDomain.getManageServerItem()) && settleDomain.getManageServerItem()
......@@ -4060,49 +4069,18 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(),
settleDomain.getManagementFee());
}
} else {
BigDecimal gMoney = BigDecimal.ZERO;
if (CommonConstants.TWO_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
} else {
gMoney = BigDecimalUtils.safeMultiply(library.getSumAll(),
settleDomain.getManagementFee().divide(new BigDecimal("100"),
CommonConstants.THREE_INT, BigDecimal.ROUND_HALF_UP));
}
if (!isExist) {
createIncomeInsurance(library, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(), gMoney);
}
}
}
}
if (Common.isNotNull(settleDomain.getRiskServerItem()) && settleDomain.getRiskServerItem()
.contains(CommonConstants.TWO_STRING)) {
//预估模式
if (CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType()) &&
CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
if (!isExist) {
createIncomeInsurance(library, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(),
settleDomain.getRiskFundFee());
}
} else {
if (CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
BigDecimal money = BigDecimal.ZERO;
if (CommonConstants.TWO_STRING.equals(settleDomain.getRiskFundType())) {
money = settleDomain.getRiskFundFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
money = settleDomain.getRiskFundFee();
} else {
money = BigDecimalUtils.safeMultiply(library.getSumAll(),
settleDomain.getRiskFundFee().divide(new BigDecimal("100"),
CommonConstants.THREE_INT, BigDecimal.ROUND_HALF_UP));
}
if (CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
//预估模式
if (CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType())) {
if (!isExist) {
createIncomeInsurance(library, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(), money);
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(),
settleDomain.getRiskFundFee());
}
}
}
......
......@@ -1589,7 +1589,8 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
.eq(TIncomeDetail::getEmpIdcard, library.getEmpIdcard())
.eq(TIncomeDetail::getDeptId, library.getSettleDomainId())
.eq(TIncomeDetail::getSourceType, CommonConstants.ONE_STRING)
.eq(TIncomeDetail::getPayMonth, library.getSocialPayMonth()));
.eq(TIncomeDetail::getPayMonth, library.getSocialPayMonth())
.eq(TIncomeDetail::getMrSettleType, CommonConstants.ONE_STRING));
if (Common.isNotNull(updateList)) {
for (TIncomeDetail upd : updateList) {
TIncomeDetail detail = new TIncomeDetail();
......@@ -1627,7 +1628,8 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
.eq(TIncomeDetail::getEmpIdcard,library.getEmpIdcard())
.eq(TIncomeDetail::getDeptId,library.getSettleDomainId())
.eq(TIncomeDetail::getSourceType,CommonConstants.TWO_STRING)
.eq(TIncomeDetail::getPayMonth,library.getProvidentPayMonth()));
.eq(TIncomeDetail::getPayMonth,library.getProvidentPayMonth())
.eq(TIncomeDetail::getMrSettleType, CommonConstants.ONE_STRING));
if (Common.isNotNull(updateList)) {
for (TIncomeDetail upd : updateList) {
TIncomeDetail detail = new TIncomeDetail();
......@@ -1853,6 +1855,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
|| CommonConstants.THREE_STRING.equals(socialFundInfo.getSocialStatus())) {
//获取所有的预估数据
List<TForecastLibrary> librarySocialInfoList1 = new ArrayList<>();
List<TForecastLibrary> librarySocialInfoList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)
......@@ -1862,6 +1865,12 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
for (TForecastLibrary library : librarySocialInfoList) {
//办理成功生成收入
createIncomeInfo(library);
if (CommonConstants.ZERO_INT == library.getDataPush()) {
librarySocialInfoList1.add(library);
}
}
if (Common.isNotNull(librarySocialInfoList1)) {
this.pushForecastInfo(librarySocialInfoList1);
}
}
}
......@@ -2183,22 +2192,17 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
isSaveAndUpdate = true;
}
if ((Common.isNotNull(socialFundInfo.getSocialId())
//社保收入
if (Common.isNotNull(socialFundInfo.getSocialId())
&& CommonConstants.FOUR_STRING.equals(socialFundInfo.getSocialStatus())
|| CommonConstants.THREE_STRING.equals(socialFundInfo.getSocialStatus()))
|| (Common.isNotNull(socialFundInfo.getFundId())
&& CommonConstants.THREE_STRING.equals(socialFundInfo.getFundStatus()))) {
|| CommonConstants.THREE_STRING.equals(socialFundInfo.getSocialStatus())) {
//获取所有的预估数据
List<TForecastLibrary> librarySocialInfoList = null;
librarySocialInfoList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getSettleDomainId, socialFundInfo.getSettleDomain())
.and(obj -> obj
.in(TForecastLibrary::getSocialPayMonth, payMonthList)
.or()
.in(TForecastLibrary::getProvidentPayMonth, payMonthList))
);
.in(TForecastLibrary::getSocialPayMonth, payMonthList));
if (Common.isNotNull(librarySocialInfoList)) {
for (TForecastLibrary library : librarySocialInfoList) {
......@@ -2207,6 +2211,25 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
}
}
//公积金收入
if (Common.isNotNull(socialFundInfo.getFundId())
&& CommonConstants.THREE_STRING.equals(socialFundInfo.getFundStatus())) {
//获取所有的预估数据
List<TForecastLibrary> libraryFundInfoList = null;
libraryFundInfoList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getSettleDomainId, socialFundInfo.getSettleDomain())
.in(TForecastLibrary::getProvidentPayMonth, payMonthList));
if (Common.isNotNull(libraryFundInfoList)) {
for (TForecastLibrary library : libraryFundInfoList) {
//办理成功生成收入
createIncomeInfo(library);
}
}
}
if (isSaveAndUpdate) {
return R.ok(null, "执行成功!");
} else {
......@@ -2285,9 +2308,26 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
}
@Override
public void pushForecastInfo(List<TForecastLibrary> library) {
if (Common.isNotNull(library)) {
//推送数据封装并推送
initEkpPushSocialParam(library);
}
}
@Override
public void pushForecastFundInfo(List<TForecastLibrary> library) {
if (Common.isNotNull(library)) {
//推送数据封装并推送
initEkpPushFundParam(library);
}
}
public void initEkpPushSocialParam(List<TForecastLibrary> unPushInfo) {
List<String> pushList = new ArrayList<>();
Map<String,Integer> map = new HashMap<>();
Map<String,String> idMap = new HashMap<>();
for (TForecastLibrary library : unPushInfo) {
//获取项目信息
TSettleDomain settleDomain = new TSettleDomain();
......@@ -2424,7 +2464,11 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
socialParam.setFd_3adfe8c73cb5a4(CommonConstants.EMPTY_STRING);
}
//客户名称
socialParam.setFd_3adfe8c81a0e42(library.getUnitName());
if (Common.isNotNull(settleDomain.getCustomerName())) {
socialParam.setFd_3adfe8c81a0e42(settleDomain.getCustomerName());
} else {
socialParam.setFd_3adfe8c81a0e42(CommonConstants.EMPTY_STRING);
}
//社保户
if (Common.isNotNull(library.getSocialHouseholdName())) {
socialParam.setFd_3aeafa25916e82(library.getSocialHouseholdName());
......@@ -2520,6 +2564,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
if (map.get(body) > 0) {
int i = map.get(body) + 1;
map.put(body,i);
idMap.put(body,library.getId());
//单个异常超过十次,保存异常内容
if (i >= 10) {
baseMapper.updatePushStatus(pushList);
......@@ -2531,31 +2576,26 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
error.setLinkId(library.getId());
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.saveError(error);
tSendEkpErrorService.save(error);
}
break;
}
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.TWO_STRING);
error.setLinkId(library.getId());
error.setTitle(body);
error.setNums(i);
tSendEkpErrorService.saveError(error);
} else {
map.put(body,1);
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.TWO_STRING);
error.setLinkId(library.getId());
error.setTitle(body);
error.setNums(1);
tSendEkpErrorService.saveError(error);
idMap.put(body,library.getId());
}
}
}
for (String key: map.keySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.TWO_STRING);
error.setTitle(key);
error.setLinkId(idMap.get(key));
error.setNums(map.get(key));
tSendEkpErrorService.save(error);
}
//更新推送状态
if (Common.isNotNull(pushList)) {
baseMapper.updatePushStatus(pushList);
......@@ -2565,6 +2605,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
public void initEkpPushFundParam(List<TForecastLibrary> unPushInfo) {
List<String> pushList = new ArrayList<>();
Map<String,Integer> map = new HashMap<>();
Map<String,String> idMap = new HashMap<>();
for (TForecastLibrary library : unPushInfo) {
//获取项目信息
TSettleDomain settleDomain = new TSettleDomain();
......@@ -2589,14 +2630,14 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
//员工身份证
fundParam.setFd_3adfe8c7e4cf7a(library.getEmpIdcard());
//预估单位代缴
if (Common.isNotNull(library.getUnitSocialSum())) {
fundParam.setFd_3adfeb4e8064a8(library.getUnitSocialSum().toString());
if (Common.isNotNull(library.getUnitFundSum())) {
fundParam.setFd_3adfeb4e8064a8(library.getUnitFundSum().toString());
} else {
fundParam.setFd_3adfeb4e8064a8(CommonConstants.EMPTY_STRING);
}
//预估个人代缴
if (Common.isNotNull(library.getPersonalSocialSum())) {
fundParam.setFd_3adfeb52a4d2e2(library.getPersonalSocialSum().toString());
if (Common.isNotNull(library.getPersonalFundSum())) {
fundParam.setFd_3adfeb52a4d2e2(library.getPersonalFundSum().toString());
} else {
fundParam.setFd_3adfeb52a4d2e2(CommonConstants.EMPTY_STRING);
}
......@@ -2645,7 +2686,11 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
//个人代缴
fundParam.setFd_3adfeb5366dd82(CommonConstants.EMPTY_STRING);
//客户名称
fundParam.setFd_3adfe8c81a0e42(library.getUnitName());
if (Common.isNotNull(settleDomain.getCustomerName())) {
fundParam.setFd_3adfe8c81a0e42(settleDomain.getCustomerName());
} else {
fundParam.setFd_3adfe8c81a0e42(CommonConstants.EMPTY_STRING);
}
//公积金账户
if (Common.isNotNull(library.getProvidentHouseholdName())) {
fundParam.setFd_3aeafa8cc144bc(library.getProvidentHouseholdName());
......@@ -2659,7 +2704,9 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
//个人差异
fundParam.setFd_3adfeb5413fb44(CommonConstants.EMPTY_STRING);
//应收
fundParam.setFd_3adfeb7b624f06(CommonConstants.EMPTY_STRING);
if (Common.isNotNull(library.getSumAll())) {
fundParam.setFd_3adfeb7b624f06(library.getSumAll().toString());
}
//收款状态
fundParam.setFd_3add9eaeed2560(CommonConstants.EMPTY_STRING);
//结算单号
......@@ -2693,6 +2740,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
if (map.get(body) > 0) {
int i = map.get(body) + 1;
map.put(body,i);
idMap.put(body,library.getId());
//单个异常超过十次,保存异常内容
if (i >= 10) {
baseMapper.updatePushStatus(pushList);
......@@ -2704,31 +2752,26 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
error.setLinkId(library.getId());
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.saveError(error);
tSendEkpErrorService.save(error);
}
break;
}
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.TWO_STRING);
error.setLinkId(library.getId());
error.setTitle(body);
error.setNums(i);
tSendEkpErrorService.saveError(error);
} else {
map.put(body,1);
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.TWO_STRING);
error.setLinkId(library.getId());
error.setTitle(body);
error.setNums(1);
tSendEkpErrorService.saveError(error);
idMap.put(body,library.getId());
}
}
}
for (String key: map.keySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.TWO_STRING);
error.setLinkId(idMap.get(key));
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.save(error);
}
//更新推送状态
if (Common.isNotNull(pushList)) {
baseMapper.updatePushStatus(pushList);
......@@ -2780,6 +2823,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
}
int isSum = 0;
if (Common.isNotNull(settleDomain)) {
// 含有社保,则计算收入
if (Common.isNotNull(settleDomain.getManageServerItem()) && ((settleDomain.getManageServerItem().contains(CommonConstants.ONE_STRING)
......@@ -2793,22 +2837,6 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(),
settleDomain.getManagementFee(), sourceType);
}
} else {
BigDecimal gMoney;
if (CommonConstants.TWO_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
} else {
gMoney = BigDecimalUtils.safeMultiply(library.getSumAll(),
settleDomain.getManagementFee().divide(new BigDecimal("100"),
CommonConstants.THREE_INT, BigDecimal.ROUND_HALF_UP));
}
if (!isExist) {
createIncomeInsurance(library, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(),
gMoney, sourceType);
}
}
}
}
......@@ -2816,29 +2844,12 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
&& CommonConstants.ONE_STRING.equals(sourceType)) || (settleDomain.getRiskServerItem().contains(CommonConstants.TWO_STRING)
&& CommonConstants.TWO_STRING.equals(sourceType)))) {
//预估模式
if (CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType()) &&
CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
if (!isExist) {
createIncomeInsurance(library, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(),
settleDomain.getRiskFundFee(), sourceType);
}
} else {
if (CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
BigDecimal money;
if (CommonConstants.TWO_STRING.equals(settleDomain.getRiskFundType())) {
money = settleDomain.getRiskFundFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
money = settleDomain.getRiskFundFee();
} else {
money = BigDecimalUtils.safeMultiply(library.getSumAll(),
settleDomain.getRiskFundFee().divide(new BigDecimal("100"),
CommonConstants.THREE_INT, BigDecimal.ROUND_HALF_UP));
}
if (CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
if (CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType())) {
if (!isExist) {
createIncomeInsurance(library, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(),
money, sourceType);
settleDomain.getRiskFundFee(), sourceType);
}
}
}
......
......@@ -36,8 +36,10 @@ import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpIncomeParamRisk;
import com.yifu.cloud.plus.v1.yifu.social.constants.SocialConstants;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncome;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncomeDetail;
import com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSendEkpError;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TIncomeMapper;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TPaymentInfoMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.TIncomeDetailService;
import com.yifu.cloud.plus.v1.yifu.social.service.TIncomeService;
import com.yifu.cloud.plus.v1.yifu.social.service.TSendEkpErrorService;
......@@ -74,6 +76,9 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
@Autowired
private EkpIncomeUtil ekpIncomeUtil;
@Autowired
private TPaymentInfoMapper tPaymentInfoMapper;
/**
* 收入明细表简单分页查询
*
......@@ -275,12 +280,380 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
}
}
/**
* @Description: 新增收入明细-详情表,同时统计;
* @Author: hgw
* @Date: 2022/8/31 16:34
* @return: boolean
**/
@Override
public void saveBathDetail(List<TIncomeDetail> tIncomeDetailList) {
Map<String,Integer> map = new HashMap<>();
Map<String,String> idMap = new HashMap<>();
for (TIncomeDetail tIncomeDetail : tIncomeDetailList) {
// 获取对应信息的统计表,根据项目配置,判断是否可以加一条统计:
TIncome income = new TIncome();
income.setEmpIdcard(tIncomeDetail.getEmpIdcard());
income.setDeptId(tIncomeDetail.getDeptId());
List<TIncome> incomeList = baseMapper.getTIncomeList(income);
TIncomeDetail detail = new TIncomeDetail();
detail.setEmpIdcard(tIncomeDetail.getEmpIdcard());
detail.setDeptId(tIncomeDetail.getDeptId());
List<TIncomeDetail> detailList = tIncomeDetailService.getTIncomeDetailList(detail);
tIncomeDetail.setCreateTime(new Date());
tIncomeDetail.setDataCreateMonth(DateUtil.addMonth(0));
tIncomeDetailService.save(tIncomeDetail);
tPaymentInfoMapper.updateByIncome(tIncomeDetail.getSourceId());
// 不存在,直接新增
if (incomeList == null || incomeList.isEmpty()) {
BeanUtil.copyProperties(tIncomeDetail, income);
income.setSendStatus(CommonConstants.ZERO_STRING);
this.save(income);
String sendBack = this.getSendBack(income);
income.setSendTime(new Date());
if (Common.isNotNull(sendBack) && sendBack.length() == 32) {
income.setSendStatus(CommonConstants.ONE_STRING);
income.setSendMonth(DateUtil.addMonth(0));
income.setEkpId(sendBack);
} else {
if (map.get(sendBack) > 0) {
int i = map.get(sendBack) + 1;
map.put(sendBack,i);
idMap.put(sendBack,income.getId());
//单个异常超过十次,保存异常内容
if (i >= 10) {
for (String key: map.keySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.FIVE_STRING);
error.setLinkId(income.getId());
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.save(error);
}
break;
}
} else {
map.put(sendBack,1);
idMap.put(sendBack,income.getId());
}
}
this.updateById(income);
} else {
// 判断,比例,直接加
if (CommonConstants.ONE_STRING.equals(tIncomeDetail.getFeeMode())) {
BeanUtil.copyProperties(tIncomeDetail, income);
income.setSendStatus(CommonConstants.ZERO_STRING);
this.save(income);
String sendBack = this.getSendBack(income);
income.setSendTime(new Date());
if (Common.isNotNull(sendBack) && sendBack.length() == 32) {
income.setSendStatus(CommonConstants.ONE_STRING);
income.setSendMonth(DateUtil.addMonth(0));
income.setEkpId(sendBack);
} else {
if (map.get(sendBack) > 0) {
int i = map.get(sendBack) + 1;
map.put(sendBack,i);
idMap.put(sendBack,income.getId());
//单个异常超过十次,保存异常内容
if (i >= 10) {
for (String key: map.keySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.FIVE_STRING);
error.setLinkId(income.getId());
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.save(error);
}
break;
}
} else {
map.put(sendBack,1);
idMap.put(sendBack,income.getId());
}
}
this.updateById(income);
} else {
Map<String, Integer> numMap = new HashMap<>();
Map<String, Integer> incomeMap = new HashMap<>();
// 商险Map
Map<String, Integer> insureMap = new HashMap<>();
Integer nums;
Integer insureNums;
for (TIncomeDetail detail1 : detailList) {
nums = numMap.get(detail1.getPayMonth() + CommonConstants.DOWN_LINE_STRING + detail1.getSourceType()
+ CommonConstants.DOWN_LINE_STRING + detail1.getFeeType());
if (Common.isEmpty(nums)) {
nums = CommonConstants.ZERO_INT;
}
if (CommonConstants.ONE_STRING.equals(detail1.getRedData())) {
nums--;
} else {
nums++;
}
numMap.put(detail1.getPayMonth() + CommonConstants.DOWN_LINE_STRING + detail1.getSourceType()
+ CommonConstants.DOWN_LINE_STRING + detail1.getFeeType(), nums);
}
for (TIncome income1 : incomeList) {
nums = incomeMap.get(income1.getPayMonth() + CommonConstants.DOWN_LINE_STRING + income1.getFeeType());
if (Common.isEmpty(nums)) {
nums = CommonConstants.ZERO_INT;
}
if (CommonConstants.ONE_STRING.equals(income1.getRedData())) {
nums--;
} else {
nums++;
}
incomeMap.put(income1.getPayMonth() + CommonConstants.DOWN_LINE_STRING + income1.getFeeType(), nums);
insureNums = insureMap.get(income1.getDataCreateMonth() + CommonConstants.DOWN_LINE_STRING + income1.getFeeType());
if (Common.isEmpty(insureNums)) {
insureNums = CommonConstants.ZERO_INT;
}
if (CommonConstants.ONE_STRING.equals(income1.getRedData())) {
insureNums--;
} else {
insureNums++;
}
insureMap.put(income1.getDataCreateMonth() + CommonConstants.DOWN_LINE_STRING + income1.getFeeType(), insureNums);
}
// 金额人数、人次,需要判重
// 社保、公积金(收入来源:1社保2公积金3商险4薪资)
if (CommonConstants.ONE_STRING.equals(tIncomeDetail.getSourceType())
|| CommonConstants.TWO_STRING.equals(tIncomeDetail.getSourceType())) {
if (CommonConstants.ZERO_STRING.equals(tIncomeDetail.getRedData())) {
if (incomeMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType()) == null
|| incomeMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType()) <= CommonConstants.ZERO_INT) {
BeanUtil.copyProperties(tIncomeDetail, income);
income.setSendStatus(CommonConstants.ZERO_STRING);
this.save(income);
String sendBack = this.getSendBack(income);
income.setSendTime(new Date());
if (Common.isNotNull(sendBack) && sendBack.length() == 32) {
income.setSendStatus(CommonConstants.ONE_STRING);
income.setSendMonth(DateUtil.addMonth(0));
income.setEkpId(sendBack);
} else {
if (map.get(sendBack) > 0) {
int i = map.get(sendBack) + 1;
map.put(sendBack,i);
idMap.put(sendBack,income.getId());
//单个异常超过十次,保存异常内容
if (i >= 10) {
for (String key: map.keySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.FIVE_STRING);
error.setLinkId(income.getId());
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.save(error);
}
break;
}
} else {
map.put(sendBack,1);
idMap.put(sendBack,income.getId());
}
}
this.updateById(income);
}
} else {
// 红冲判断:当本类型是最大值,才可以红冲
if (this.redDateJudge(tIncomeDetail, numMap)) {
BeanUtil.copyProperties(tIncomeDetail, income);
income.setSendStatus(CommonConstants.ZERO_STRING);
this.save(income);
String sendBack = this.getSendBack(income);
income.setSendTime(new Date());
if (Common.isNotNull(sendBack) && sendBack.length() == 32) {
income.setSendStatus(CommonConstants.ONE_STRING);
income.setSendMonth(DateUtil.addMonth(0));
income.setEkpId(sendBack);
} else {
if (map.get(sendBack) > 0) {
int i = map.get(sendBack) + 1;
map.put(sendBack,i);
idMap.put(sendBack,income.getId());
//单个异常超过十次,保存异常内容
if (i >= 10) {
for (String key: map.keySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.FIVE_STRING);
error.setLinkId(income.getId());
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.save(error);
}
break;
}
} else {
map.put(sendBack,1);
idMap.put(sendBack,income.getId());
}
}
this.updateById(income);
}
}
} else if (CommonConstants.THREE_STRING.equals(tIncomeDetail.getSourceType())) {
// 商险。收费方式:2金额-人数
if (CommonConstants.TWO_STRING.equals(tIncomeDetail.getFeeMode())) {
if (CommonConstants.ZERO_STRING.equals(tIncomeDetail.getRedData())) {
if (insureMap.get(tIncomeDetail.getDataCreateMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType()) == null
|| insureMap.get(tIncomeDetail.getDataCreateMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType()) <= CommonConstants.ZERO_INT) {
BeanUtil.copyProperties(tIncomeDetail, income);
income.setSendStatus(CommonConstants.ZERO_STRING);
this.save(income);
String sendBack = this.getSendBack(income);
income.setSendTime(new Date());
if (Common.isNotNull(sendBack) && sendBack.length() == 32) {
income.setSendStatus(CommonConstants.ONE_STRING);
income.setSendMonth(DateUtil.addMonth(0));
income.setEkpId(sendBack);
} else {
if (map.get(sendBack) > 0) {
int i = map.get(sendBack) + 1;
map.put(sendBack,i);
idMap.put(sendBack,income.getId());
//单个异常超过十次,保存异常内容
if (i >= 10) {
for (String key: map.keySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.FIVE_STRING);
error.setLinkId(income.getId());
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.save(error);
}
break;
}
} else {
map.put(sendBack,1);
idMap.put(sendBack,income.getId());
}
}
this.updateById(income);
}
} else {
if (this.redDateJudge(tIncomeDetail, numMap)) {
BeanUtil.copyProperties(tIncomeDetail, income);
income.setSendStatus(CommonConstants.ZERO_STRING);
this.save(income);
String sendBack = this.getSendBack(income);
income.setSendTime(new Date());
if (Common.isNotNull(sendBack) && sendBack.length() == 32) {
income.setSendStatus(CommonConstants.ONE_STRING);
income.setSendMonth(DateUtil.addMonth(0));
income.setEkpId(sendBack);
} else {
if (map.get(sendBack) > 0) {
int i = map.get(sendBack) + 1;
map.put(sendBack,i);
idMap.put(sendBack,income.getId());
//单个异常超过十次,保存异常内容
if (i >= 10) {
for (String key: map.keySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.FIVE_STRING);
error.setLinkId(income.getId());
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.save(error);
}
break;
}
} else {
map.put(sendBack,1);
idMap.put(sendBack,income.getId());
}
}
this.updateById(income);
}
}
} else {
// 各个模式累加逻辑:
this.judgeMixModel(tIncomeDetail, numMap, incomeMap);
}
} else {
// 薪资。收费方式:2金额-人数
if (CommonConstants.TWO_STRING.equals(tIncomeDetail.getFeeMode())) {
if (incomeMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType()) == null
|| incomeMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType()) <= CommonConstants.ZERO_INT) {
BeanUtil.copyProperties(tIncomeDetail, income);
income.setSendStatus(CommonConstants.ZERO_STRING);
this.save(income);
String sendBack = this.getSendBack(income);
income.setSendTime(new Date());
if (Common.isNotNull(sendBack) && sendBack.length() == 32) {
income.setSendStatus(CommonConstants.ONE_STRING);
income.setSendMonth(DateUtil.addMonth(0));
income.setEkpId(sendBack);
} else {
if (map.get(sendBack) > 0) {
int i = map.get(sendBack) + 1;
map.put(sendBack,i);
idMap.put(sendBack,income.getId());
//单个异常超过十次,保存异常内容
if (i >= 10) {
for (String key: map.keySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.FIVE_STRING);
error.setLinkId(income.getId());
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.save(error);
}
break;
}
} else {
map.put(sendBack,1);
idMap.put(sendBack,income.getId());
}
}
this.updateById(income);
}
} else {
// 3金额-人次
// 各个模式累加逻辑:
this.judgeMixModel(tIncomeDetail, numMap, incomeMap);
}
}
}
}
}
for (String key: map.keySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.FIVE_STRING);
error.setLinkId(idMap.get(key));
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.save(error);
}
}
@Override
public void pushDetail() {
List<TIncome> list = baseMapper.selectList(Wrappers.<TIncome>query().lambda()
.eq(TIncome::getSendStatus, CommonConstants.ZERO_STRING));
String sendBack;
Map<String,Integer> map = new HashMap<>();
Map<String,String> idMap = new HashMap<>();
//收入更新
List<TIncome> updateList = new ArrayList<>();
for (TIncome income : list) {
......@@ -299,6 +672,7 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
if (map.get(sendBack) > 0) {
int i = map.get(sendBack) + 1;
map.put(sendBack,i);
idMap.put(sendBack,income.getId());
//单个异常超过十次,保存异常内容
if (i >= 10) {
baseMapper.updateIncomeById(updateList);
......@@ -310,31 +684,26 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
error.setLinkId(income.getId());
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.saveError(error);
tSendEkpErrorService.save(error);
}
break;
}
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.THREE_STRING);
error.setLinkId(income.getId());
error.setTitle(sendBack);
error.setNums(i);
tSendEkpErrorService.saveError(error);
} else {
map.put(sendBack,1);
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.THREE_STRING);
error.setLinkId(income.getId());
error.setTitle(sendBack);
error.setNums(1);
tSendEkpErrorService.saveError(error);
idMap.put(sendBack,income.getId());
}
}
}
for (String key: map.keySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.FIVE_STRING);
error.setLinkId(idMap.get(key));
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.save(error);
}
baseMapper.updateIncomeById(updateList);
}
......@@ -412,7 +781,7 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
if (CommonConstants.ONE_STRING.equals(income.getFeeMode())) {
sendParam.setFd_3adda3037e3bda("比例");
} else if (CommonConstants.TWO_STRING.equals(income.getFeeMode())) {
sendParam.setFd_3adda3037e3bda("人");
sendParam.setFd_3adda3037e3bda("人");
} else {
sendParam.setFd_3adda3037e3bda("人次");
}
......@@ -455,6 +824,8 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
sendParam.setFd_3aead3c68b1078("");
// 收款单号
sendParam.setFd_3aeae58b14691c("");
// 管理费id
sendParam.setFd_3b13dae9bd70f8(income.getId());
}
private void copyToEkpRisk(TIncome income, EkpIncomeParamRisk sendParam) {
......@@ -473,7 +844,7 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
if (CommonConstants.ONE_STRING.equals(income.getFeeMode())) {
sendParam.setFd_3adda3037e3bda("比例");
} else if (CommonConstants.TWO_STRING.equals(income.getFeeMode())) {
sendParam.setFd_3adda3037e3bda("人");
sendParam.setFd_3adda3037e3bda("人");
} else {
sendParam.setFd_3adda3037e3bda("人次");
}
......@@ -516,6 +887,8 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
sendParam.setFd_3aead7204bb594("");
// 收款单号
sendParam.setFd_3aeae59b70fe5a("");
// 风险金id
sendParam.setFd_3b13dac4c03022(income.getId());
}
/**
......@@ -687,5 +1060,4 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
return true;
}
}
......@@ -380,7 +380,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importTPaymentSocialInfo(cachedDataList, errorMessageList, random, user, rowNumber);
importTPaymentSocialInfo(cachedDataList, errorMessageList, user, rowNumber);
log.info("存储数据库成功!");
}
}).sheet().doRead();
......@@ -392,7 +392,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
private void importTPaymentSocialInfo(List<TPaymentInfoVo> list, List<ErrorMessage> errorMessageList,
String random, YifuUser user, Integer rowNumber) {
YifuUser user, Integer rowNumber) {
long start = System.currentTimeMillis();
HashMap<String, String> areaMap = new HashMap<>();
......@@ -404,7 +404,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
for (SysArea area : areaList.getSysAreaList()) {
areaMap.put(Integer.toString(area.getId()), area.getAreaName());
areaMap2.put(area.getAreaName() + CommonConstants.DOWN_LINE_STRING + (
null == area.getParentId() ? "null" : (0 == area.getParentId().intValue() ? "null" : Integer.toString(
null == area.getParentId() ? "null" : (0 == area.getParentId() ? "null" : Integer.toString(
area.getParentId()))), Integer.toString(area.getId()));
}
}
......@@ -523,10 +523,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
}
// -----------------------------生成paymentInfoMap本段结束--------------------------------
/**
* 修改批量导入社保为线程池的方式。逻辑分析,根据前端传入的list,将list分成每份partSize个。
* 有以下3种情况。1.list数量不足partSize,直接进行处理;2.list数量正好可以根据partSize等分,循环处理;3.不能等分有剩余的情况
*/
// -----------------------------线程池处理list,批量保存社保信息开始--------------------------------
List<TPaymentInfoVo> tempList = new ArrayList<>();
......@@ -544,15 +540,15 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
String sumNumKey = user.getId() + CommonConstants.DOWN_LINE_STRING + "sum_key";
Integer bfInt = (Integer) redisUtil.get(sumNumKey);
if (Common.isNotNull(bfInt)) {
if (bfInt <= rowNumber.intValue()) {
maerialRatio = numberFormat.format((float) bfInt.intValue() / (float) rowNumber.intValue() * 100);
if (rowNumber >= bfInt) {
maerialRatio = numberFormat.format(((float) bfInt / (float) rowNumber) * 100);
bfInt = bfInt + 100;
} else {
maerialRatio = "100";
}
}else {
if (100 <= rowNumber.intValue()) {
maerialRatio = numberFormat.format((float) 100 / (float) rowNumber.intValue() * 100);
if (rowNumber >= 100) {
maerialRatio = numberFormat.format(((float) 100 / (float) rowNumber) * 100);
bfInt = 100;
} else {
maerialRatio = "100";
......@@ -715,7 +711,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
if (Common.isNotNull(list)) {
TPaymentInfo paymentInfo = null;
TSocialFundInfo socialInfo = null;
String temp = null;
String temp;
int res = -1;
List<TSocialFundInfo> socialInfoList = socialFundInfoMapper.selectList(Wrappers.<TSocialFundInfo>query().lambda()
......@@ -756,25 +752,24 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
continue;
}
//无对应员工的社保数据
if (null != socialMap) {
//采用客服导入的地址
areaArray = infoVo.getSocialPayAddr().split(CommonConstants.CENTER_SPLIT_LINE_STRING);
infoVo = initAddress(areaArray, areaMap2, infoVo);
socialInfo = socialMap.get(infoVo.getEmpIdcard()
+ CommonConstants.DOWN_LINE_STRING + infoVo.getSocialProvince()
+ CommonConstants.DOWN_LINE_STRING + infoVo.getSocialCity()
+ CommonConstants.DOWN_LINE_STRING + (null == infoVo.getSocialTown()
? "null" : infoVo.getSocialTown()));
//对身份证与人员姓名的对应关系进行校验
if (socialInfo != null && !socialInfo.getEmpName().equals(infoVo.getEmpName())) {
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "姓名与身份证信息不一致,请核实后再次尝试!"));
continue;
}
if (socialInfo != null && socialInfo.getSocialStartDate() == null) {
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpIdcard() + "的社保起缴日期为空!"));
continue;
}
//采用客服导入的地址
areaArray = infoVo.getSocialPayAddr().split(CommonConstants.CENTER_SPLIT_LINE_STRING);
infoVo = initAddress(areaArray, areaMap2, infoVo);
socialInfo = socialMap.get(infoVo.getEmpIdcard()
+ CommonConstants.DOWN_LINE_STRING + infoVo.getSocialProvince()
+ CommonConstants.DOWN_LINE_STRING + infoVo.getSocialCity()
+ CommonConstants.DOWN_LINE_STRING + (null == infoVo.getSocialTown()
? "null" : infoVo.getSocialTown()));
//对身份证与人员姓名的对应关系进行校验
if (socialInfo != null && !socialInfo.getEmpName().equals(infoVo.getEmpName())) {
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "姓名与身份证信息不一致,请核实后再次尝试!"));
continue;
}
if (socialInfo != null && socialInfo.getSocialStartDate() == null) {
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpIdcard() + "的社保起缴日期为空!"));
continue;
}
if (null == socialInfo) {
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "无对应员工" +
infoVo.getEmpIdcard() + "的社保数据(请查验社保缴纳地)"));
......@@ -945,21 +940,19 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
.eq(TSocialInfo::getEmpIdcard, infoVo.getEmpIdcard()).groupBy(TSocialInfo::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL));
if (null == paymentInfo) {
paymentInfo = new TPaymentInfo();
paymentInfo.setLockStatus(CommonConstants.ZERO_STRING);
paymentInfo.setEmpId(socialInfo.getEmpId());
paymentInfo.setEmpIdcard(socialInfo.getEmpIdcard());
paymentInfo.setEmpName(socialInfo.getEmpName());
paymentInfo.setSettleDomainId(socialInfo.getSettleDomain());
paymentInfo.setSettleDomainName(socialInfo.getSettleDomainName());
paymentInfo.setSettleDomainCode(socialInfo.getSettleDomainCode());
paymentInfo.setUnitId(socialInfo.getUnitId());
paymentInfo.setUnitName(socialInfo.getUnitName());
if (Common.isNotNull(tSocialInfo)) {
paymentInfo.setInauguralTeam(tSocialInfo.getInauguralTeam());
paymentInfo.setEmpNo(tSocialInfo.getEmpNo());
}
paymentInfo = new TPaymentInfo();
paymentInfo.setLockStatus(CommonConstants.ZERO_STRING);
paymentInfo.setEmpId(socialInfo.getEmpId());
paymentInfo.setEmpIdcard(socialInfo.getEmpIdcard());
paymentInfo.setEmpName(socialInfo.getEmpName());
paymentInfo.setSettleDomainId(socialInfo.getSettleDomain());
paymentInfo.setSettleDomainName(socialInfo.getSettleDomainName());
paymentInfo.setSettleDomainCode(socialInfo.getSettleDomainCode());
paymentInfo.setUnitId(socialInfo.getUnitId());
paymentInfo.setUnitName(socialInfo.getUnitName());
if (Common.isNotNull(tSocialInfo)) {
paymentInfo.setInauguralTeam(tSocialInfo.getInauguralTeam());
paymentInfo.setEmpNo(tSocialInfo.getEmpNo());
}
paymentInfo.setSocialProvince(socialInfo.getSocialProvince());
paymentInfo.setSocialCity(socialInfo.getSocialCity());
......@@ -1033,20 +1026,18 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
paymentInfo.setSumAll(paymentInfo.getSocialSum());
paymentInfo.setCreateBy(user.getId());
paymentInfo.setCreateName(user.getNickname());
if (null != paymentInfo && Common.isEmpty(paymentInfo.getSocialId())) {
if (Common.isEmpty(paymentInfo.getSocialId())) {
paymentInfo.setSocialId(UUID.randomUUID().toString());
}
if (null != paymentInfo && Common.isNotNull(paymentInfo.getId())) {
if (Common.isNotNull(paymentInfo.getId())) {
res = baseMapper.updateById(paymentInfo);
if (res < 0) {
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpName() + "_缴费库更新失败!"));
continue;
}
} else {
res = insertAndSTimestamp(paymentInfo);
if (res < 0) {
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpName() + "_缴费库保存失败!"));
continue;
}
}
}
......@@ -1175,7 +1166,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importTPaymentSocialHeFei(cachedDataList, errorMessageList, random, user, type,rowNumber);
importTPaymentSocialHeFei(cachedDataList, errorMessageList, user, type,rowNumber);
log.info("存储数据库成功!");
}
}).sheet().doRead();
......@@ -1188,7 +1179,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
@Override
public R<List<ErrorMessage>> batchImportPaymentFundInfo(InputStream inputStream) {
YifuUser user = SecurityUtils.getUser();
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<TPaymentInfoVo> util1 = new ExcelUtil<>(TPaymentInfoVo.class);
// 写法2:
......@@ -1233,7 +1223,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
batchSavePaymentFundInfo(cachedDataList, errorMessageList, user);
batchSavePaymentFundInfo(cachedDataList, errorMessageList);
log.info("存储数据库成功!");
}
}).sheet().doRead();
......@@ -1244,7 +1234,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
return R.ok(errorMessageList);
}
private void batchSavePaymentFundInfo(List<TPaymentInfoVo> list, List<ErrorMessage> errorMessageList, YifuUser user) {
private void batchSavePaymentFundInfo(List<TPaymentInfoVo> list, List<ErrorMessage> errorMessageList) {
HashMap<String, String> areaMap = new HashMap<String, String>();
R<AreaVo> areaListR = upmsDaprUtils.getAreaListR();
......@@ -1259,8 +1249,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
try {
if (Common.isNotNull(list)) {
TPaymentInfo paymentInfo = null;
TSocialFundInfo fund = null;
String temp = null;
TSocialFundInfo fund;
String temp;
int res = -1;
//获取身份证列表
......@@ -1292,7 +1282,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
, info);
}
}
String[] areaArray = null;
String[] areaArray;
for (TPaymentInfoVo infoVo : list) {
if (Common.isNotNull(infoVo.getEmpIdcard())) {
......@@ -1382,22 +1372,20 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
TProvidentFund tProvidentFund = providentFundMapper.selectOne(Wrappers.<TProvidentFund>query().lambda()
.eq(TProvidentFund::getEmpIdcard, infoVo.getEmpIdcard()).groupBy(TProvidentFund::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL));
if (null == paymentInfo) {
paymentInfo = new TPaymentInfo();
paymentInfo.setLockStatus(CommonConstants.ZERO_STRING);
paymentInfo.setEmpId(fund.getEmpId());
paymentInfo.setEmpIdcard(fund.getEmpIdcard());
paymentInfo.setEmpName(fund.getEmpName());
paymentInfo.setSettleDomainId(fund.getSettleDomainFund());
paymentInfo.setSettleDomainName(fund.getSettleDomainNameFund());
paymentInfo.setSettleDomainCode(fund.getSettleDomainCodeFund());
paymentInfo.setUnitId(fund.getUnitIdFund());
paymentInfo.setUnitName(fund.getUnitNameFund());
if (Common.isNotNull(tProvidentFund)) {
paymentInfo.setInauguralTeam(tProvidentFund.getInauguralTeam());
paymentInfo.setEmpNo(tProvidentFund.getEmpNo());
}
paymentInfo = new TPaymentInfo();
paymentInfo.setLockStatus(CommonConstants.ZERO_STRING);
paymentInfo.setEmpId(fund.getEmpId());
paymentInfo.setEmpIdcard(fund.getEmpIdcard());
paymentInfo.setEmpName(fund.getEmpName());
paymentInfo.setSettleDomainId(fund.getSettleDomainFund());
paymentInfo.setSettleDomainName(fund.getSettleDomainNameFund());
paymentInfo.setSettleDomainCode(fund.getSettleDomainCodeFund());
paymentInfo.setUnitId(fund.getUnitIdFund());
paymentInfo.setUnitName(fund.getUnitNameFund());
if (Common.isNotNull(tProvidentFund)) {
paymentInfo.setInauguralTeam(tProvidentFund.getInauguralTeam());
paymentInfo.setEmpNo(tProvidentFund.getEmpNo());
}
paymentInfo.setProvidentPayMonth(infoVo.getProvidentPayMonth());
paymentInfo.setFundProvince(fund.getFundProvince());
......@@ -1434,10 +1422,10 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
paymentInfo.setUnitProvidentSum(null == infoVo.getUnitProvidentSum() ? BigDecimal.ZERO : infoVo.getUnitProvidentSum());
paymentInfo.setProvidentSum(null == infoVo.getProvidentSum() ? BigDecimal.ZERO : infoVo.getProvidentSum());
paymentInfo.setSumAll(paymentInfo.getProvidentSum());
if (null != paymentInfo && Common.isEmpty(paymentInfo.getFundId())) {
if (Common.isEmpty(paymentInfo.getFundId())) {
paymentInfo.setFundId(UUID.randomUUID().toString());
}
if (null != paymentInfo && Common.isNotNull(paymentInfo.getId())) {
if (Common.isNotNull(paymentInfo.getId())) {
res = baseMapper.updateById(paymentInfo);
if (res < 0) {
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpName() +
......@@ -1452,7 +1440,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
continue;
}
}
if (null != paymentInfo && Common.isNotNull(paymentInfo.getId()) && Common.isNotNull(paymentInfo.getFundId())) {
if (Common.isNotNull(paymentInfo.getId()) && Common.isNotNull(paymentInfo.getFundId())) {
paymentInfoMap.put(paymentInfo.getProvidentPayAddr()
+ CommonConstants.DOWN_LINE_STRING
+ paymentInfo.getEmpIdcard().trim()
......@@ -1474,10 +1462,10 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
private void importTPaymentSocialHeFei(List<TPaymentHeFeiVo> list, List<ErrorMessage> errorMessageList,
String random, YifuUser user, String type, Integer rowNumber) {
YifuUser user, String type, Integer rowNumber) {
HashMap<String, String> areaMap = new HashMap<String, String>();
HashMap<String, String> areaMap2 = new HashMap<String, String>();
HashMap<String, String> areaMap = new HashMap<>();
HashMap<String, String> areaMap2 = new HashMap<>();
R<AreaVo> areaListR = upmsDaprUtils.getAreaListR();
if (Common.isNotNull(areaListR)) {
AreaVo areaList = areaListR.getData();
......@@ -1485,7 +1473,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
for (SysArea area : areaList.getSysAreaList()) {
areaMap.put(Integer.toString(area.getId()), area.getAreaName());
areaMap2.put(area.getAreaName() + CommonConstants.DOWN_LINE_STRING + (null == area.getParentId() ?
"null" : (0 == area.getParentId().intValue() ? "null" : Integer.toString(
"null" : (0 == area.getParentId() ? "null" : Integer.toString(
area.getParentId()))), Integer.toString(area.getId()));
}
}
......@@ -1586,11 +1574,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
// -----------------------------生成paymentInfoMap本段结束--------------------------------
/**
* 修改批量导入社保为线程池的方式。逻辑分析,根据前端传入的list,将list分成每份partSize个。
* 有以下3种情况。1.list数量不足partSize,直接进行处理;2.list数量正好可以根据partSize等分,循环处理;3.不能等分有剩余的情况
*/
// -----------------------------线程池处理list,批量保存社保信息开始--------------------------------
List<TPaymentHeFeiVo> tempList = new ArrayList<>();
AtomicInteger atomicLine = new AtomicInteger(CommonConstants.ZERO_INT);
......@@ -1606,15 +1589,15 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
String sumNumKey = user.getId() + CommonConstants.DOWN_LINE_STRING + "sum_key";
Integer bfInt = (Integer) redisUtil.get(sumNumKey);
if (Common.isNotNull(bfInt)) {
if (bfInt <= rowNumber.intValue()) {
maerialRatio = numberFormat.format((float) bfInt.intValue() / (float) rowNumber.intValue() * 100);
if (bfInt <= rowNumber) {
maerialRatio = numberFormat.format((float) bfInt / (float) rowNumber * 100);
bfInt = bfInt + 100;
} else {
maerialRatio = "100";
}
}else {
if (100 <= rowNumber.intValue()) {
maerialRatio = numberFormat.format((float) 100 / (float) rowNumber.intValue() * 100);
if (100 <= rowNumber) {
maerialRatio = numberFormat.format((float) 100 / (float) rowNumber * 100);
bfInt = 100;
} else {
maerialRatio = "100";
......@@ -1627,7 +1610,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
// 1.list.size()不足partSize,直接执行
if (list.size() < partSize) {
CompletableFuture<List<ErrorMessage>> listCompletableFuture = CompletableFuture.supplyAsync(()
-> executeImportSocialListThree(user, atomicLine, random, list, areaMap, areaMap2,
-> executeImportSocialListThree(user, atomicLine, list, areaMap, areaMap2,
paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap,
paymentInfoBigMap,CommonConstants.ONE_INT, type, errorMessageList),
yfSocialImportThreadPoolExecutor);
......@@ -1640,7 +1623,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
// 处理第一个0位元素
final List<TPaymentHeFeiVo> finalList = list.subList(0, 1);
CompletableFuture<List<ErrorMessage>> oneCompletableFuture = CompletableFuture.supplyAsync(()
-> executeImportSocialListThree(user, atomicLine, random, finalList, areaMap,
-> executeImportSocialListThree(user, atomicLine, finalList, areaMap,
areaMap2, paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap,
paymentInfoInjuryMap, paymentInfoBigMap,CommonConstants.ONE_INT, type,
errorMessageList), yfSocialImportThreadPoolExecutor);
......@@ -1654,7 +1637,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
final int idx = i - partSize + 2;
List<TPaymentHeFeiVo> finalTempList1 = tempList;
CompletableFuture<List<ErrorMessage>> listCompletableFuture = CompletableFuture.supplyAsync(()
-> executeImportSocialListThree(user, atomicLine, random, finalTempList1
-> executeImportSocialListThree(user, atomicLine, finalTempList1
, areaMap, areaMap2, paymentInfoPensionMap, paymentInfoMedicalMap,
paymentInfoUnEmpMap, paymentInfoInjuryMap, paymentInfoBigMap,idx, type,
errorMessageList), yfSocialImportThreadPoolExecutor);
......@@ -1681,7 +1664,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
List<TPaymentHeFeiVo> finalTempList = tempList;
int finalLastIdx = lastIdx + 1;
CompletableFuture<List<ErrorMessage>> listCompletableFuture = CompletableFuture.supplyAsync(()
-> executeImportSocialListThree(user, atomicLine, random, finalTempList, areaMap,
-> executeImportSocialListThree(user, atomicLine, finalTempList, areaMap,
areaMap2, paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap,
paymentInfoInjuryMap, paymentInfoBigMap,finalLastIdx, type, errorMessageList)
, yfSocialImportThreadPoolExecutor);
......@@ -1713,7 +1696,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
private List<ErrorMessage> executeImportSocialListThree(YifuUser user, AtomicInteger atomicLine,
String random,
List<TPaymentHeFeiVo> list,
HashMap<String, String> areaMap,
HashMap<String, String> areaMap2,
......@@ -1729,7 +1711,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
TSocialFundInfo socialInfo = null;
String temp;
int res = -1;
List<String> idcards = Common.listObjectToStrList(list, ExcelAttributeConstants.EMPIDCARD);
List<TSocialFundInfo> socialInfoList = socialFundInfoMapper.selectList(Wrappers.<TSocialFundInfo>query().lambda()
.in(TSocialFundInfo::getEmpIdcard, Common.listObjectToStrList(list, ExcelAttributeConstants.EMPIDCARD)));
......@@ -1756,7 +1737,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
infoVo.setEmpIdcard(infoVo.getEmpIdcard().replace("x", "X"));
}
//导入校验
if (socialThreeCheckBase(random, i, errorMessageList, infoVo, type)) {
if (socialThreeCheckBase(errorMessageList, infoVo, type)) {
continue;
}
//无对应员工的社保数据
......@@ -2013,20 +1994,18 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
payExists.setSumAll(payExists.getSocialSum());
payExists.setCreateBy(user.getId());
payExists.setCreateName(user.getNickname());
if (null != payExists && Common.isEmpty(payExists.getSocialId())) {
if (Common.isEmpty(payExists.getSocialId())) {
payExists.setSocialId(UUID.randomUUID().toString());
}
if (null != payExists && Common.isNotNull(payExists.getId())) {
if (Common.isNotNull(payExists.getId())) {
res = baseMapper.updateById(payExists);
if (res < 0) {
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpIdcard() + "_缴费库更新失败!"));
continue;
}
} else {
res = insertAndSTimestamp(payExists);
if (res < 0) {
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpIdcard() + "_缴费库保存失败!"));
continue;
}
}
}
......@@ -2037,7 +2016,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
/**
* 导入校验
**/
private boolean socialThreeCheckBase(String random, int i, List<ErrorMessage> errorMessageList, TPaymentHeFeiVo
private boolean socialThreeCheckBase(List<ErrorMessage> errorMessageList, TPaymentHeFeiVo
infoVo, String type) {
if (!Common.isNotNull(infoVo.getSocialPayMonth())) {
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "社保缴纳月份不可为空!"));
......@@ -2063,12 +2042,11 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
/**
* 转换缴纳地址为省市县ID
**/
private TPaymentHeFeiVo initAddressThree(String[]
areaArray, HashMap<String, String> areaMap2, TPaymentHeFeiVo s) {
private TPaymentHeFeiVo initAddressThree(String[] areaArray, HashMap<String, String> areaMap2, TPaymentHeFeiVo s) {
if (null == areaArray || null == areaMap2 || null == s) {
return s;
}
String temp = null;
String temp;
if (areaArray.length >= CommonConstants.TWO_INT) {
temp = areaMap2.get(areaArray[0] + CommonConstants.DOWN_LINE_STRING + "null");
if (Common.isNotNull(temp)) {
......@@ -2226,7 +2204,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
@Override
public void createPaymentSocialInfo() {
//获取所有未推送的社保预估明细数据
//获取所有未推送的社保实缴明细数据
List<TPaymentInfo> unPushInfo = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
.eq(TPaymentInfo::getPushStatus, CommonConstants.ONE_STRING)
.isNotNull(TPaymentInfo::getSocialId));
......@@ -2238,7 +2216,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
@Override
public void createPaymentFundInfo() {
//获取所有未推送的社保预估明细数据
//获取所有未推送的公积金实缴明细数据
List<TPaymentInfo> unPushInfo = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
.eq(TPaymentInfo::getPushStatus, CommonConstants.ONE_STRING)
.isNotNull(TPaymentInfo::getFundId));
......@@ -2248,31 +2226,27 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
}
@Override
public void pushPaymentSocialFundInfo() {
YifuUser user = SecurityUtils.getUser();
//手动推送未推送的社保公积金明细数据
createPaymentSocialInfoReal(user);
createPaymentFundInfoReal(user);
//推送社保公积金收入数据
createPaymentInfoIncomeReal(user);
createPaymentFundIncomeReal(user);
}
@Override
public void createPaymentInfoIncome() {
BigDecimal sumSocial = BigDecimal.ZERO;
//判断缴费库中社保合计和本次导入合计相加是否为0,为0则不生成收入
List<TPaymentInfo> sumList = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
.between(TPaymentInfo::getCreateTime,LocalDateTimeUtils.getThatDayStartTime(LocalDateTime.now().plusDays(-1)),
LocalDateTimeUtils.getDayStart(LocalDateTime.now()))
.isNotNull(TPaymentInfo::getSocialId));
if (Common.isNotNull(sumList)) {
for (TPaymentInfo paymentInfo: sumList) {
//获取员工当前缴纳月总合计
List<TPaymentInfo> payInfoList = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
.eq(TPaymentInfo::getEmpIdcard, paymentInfo.getEmpIdcard())
.eq(TPaymentInfo::getSocialPayMonth, paymentInfo.getSocialPayMonth())
.eq(TPaymentInfo::getSettleDomainId, paymentInfo.getSettleDomainId()));
if (Common.isNotNull(payInfoList)) {
for (TPaymentInfo payInfo:payInfoList)
sumSocial = BigDecimalUtils.safeAdd(sumSocial,payInfo.getSocialSum());
}
if (sumSocial.compareTo(BigDecimal.ZERO) == CommonConstants.ZERO_INT) {
continue;
}
//生成收入
createIncomeInfo(paymentInfo,CommonConstants.ONE_STRING);
}
//生成收入
createIncomeInfo(sumList,CommonConstants.ONE_STRING);
}
}
......@@ -2283,10 +2257,55 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
LocalDateTimeUtils.getDayStart(LocalDateTime.now()))
.isNotNull(TPaymentInfo::getFundId));
if (Common.isNotNull(sumList)) {
for (TPaymentInfo paymentInfo: sumList) {
//生成公积金收入
createIncomeInfo(paymentInfo,CommonConstants.TWO_STRING);
}
//生成公积金收入
createIncomeInfo(sumList,CommonConstants.TWO_STRING);
}
}
public void createPaymentSocialInfoReal(YifuUser user) {
//获取所有未推送的社保实缴明细数据
List<TPaymentInfo> unPushInfo = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
.eq(TPaymentInfo::getCreateBy, user.getId())
.eq(TPaymentInfo::getPushStatus, CommonConstants.ONE_STRING)
.isNotNull(TPaymentInfo::getSocialId));
if (Common.isNotNull(unPushInfo)) {
//推送数据封装并推送
initEkpPushSocialParam(unPushInfo);
}
}
public void createPaymentFundInfoReal(YifuUser user) {
//获取所有未推送的公积金实缴明细数据
List<TPaymentInfo> unPushInfo = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
.eq(TPaymentInfo::getCreateBy, user.getId())
.eq(TPaymentInfo::getPushStatus, CommonConstants.ONE_STRING)
.isNotNull(TPaymentInfo::getFundId));
if (Common.isNotNull(unPushInfo)) {
//推送数据封装并推送
initEkpPushFundParam(unPushInfo);
}
}
public void createPaymentInfoIncomeReal(YifuUser user) {
//判断缴费库中社保合计和本次导入合计相加是否为0,为0则不生成收入
List<TPaymentInfo> sumList = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
.eq(TPaymentInfo::getCreateBy, user.getId())
.eq(TPaymentInfo::getIncomeStatus, CommonConstants.ONE_STRING)
.isNotNull(TPaymentInfo::getSocialId));
if (Common.isNotNull(sumList)) {
//生成收入
createIncomeInfo(sumList,CommonConstants.ONE_STRING);
}
}
public void createPaymentFundIncomeReal(YifuUser user) {
List<TPaymentInfo> sumList = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
.eq(TPaymentInfo::getCreateBy, user.getId())
.eq(TPaymentInfo::getIncomeStatus, CommonConstants.ONE_STRING)
.isNotNull(TPaymentInfo::getFundId));
if (Common.isNotNull(sumList)) {
//生成公积金收入
createIncomeInfo(sumList,CommonConstants.TWO_STRING);
}
}
......@@ -2304,12 +2323,13 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
public void initEkpPushSocialParam(List<TPaymentInfo> unPushInfo) {
List<String> pushList = new ArrayList<>();
Map<String,Integer> map = new HashMap<>();
Map<String,String> idMap = new HashMap<>();
for (TPaymentInfo library:unPushInfo) {
//获取项目信息
TSettleDomain settleDomain = new TSettleDomain();
List<TSettleDomainSelectVo> settleDomainR = null;
R<TSettleDomainListVo> listVo = null;
List<TSettleDomainSelectVo> settleDomainR;
R<TSettleDomainListVo> listVo;
listVo = archivesDaprUtil.selectSettleDomainSelectVoById(library.getSettleDomainId());
if (Common.isNotNull(listVo)) {
TSettleDomainListVo tSettleDomainListVo = listVo.getData();
......@@ -2542,43 +2562,39 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}else {
if (map.get(body) > 0) {
int i = map.get(body) + 1;
idMap.put(body,library.getId());
map.put(body,i);
//单个异常超过十次,保存异常内容
if (i >= 10) {
baseMapper.updatePushStatus(pushList);
for (String key: map.keySet()) {
for (Map.Entry<String,Integer> entry : map.entrySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.THREE_STRING);
error.setLinkId(library.getId());
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.saveError(error);
error.setTitle(entry.getKey());
error.setNums(entry.getValue());
tSendEkpErrorService.save(error);
}
break;
}
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.THREE_STRING);
error.setLinkId(library.getId());
error.setTitle(body);
error.setNums(i);
tSendEkpErrorService.saveError(error);
} else {
map.put(body,1);
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.THREE_STRING);
error.setLinkId(library.getId());
error.setTitle(body);
error.setNums(1);
tSendEkpErrorService.saveError(error);
idMap.put(body,library.getId());
}
}
}
for (String key: map.keySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.THREE_STRING);
error.setLinkId(idMap.get(key));
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.save(error);
}
//更新推送状态
if (Common.isNotNull(pushList)) {
baseMapper.updatePushStatus(pushList);
......@@ -2588,11 +2604,12 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
public void initEkpPushFundParam(List<TPaymentInfo> unPushInfo) {
List<String> pushList = new ArrayList<>();
Map<String,Integer> map = new HashMap<>();
Map<String,String> idMap = new HashMap<>();
for (TPaymentInfo library:unPushInfo) {
//获取项目信息
TSettleDomain settleDomain = new TSettleDomain();
List<TSettleDomainSelectVo> settleDomainR = null;
R<TSettleDomainListVo> listVo = null;
List<TSettleDomainSelectVo> settleDomainR;
R<TSettleDomainListVo> listVo;
listVo = archivesDaprUtil.selectSettleDomainSelectVoById(library.getSettleDomainId());
if (Common.isNotNull(listVo)) {
TSettleDomainListVo tSettleDomainListVo = listVo.getData();
......@@ -2718,170 +2735,181 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
if (map.get(body) > 0) {
int i = map.get(body) + 1;
map.put(body,i);
idMap.put(body,library.getId());
//单个异常超过十次,保存异常内容
if (i >= 10) {
baseMapper.updatePushStatus(pushList);
for (String key: map.keySet()) {
for (Map.Entry<String,Integer> entry : map.entrySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.THREE_STRING);
error.setLinkId(library.getId());
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.saveError(error);
error.setTitle(entry.getKey());
error.setNums(entry.getValue());
tSendEkpErrorService.save(error);
}
break;
}
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.THREE_STRING);
error.setLinkId(library.getId());
error.setTitle(body);
error.setNums(i);
tSendEkpErrorService.saveError(error);
} else {
map.put(body,1);
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.THREE_STRING);
error.setLinkId(library.getId());
error.setTitle(body);
error.setNums(1);
tSendEkpErrorService.saveError(error);
idMap.put(body,library.getId());
}
}
}
for (String key: map.keySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.THREE_STRING);
error.setLinkId(idMap.get(key));
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.save(error);
}
//更新推送状态
if (Common.isNotNull(pushList)) {
baseMapper.updatePushStatus(pushList);
}
}
public void createIncomeInfo(TPaymentInfo paymentInfo,String socialFundFlag) {
//获取项目信息
TSettleDomain settleDomain = new TSettleDomain();
List<TSettleDomainSelectVo> settleDomainR = null;
R<TSettleDomainListVo> listVo = null;
listVo = archivesDaprUtil.selectSettleDomainSelectVoById(paymentInfo.getSettleDomainId());
if (Common.isNotNull(listVo)) {
TSettleDomainListVo tSettleDomainListVo = listVo.getData();
if (Common.isNotNull(tSettleDomainListVo) && Common.isNotEmpty(tSettleDomainListVo.getListSelectVO())) {
settleDomainR = tSettleDomainListVo.getListSelectVO();
for (TSettleDomainSelectVo vo :settleDomainR) {
BeanUtils.copyProperties(vo,settleDomain);
}
}
}
Boolean exitFlag = false;
List<TIncomeDetail> exitIncome = new ArrayList<>();
if (CommonConstants.ONE_STRING.equals(socialFundFlag)) {
exitIncome = detailMapper.selectList(Wrappers.<TIncomeDetail>query().lambda()
.eq(TIncomeDetail::getEmpIdcard, paymentInfo.getEmpIdcard())
.eq(TIncomeDetail::getPayMonth, paymentInfo.getSocialPayMonth())
.eq(TIncomeDetail::getDeptId, paymentInfo.getSettleDomainId())
.eq(TIncomeDetail::getSourceType, CommonConstants.ONE_STRING));
} else {
exitIncome = detailMapper.selectList(Wrappers.<TIncomeDetail>query().lambda()
.eq(TIncomeDetail::getEmpIdcard, paymentInfo.getEmpIdcard())
.eq(TIncomeDetail::getPayMonth, paymentInfo.getProvidentPayMonth())
.eq(TIncomeDetail::getDeptId, paymentInfo.getSettleDomainId())
.eq(TIncomeDetail::getSourceType, CommonConstants.TWO_STRING));
}
if (Common.isNotNull(exitIncome)) {
BigDecimal sumMoney = BigDecimal.ZERO;
for (TIncomeDetail income : exitIncome) {
sumMoney = BigDecimalUtils.safeAdd(income.getMoney(),sumMoney);
}
if (sumMoney.compareTo(BigDecimal.ZERO) == CommonConstants.ONE_INT) {
exitFlag = true;
}
}
if (Common.isNotNull(settleDomain)) {
// 含有社保,则计算收入
if (Common.isNotNull(settleDomain.getManageServerItem()) && ((settleDomain.getManageServerItem().contains(CommonConstants.ONE_STRING)
&& CommonConstants.ONE_STRING.equals(socialFundFlag)) || (settleDomain.getManageServerItem().contains(CommonConstants.TWO_STRING)
&& CommonConstants.TWO_STRING.equals(socialFundFlag)))) {
//预估模式
if (CommonConstants.ZERO_STRING.equals(settleDomain.getManagementTag())) {
if (CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType())) {
//预估模式只有按人次和人数收费
if (!exitFlag) {
createIncomeInsurance(paymentInfo, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(),
settleDomain.getManagementFee(), socialFundFlag);
}
} else {
BigDecimal gMoney = BigDecimal.ZERO;
if (CommonConstants.TWO_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
public void createIncomeInfo(List<TPaymentInfo> updateList,String socialFundFlag) {
List<TIncomeDetail> detailList = new ArrayList<>();
for (TPaymentInfo paymentInfo : updateList) {
boolean exitFlag = false;
List<TIncomeDetail> exitIncome;
if (CommonConstants.ONE_STRING.equals(socialFundFlag)) {
exitIncome = detailMapper.selectList(Wrappers.<TIncomeDetail>query().lambda()
.eq(TIncomeDetail::getEmpIdcard, paymentInfo.getEmpIdcard())
.eq(TIncomeDetail::getPayMonth, paymentInfo.getSocialPayMonth())
.eq(TIncomeDetail::getDeptId, paymentInfo.getSettleDomainId())
.eq(TIncomeDetail::getSourceType, CommonConstants.ONE_STRING));
} else {
exitIncome = detailMapper.selectList(Wrappers.<TIncomeDetail>query().lambda()
.eq(TIncomeDetail::getEmpIdcard, paymentInfo.getEmpIdcard())
.eq(TIncomeDetail::getPayMonth, paymentInfo.getProvidentPayMonth())
.eq(TIncomeDetail::getDeptId, paymentInfo.getSettleDomainId())
.eq(TIncomeDetail::getSourceType, CommonConstants.TWO_STRING));
}
if (Common.isNotNull(exitIncome)) {
BigDecimal sumMoney = BigDecimal.ZERO;
for (TIncomeDetail income : exitIncome) {
sumMoney = BigDecimalUtils.safeAdd(income.getMoney(), sumMoney);
if (paymentInfo.getId().equals(income.getSourceId())) {
exitFlag = true;
}
}
if (exitFlag) {
continue;
}
if (sumMoney.compareTo(BigDecimal.ZERO) > 0) {
exitFlag = true;
}
}
//获取项目信息
TSettleDomain settleDomain = new TSettleDomain();
List<TSettleDomainSelectVo> settleDomainR;
R<TSettleDomainListVo> listVo;
listVo = archivesDaprUtil.selectSettleDomainSelectVoById(paymentInfo.getSettleDomainId());
if (Common.isNotNull(listVo)) {
TSettleDomainListVo tSettleDomainListVo = listVo.getData();
if (Common.isNotNull(tSettleDomainListVo) && Common.isNotEmpty(tSettleDomainListVo.getListSelectVO())) {
settleDomainR = tSettleDomainListVo.getListSelectVO();
for (TSettleDomainSelectVo vo : settleDomainR) {
BeanUtils.copyProperties(vo, settleDomain);
}
}
}
int isSum = 0;
if (Common.isNotNull(settleDomain)) {
// 含有社保,则计算收入
if (Common.isNotNull(settleDomain.getManageServerItem()) && ((settleDomain.getManageServerItem().contains(CommonConstants.ONE_STRING)
&& CommonConstants.ONE_STRING.equals(socialFundFlag)) || (settleDomain.getManageServerItem().contains(CommonConstants.TWO_STRING)
&& CommonConstants.TWO_STRING.equals(socialFundFlag)))) {
//预估模式
if (CommonConstants.ZERO_STRING.equals(settleDomain.getManagementTag())) {
if (CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType())) {
//预估模式只有按人次和人数收费
if (!exitFlag) {
createIncomeInsurance(paymentInfo, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(),
settleDomain.getManagementFee(), socialFundFlag, detailList);
}
} else {
if (CommonConstants.ONE_STRING.equals(socialFundFlag)) {
gMoney = BigDecimalUtils.safeMultiply(paymentInfo.getSocialSum(),
settleDomain.getManagementFee().divide(new BigDecimal("100"),
CommonConstants.THREE_INT, BigDecimal.ROUND_HALF_UP));
BigDecimal gMoney;
if (CommonConstants.TWO_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
} else {
gMoney = BigDecimalUtils.safeMultiply(paymentInfo.getProvidentSum(),
settleDomain.getManagementFee().divide(new BigDecimal("100"),
CommonConstants.THREE_INT, BigDecimal.ROUND_HALF_UP));
isSum = 1;
if (CommonConstants.ONE_STRING.equals(socialFundFlag)) {
gMoney = BigDecimalUtils.safeMultiply(paymentInfo.getSocialSum(),
settleDomain.getManagementFee().divide(new BigDecimal("100"),
CommonConstants.FIVE_INT, BigDecimal.ROUND_HALF_UP));
} else {
gMoney = BigDecimalUtils.safeMultiply(paymentInfo.getProvidentSum(),
settleDomain.getManagementFee().divide(new BigDecimal("100"),
CommonConstants.FIVE_INT, BigDecimal.ROUND_HALF_UP));
}
}
if (!exitFlag || isSum == 1) {
createIncomeInsurance(paymentInfo, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(),
gMoney, socialFundFlag, detailList);
}
}
if (!exitFlag) {
createIncomeInsurance(paymentInfo, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(),
gMoney, socialFundFlag);
}
}
}
}
if (Common.isNotNull(settleDomain.getRiskServerItem()) && ((settleDomain.getRiskServerItem().contains(CommonConstants.ONE_STRING)
&& CommonConstants.ONE_STRING.equals(socialFundFlag)) || (settleDomain.getRiskServerItem().contains(CommonConstants.TWO_STRING)
&& CommonConstants.TWO_STRING.equals(socialFundFlag)))) {
//预估模式
if (CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType()) &&
CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
if (!exitFlag) {
createIncomeInsurance(paymentInfo, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(),
settleDomain.getRiskFundFee(), socialFundFlag);
}
} else {
if (Common.isNotNull(settleDomain.getRiskServerItem()) && ((settleDomain.getRiskServerItem().contains(CommonConstants.ONE_STRING)
&& CommonConstants.ONE_STRING.equals(socialFundFlag)) || (settleDomain.getRiskServerItem().contains(CommonConstants.TWO_STRING)
&& CommonConstants.TWO_STRING.equals(socialFundFlag)))) {
//预估模式
if (CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
BigDecimal money = BigDecimal.ZERO;
if (CommonConstants.TWO_STRING.equals(settleDomain.getRiskFundType())) {
money = settleDomain.getRiskFundFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
money = settleDomain.getRiskFundFee();
if (CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType())) {
if (!exitFlag) {
createIncomeInsurance(paymentInfo, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(),
settleDomain.getRiskFundFee(), socialFundFlag, detailList);
}
} else {
if (CommonConstants.ONE_STRING.equals(socialFundFlag)) {
money = BigDecimalUtils.safeMultiply(paymentInfo.getSocialSum(),
settleDomain.getRiskFundFee().divide(new BigDecimal("100"),
CommonConstants.THREE_INT, BigDecimal.ROUND_HALF_UP));
} else {
money = BigDecimalUtils.safeMultiply(paymentInfo.getProvidentSum(),
settleDomain.getRiskFundFee().divide(new BigDecimal("100"),
CommonConstants.THREE_INT, BigDecimal.ROUND_HALF_UP));
if (CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
BigDecimal money;
if (CommonConstants.TWO_STRING.equals(settleDomain.getRiskFundType())) {
money = settleDomain.getRiskFundFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getRiskFundType())) {
money = settleDomain.getRiskFundFee();
} else {
isSum = 2;
if (CommonConstants.ONE_STRING.equals(socialFundFlag)) {
money = BigDecimalUtils.safeMultiply(paymentInfo.getSocialSum(),
settleDomain.getRiskFundFee().divide(new BigDecimal("100"),
CommonConstants.FIVE_INT, BigDecimal.ROUND_HALF_UP));
} else {
money = BigDecimalUtils.safeMultiply(paymentInfo.getProvidentSum(),
settleDomain.getRiskFundFee().divide(new BigDecimal("100"),
CommonConstants.FIVE_INT, BigDecimal.ROUND_HALF_UP));
}
}
if (!exitFlag || isSum == 2) {
createIncomeInsurance(paymentInfo, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(),
money, socialFundFlag, detailList);
}
}
}
if (!exitFlag) {
createIncomeInsurance(paymentInfo, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(),
money, socialFundFlag);
}
}
}
}
}
incomeService.saveBathDetail(detailList);
}
public void createIncomeInsurance(TPaymentInfo library, TSettleDomain settleDomain, String feeType,
String charges, String feeMode, BigDecimal money,String sourceType) {
String charges, String feeMode, BigDecimal money,String sourceType,
List<TIncomeDetail> detailList) {
//生成收入数据
TIncomeDetail detail = new TIncomeDetail();
detail.setCreateTime(DateUtil.getCurrentDateTime());
......@@ -2910,13 +2938,12 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
detail.setMrSettleType(settleDomain.getMrSettleType());
detail.setId(CommonConstants.NULL);
detail.setRedData(CommonConstants.ZERO_STRING);
incomeService.saveDetail(detail);
detailList.add(detail);
}
public String dateStringInsert(String month) {
StringBuilder sb = new StringBuilder(month);
sb.insert(4, "-");
String replaceMonth = sb.toString();
return replaceMonth;
return sb.toString();
}
}
......@@ -63,7 +63,6 @@
<result property="createMonth" column="CREATE_MONTH"/>
<result property="payMonth" column="PAY_MONTH"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="dataCreateMonth" column="DATA_CREATE_MONTH"/>
<result property="sendStatus" column="SEND_STATUS"/>
</resultMap>
<sql id="Base_Column_List">
......
......@@ -104,6 +104,7 @@
<result property="updateBy" column="UPDATE_BY"/>
<result property="createName" column="CREATE_NAME"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="incomeStatus" column="INCOME_STATUS"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
......@@ -1098,6 +1099,14 @@
and PUSH_STATUS = '1' and EMP_IDCARD = #{infoVo.empIdcard}
</update>
<!-- 更改薪资公积金结算状态 -->
<update id="updateByIncome">
update t_payment_info
set INCOME_STATUS = '0'
where
ID = #{id}
</update>
<!-- 更改社保推送结算状态 -->
<update id="updatePushStatus">
update t_payment_info
......
......@@ -532,6 +532,10 @@
<if test="tSocialFundInfo.id != null and tSocialFundInfo.id.trim() != ''">
AND a.ID = #{tSocialFundInfo.id}
</if>
<if test="tSocialFundInfo.settleDomainCode != null and tSocialFundInfo.settleDomainCode.trim() != ''">
AND a.SETTLE_DOMAIN_CODE = #{tSocialFundInfo.settleDomainCode}
</if>
<if test="tSocialFundInfo.empId != null and tSocialFundInfo.empId.trim() != ''">
AND a.EMP_ID = #{tSocialFundInfo.empId}
</if>
......
......@@ -30,7 +30,6 @@ import com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserExcelVO;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserInfoVO;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserVO;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysUserService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils;
......@@ -295,4 +294,24 @@ public class UserController {
}
return naVo;
}
/**
* @Author hgw
* @Description 获取部门下的用户id
* @Date 2022-9-14 11:29:59
**/
@Inner
@PostMapping(value = {"/inner/getUserIdByDeptIds"})
public String getUserIdByDeptIds(@RequestBody String deptIds) {
StringBuilder userIds = new StringBuilder("0");
if (Common.isNotNull(deptIds)) {
List<SysUser> sysUsers = userService.list(Wrappers.<SysUser>query().lambda().in(SysUser::getDeptId, deptIds));
if (Common.isNotEmpty(sysUsers)){
for (SysUser u:sysUsers){
userIds.append(",'").append(u.getUserId()).append("'");
}
}
}
return userIds.toString();
}
}
......@@ -108,13 +108,13 @@ public class SysDataAuthServiceImpl extends ServiceImpl<SysDataAuthMapper, SysDa
// 处理权限部门
if (sysDataAuth.getIsDeptAuth() == 1 || sysDataAuth.getIsDeptAuth() == 2) {
if (sysDataAuth.getIsDeptAuth() == 2) {
sql.append(" or dept.dept_id in ('0' ");
sql.append(" or a.create_user in (start'0' ");
for (SysDataAuthDeptRel dept : authDeptList) {
sql.append(", '").append(dept.getDeptId()).append("'");
}
sql.append(")");
sql.append("end)");
} else {
sql.append(" or dept.dept_id = #deptId ");
sql.append(" or a.create_user in (#deptId) ");
}
for (SysDataAuthMenuRel menu : menuDeptList) {
authSqlMap.put(linkId + CommonConstants.DOWN_LINE_STRING + menu.getMenuId(), sql.toString());
......@@ -137,7 +137,7 @@ public class SysDataAuthServiceImpl extends ServiceImpl<SysDataAuthMapper, SysDa
// 处理项目
if (menuSettleList != null && !menuSettleList.isEmpty()) {
nowSql = " or a.settle_domain_id in ('0'#settleDomainId) ";
nowSql = " or a.dept_id in ('0'#settleDomainId) ";
sysDataAuth.setIsSettleAuth(1);
for (SysDataAuthMenuRel menu : menuSettleList) {
mapSql = authSqlMap.get(linkId + CommonConstants.DOWN_LINE_STRING + menu.getMenuId());
......@@ -314,15 +314,15 @@ public class SysDataAuthServiceImpl extends ServiceImpl<SysDataAuthMapper, SysDa
if (menuDeptList == null || menuDeptList.isEmpty()) {
return R.failed("请选择部门关联的菜单!");
} else if (sysDataAuth.getIsDeptAuth() == 2) {
sql.append(" or dept.dept_id in ('0' ");
sql.append(" or a.create_user in (start'0' ");
for (SysDataAuthDeptRel dept : authDeptList) {
sql.append(", '").append(dept.getDeptId()).append("'");
dept.setSysDataAuthId(mainId);
}
sql.append(")");
sql.append("end)");
authDeptRelService.saveOrUpdateBatch(authDeptList);
} else {
sql.append(" or dept.dept_id = #deptId ");
sql.append(" or a.create_user in (#deptId) ");
}
for (SysDataAuthMenuRel menu : menuDeptList) {
authSqlMap.put(linkId + CommonConstants.DOWN_LINE_STRING + menu.getMenuId(), sql.toString());
......@@ -352,7 +352,7 @@ public class SysDataAuthServiceImpl extends ServiceImpl<SysDataAuthMapper, SysDa
// 处理项目
if (menuSettleList != null && !menuSettleList.isEmpty()) {
nowSql = " or a.settle_domain_id in ('0'#settleDomainId) ";
nowSql = " or a.dept_id in ('0'#settleDomainId) ";
sysDataAuth.setIsSettleAuth(1);
for (SysDataAuthMenuRel menu : menuSettleList) {
mapSql = authSqlMap.get(linkId + CommonConstants.DOWN_LINE_STRING + menu.getMenuId());
......
......@@ -38,10 +38,6 @@ security:
- /v3/api-docs
- /actuator/**
- /swagger-ui/**
- /**/insuranceDetail/updateInsuranceSettle
- /**/insuranceDetail/urgentUpdateIsUse
- /insuranceDetail/urgentUpdateIsUse
- /insuranceDetail/updateInsuranceSettle
......
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