Commit 776608d9 authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/MVP1.4' into MVP1.4

parents fa0b2e34 020a113e
package com.yifu.cloud.plus.v1.business.vo.settle;
import lombok.Getter;
import org.apache.commons.lang.StringUtils;
/**
* @description: SettleAdditionTypeEnum 结算相关附件类型
* @author: wangweiguo
* @date: 2021/8/19
*/
@Getter
public enum SettleAdditionTypeEnum {
SETTLE_RECORD("结算单", 0),
PROVE_SOCIAL("流水证明_社保", 1),
PROVE_FUND("流水证明_公积金", 2),
PROVE_SALARY_RECORD("流水证明_代发工资单", 3),
PROVE_MEAL_FEE("流水证明_餐补", 4),
PROVE_GIFT_BAG("流水证明_春节大礼包", 5);
private String typeName;
private int type;
SettleAdditionTypeEnum(String typeName, int type) {
this.typeName = typeName;
this.type = type;
}
public static SettleAdditionTypeEnum getTypeEnumByFileName(String fileName) {
for (SettleAdditionTypeEnum setteAdditionTypeEnum : values()) {
if (!StringUtils.contains(fileName, setteAdditionTypeEnum.typeName)) {
continue;
}
return setteAdditionTypeEnum;
}
return null;
}
}
package com.yifu.cloud.plus.v1.business.controller.settle;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.business.entity.settle.TBusSettle;
import com.yifu.cloud.plus.v1.business.service.settle.TBusSettleService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.time.LocalDateTime;
import java.util.List;
/**
* B端结算表
*
* @author hgw
* @date 2021-08-16 15:58:09
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/tbussettle")
@Tag(name = "B端结算表")
public class TBusSettleController {
private final TBusSettleService tBusSettleService;
/**
* 简单分页查询
*
* @param page 分页对象
* @param tBusSettle B端结算表
* @return
*/
@Operation(summary = "简单分页查询")
@GetMapping("/page")
public R<IPage<TBusSettle>> getTBusSettlePage(Page<TBusSettle> page, TBusSettle tBusSettle) {
return new R<>(tBusSettleService.getTBusSettlePage(page, tBusSettle));
}
/**
* 列表,可用来查重
*
* @param tBusSettle B端结算表
* @return
*/
@Operation(summary = "列表,可用来查重")
@GetMapping("/getTBusSettleList")
public R<List<TBusSettle>> getTBusSettleList(TBusSettle tBusSettle) {
return new R<>(tBusSettleService.getTBusSettleList(tBusSettle));
}
/**
* 通过id查询单条记录
*
* @param id
* @return R
*/
@Operation(summary = "id查询")
@GetMapping("/{id}")
public R<TBusSettle> getById(@PathVariable("id") String id) {
return new R<>(tBusSettleService.getById(id));
}
/**
* 新增记录
*
* @param tBusSettle
* @return R
*/
@Operation(summary = "新增(yifu-hro-business:tbussettle_add)")
@PostMapping
@PreAuthorize("@pms.hasPermission('yifu-hro-business:tbussettle_add')")
public R<Boolean> save(@RequestBody TBusSettle tBusSettle) {
YifuUser user = SecurityUtils.getUser();
if (user != null && user.getId() != null) {
tBusSettle.setCreateTime(LocalDateTime.now());
tBusSettle.setCreateUserId(String.valueOf(user.getId()));
tBusSettle.setCreateUserName(user.getNickname());
return new R<>(tBusSettleService.save(tBusSettle));
} else {
return R.failed("未获取到登录人信息!");
}
}
/**
* 修改记录
*
* @param tBusSettle
* @return R
*/
@Operation(summary = "修改(yifu-hro-business:tbussettle_edit)")
@SysLog("修改B端结算表")
@PutMapping
@PreAuthorize("@pms.hasPermission('yifu-hro-business:tbussettle_edit')")
public R<Boolean> update(@RequestBody TBusSettle tBusSettle) {
return new R<>(tBusSettleService.updateById(tBusSettle));
}
/**
* 通过id删除一条记录
*
* @param id
* @return R
*/
@Operation(summary = "假删除(yifu-hro-business:tbussettle_del)")
@SysLog("假删除B端结算表")
@DeleteMapping("/{id}")
@PreAuthorize("@pms.hasPermission('yifu-hro-business:tbussettle_del')")
public R<Boolean> removeById(@PathVariable String id) {
TBusSettle tBusSettle = new TBusSettle();
tBusSettle.setId(id);
tBusSettle.setDeleteFlag(CommonConstants.ONE_INT);
return new R<>(tBusSettleService.updateById(tBusSettle));
}
/**
* @param file zip文件包
* @description: 解析zip文件包中的多个附件,并生成结算记录
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.Boolean>
* @author: wangweiguo
* @date: 2021/8/19
*/
@Operation(summary = "导入:(yifu-hro-business:import_zip)")
@PostMapping("/importZip")
@PreAuthorize("@pms.hasPermission('yifu-hro-business:import_zip')")
//@ApiImplicitParam(value = "zip文件", name = "file", paramType = "form", required = true)
public R<Boolean> importZip(@RequestParam("file") MultipartFile file) {
return this.tBusSettleService.importZip(file);
}
}
package com.yifu.cloud.plus.v1.business.mapper.settle;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.business.entity.settle.TBusSettle;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* B端结算表
*
* @author hgw
* @date 2021-08-16 15:58:09
*/
@Mapper
public interface TBusSettleMapper extends BaseMapper<TBusSettle> {
/**
* B端结算表简单分页查询
*
* @param tBusSettle B端结算表
* @return
*/
IPage<TBusSettle> getTBusSettlePage(Page<TBusSettle> page, @Param("tBusSettle") TBusSettle tBusSettle);
/**
* @param tBusSettle
* @Description: 列表
* @Author: hgw
* @Date: 2021/8/16 16:37
* @return: java.util.List<com.yifu.cloud.v1.hrobusiness.api.entity.settle.TBusSettle>
**/
List<TBusSettle> getTBusSettleList(@Param("tBusSettle") TBusSettle tBusSettle);
}
package com.yifu.cloud.plus.v1.business.service.settle;
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.business.entity.settle.TBusSettle;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
* B端结算表
*
* @author hgw
* @date 2021-08-16 15:58:09
*/
public interface TBusSettleService extends IService<TBusSettle> {
/**
* B端结算表简单分页查询
*
* @param tBusSettle B端结算表
* @return
*/
IPage<TBusSettle> getTBusSettlePage(Page<TBusSettle> page, TBusSettle tBusSettle);
/**
* @param tBusSettle
* @Description: 列表
* @Author: hgw
* @Date: 2021/8/16 16:37
* @return: java.util.List<com.yifu.cloud.v1.hrobusiness.api.entity.settle.TBusSettle>
**/
List<TBusSettle> getTBusSettleList(TBusSettle tBusSettle);
/**
* @description: 解析zip文件包中的多个附件,并生成结算记录
* @param file zip文件包
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.Boolean>
* @author: wangweiguo
* @date: 2021/8/19
*/
R<Boolean> importZip(MultipartFile file);
}
package com.yifu.cloud.plus.v1.business.service.settle.impl;
import cn.hutool.core.io.FileTypeUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.ZipUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.business.entity.settle.TBusSettle;
import com.yifu.cloud.plus.v1.business.mapper.settle.TBusSettleMapper;
import com.yifu.cloud.plus.v1.business.service.settle.TBusSettleService;
import com.yifu.cloud.plus.v1.business.service.system.TBusAttaInfoService;
import com.yifu.cloud.plus.v1.business.vo.BusFileVo;
import com.yifu.cloud.plus.v1.business.vo.settle.SettleAdditionTypeEnum;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.CheckedException;
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.security.util.SecurityUtils;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.time.LocalDateTime;
import java.util.List;
import java.util.UUID;
/**
* B端结算表
*
* @author hgw
* @date 2021-08-16 15:58:09
*/
@AllArgsConstructor
@Slf4j
@Service
public class TBusSettleServiceImpl extends ServiceImpl<TBusSettleMapper, TBusSettle> implements TBusSettleService {
private final TBusAttaInfoService busAttaInfoService;
public static final String DEPART_ALREADY_EXIST_MONTH_DATA = "该部门该结算月份已有数据,若要更新,请先将原数据删除后,再次导入!";
public static final String SETTLE_MONTH_MATCH = "([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})(0[1-9]{1}|1[0-2]{1})";
public static final String FILE_NAME_DATE_FORMAT_ERROR = "文件名格式中日期格式错误!";
public static final String SAVE_SETTLE_ERROR = "保存结算记录出错";
public static final String FILE_NAME_ERROT = "命名格式不规范";
public static final String HRB_SETTLE_FILE_PATH = "hrb/settle";
public static final String ZIP_FILE_NAME_VALID_FAILD = "zip压缩文件名格式不正确";
public static final String ZIP_EXTRACT_ERROR = "结算管理导入zip文件解压功能出错";
/**
* B端结算表简单分页查询
*
* @param tBusSettle B端结算表
* @return
*/
@Override
public IPage<TBusSettle> getTBusSettlePage(Page<TBusSettle> page, TBusSettle tBusSettle) {
return baseMapper.getTBusSettlePage(page, tBusSettle);
}
@Override
public List<TBusSettle> getTBusSettleList(TBusSettle tBusSettle) {
return baseMapper.getTBusSettleList(tBusSettle);
}
/**
* @param file zip文件包
* @description: 解析zip文件包中的多个附件,并生成结算记录
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.Boolean>
* @author: wangweiguo
* @date: 2021/8/19
*/
@Override
@Transactional
public R<Boolean> importZip(MultipartFile file) {
File unzip = null;
YifuUser user = SecurityUtils.getUser();
if (null == user) {
return R.failed("用户未登录");
}
File etractFile = null;
try {
String fileType = FileTypeUtil.getType(file.getInputStream());
if (!StringUtils.equalsIgnoreCase(fileType, CommonConstants.ZIP_TYPE)) {
return R.failed("导入的文件格式不正确");
}
String[] destoryName = StringUtils.split(StringUtils.removeEndIgnoreCase(file.getOriginalFilename()
, CommonConstants.SPOT.concat(fileType)), CommonConstants.DOWN_LINE_CHAR);
if (null != destoryName && destoryName.length == 2) {
TBusSettle busSettle = this.lambdaQuery()
.eq(TBusSettle::getSettleMonth, destoryName[1])
.eq(TBusSettle::getAccountDeptName, destoryName[0])
.eq(TBusSettle::getDeleteFlag, CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL).one();
if (null != busSettle) {
return R.failed(DEPART_ALREADY_EXIST_MONTH_DATA);
}
etractFile = new File(UUID.randomUUID().toString());
unzip = ZipUtil.unzip(file.getInputStream(), etractFile, CharsetUtil.CHARSET_GBK);
// 正常解压后创建结算记录
busSettle = new TBusSettle();
busSettle.setAccountDeptName(destoryName[0]);
busSettle.setSettleMonth(destoryName[1]);
busSettle.setCreateUserId(String.valueOf(user.getId()));
busSettle.setCreateUserName(user.getNickname());
busSettle.setCreateTime(LocalDateTime.now());
if (!busSettle.getSettleMonth().matches(SETTLE_MONTH_MATCH)) {
return R.failed(FILE_NAME_DATE_FORMAT_ERROR);
}
boolean saveBusSettleSuccess = this.save(busSettle);
if (!saveBusSettleSuccess) {
return R.failed(SAVE_SETTLE_ERROR);
}
List<File> files = FileUtil.loopFiles(unzip);
for (File fl : files) {
String fileName = FileUtil.getName(fl);
SettleAdditionTypeEnum settleAdditionTypeEnum = SettleAdditionTypeEnum.getTypeEnumByFileName(fileName);
if (null == settleAdditionTypeEnum) {
runTimeExceptionDiy(fileName + ":" + FILE_NAME_ERROT);
}
R<BusFileVo> busFileVoR = this.busAttaInfoService.uploadFile(fileCovertMultipartFile(fl)
, HRB_SETTLE_FILE_PATH, settleAdditionTypeEnum.getType(), busSettle.getId());
if (!R.isSuccess(busFileVoR)) {
runTimeExceptionDiy(busFileVoR.getMsg());
}
}
} else {
return R.failed(ZIP_FILE_NAME_VALID_FAILD);
}
} catch (IOException e) {
runTimeExceptionDiy(ZIP_EXTRACT_ERROR.concat(": ").concat(e.getCause().toString()));
} finally {
if (etractFile != null) {
FileUtil.del(etractFile);
}
}
return R.ok();
}
private static void runTimeExceptionDiy(String errorInfo) {
throw new CheckedException(errorInfo);
}
/**
* File转MultipartFile
*
* @param file 需要转换的文件
* @description: File转MultipartFile
* @return: org.springframework.web.multipart.MultipartFile
* @author: wangweiguo
* @date: 2021/8/19
*/
private MultipartFile fileCovertMultipartFile(File file) {
FileItemFactory factory = new DiskFileItemFactory(16, null);
String textFieldName = "textField";
FileItem item = factory.createItem(textFieldName, "text/plain", true, file.getName());
int bytesRead = 0;
byte[] buffer = new byte[8192];
try {
FileInputStream fis = new FileInputStream(file);
OutputStream os = item.getOutputStream();
while ((bytesRead = fis.read(buffer, 0, 8192)) != -1) {
os.write(buffer, 0, bytesRead);
}
os.close();
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
return new CommonsMultipartFile(item);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.business.mapper.settle.TBusSettleMapper">
<resultMap id="tBusSettleMap" type="com.yifu.cloud.plus.v1.business.entity.settle.TBusSettle">
<id property="id" column="id"/>
<result property="accountDeptName" column="account_dept_name"/>
<result property="settleMonth" column="settle_month"/>
<result property="createUserId" column="create_user_id"/>
<result property="createUserName" column="create_user_name"/>
<result property="createTime" column="create_time"/>
<result property="deleteFlag" column="delete_flag"/>
</resultMap>
<sql id="Base_Column_List">
a.id,
a.account_dept_name,
a.settle_month,
a.create_user_id,
a.create_user_name,
a.create_time,
a.delete_flag
</sql>
<sql id="tBusSettle_where">
<if test="tBusSettle != null">
<if test="tBusSettle.id != null and tBusSettle.id.trim() != ''">
AND a.id = #{tBusSettle.id}
</if>
<if test="tBusSettle.accountDeptName != null and tBusSettle.accountDeptName.trim() != ''">
AND a.account_dept_name like concat('%',#{tBusSettle.accountDeptName},'%')
</if>
<if test="tBusSettle.settleMonth != null and tBusSettle.settleMonth.trim() != ''">
AND a.settle_month = #{tBusSettle.settleMonth}
</if>
<if test="tBusSettle.createUserId != null and tBusSettle.createUserId.trim() != ''">
AND a.create_user_id = #{tBusSettle.createUserId}
</if>
<if test="tBusSettle.createUserName != null and tBusSettle.createUserName.trim() != ''">
AND a.create_user_name = #{tBusSettle.createUserName}
</if>
<if test="tBusSettle.createTime != null">
AND a.create_time = #{tBusSettle.createTime}
</if>
<if test="tBusSettle.deleteFlag != null">
AND a.delete_flag = #{tBusSettle.deleteFlag}
</if>
</if>
</sql>
<!--tBusSettle简单分页查询-->
<select id="getTBusSettlePage" resultMap="tBusSettleMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_bus_settle a
<where>
a.delete_flag = 0
<include refid="tBusSettle_where"/>
</where>
ORDER BY a.create_time desc
</select>
<!--tBusSettle简单查询list-->
<select id="getTBusSettleList" resultMap="tBusSettleMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_bus_settle a
<where>
a.delete_flag = 0
<include refid="tBusSettle_where"/>
</where>
ORDER BY a.create_time desc
</select>
</mapper>
...@@ -152,4 +152,6 @@ public class ExcelAttributeConstants { ...@@ -152,4 +152,6 @@ public class ExcelAttributeConstants {
// B端人员使用的 // B端人员使用的
public static final String CUSTOMER = "customer"; public static final String CUSTOMER = "customer";
public static final String HOUSEHOLD = "household";
} }
package com.yifu.cloud.plus.v1.yifu.salary.vo;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccountItem;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @Description: B端-结算单Vo
* @Author: hgw
* @Date: 2020-8-21 11:31:03
* @return:
**/
@Getter
@Setter
public class SalaryAccountAndItemVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@Schema(description = "主键", name = "id")
private String id;
/**
* 工资表id
*/
@Schema(description = "工资表id", name = "salaryFormId")
private String salaryFormId;
/**
* 工资月
*/
@Schema(description = "工资月", name = "salaryDate")
private String salaryDate;
/**
* 员工姓名
*/
@Schema(description = "员工姓名", name = "empName")
private String empName;
/**
* 员工身份证号
*/
@Schema(description = "员工身份证号", name = "empIdcard")
private String empIdcard;
/**
* 工资发放时间(0立即发、1暂停发)
*/
@Schema(description = "工资发放时间(0立即发、1暂停发)", name = "salaryGiveTime")
private String salaryGiveTime;
/**
* 发放状态 0: 未发放 1: 发放成功 2:发放失败
*/
@Schema(description = "发放状态 0: 未发放 1: 发放成功 2:发放失败", name = "distributionFlag")
private String distributionFlag;
/**
* 社保扣缴月份
*/
@Schema(description = "社保扣缴月份", name = "deduSocialMonth")
private String deduSocialMonth;
/**
* 公积金扣缴月份
*/
@Schema(description = "公积金扣缴月份", name = "deduProvidentMonth")
private String deduProvidentMonth;
/**
* 财务类型 0:工资;1:绩效;2:其他
*/
@Schema(description = "财务类型 0:工资;1:绩效;2:其他", name = "salaryType")
private String salaryType;
/**
* 结算月
*/
@Schema(description = "结算月", name = "settlementMonth")
private String settlementMonth;
/**
* 应发工资
*/
@Schema(description = "应发工资", name = "relaySalary")
private String relaySalary;
/**
* 实发工资
*/
@Schema(description = "实发工资", name = "actualSalarySum")
private String actualSalarySum;
/**
* 个税
*/
@Schema(description = "个税", name = "salaryTax")
private String salaryTax;
/**
* 年
*/
@Schema(description = "年", name = "years")
private String years;
/**
* 单位社保
*/
@Schema(description = "单位社保", name = "unitSocial")
private String unitSocial;
/**
* 个人社保
*/
@Schema(description = "个人社保", name = "personalSocial")
private String personalSocial;
/**
* 单位公积金
*/
@Schema(description = "单位公积金", name = "unitFund")
private String unitFund;
/**
* 个人公积金
*/
@Schema(description = "个人公积金", name = "personalFund")
private String personalFund;
/**
* 发放时间
*/
@Schema(description = "发放时间", name = "revenueTime")
private Date revenueTime;
/**
* 工资组成部分明细
*/
private List<TSalaryAccountItem> saiList = new ArrayList<>();
}
package com.yifu.cloud.plus.v1.yifu.salary.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
/**
* @Description: B端-结算单Vo
* @Author: hgw
* @Date: 2020-8-21 11:31:03
* @return:
**/
@Getter
@Setter
public class SettlementFormVo implements Serializable {
private static final long serialVersionUID = 1L;
/*
* 工资月份
**/
@Schema(description = "工资月份", name = "salaryMonth")
private String salaryMonth;
/*
* 发薪人次
**/
@Schema(description = "发薪人次", name = "personTime")
private String personTime;
/*
* 应发工资
**/
@Schema(description = "应发工资", name = "salarySum")
private String salarySum;
/*
* 实发工资
**/
@Schema(description = "实发工资", name = "cardPay")
private String cardPay;
/*
* 年
**/
@Schema(description = "年", name = "years")
private String years;
/*
* 人工成本
**/
@Schema(description = "人工成本", name = "laborCosts")
private String laborCosts;
}
package com.yifu.cloud.plus.v1.yifu.salary.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ServiceNameConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
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.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccountItem;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryStandard;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryAccountItemService;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryAccountService;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryStandardService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryAccountAndItemVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SettlementFormVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardSearchVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.List;
/**
* B端工资接口
*
* @author hgw
* @date 2020-8-19 09:39:06
*/
@RestController
@AllArgsConstructor
@RequestMapping("/customerBusiness/businessSalary")
@Tag(name = "B端工资接口")
public class BusinessSalaryController {
// 工资表服务
private final TSalaryStandardService tSalaryStandardService;
// 工资报表服务
private final TSalaryAccountService tSalaryAccountService;
// 工资明细
private final TSalaryAccountItemService tSalaryAccountItemService;
private final MenuUtil menuUtil;
// 工资明细属性
private static final String JAVA_FIED_NAME = "JAVA_FIED_NAME";
// 应发
private static final String RELAY_SALARY = "relaySalary";
// 实发
private static final String ACTUAL_SALARY_SUM = "actualSalarySum";
// 个税
private static final String SALARY_TAX = "salaryTax";
// 单位社保
private static final String UNIT_SOCIAL = "unitSocial";
// 个人社保
private static final String PERSONAL_SOCIAL = "personalSocial";
// 单位社保
private static final String UNIT_FUND = "unitFund";
// 个人公积金
private static final String PERSONAL_FUND = "personalFund";
/**
* @param page 分页
* @param settlementFormVo 结算单vo
* @Description: B端薪酬第一个统计列表
* @Author: hgw
* @Date: 2020-8-21 16:17:51
* @return: com.yifu.cloud.v1.common.core.util.R<com.baomidou.mybatisplus.core.metadata.IPage < com.yifu.cloud.v1.hrms.api.vo.SettlementFormVo>>
**/
@Operation(description = "1薪酬首列表-分页查询")
@GetMapping("/getSettlementFormVoPage")
public R<IPage<SettlementFormVo>> getSettlementFormVoPage(Page<SettlementFormVo> page, SettlementFormVo settlementFormVo) {
if (Boolean.TRUE.equals(Common.isEmpty(settlementFormVo.getYears()))) {
// 当前年份
String curYear = DateUtil.getYear(new Date());
settlementFormVo.setYears(curYear);
}
YifuUser user = SecurityUtils.getUser();
if (user == null) {
return R.failed("请登录!");
}
List<String> settleDepartIdList = null;
if (!SecurityUtils.isHaveAllOrg(ServiceNameConstants.CLIENT_ID_HR_B, user)) {
settleDepartIdList = user.getSettleIdList();
if (settleDepartIdList == null || settleDepartIdList.isEmpty()) {
return R.failed("无结算主体权限,请联系管理员分配!");
}
}
return new R<>(tSalaryAccountService.getSettlementFormVoPage(page, settlementFormVo, settleDepartIdList));
}
/**
* @param page 分页信息
* @param tSalaryStandard 工资表
* @Description: 工资列表-分页查询
* @Author: hgw
* @Date: 2020-8-21 16:17:45
* @return: com.yifu.cloud.v1.common.core.util.R<com.baomidou.mybatisplus.core.metadata.IPage < com.yifu.cloud.v1.hrms.api.entity.TSalaryStandard>>
**/
@Operation(description = "2工资列表-分页查询(salaryMonth必传)")
@GetMapping("/getSalaryStandardPage")
public R<IPage<TSalaryStandard>> getSalaryStandardPage(Page<TSalaryStandard> page, TSalaryStandardSearchVo tSalaryStandard
, String createTimeStart, String createTimeEnd, String revenueTimeStart, String revenueTimeEnd) {
if (Boolean.TRUE.equals(Common.isEmpty(tSalaryStandard.getSalaryMonth()))) {
tSalaryStandard.setSalaryMonth("-1");
}
tSalaryStandard.setDeleteFlag(CommonConstants.ZERO_INT);
YifuUser user = SecurityUtils.getUser();
menuUtil.setAuthSql(user, tSalaryStandard);
return new R<>(tSalaryStandardService.getTSalaryStandardPageApply(page, tSalaryStandard));
}
/**
* 工资详情-报账列表-分页查询
*
* @param page 分页对象
* @param salaryAccountAndItemVo 工资详情-报账列表-分页查询
* @return
* @Author: hgw
* @Date: 2020-8-21 16:16:24
*/
@Operation(description = "3工资详情-报账列表-分页查询(salaryFormId必传)")
@GetMapping("/getSalaryAccountAndItemVoPage")
public R<IPage<SalaryAccountAndItemVo>> getSalaryAccountPage(Page<SalaryAccountAndItemVo> page
, SalaryAccountAndItemVo salaryAccountAndItemVo) {
if (Boolean.TRUE.equals(Common.isEmpty(salaryAccountAndItemVo.getSalaryFormId()))) {
salaryAccountAndItemVo.setSalaryFormId(CommonConstants.ZERO_STRING);
}
// 分页报账以及详情数据
IPage<SalaryAccountAndItemVo> accountPage = getSalaryAccountAndItemVoIPage(page, salaryAccountAndItemVo);
return new R<>(accountPage);
}
/**
* @param salaryAccountId 报账id
* @Description: 获取报账明细
* @Author: hgw
* @Date: 2020/8/21 17:39
* @return: java.util.List<com.yifu.cloud.v1.hrms.api.entity.TSalaryAccountItem>
**/
private List<TSalaryAccountItem> gettSalaryAccountItemList(String salaryAccountId) {
TSalaryAccountItem item = new TSalaryAccountItem();
item.setSalaryAccountId(salaryAccountId);
QueryWrapper<TSalaryAccountItem> queryWrapperAi = new QueryWrapper<>();
queryWrapperAi.setEntity(item);
queryWrapperAi.ne(JAVA_FIED_NAME, RELAY_SALARY);
queryWrapperAi.ne(JAVA_FIED_NAME, ACTUAL_SALARY_SUM);
queryWrapperAi.ne(JAVA_FIED_NAME, SALARY_TAX);
queryWrapperAi.ne(JAVA_FIED_NAME, UNIT_SOCIAL);
queryWrapperAi.ne(JAVA_FIED_NAME, PERSONAL_SOCIAL);
queryWrapperAi.ne(JAVA_FIED_NAME, UNIT_FUND);
queryWrapperAi.ne(JAVA_FIED_NAME, PERSONAL_FUND);
return tSalaryAccountItemService.list(queryWrapperAi);
}
/**
* 工资详情-报账列表-分页查询
*
* @param page 分页对象
* @param salaryAccountAndItemVo 工资详情-报账列表-分页查询
* @return
* @Author: hgw
* @Date: 2020-8-21 16:16:24
*/
@Operation(description = "3.2人员-报账列表(empIdcard必传)")
@GetMapping("/getAccountByIdCardPage")
public R<IPage<SalaryAccountAndItemVo>> getAccountByIdCardPage(Page<SalaryAccountAndItemVo> page
, SalaryAccountAndItemVo salaryAccountAndItemVo) {
if (Boolean.TRUE.equals(Common.isEmpty(salaryAccountAndItemVo.getEmpIdcard()))) {
salaryAccountAndItemVo.setEmpIdcard("-1");
}
if (Boolean.TRUE.equals(Common.isEmpty(salaryAccountAndItemVo.getYears()))) {
// 当前年份
String curYear = DateUtil.getYear(new Date());
salaryAccountAndItemVo.setYears(curYear);
}
// 发放状态 0: 未发放 1: 发放成功 2:发放失败
salaryAccountAndItemVo.setDistributionFlag(CommonConstants.ONE_STRING);
// 分页报账以及详情数据
IPage<SalaryAccountAndItemVo> accountPage = getSalaryAccountAndItemVoIPage(page, salaryAccountAndItemVo);
return new R<>(accountPage);
}
/**
* @param page 分页
* @param salaryAccountAndItemVo 报账信息
* @Description: 获取报账分页数据
* @Author: hgw
* @Date: 2020/8/21 17:42
* @return: com.baomidou.mybatisplus.core.metadata.IPage<com.yifu.cloud.v1.hrms.api.vo.SalaryAccountAndItemVo>
**/
private IPage<SalaryAccountAndItemVo> getSalaryAccountAndItemVoIPage(Page<SalaryAccountAndItemVo> page
, SalaryAccountAndItemVo salaryAccountAndItemVo) {
IPage<SalaryAccountAndItemVo> accountPage = tSalaryAccountService
.getSalaryAccountAndItemVoPage(page, salaryAccountAndItemVo);
// 报账列表
List<SalaryAccountAndItemVo> accountList = accountPage.getRecords();
if (accountList != null && !accountList.isEmpty()) {
// 获取报账明细
for (SalaryAccountAndItemVo a : accountList) {
a.setSaiList(gettSalaryAccountItemList(a.getId()));
}
}
return accountPage;
}
/**
* @param salaryFormId 工资id
* @Description: 工资详情-上面的统计
* @Author: hgw
* @Date: 2020/8/21 17:54
* @return: com.yifu.cloud.v1.common.core.util.R<com.yifu.cloud.v1.hrms.api.vo.SettlementFormVo>
**/
@Operation(description = "3.3工资详情-上面的统计(salaryFormId必传)")
@GetMapping("/getSettlementStasticsBySalaryFormId")
public R<SettlementFormVo> getSettlementStasticsBySalaryFormId(String salaryFormId) {
if (Boolean.TRUE.equals(Common.isEmpty(salaryFormId))) {
salaryFormId = CommonConstants.ZERO_STRING;
}
// 分页报账以及详情数据
SettlementFormVo settlementFormVo = tSalaryAccountService.getSettlementFormVoBySalaryFormId(salaryFormId);
return new R<>(settlementFormVo);
}
}
...@@ -24,6 +24,8 @@ import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParamVo; ...@@ -24,6 +24,8 @@ import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParamVo;
import com.yifu.cloud.plus.v1.yifu.salary.entity.THaveSalaryNosocial; import com.yifu.cloud.plus.v1.yifu.salary.entity.THaveSalaryNosocial;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount; import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount;
import com.yifu.cloud.plus.v1.yifu.salary.vo.AccountCheckVo; import com.yifu.cloud.plus.v1.yifu.salary.vo.AccountCheckVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryAccountAndItemVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SettlementFormVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountSearchVo; import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountSearchVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -129,4 +131,36 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> { ...@@ -129,4 +131,36 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> {
* @return: void * @return: void
**/ **/
void backSalaryBySalaryId(@Param("salaryId") String salaryId); void backSalaryBySalaryId(@Param("salaryId") String salaryId);
/**
* @param page 分页
* @param settlementFormVo 结算单Vo
* @Description: B端薪酬第一个统计列表
* @Author: hgw
* @Date: 2020/8/21 11:38
* @return: com.baomidou.mybatisplus.core.metadata.IPage<com.yifu.cloud.v1.hrms.api.vo.SettlementFormVo>
**/
IPage<SettlementFormVo> getSettlementFormVoPage(Page<SettlementFormVo> page
, @Param("settlementFormVo") SettlementFormVo settlementFormVo
, @Param("settleDepartIdList") List<String> settleDepartIdList);
/**
* @param salaryFormId 结算单id
* @Description: 工资详情-上面的统计
* @Author: hgw
* @Date: 2020-8-21 17:55:24
* @return: com.baomidou.mybatisplus.core.metadata.IPage<com.yifu.cloud.v1.hrms.api.vo.SettlementFormVo>
**/
SettlementFormVo getSettlementFormVoBySalaryFormId(@Param("salaryFormId") String salaryFormId);
/**
* @param page
* @param salaryAccountAndItemVo
* @Description: 获取报账以及薪资
* @Author: hgw
* @Date: 2020/8/21 15:32
* @return: com.baomidou.mybatisplus.core.metadata.IPage<com.yifu.cloud.v1.hrms.api.vo.SalaryAccountAndItemVo>
**/
IPage<SalaryAccountAndItemVo> getSalaryAccountAndItemVoPage(Page<SalaryAccountAndItemVo> page
, @Param("salaryAccountAndItemVo") SalaryAccountAndItemVo salaryAccountAndItemVo);
} }
...@@ -24,6 +24,8 @@ import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParamVo; ...@@ -24,6 +24,8 @@ import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParamVo;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpSocialViewVo; import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpSocialViewVo;
import com.yifu.cloud.plus.v1.yifu.salary.entity.THaveSalaryNosocial; import com.yifu.cloud.plus.v1.yifu.salary.entity.THaveSalaryNosocial;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount; import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryAccountAndItemVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SettlementFormVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountSearchVo; import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountSearchVo;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -133,4 +135,35 @@ public interface TSalaryAccountService extends IService<TSalaryAccount> { ...@@ -133,4 +135,35 @@ public interface TSalaryAccountService extends IService<TSalaryAccount> {
* @return: R * @return: R
**/ **/
void updateSalarySettleStatus(List<EkpSocialViewVo> viewVo); void updateSalarySettleStatus(List<EkpSocialViewVo> viewVo);
/**
* @param page 分页
* @param settlementFormVo 结算单Vo
* @Description: B端薪酬第一个统计列表
* @Author: hgw
* @Date: 2020/8/21 11:38
* @return: com.baomidou.mybatisplus.core.metadata.IPage<com.yifu.cloud.v1.hrms.api.vo.SettlementFormVo>
**/
IPage<SettlementFormVo> getSettlementFormVoPage(Page<SettlementFormVo> page, SettlementFormVo settlementFormVo
, List<String> settleDepartIdList);
/**
* @param salaryFormId 结算单id
* @Description: 工资详情-上面的统计
* @Author: hgw
* @Date: 2020-8-21 17:55:24
* @return: com.baomidou.mybatisplus.core.metadata.IPage<com.yifu.cloud.v1.hrms.api.vo.SettlementFormVo>
**/
SettlementFormVo getSettlementFormVoBySalaryFormId(String salaryFormId);
/**
* @param page
* @param salaryAccountAndItemVo
* @Description: 获取报账以及薪资
* @Author: hgw
* @Date: 2020/8/21 15:32
* @return: com.baomidou.mybatisplus.core.metadata.IPage<com.yifu.cloud.v1.hrms.api.vo.SalaryAccountAndItemVo>
**/
IPage<SalaryAccountAndItemVo> getSalaryAccountAndItemVoPage(Page<SalaryAccountAndItemVo> page
, SalaryAccountAndItemVo salaryAccountAndItemVo);
} }
...@@ -34,6 +34,8 @@ import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount; ...@@ -34,6 +34,8 @@ import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryAccountMapper; import com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryAccountMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryAccountService; import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryAccountService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.AccountCheckVo; import com.yifu.cloud.plus.v1.yifu.salary.vo.AccountCheckVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryAccountAndItemVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SettlementFormVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountSearchVo; import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountSearchVo;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -255,4 +257,44 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper, ...@@ -255,4 +257,44 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
} }
} }
/**
* @param page 分页
* @param settlementFormVo 结算单Vo
* @Description: B端薪酬第一个统计列表
* @Author: hgw
* @Date: 2020/8/21 11:38
* @return: com.baomidou.mybatisplus.core.metadata.IPage<com.yifu.cloud.v1.hrms.api.vo.SettlementFormVo>
**/
@Override
public IPage<SettlementFormVo> getSettlementFormVoPage(Page<SettlementFormVo> page
, SettlementFormVo settlementFormVo, List<String> settleDepartIdList){
return baseMapper.getSettlementFormVoPage(page,settlementFormVo, settleDepartIdList);
}
/**
* @param salaryFormId 结算单id
* @Description: 工资详情-上面的统计
* @Author: hgw
* @Date: 2020-8-21 17:55:24
* @return: com.baomidou.mybatisplus.core.metadata.IPage<com.yifu.cloud.v1.hrms.api.vo.SettlementFormVo>
**/
@Override
public SettlementFormVo getSettlementFormVoBySalaryFormId(String salaryFormId) {
return baseMapper.getSettlementFormVoBySalaryFormId(salaryFormId);
}
/**
* @param page
* @param salaryAccountAndItemVo
* @Description: 获取报账以及薪资
* @Author: hgw
* @Date: 2020/8/21 15:32
* @return: com.baomidou.mybatisplus.core.metadata.IPage<com.yifu.cloud.v1.hrms.api.vo.SalaryAccountAndItemVo>
**/
@Override
public IPage<SalaryAccountAndItemVo> getSalaryAccountAndItemVoPage(Page<SalaryAccountAndItemVo> page
, SalaryAccountAndItemVo salaryAccountAndItemVo) {
return baseMapper.getSalaryAccountAndItemVoPage(page, salaryAccountAndItemVo);
}
} }
...@@ -98,6 +98,37 @@ ...@@ -98,6 +98,37 @@
<result property="payCollectFlag" column="PAY_SETTLE_FLAG"/> <result property="payCollectFlag" column="PAY_SETTLE_FLAG"/>
</resultMap> </resultMap>
<!-- B端薪酬第一个统计列表 -->
<resultMap id="settlementFormVoMap" type="com.yifu.cloud.plus.v1.yifu.salary.vo.SettlementFormVo">
<result property="salaryMonth" column="SALARY_MONTH"/>
<result property="personTime" column="PERSON_TIME"/>
<result property="salarySum" column="SALARY_SUM"/>
<result property="cardPay" column="CARD_PAY"/>
<result property="laborCosts" column="LABOR_COSTS"/>
</resultMap>
<!-- B端工资报账信息 -->
<resultMap id="salaryAccountAndItemVoMap" type="com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryAccountAndItemVo">
<id property="id" column="ID"/>
<result property="salaryDate" column="SALARY_DATE"/>
<result property="empName" column="EMP_NAME"/>
<result property="empIdcard" column="EMP_IDCARD"/>
<result property="salaryGiveTime" column="SALARY_GIVE_TIME"/>
<result property="distributionFlag" column="DISTRIBUTION_FLAG"/>
<result property="deduSocialMonth" column="DEDU_SOCIAL_MONTH"/>
<result property="deduProvidentMonth" column="DEDU_PROVIDENT_MONTH"/>
<result property="salaryType" column="SALARY_TYPE"/>
<result property="settlementMonth" column="SETTLEMENT_MONTH"/>
<result property="relaySalary" column="RELAY_SALARY"/>
<result property="actualSalarySum" column="ACTUAL_SALARY_SUM"/>
<result property="salaryTax" column="SALARY_TAX"/>
<result property="unitSocial" column="UNIT_SOCIAL"/>
<result property="personalSocial" column="PERSONAL_SOCIAL"/>
<result property="unitFund" column="UNIT_FUND"/>
<result property="personalFund" column="PERSONAL_FUND"/>
<result property="revenueTime" column="REVENUE_TIME"/>
</resultMap>
<!-- 对接EKP的参数 --> <!-- 对接EKP的参数 -->
<resultMap id="ekpSalaryParamVoMap" type="com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParamVo"> <resultMap id="ekpSalaryParamVoMap" type="com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParamVo">
<result property="fd_3b10af838eab5c" column="fd_3b10af838eab5c"/> <result property="fd_3b10af838eab5c" column="fd_3b10af838eab5c"/>
...@@ -848,4 +879,79 @@ ...@@ -848,4 +879,79 @@
<update id="backSalaryBySalaryId" > <update id="backSalaryBySalaryId" >
update t_salary_account a set a.SEND_STATUS = '0' where a.SALARY_FORM_ID = #{salaryId} update t_salary_account a set a.SEND_STATUS = '0' where a.SALARY_FORM_ID = #{salaryId}
</update> </update>
<!-- B端薪酬第一个统计列表 -->
<select id="getSettlementFormVoPage" resultMap="settlementFormVoMap">
select s.SALARY_MONTH,count(1) PERSON_TIME,sum(ifnull(s.RELAY_SALARY,0)) SALARY_SUM,sum(ifnull(s.ACTUAL_SALARY,0)) CARD_PAY
from t_salary_account s
where s.SALARY_MONTH like '${settlementFormVo.years}%'
<if test="settleDepartIdList != null">
AND s.DEPT_ID in
<foreach collection="settleDepartIdList" item="ids" open="(" separator="," close=")">
#{ids}
</foreach>
</if>
and s.DELETE_FLAG=0
GROUP BY s.SALARY_MONTH desc
</select>
<!-- B端工资详情-上面的统计 -->
<select id="getSettlementFormVoBySalaryFormId" resultMap="settlementFormVoMap">
SELECT
count(1) PERSON_TIME,
sum(ifnull(s.RELAY_SALARY,0)) SALARY_SUM,
sum(ifnull(s.ACTUAL_SALARY,0)) CARD_PAY,
sum(ifnull(s.RELAY_SALARY,0)) + sum(ifnull(s.UNIT_SOCIAL, 0)) + sum(ifnull(s.UNIT_FUND, 0)) LABOR_COSTS
FROM
t_salary_account s
where s.SALARY_FORM_ID = #{salaryFormId}
GROUP BY s.SALARY_FORM_ID
</select>
<!--获取报账以及薪资 -->
<select id="getSalaryAccountAndItemVoPage" resultMap="salaryAccountAndItemVoMap">
select a.id,a.SALARY_MONTH SALARY_DATE,a.EMP_NAME,a.EMP_IDCARD,a.SALARY_GIVE_TIME
,a.DISTRIBUTION_FLAG,a.DEDU_SOCIAL_MONTH,a.DEDU_PROVIDENT_MONTH
,a.FORM_TYPE SALARY_TYPE,a.SETTLEMENT_MONTH
,a.RELAY_SALARY RELAY_SALARY
,a.ACTUAL_SALARY ACTUAL_SALARY_SUM
,a.SALARY_TAX SALARY_TAX
,a.UNIT_SOCIAL UNIT_SOCIAL
,a.PERSON_SOCIAL PERSONAL_SOCIAL
,a.UNIT_FUND UNIT_FUND
,a.PERSON_FUND PERSONAL_FUND
,a.SEND_TIME REVENUE_TIME
from t_salary_account a
where a.DELETE_FLAG = 0
<if test="salaryAccountAndItemVo.salaryFormId != null and salaryAccountAndItemVo.salaryFormId.trim() != ''">
AND a.SALARY_FORM_ID = #{salaryAccountAndItemVo.salaryFormId}
</if>
<if test="salaryAccountAndItemVo.empName != null and salaryAccountAndItemVo.empName.trim() != ''">
AND a.EMP_NAME = #{salaryAccountAndItemVo.empName}
</if>
<if test="salaryAccountAndItemVo.empIdcard != null and salaryAccountAndItemVo.empIdcard.trim() != ''">
AND a.EMP_IDCARD = #{salaryAccountAndItemVo.empIdcard}
</if>
<if test="salaryAccountAndItemVo.salaryGiveTime != null and salaryAccountAndItemVo.salaryGiveTime.trim() != ''">
AND a.SALARY_GIVE_TIME = #{salaryAccountAndItemVo.salaryGiveTime}
</if>
<if test="salaryAccountAndItemVo.distributionFlag != null and salaryAccountAndItemVo.distributionFlag.trim() != ''">
AND a.DISTRIBUTION_FLAG = #{salaryAccountAndItemVo.distributionFlag}
</if>
<if test="salaryAccountAndItemVo.deduSocialMonth != null and salaryAccountAndItemVo.deduSocialMonth.trim() != ''">
AND a.DEDU_SOCIAL_MONTH = #{salaryAccountAndItemVo.deduSocialMonth}
</if>
<if test="salaryAccountAndItemVo.deduProvidentMonth != null and salaryAccountAndItemVo.deduProvidentMonth.trim() != ''">
AND a.DEDU_PROVIDENT_MONTH = #{salaryAccountAndItemVo.deduProvidentMonth}
</if>
<if test="salaryAccountAndItemVo.salaryType != null and salaryAccountAndItemVo.salaryType.trim() != ''">
AND a.FORM_TYPE = #{salaryAccountAndItemVo.salaryType}
</if>
<if test="salaryAccountAndItemVo.settlementMonth != null and salaryAccountAndItemVo.settlementMonth.trim() != ''">
AND a.SETTLEMENT_MONTH = #{salaryAccountAndItemVo.settlementMonth}
</if>
<if test="salaryAccountAndItemVo.years != null and salaryAccountAndItemVo.years.trim() != ''">
AND a.SALARY_MONTH like concat(#{salaryAccountAndItemVo.years},'%')
</if>
</select>
</mapper> </mapper>
...@@ -714,5 +714,11 @@ public class TPaymentInfo extends BaseEntity { ...@@ -714,5 +714,11 @@ public class TPaymentInfo extends BaseEntity {
@ExcelIgnore @ExcelIgnore
private String bjSameFlg; private String bjSameFlg;
/**
* B端按年查询专用
*/
@TableField(exist = false)
@ExcelIgnore
private String likeYear;
} }
package com.yifu.cloud.plus.v1.yifu.social.vo;
import lombok.Data;
/**
* 返回公积金派增和派减数据
* @Author fxj
* @Date 2020-08-25
**/
@Data
public class FundAddAndReduceVo {
/**
* 公积金办理单位
**/
private String fundHouse;
/**
* 公积金缴纳地-省
**/
private Integer fundProvince;
/**
* 公积金缴纳地-市
**/
private Integer fundCity;
/**
* 公积金缴纳地-县
**/
private Integer fundTown;
/**
* 公积金办理单位-派减
**/
private String fundHouseReduce;
/**
* 公积金缴纳地-省-派减
**/
private Integer fundProvinceReduce;
/**
* 公积金缴纳地-市-派减
**/
private Integer fundCityReduce;
/**
* 公积金缴纳地-县-派减
**/
private Integer fundTownReduce;
/**
* 公积金派增办理状态 0 派单开始 1办理成功 2办理失败
**/
private String fundAddStatus;
/**
* 公积金派减办理状态 0 派单开始 1 办理成功 2 办理失败
**/
private String fundReduceStatus;
/**
* 公积金派增时间
**/
private String fundStartDate;
/**
* 公积金派减时间
**/
private String fundEndDate;
/**
* 公积金派增派单时间
**/
private String fundAddDispatchDate;
/**
* 公积金派减派单时间
**/
private String fundReduceDispatchDate;
}
package com.yifu.cloud.plus.v1.yifu.social.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
/**
* 获取对应单位或结算主体权限下的缴费库统计情况
* @Author fxj
* @Date 2020-08-31
**/
@Data
public class PaymentBusinessPageDetail {
/**
* 账单人数 退费不计数
**/
@Schema(description = "账单人数", name = "personalSum")
private Integer personalCount;
/**
* 增员
**/
@Schema(description = "增员", name = "personalSum")
private Integer personalAdd;
/**
* 减员
**/
@Schema(description = "减员", name = "personalSum")
private Integer personalReduce;
/**
* 个人合计
**/
@Schema(description = "个人合计", name = "personalSum")
private BigDecimal personalSum;
/**
* 单位合计
**/
@Schema(description = "单位合计", name = "unitSum")
private BigDecimal unitSum;
/**
* 合计
**/
@Schema(description = "合计", name = "sum")
private BigDecimal sum;
}
package com.yifu.cloud.plus.v1.yifu.social.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
/**
* 个人社保公积金账单列表对象
* @Author fxj
* @Date 2020-08-25
**/
@Data
public class PaymentBusinessPageVo {
/**
* 员工姓名
**/
@Schema(description = "员工姓名", name = "empName")
private String empName;
/**
* 员工ID
**/
@Schema(description = "员工ID", name = "empName")
private String empId;
/**
* 缴费月份
**/
@Schema(description = "缴费月份", name = "month")
private String month;
/**
* 结算主体ID
**/
private String settleDomainId;
/**
* 社保个人缴费
**/
@Schema(description = "社保个人缴费", name = "socialPersonalSum")
private BigDecimal socialPersonalSum;
/**
* 社保公司合计
**/
@Schema(description = "社保公司合计", name = "socialUnitSum")
private BigDecimal socialUnitSum;
/**
* 公积金个人合计
**/
@Schema(description = "公积金个人合计", name = "fundPersonalSum")
private BigDecimal fundPersonalSum;
/**
* 公积金公司合计
**/
@Schema(description = "公积金公司合计", name = "fundUnitSum")
private BigDecimal fundUnitSum;
/**
* 个人合计
**/
@Schema(description = "个人合计", name = "personalSum")
private BigDecimal personalSum;
/**
* 单位合计
**/
@Schema(description = "单位合计", name = "unitSum")
private BigDecimal unitSum;
/**
* 合计
**/
@Schema(description = "合计", name = "sum")
private BigDecimal sum;
/***************************社保明细**************************/
/**
* 单位社保补缴利息
*/
@Schema(description = "单位社保补缴利息", name = "companyAccrual")
private BigDecimal companyAccrual;
/**
* 个人社保补缴利息
*/
@Schema(description = "个人社保补缴利息", name = "personalAccrual")
private BigDecimal personalAccrual;
/**
* 单位养老基数
*/
@Schema(description = "养老基数", name = "unitPensionSet")
private BigDecimal unitPensionSet;
/**
* 单位医疗基数
*/
@Schema(description = "医保基数", name = "unitMedicalSet")
private BigDecimal unitMedicalSet;
/**
* 单位失业基数
*/
@Schema(description = "失业基数", name = "unitUnemploymentSet")
private BigDecimal unitUnemploymentSet;
/**
* 单位工伤基数
*/
@Schema(description = "工伤基数", name = "unitInjurySet")
private BigDecimal unitInjurySet;
/**
* 单位生育基数
*/
@Schema(description = "生育基数", name = "unitBirthSet")
private BigDecimal unitBirthSet;
/**
* 个人养老基数
*/
@Schema(description = "个人养老基数", name = "personalPensionSet")
private BigDecimal personalPensionSet;
/**
* 个人医疗基数
*/
@Schema(description = "个人医疗基数", name = "personalMedicalSet")
private BigDecimal personalMedicalSet;
/**
* 个人失业基数
*/
@Schema(description = "个人失业基数", name = "personalUnemploymentSet")
private BigDecimal personalUnemploymentSet;
/**
* 单位养老比例
*/
@Schema(description = "单位养老比例", name = "unitPensionPer")
private BigDecimal unitPensionPer;
/**
* 单位医疗比例
*/
@Schema(description = "单位医疗比例", name = "unitMedicalPer")
private BigDecimal unitMedicalPer;
/**
* 单位失业比例
*/
@Schema(description = "单位失业比例", name = "unitUnemploymentPer")
private BigDecimal unitUnemploymentPer;
/**
* 单位工伤比例
*/
@Schema(description = "单位工伤比例", name = "unitInjuryPer")
private BigDecimal unitInjuryPer;
/**
* 单位生育比例
*/
@Schema(description = "单位生育比例", name = "unitBirthPer")
private BigDecimal unitBirthPer;
/**
* 个人养老比例
*/
@Schema(description = "个人养老比例", name = "personalPensionPer")
private BigDecimal personalPensionPer;
/**
* 个人医疗比例
*/
@Schema(description = "个人医疗比例", name = "personalMedicalPer")
private BigDecimal personalMedicalPer;
/**
* 个人失业比例
*/
@Schema(description = "个人失业比例", name = "personalUnemploymentPer")
private BigDecimal personalUnemploymentPer;
/**
* 单位大病比例
*/
@Schema(description = "单位大病比例", name = "unitBigailmentPer")
private BigDecimal unitBigailmentPer;
/**
* 个人大病比例
*/
@Schema(description = "个人大病比例", name = "personalBigailmentPer")
private BigDecimal personalBigailmentPer;
/**
* 单位养老金额
*/
@Schema(description = "养老单位缴费", name = "unitPensionMoney")
private BigDecimal unitPensionMoney;
/**
* 单位医疗金额
*/
@Schema(description = "医保单位缴费", name = "unitMedicalMoney")
private BigDecimal unitMedicalMoney;
/**
* 单位失业金额
*/
@Schema(description = "失业单位缴费", name = "unitUnemploymentMoney")
private BigDecimal unitUnemploymentMoney;
/**
* 单位工伤金额
*/
@Schema(description = "工伤缴费", name = "unitInjuryMoney")
private BigDecimal unitInjuryMoney;
/**
* 单位生育金额
*/
@Schema(description = "生育缴费", name = "unitBirthMoney")
private BigDecimal unitBirthMoney;
/**
* 单位大病金额
*/
@Schema(description = "单位医疗救助金", name = "unitBigmailmentMoney")
private BigDecimal unitBigmailmentMoney;
/**
* 个人养老金额
*/
@Schema(description = "养老个人缴费", name = "personalPensionMoney")
private BigDecimal personalPensionMoney;
/**
* 个人医疗金额
*/
@Schema(description = "医保个人缴费", name = "personalMedicalMoney")
private BigDecimal personalMedicalMoney;
/**
* 个人失业金额
*/
@Schema(description = "失业个人缴费", name = "personalUnemploymentMoney")
private BigDecimal personalUnemploymentMoney;
/**
* 个人大病金额
*/
@Schema(description = "个人医疗救助金", name = "personalBigmailmentMoney")
private BigDecimal personalBigmailmentMoney;
/************************公积金明细***************************/
/**
* 公积金编号
*/
@Schema(description = "公积金编号", name = "providentNo")
private String providentNo;
/**
* 单位公积金基数
*/
@Schema(description = "公积金单边基数", name = "unitProvidentSet")
private BigDecimal unitProvidentSet;
/**
* 单边公积金比例
*/
@Schema(description = "公积金单边比例", name = "providentPercent")
private BigDecimal providentPercent;
/**
* 个人公积金基数
*/
@Schema(description = "个人公积金基数", name = "personalProidentSet")
private BigDecimal personalProidentSet;
/**
* 个人退费
*/
@Schema(description = "个人退费", name = "personalRefund")
private BigDecimal personalRefund;
/**
* 公司退费
*/
@Schema(description = "公司退费", name = "unitRefund")
private BigDecimal unitRefund;
/**
* 兼职工伤基数
*/
@Schema(description = "兼职工伤基数", name = "injuryAloneSet")
private BigDecimal injuryAloneSet;
/**
* 兼职工伤比例
*/
@Schema(description = "兼职工伤比例", name = "injuryAlonePer")
private BigDecimal injuryAlonePer;
/**
* 兼职工伤金额
*/
@Schema(description = "兼职工伤金额", name = "injuryAloneMoney")
private BigDecimal injuryAloneMoney;
}
package com.yifu.cloud.plus.v1.yifu.social.vo;
import lombok.Data;
/**
* 返回社保派增和派减数据
* @Author fxj
* @Date 2020-08-25
**/
@Data
public class SocialAddAndReduceVo {
/**
* 社保办理单位
**/
private String socialHouse;
/**
* 社保办理单位- 派减
**/
private String socialHouseReduce;
/**
* 社保缴纳地-省
**/
private Integer socialProvince;
/**
* 社保缴纳地-市
**/
private Integer socialCity;
/**
* 社保缴纳地-县
**/
private Integer socialTown;
/**
* 社保缴纳地-省- 派减
**/
private Integer socialProvinceReduce;
/**
* 社保缴纳地-市- 派减
**/
private Integer socialCityReduce;
/**
* 社保缴纳地-县- 派减
**/
private Integer socialTownReduce;
/**
* 社保派增办理状态 0 派单开始 1 办理中 2 办理成功 3 办理失败 4 部分办理成功
**/
private String socialAddStatus;
/**
* 社保派减办理状态 0 派单开始 1 办理中 2 办理成功 3 办理失败
**/
private String socialReduceStatus;
/**
* 社保派增时间
**/
private String socialStartDate;
/**
* 社保派减时间
**/
private String socialEndDate;
/**
* 社保派增派单时间
**/
private String socialAddDispatchDate;
/**
* 社保派减派单时间
**/
private String socialReduceDispatchDate;
}
package com.yifu.cloud.plus.v1.yifu.social.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
* 社保公积金列表数据统计
* @Author fxj
* @Date 2020-08-28
**/
@Data
public class SocialAndFundBusinessPageVo {
/**
* 月份
**/
private String month;
/**
* 人数
**/
private Integer peopleCount;
/**
* 个人缴费合计
**/
private BigDecimal personalSum;
/**
* 单位缴费合计
**/
private BigDecimal unitSum;
/**
* 单位ID
**/
private String unitId;
/**
* 结算主体ID
**/
private String settleDomainId;
/**
* 查询条件年
**/
private String year;
}
package com.yifu.cloud.plus.v1.yifu.social.vo;
import lombok.Data;
/**
*
* @Author fxj
* @Date 2020-09-01
**/
@Data
public class SocialAndFundReduceBusinessVo {
/**
* 员工姓名
**/
private String empName;
/**
* 离职日期
**/
private String leaveDate;
/**
* 社保状态
**/
private String socialStatus;
/**
* 公积金状态
**/
private String fundStatus;
/**
* 社保派减日期
**/
private String socialReduceDate;
/**
* 公积金派减日期
**/
private String fundReduceDate;
}
package com.yifu.cloud.plus.v1.yifu.social.vo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
public class TPaymentAllInfoVo implements Serializable {
private String id;
/**
* 员工姓名
*/
@Length(max = 20, message = "员工姓名不能超过20个字符")
@ExcelAttribute(name = "员工姓名", maxLength = 20)
@Schema(description = "员工姓名", name = "empName")
private String empName;
/**
* 员工编码
*/
@Length(max = 32, message = "员工编码不能超过32个字符")
@ExcelAttribute(name = "员工编码", maxLength = 32)
@Schema(description = "员工编码", name = "empNo")
private String empNo;
/**
* 员工ID
*/
@Length(max = 32, message = "员工ID不能超过32个字符")
@ExcelAttribute(name = "员工ID", maxLength = 32)
@Schema(description = "员工ID", name = "empId")
private String empId;
/**
* 员工身份证
*/
@Length(max = 100, message = "不能超过100个字符")
@ExcelAttribute(name = "身份证号", isNotEmpty = true, maxLength = 100,errorInfo = "身份证字段不可为空!")
@Schema(description = "身份证号", name = "empIdcard")
private String empIdcard;
/**
* 单位名称
*/
@Length(max = 50, message = "单位名称不能超过50个字符")
@ExcelAttribute(name = "单位名称", maxLength = 50, isDataId = true, dataType = ExcelAttributeConstants.CUSTOMER)
@Schema(description = "单位名称", name = "unitId")
private String unitId;
/**
* 部门名称
*/
@Length(max = 50, message = "部门名称不能超过50个字符")
@ExcelAttribute(name = "部门名称", maxLength = 50, isDataId = true, dataType = ExcelAttributeConstants.DEPART)
@Schema(description = "部门名称", name = "settleDomainId")
private String settleDomainId;
/**
* 社保户(dataType 要与导出的字段数据对应上)
*/
@Length(max = 32, message = "社保户不能超过32个字符")
@ExcelAttribute(name = "社保户", maxLength = 32, isDataId = true,dataType = ExcelAttributeConstants.HOUSEHOLD)
@Schema(description = "社保户", name = "socialHousehold")
private String socialHousehold;
/**
* 社保编号
*/
@Length(max = 20, message = "社保编号不能超过20个字符")
@ExcelAttribute(name = "社保编号", maxLength = 20)
@Schema(description = "社保编号", name = "socialSecurityNo")
private String socialSecurityNo;
/**
* 社保缴纳地
*/
@Length(max = 50, message = "社保缴纳地不能超过50个字符")
@ExcelAttribute(name = "社保缴纳地", maxLength = 50)
@Schema(description = "社保缴纳地", name = "socialPayAddr")
private String socialPayAddr;
/**
* 社保缴纳地-省
*/
@Length(max = 32, message = "不能超过32个字符")
@ExcelAttribute(name = "社保缴纳地-省", maxLength = 32, isDataId = true, isArea = true)
@Schema(description = "社保缴纳地-省", name = "fileProvince")
private Integer socialProvince;
/**
* 社保缴纳地-市
*/
@Length(max = 32, message = "不能超过32个字符")
@ExcelAttribute(name = "社保缴纳地-市", maxLength = 32, isDataId = true, isArea = true, parentField = "socialProvince")
@Schema(description = "社保缴纳地-市", name = "fileCity")
private Integer socialCity;
/**
* 社保缴纳地-县
*/
@Length(max = 32, message = "不能超过32个字符")
@ExcelAttribute(name = "社保缴纳地-县", maxLength = 32, isDataId = true, isArea = true, parentField = "socialCity")
@Schema(description = "社保缴纳地-县", name = "fileTown")
private Integer socialTown;
/**
* 社保缴纳月份empNo
*/
@Length(max = 6, message = "社保缴纳月份不能超过6个字符")
@ExcelAttribute(name = "社保缴纳月份", maxLength = 6)
@Schema(description = "社保缴纳月份", name = "socialPayMonth")
private String socialPayMonth;
/**
* 社保生成月份
*/
@Length(max = 6, message = "社保生成月份不能超过6个字符")
@ExcelAttribute(name = "社保生成月份", maxLength = 6)
@Schema(description = "社保生成月份", name = "socialCreateMonth")
private String socialCreateMonth;
/**
* 创建人
*/
@Length(max = 32, message = "创建人不能超过32个字符")
@ExcelAttribute(name = "创建人", maxLength = 32)
@Schema(description = "创建人", name = "createUser")
private String createUser;
/**
* 最后更新人
*/
@Length(max = 32, message = "最后更新人不能超过32个字符")
@ExcelAttribute(name = "最后更新人", maxLength = 32)
@Schema(description = "最后更新人", name = "lastUpdateUser")
private String lastUpdateUser;
/**
* 最后更新时间
*/
@ExcelAttribute(name = "最后更新时间")
@Schema(description = "最后更新时间", name = "lastUpdateTime")
private LocalDateTime lastUpdateTime;
/**
* 锁定状态 0 未锁定 1 锁定
*/
@Length(max = 1, message = "锁定状态 0 未锁定 1 锁定不能超过1个字符")
@ExcelAttribute(name = "锁定状态 0 未锁定 1 锁定", maxLength = 1)
@Schema(description = "锁定状态 0 未锁定 1 锁定", name = "lockStatus")
private String lockStatus;
/**
* 结算状态 0: 未结算 1: 待结算 2: 已结算
*/
@Length(max = 1, message = "结算状态 0: 未结算 1: 待结算 2: 已结算不能超过1个字符")
@ExcelAttribute(name = "结算状态", maxLength = 1,isDataId = true,dataType = "settlement_flag")
@Schema(description = "结算状态 0: 未结算 1: 待结算 2: 已结算", name = "settlementFlag")
private String settlementFlag;
/**
* 公积金缴纳月份
*/
@Length(max = 6, message = "公积金缴纳月份不能超过6个字符")
@ExcelAttribute(name = "公积金缴纳月份", maxLength = 6)
@Schema(description = "公积金缴纳月份", name = "providentPayMonth")
private String providentPayMonth;
/**
* 公积金生成月份
*/
@Length(max = 6, message = "公积金生成月份不能超过6个字符")
@ExcelAttribute(name = "公积金生成月份", maxLength = 6)
@Schema(description = "公积金生成月份", name = "providentCreateMonth")
private String providentCreateMonth;
/**
* 公积金户
*/
@Length(max = 32, message = "公积金户不能超过32个字符")
@ExcelAttribute(name = "公积金户", maxLength = 32,isDataId = true,dataType = ExcelAttributeConstants.HOUSEHOLD)
@Schema(description = "公积金户", name = "providentHousehold")
private String providentHousehold;
/**
* 公积金缴纳地
*/
@Length(max = 50, message = "公积金缴纳地不能超过50个字符")
@ExcelAttribute(name = "公积金缴纳地", maxLength = 50)
@Schema(description = "公积金缴纳地", name = "providentPayAddr")
private String providentPayAddr;
/**
* 缴纳地-省
*/
@Length(max = 32, message = "不能超过32个字符")
@ExcelAttribute(name = "公积金缴纳地-省", maxLength = 32, isDataId = true, isArea = true)
@Schema(description = "公积金缴纳地-省", name = "fundProvince")
private Integer fundProvince;
/**
* 缴纳地-市
*/
@Length(max = 32, message = "不能超过32个字符")
@ExcelAttribute(name = "公积金缴纳地-市", maxLength = 32, isDataId = true, isArea = true, parentField = "fundProvince")
@Schema(description = "公积金缴纳地-市", name = "fundCity")
private Integer fundCity;
/**
* 缴纳地-县
*/
@Length(max = 32, message = "不能超过32个字符")
@ExcelAttribute(name = "公积金缴纳地-县", maxLength = 32, isDataId = true, isArea = true, parentField = "fundlCity")
@Schema(description = "公积金缴纳地-县", name = "fundTown")
private Integer fundTown;
/**
* 社保ID
*/
@Length(max = 32, message = "不能超过32个字符")
@ExcelAttribute(name = "社保ID", maxLength = 32, isDataId = true)
@Schema(description = "社保ID", name = "socialId")
private String socialId;
/**
* 公积金ID
*/
@Length(max = 32, message = "不能超过32个字符")
@ExcelAttribute(name = "公积金ID", maxLength = 32, isDataId = true)
@Schema(description = "公积金ID", name = "fundId")
private String fundId;
/**
* 社保合计
*/
@ExcelAttribute(name = "社保合计")
@Schema(description = "社保合计", name = "socialSum")
private BigDecimal socialSum;
/**
* 单位社保合计
*/
@ExcelAttribute(name = "单位社保合计")
@Schema(description = "单位社保合计", name = "unitSocialSum")
private BigDecimal unitSocialSum;
/**
* 个人社保合计
*/
@ExcelAttribute(name = "个人社保合计")
@Schema(description = "个人社保合计", name = "socialSecurityPersonalSum")
private BigDecimal socialSecurityPersonalSum;
/**
* 公积金总合计
*/
@ExcelAttribute(name = "公积金总合计")
@Schema(description = "公积金总合计", name = "providentSum")
private BigDecimal providentSum;
/**
* 总合计
*/
@ExcelAttribute(name = "总合计")
@Schema(description = "总合计", name = "sumAll")
private BigDecimal sumAll;
/**
* 创建时间
*/
@ExcelAttribute(name = "创建时间")
@Schema(description = "创建时间", name = "createTime")
private LocalDateTime createTime;
/**
* 就职班组
*/
@Length(max = 50, message = "就职班组不能超过50个字符")
@ExcelAttribute(name = "就职班组", maxLength = 50)
@Schema(description = "就职班组", name = "inauguralTeam")
private String inauguralTeam;
/**
* 电信编号
*/
@Length(max = 50, message = "电信编号不能超过50个字符")
@ExcelAttribute(name = "电信编号", maxLength = 50)
@Schema(description = "电信编号", name = "telecomNumber")
private String telecomNumber;
/***************************社保明细**************************/
/**
* 单位社保补缴利息
*/
@ExcelAttribute(name = "单位补缴利息")
@Schema(description = "单位补缴利息", name = "companyAccrual")
private BigDecimal companyAccrual;
/**
* 个人社保补缴利息
*/
@ExcelAttribute(name = "个人补缴利息")
@Schema(description = "个人补缴利息", name = "personalAccrual")
private BigDecimal personalAccrual;
/**
* 单位养老基数
*/
@ExcelAttribute(name = "养老基数")
@Schema(description = "养老基数", name = "unitPensionSet")
private BigDecimal unitPensionSet;
/**
* 单位医疗基数
*/
@ExcelAttribute(name = "医保基数")
@Schema(description = "医保基数", name = "unitMedicalSet")
private BigDecimal unitMedicalSet;
/**
* 单位失业基数
*/
@ExcelAttribute(name = "失业基数")
@Schema(description = "失业基数", name = "unitUnemploymentSet")
private BigDecimal unitUnemploymentSet;
/**
* 单位工伤基数
*/
@ExcelAttribute(name = "工伤基数")
@Schema(description = "工伤基数", name = "unitInjurySet")
private BigDecimal unitInjurySet;
/**
* 单位生育基数
*/
@ExcelAttribute(name = "生育基数")
@Schema(description = "生育基数", name = "unitBirthSet")
private BigDecimal unitBirthSet;
/**
* 个人养老基数
*/
@ExcelAttribute(name = "个人养老基数")
@Schema(description = "个人养老基数", name = "personalPensionSet")
private BigDecimal personalPensionSet;
/**
* 个人医疗基数
*/
@ExcelAttribute(name = "个人医疗基数")
@Schema(description = "个人医疗基数", name = "personalMedicalSet")
private BigDecimal personalMedicalSet;
/**
* 个人失业基数
*/
@ExcelAttribute(name = "个人失业基数")
@Schema(description = "个人失业基数", name = "personalUnemploymentSet")
private BigDecimal personalUnemploymentSet;
/**
* 单位养老比例
*/
@ExcelAttribute(name = "单位养老比例")
@Schema(description = "单位养老比例", name = "unitPensionPer")
private BigDecimal unitPensionPer;
/**
* 单位医疗比例
*/
@ExcelAttribute(name = "单位医疗比例")
@Schema(description = "单位医疗比例", name = "unitMedicalPer")
private BigDecimal unitMedicalPer;
/**
* 单位失业比例
*/
@ExcelAttribute(name = "单位失业比例")
@Schema(description = "单位失业比例", name = "unitUnemploymentPer")
private BigDecimal unitUnemploymentPer;
/**
* 单位工伤比例
*/
@ExcelAttribute(name = "单位工伤比例")
@Schema(description = "单位工伤比例", name = "unitInjuryPer")
private BigDecimal unitInjuryPer;
/**
* 单位生育比例
*/
@ExcelAttribute(name = "单位生育比例")
@Schema(description = "单位生育比例", name = "unitBirthPer")
private BigDecimal unitBirthPer;
/**
* 个人养老比例
*/
@ExcelAttribute(name = "个人养老比例")
@Schema(description = "个人养老比例", name = "personalPensionPer")
private BigDecimal personalPensionPer;
/**
* 个人医疗比例
*/
@ExcelAttribute(name = "个人医疗比例")
@Schema(description = "个人医疗比例", name = "personalMedicalPer")
private BigDecimal personalMedicalPer;
/**
* 个人失业比例
*/
@ExcelAttribute(name = "个人失业比例")
@Schema(description = "个人失业比例", name = "personalUnemploymentPer")
private BigDecimal personalUnemploymentPer;
/**
* 单位大病比例
*/
@ExcelAttribute(name = "单位大病比例")
@Schema(description = "单位大病比例", name = "unitBigailmentPer")
private BigDecimal unitBigailmentPer;
/**
* 个人大病比例
*/
@ExcelAttribute(name = "个人大病比例")
@Schema(description = "个人大病比例", name = "personalBigailmentPer")
private BigDecimal personalBigailmentPer;
/**
* 单位养老金额
*/
@ExcelAttribute(name = "养老单位缴费")
@Schema(description = "养老单位缴费", name = "unitPensionMoney")
private BigDecimal unitPensionMoney;
/**
* 单位医疗金额
*/
@ExcelAttribute(name = "医保单位缴费")
@Schema(description = "医保单位缴费", name = "unitMedicalMoney")
private BigDecimal unitMedicalMoney;
/**
* 单位失业金额
*/
@ExcelAttribute(name = "失业单位缴费")
@Schema(description = "失业单位缴费", name = "unitUnemploymentMoney")
private BigDecimal unitUnemploymentMoney;
/**
* 单位工伤金额
*/
@ExcelAttribute(name = "工伤缴费")
@Schema(description = "工伤缴费", name = "unitInjuryMoney")
private BigDecimal unitInjuryMoney;
/**
* 单位生育金额
*/
@ExcelAttribute(name = "生育缴费")
@Schema(description = "生育缴费", name = "unitBirthMoney")
private BigDecimal unitBirthMoney;
/**
* 单位大病金额
*/
@ExcelAttribute(name = "单位医疗救助金")
@Schema(description = "单位医疗救助金", name = "unitBigmailmentMoney")
private BigDecimal unitBigmailmentMoney;
/**
* 个人养老金额
*/
@ExcelAttribute(name = "养老个人缴费")
@Schema(description = "养老个人缴费", name = "personalPensionMoney")
private BigDecimal personalPensionMoney;
/**
* 个人医疗金额
*/
@ExcelAttribute(name = "医保个人缴费")
@Schema(description = "医保个人缴费", name = "personalMedicalMoney")
private BigDecimal personalMedicalMoney;
/**
* 个人失业金额
*/
@ExcelAttribute(name = "失业个人缴费")
@Schema(description = "失业个人缴费", name = "personalUnemploymentMoney")
private BigDecimal personalUnemploymentMoney;
/**
* 个人大病金额
*/
@ExcelAttribute(name = "个人医疗救助金")
@Schema(description = "个人医疗救助金", name = "personalBigmailmentMoney")
private BigDecimal personalBigmailmentMoney;
/************************公积金明细***************************/
/**
* 公积金编号
*/
@Length(max = 50, message = "公积金编号不能超过50个字符")
@ExcelAttribute(name = "公积金编号", maxLength = 50)
@Schema(description = "公积金编号", name = "providentNo")
private String providentNo;
/**
* 单位公积金基数
*/
@ExcelAttribute(name = "公积金单边基数")
@Schema(description = "公积金单边基数", name = "unitProvidentSet")
private BigDecimal unitProvidentSet;
/**
* 单边公积金比例
*/
@ExcelAttribute(name = "公积金单边比例")
@Schema(description = "公积金单边比例", name = "providentPercent")
private BigDecimal providentPercent;
/**
* 单位公积金费用
*/
@ExcelAttribute(name = "公积金单边金额")
@Schema(description = "公积金单边金额", name = "unitProvidentSum")
private BigDecimal unitProvidentSum;
/**
* 个人公积金基数
*/
@ExcelAttribute(name = "个人公积金基数")
@Schema(description = "个人公积金基数", name = "personalProidentSet")
private BigDecimal personalProidentSet;
/**
* 个人公积金费用
*/
@ExcelAttribute(name = "个人公积金费用")
@Schema(description = "个人公积金费用", name = "personalProvidentSum")
private BigDecimal personalProvidentSum;
/**
* 社保结算状态 0: 未结算 1: 待结算 2: 已结算
*/
@ExcelAttribute(name = "社保结算状态", maxLength = 1,isDataId = true,dataType = "settlement_flag")
@Schema(description = "社保结算状态 0: 未结算 1: 待结算 2: 已结算", name = "socialSettlementFlag")
private String socialSettlementFlag;
/**
* 公积金结算状态 0: 未结算 1: 待结算 2: 已结算
*/
@ExcelAttribute(name = "公积金结算状态", maxLength = 1,isDataId = true,dataType = "settlement_flag")
@Schema(description = "公积金结算状态 0: 未结算 1: 待结算 2: 已结算", name = "fundSettlementFlag")
private String fundSettlementFlag;
/**
* 社保核准表ID
*/
@ExcelAttribute(name = "社保核准表ID", maxLength = 32)
@Schema(description = "社保核准表ID", name = "socialSettlementId")
private String socialSettlementId;
/**
* 公积金核准表ID
*/
@ExcelAttribute(name = "公积金核准表ID", maxLength = 32)
@Schema(description = "公积金核准表ID", name = "fundSettlementId")
private String fundSettlementId;
/**
* 工资社保结算状态 0: 未结算 1: 待结算 2: 已结算
*/
@Length(max = 1, message = "工资社保结算状态 0: 未结算 1: 已结算不能超过1个字符")
@ExcelAttribute(name = "工资社保结算状态", maxLength = 1,isDataId = true,dataType = "settlement_flag")
@Schema(description = "工资社保结算状态 0: 未结算 1: 已结算", name = "salarySocialFlag")
private String salarySocialFlag;
/**
* 工资公积金结算状态 0: 未结算 1: 待结算 2: 已结算
*/
@Length(max = 1, message = "工资公积金结算状态 0: 未结算 1: 已结算不能超过1个字符")
@ExcelAttribute(name = "工资公积金结算状态", maxLength = 1,isDataId = true,dataType = "settlement_flag")
@Schema(description = "工资公积金结算状态 0: 未结算 1: 已结算", name = "salaryFundFlag")
private String salaryFundFlag;
}
package com.yifu.cloud.plus.v1.yifu.social.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.EmpBusinessConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ServiceNameConstants;
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.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.social.service.TPaymentInfoService;
import com.yifu.cloud.plus.v1.yifu.social.service.TProvidentFundService;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialInfoService;
import com.yifu.cloud.plus.v1.yifu.social.vo.*;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
* B端社保相关接口
* @Author fxj
* @Date 2020-08-25
* @return
**/
@RestController
@AllArgsConstructor
@RequestMapping(value = "/customerBusiness/dispatchBusiness")
@Tag(name = "B端社保相关接口")
@Slf4j
@SuppressWarnings({"SpringJavaInjectionPointsAutowiringInspection"})
public class DispatchBusinessController {
private final TSocialInfoService tSocialInfoService;
private final TProvidentFundService tProvidentFundService;
private final TPaymentInfoService tPaymentInfoService;
/**
* 通过ID查询员工对应社保的派增派减数据
* @Author fxj
* @Date 2020-08-25
* @param empId
* @return
**/
@Operation(description = "通过ID查询员工对应社保的派增派减数据")
@GetMapping("/getSocialAddOrReduceByEmpId")
public R<SocialAddAndReduceVo> getSocialAddOrReduceByEmpId(@RequestParam(value = "empId" ) String empId) {
return new R<>(tSocialInfoService.getAddOrReduceInfoByEmpId(empId));
}
/**
* 通过ID查询员工对应公积金的派增派减数据
* @Author fxj
* @Date 2020-08-25
* @param empId
* @return
**/
@Operation(description = "通过ID查询员工对应公积金的派增派减数据")
@GetMapping("/getFundAddOrReduceByEmpId")
public R<FundAddAndReduceVo> getFundAddOrReduceByEmpId(@RequestParam(value = "empId" ) String empId) {
return new R<>(tProvidentFundService.getAddOrReduceInfoByEmpId(empId));
}
/**
* 按年查询指定人的缴费库数据
* @Author fxj
* @Date 2020-08-25
* @param year
* @param empId
* @return
**/
@Operation(description = "按年查询指定人的缴费库数据:年格式YYYY")
@GetMapping("/getPaymentByYearAndEmpId")
public R<List<PaymentBusinessPageVo>> getPaymentByYearAndEmpId(@RequestParam(value = "year" ) String year, @RequestParam(value = "empId" ) String empId) {
if (!Common.isNotNull(year) && !Common.isNotNull(empId)){
return R.failed("请传参年分和员工ID!");
}
return new R<>(tPaymentInfoService.getPaymentByYearAndEmpId(year,empId));
}
/**
* 按年月查询指定人的缴费库数据:年月格式 yyyyMM
* @Author fxj
* @Date 2020-08-25
* @param month
* @param empId
* @return
**/
@Operation(description = "按年月查询指定人的缴费库数据:年月格式 yyyyMM")
@GetMapping("/getPaymentByMonthAndEmpId")
public R<PaymentBusinessPageVo> getPaymentByMonthAndEmpId(@RequestParam(value = "month" ) String month, @RequestParam(value = "empId" ) String empId) {
if (!Common.isNotNull(month) && !Common.isNotNull(empId)){
return R.failed("请传参月份和员工ID!");
}
return new R<>(tPaymentInfoService.getPaymentByMonthAndEmpId(month,empId));
}
/**
* B端社保公积金列表查询
* @Author fxj
* @Date 2020-08-28
* @param page
* @param socialAndFundBusinessPageVo
* @return
**/
@Operation(description = "B端社保公积金列表查询接口")
@GetMapping("/getSocialAndFundBusinessPage")
public R<List<SocialAndFundBusinessPageVo>> getSocialAndFundBusinessPage(Page<SocialAndFundBusinessPageVo> page, SocialAndFundBusinessPageVo socialAndFundBusinessPageVo) {
YifuUser user = SecurityUtils.getUser();
if (user == null) {
return R.failed("请登录!");
}
if (null == socialAndFundBusinessPageVo || !Common.isNotNull(socialAndFundBusinessPageVo.getYear())){
return R.failed("请选择年份!");
}
List<String> settleDomainIds = new ArrayList<>();
boolean flag = !SecurityUtils.isHaveAllOrg(ServiceNameConstants.CLIENT_ID_HR_B, user);
if (flag){
settleDomainIds = user.getSettleIdList();
if (Common.isEmpty(settleDomainIds)) {
return R.failed(EmpBusinessConstants.noSettleDomainAuth);
}
if (Common.isNotNull(socialAndFundBusinessPageVo.getSettleDomainId())){
// 无权限提示 有权限 按结算主体/项目ID 查询
if (checkUserAuth(socialAndFundBusinessPageVo.getSettleDomainId(),settleDomainIds)){
return R.failed(EmpBusinessConstants.noSettleDomainAuth);
}
settleDomainIds = null;
}
// 管理员权限特殊处理
}else {
if (Common.isEmpty(socialAndFundBusinessPageVo.getSettleDomainId())){
return new R<>(null);
}
}
return new R<>(tPaymentInfoService.getSocialAndFundBusinessPage(page, socialAndFundBusinessPageVo, settleDomainIds));
}
private static boolean checkUserAuth(String idStr, List<String> settleDomainIds) {
for (String id:settleDomainIds){
if (id.equals(idStr)){
return false;
}
}
return true;
}
/**
* 按月查询对应权限的缴费库数据
* @Author fxj
* @Date 2020-08-31
* @param paymentBusinessPageVo
* @param type 0 查询所有 1 查询对应月份派增的人员缴费库
* @return
**/
@Operation(description = "按月查询对应权限的缴费库数据:格式yyyyMM;type 0 查询所有 1 查询对应月份派增的人员缴费库")
@GetMapping("/getPaymentByMonthAndAuth")
public R<IPage<PaymentBusinessPageVo>> getPaymentByMonthAndAuth(Page<PaymentBusinessPageVo> page,
PaymentBusinessPageVo paymentBusinessPageVo,
@RequestParam(value = "type" , required = false) String type) {
if (null == paymentBusinessPageVo || !Common.isNotNull(paymentBusinessPageVo.getMonth())){
return R.failed("请选择年月!");
}
YifuUser user = SecurityUtils.getUser();
if (user == null) {
return R.failed("请登录!");
}
List<String> settleDomainIds = new ArrayList<>();
boolean flag = !Common.isNotNull(paymentBusinessPageVo.getSettleDomainId()) && !SecurityUtils.isHaveAllOrg(ServiceNameConstants.CLIENT_ID_HR_B, user);
if (flag){
settleDomainIds = user.getSettleIdList();
if (settleDomainIds == null || settleDomainIds.isEmpty()) {
return R.failed(EmpBusinessConstants.noSettleDomainAuth);
}
}
if (!Common.isNotNull(paymentBusinessPageVo.getSettleDomainId()) && !Common.isNotNull(settleDomainIds)){
return R.failed(EmpBusinessConstants.selectSettleDomainOrCallManager);
}
return new R<>(tPaymentInfoService.getPaymentByMonthAndAuth(page,paymentBusinessPageVo,settleDomainIds,type));
}
/**
* 按年月查询指定结算主体或权限内的缴费库数据统计
* @Author fxj
* @Date 2020-08-31
* @param month
* @param settleDomainId
* @return
**/
@Operation(description = "按年月查询指定结算主体或权限内的缴费库数据统计")
@GetMapping("/getPaymentBusinessPageDetailByMonthAndAuth")
public R<PaymentBusinessPageDetail> getPaymentBusinessPageDetailByMonthAndAuth(@RequestParam String month
, @RequestParam(value = "settleDomainId" , required = false) String settleDomainId) {
if (!Common.isNotNull(month)){
return R.failed("请传参月份!");
}
YifuUser user = SecurityUtils.getUser();
if (user == null) {
return R.failed("请登录!");
}
List<String> settleDomainIds = new ArrayList<>();
if (!Common.isNotNull(settleDomainId) && !SecurityUtils.isHaveAllOrg(ServiceNameConstants.CLIENT_ID_HR_B, user)){
settleDomainIds = user.getSettleIdList();
if (settleDomainIds == null || settleDomainIds.isEmpty()) {
return R.failed(EmpBusinessConstants.noSettleDomainAuth);
}
}
if (!Common.isNotNull(settleDomainId) && !Common.isNotNull(settleDomainIds)){
return R.failed(EmpBusinessConstants.selectSettleDomainOrCallManager);
}
return new R<>(tPaymentInfoService.getPaymentBusinessPageDetailByMonthAndAuth(month,settleDomainId,settleDomainIds));
}
/**
* 查询派减的社保和公积金的分页数据
* @Author fxj
* @Date 2020-08-31
* @param page
* @param month
* @param settleDomainId
* @return
**/
@Operation(description = "查询派减的社保和公积金的分页数据")
@GetMapping("/getSocialAndFundReduceInfo")
public R<IPage<SocialAndFundReduceBusinessVo>> getSocialAndFundReduceInfo(Page<SocialAndFundReduceBusinessVo> page
, @RequestParam String month, @RequestParam(value = "settleDomainId" , required = false) String settleDomainId) {
if (!Common.isNotNull(month)){
return R.failed("请传参月份!");
}
YifuUser user = SecurityUtils.getUser();
if (user == null) {
return R.failed("请登录!");
}
List<String> settleDomainIds = new ArrayList<>();
boolean flag = !Common.isNotNull(settleDomainId) && !SecurityUtils.isHaveAllOrg(ServiceNameConstants.CLIENT_ID_HR_B, user);
if (flag){
settleDomainIds = user.getSettleIdList();
if (settleDomainIds == null || settleDomainIds.isEmpty()) {
return R.failed(EmpBusinessConstants.noSettleDomainAuth);
}
}
if (!Common.isNotNull(settleDomainId) && !Common.isNotNull(settleDomainIds)){
return R.failed(EmpBusinessConstants.selectSettleDomainOrCallManager);
}
return new R<>(tPaymentInfoService.getSocialAndFundReduceInfo(page,month,settleDomainId,settleDomainIds));
}
}
...@@ -24,10 +24,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo; ...@@ -24,10 +24,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TPaymentBySalaryVo; import com.yifu.cloud.plus.v1.yifu.salary.vo.TPaymentBySalaryVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.UpdateSocialFoundVo; import com.yifu.cloud.plus.v1.yifu.salary.vo.UpdateSocialFoundVo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfo; import com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoBatchVo; import com.yifu.cloud.plus.v1.yifu.social.vo.*;
import com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoExportVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoSearchVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -240,4 +237,76 @@ public interface TPaymentInfoMapper extends BaseMapper<TPaymentInfo> { ...@@ -240,4 +237,76 @@ public interface TPaymentInfoMapper extends BaseMapper<TPaymentInfo> {
*/ */
long getTPaymentFundIncomeCount(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo, long getTPaymentFundIncomeCount(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo,
@Param("userId") String userId); @Param("userId") String userId);
/**
* B端使用,查询缴费库信息
* @Author fxj
* @Date 2019-10-12
* @param paymentInfo
* @param settleDomainIds
* @param idsStr
* @param empIds
* @return
**/
List<TPaymentAllInfoVo> getPaymentAllInfoList(@Param("tPaymentInfo") TPaymentInfo paymentInfo
, @Param("settleDomainIds") List<String> settleDomainIds, @Param("idsStr") List<String> idsStr
, @Param("empIds")List<String> empIds);
/**
* B端社保公积金列表查询
* @Author fxj
* @Date 2020-08-28
* @param socialAndFundBusinessPageVo
* @param settleDomainIds
* @return
**/
List<SocialAndFundBusinessPageVo> getSocialAndFundBusinessDataPage(
@Param("socialAndFundBusinessPageVo") SocialAndFundBusinessPageVo socialAndFundBusinessPageVo
, @Param("settleDomainIds")List<String> settleDomainIds);
/**
* B端社保公积金列表查询
* @Author fxj
* @Date 2020-08-28
* @param socialAndFundBusinessPageVo
* @param settleDomainIds
* @return
**/
List<SocialAndFundBusinessPageVo> getSocialAndFundBusinessDataCount(
@Param("socialAndFundBusinessPageVo")SocialAndFundBusinessPageVo socialAndFundBusinessPageVo
, @Param("settleDomainIds")List<String> settleDomainIds);
// B端
List<String> getSocialOrFundAddEmpIds(@Param("month")String month, @Param("settleDomainId")String settleDomainId
, @Param("settleDomainIds")List<String> settleDomainIds);
// B端
IPage<PaymentBusinessPageVo> getPaymentBusinessPageVo(Page page
, @Param("paymentBusinessPageVo") PaymentBusinessPageVo paymentBusinessPageVo
, @Param("settleDomainIds") List<String> settleDomainIds, @Param("empIds")List<String> empIds);
/**
* B端-获取派增社保或公积金人数
* @Author fxj
* @Date 2020-08-31
* @param month
* @param settleDomainId
* @param settleDomainIds
* @param type 0 获取所有办理成功状态的社保和公积金人数 1 获取所有本月派增办理成功的社保或公积金人数
* @return
**/
int getSocialOrFundAddCount(@Param("month") String month, @Param("settleDomainId") String settleDomainId, @Param("settleDomainIds") List<String> settleDomainIds, @Param("type")Integer type);
/**
* B端
* @Author fxj
* @Date 2020-08-31
* @param month
* @param settleDomainId
* @param settleDomainIds
* @return
**/
int getSocialOrFundReduceCount(@Param("month")String month, @Param("settleDomainId")String settleDomainId, @Param("settleDomainIds")List<String> settleDomainIds);
IPage<SocialAndFundReduceBusinessVo> getSocialAndFundReduceInfo(Page page, @Param("month")String month
, @Param("settleDomainId")String settleDomainId, @Param("settleDomainIds")List<String> settleDomainIds);
} }
...@@ -25,9 +25,7 @@ import com.yifu.cloud.plus.v1.yifu.salary.vo.TPaymentBySalaryVo; ...@@ -25,9 +25,7 @@ import com.yifu.cloud.plus.v1.yifu.salary.vo.TPaymentBySalaryVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TPaymentVo; import com.yifu.cloud.plus.v1.yifu.salary.vo.TPaymentVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.UpdateSocialFoundVo; import com.yifu.cloud.plus.v1.yifu.salary.vo.UpdateSocialFoundVo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfo; import com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfo;
import com.yifu.cloud.plus.v1.yifu.social.vo.ChangeDeptVo; import com.yifu.cloud.plus.v1.yifu.social.vo.*;
import com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoSearchVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoVo;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.InputStream; import java.io.InputStream;
...@@ -171,4 +169,65 @@ public interface TPaymentInfoService extends IService<TPaymentInfo> { ...@@ -171,4 +169,65 @@ public interface TPaymentInfoService extends IService<TPaymentInfo> {
void updateSocialSettleStatus(List<EkpSocialViewVo> viewVo); void updateSocialSettleStatus(List<EkpSocialViewVo> viewVo);
// hgw2023-1-6 10:42:06:以下:B端相关接口:
/**
* hgwB端相关接口-按年查询指定人的缴费库数据
* @Author fxj
* @Date 2020-08-25
* @param year
* @param empId
* @return
**/
List<PaymentBusinessPageVo> getPaymentByYearAndEmpId(String year, String empId);
/**
* hgwB端相关接口-按年月查询指定人的缴费库数据:年月格式 yyyyMM
* @Author fxj
* @Date 2020-08-25
* @param month
* @param empId
* @return
**/
PaymentBusinessPageVo getPaymentByMonthAndEmpId(String month, String empId);
/**
* hgwB端相关接口-B端社保公积金列表查询
* @Author fxj
* @Date 2020-08-28
* @param page
* @param socialAndFundBusinessPageVo
* @param settleDomainIds
* @return
**/
List<SocialAndFundBusinessPageVo> getSocialAndFundBusinessPage(Page<SocialAndFundBusinessPageVo> page, SocialAndFundBusinessPageVo socialAndFundBusinessPageVo, List<String> settleDomainIds);
/**
* hgwB端相关接口-按月查询对应权限的缴费库数据
* @Author fxj
* @Date 2020-08-25
* @param paymentBusinessPageVo
* @param settleDomainIds
* @param type
* @return
**/
IPage<PaymentBusinessPageVo> getPaymentByMonthAndAuth(Page<PaymentBusinessPageVo> page,PaymentBusinessPageVo paymentBusinessPageVo, List<String> settleDomainIds, String type);
/**
* hgwB端相关接口-按年月查询指定结算主体或权限内的缴费库数据统计
* @Author fxj
* @Date 2020-08-31
* @param month
* @param settleDomainId
* @return
**/
PaymentBusinessPageDetail getPaymentBusinessPageDetailByMonthAndAuth(String month, String settleDomainId, List<String> settleDomainIds);
/**
* hgwB端相关接口-查询派减的社保和公积金的分页数据
* @Author fxj
* @Date 2020-08-31
* @param page
* @param month
* @param settleDomainId
* @return
**/
IPage<SocialAndFundReduceBusinessVo> getSocialAndFundReduceInfo(Page<SocialAndFundReduceBusinessVo> page, String month, String settleDomainId, List<String> settleDomainIds);
// hgw2023-1-6 10:42:06:以上:B端相关接口
} }
...@@ -23,6 +23,7 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -23,6 +23,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage; 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.util.R;
import com.yifu.cloud.plus.v1.yifu.social.entity.TProvidentFund; import com.yifu.cloud.plus.v1.yifu.social.entity.TProvidentFund;
import com.yifu.cloud.plus.v1.yifu.social.vo.FundAddAndReduceVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TProvidentFundSearchVo; import com.yifu.cloud.plus.v1.yifu.social.vo.TProvidentFundSearchVo;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -47,4 +48,13 @@ public interface TProvidentFundService extends IService<TProvidentFund> { ...@@ -47,4 +48,13 @@ public interface TProvidentFundService extends IService<TProvidentFund> {
void listExport(HttpServletResponse response, TProvidentFundSearchVo searchVo); void listExport(HttpServletResponse response, TProvidentFundSearchVo searchVo);
List<TProvidentFund> noPageDiy(TProvidentFundSearchVo searchVo); List<TProvidentFund> noPageDiy(TProvidentFundSearchVo searchVo);
/**
* B端使用-通过ID查询员工对应的派增派减数据
* @Author fxj
* @Date 2020-08-25
* @param empId
* @return
**/
FundAddAndReduceVo getAddOrReduceInfoByEmpId(String empId);
} }
...@@ -23,6 +23,7 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -23,6 +23,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage; 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.util.R;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialInfo; import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialInfo;
import com.yifu.cloud.plus.v1.yifu.social.vo.SocialAddAndReduceVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TSocialInfoSearchVo; import com.yifu.cloud.plus.v1.yifu.social.vo.TSocialInfoSearchVo;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -47,4 +48,13 @@ public interface TSocialInfoService extends IService<TSocialInfo> { ...@@ -47,4 +48,13 @@ public interface TSocialInfoService extends IService<TSocialInfo> {
void listExport(HttpServletResponse response, TSocialInfoSearchVo searchVo); void listExport(HttpServletResponse response, TSocialInfoSearchVo searchVo);
List<TSocialInfo> noPageDiy(TSocialInfoSearchVo searchVo); List<TSocialInfo> noPageDiy(TSocialInfoSearchVo searchVo);
/**
* B端使用-通过ID查询员工对应的派增派减数据
* @Author fxj
* @Date 2020-08-25
* @param empId
* @return
**/
SocialAddAndReduceVo getAddOrReduceInfoByEmpId(String empId);
} }
...@@ -3341,4 +3341,375 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -3341,4 +3341,375 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
} }
return mapSelectVo; return mapSelectVo;
} }
// hgw2023-1-6 10:44:00以下:B端相关接口
/**
* 按年查询指定人的缴费库数据
* @Author fxj
* @Date 2020-08-25
* @param year
* @param empId
**/
@Override
public List<PaymentBusinessPageVo> getPaymentByYearAndEmpId(String year, String empId) {
List<PaymentBusinessPageVo> voList = new ArrayList<>();
TPaymentInfo paymentInfo = new TPaymentInfo();
paymentInfo.setEmpId(empId);
paymentInfo.setLikeYear(year);
getPaymentBusinessPagesVoList(voList, paymentInfo,null, null);
//排序
paymentBusinessVosortByMonth(voList);
return voList;
}
/**
* 缴费月份倒序
* @Author pwang
* @Date 2020-09-18 10:41
* @param list
* @return
**/
private void paymentBusinessVosortByMonth(List<PaymentBusinessPageVo> list){
Collections.sort(list, new Comparator<PaymentBusinessPageVo>() {
@Override
public int compare(PaymentBusinessPageVo o1, PaymentBusinessPageVo o2) {
return o2.getMonth().compareTo(o1.getMonth());
}
});
}
private void getPaymentBusinessPagesVoList(List<PaymentBusinessPageVo> voList, TPaymentInfo paymentInfo
, List<String> settleDomainIds, List<String> empIds) {
List<TPaymentAllInfoVo> paymentAllInfoVoList = baseMapper.getPaymentAllInfoList(paymentInfo, settleDomainIds
, null,empIds);
HashMap<String,PaymentBusinessPageVo> pageVoHashMap = new HashMap<>();
if (Common.isNotNull(paymentAllInfoVoList)){
PaymentBusinessPageVo pageVo;
for (TPaymentAllInfoVo infoVo:paymentAllInfoVoList){
pageVo = pageVoHashMap.get(infoVo.getSocialPayMonth());
if (null == pageVo){
pageVo = new PaymentBusinessPageVo();
}
if (Common.isNotNull(infoVo.getSocialPayMonth())){
pageVo.setMonth(infoVo.getSocialPayMonth());
}
// 处理合计
initPaymentSum(pageVo,false, infoVo);
pageVoHashMap.put(infoVo.getSocialPayMonth(),pageVo);
}
}
if (Common.isNotNull(pageVoHashMap)){
voList.addAll(sortValues(pageVoHashMap));
}
}
private Collection sortValues(HashMap<String,PaymentBusinessPageVo> pageVoHashMap){
List<PaymentBusinessPageVo> temp = new ArrayList<>();
if (!pageVoHashMap.isEmpty()){
Set set = pageVoHashMap.keySet();
Object[] arr = set.toArray();
Arrays.sort(arr);
for (int i=arr.length-1;i>=0;i--) {
temp.add(pageVoHashMap.get(arr[i]));
}
}
return temp;
}
/**
* 按年月查询指定人的缴费库数据:年月格式 YYYYMM
* @Author fxj
* @Date 2020-08-25
* @param month
* @param empId
**/
@Override
public PaymentBusinessPageVo getPaymentByMonthAndEmpId(String month, String empId) {
TPaymentInfo paymentInfo = new TPaymentInfo();
paymentInfo.setEmpId(empId);
paymentInfo.setSocialPayMonth(month);
PaymentBusinessPageVo pageVo = getPaymentBusinessPageVo(paymentInfo);
return pageVo;
}
private PaymentBusinessPageVo getPaymentBusinessPageVo(TPaymentInfo paymentInfo) {
List<TPaymentAllInfoVo> paymentAllInfoVoList = baseMapper.getPaymentAllInfoList(paymentInfo, null, null, null);
PaymentBusinessPageVo pageVo = new PaymentBusinessPageVo();
if (Common.isNotNull(paymentAllInfoVoList)){
boolean isRefund;
boolean isSocial;
boolean isInjury;
for (TPaymentAllInfoVo infoVo:paymentAllInfoVoList){
if (Common.isNotNull(infoVo.getSocialPayMonth())){
pageVo.setMonth(infoVo.getSocialPayMonth());
}
pageVo.setEmpId(infoVo.getEmpId());
// 处理退费
isRefund = null != infoVo.getSumAll() && infoVo.getSumAll().compareTo(BigDecimal.ZERO) < CommonConstants.ZERO_INT;
handleRefundMoney(pageVo, isRefund, infoVo);
// 处理合计
initPaymentSum(pageVo, isRefund, infoVo);
// 处理各种金额比例数据 单位养老大于零默认为派单基数
isSocial = (null != infoVo.getUnitPensionMoney() && infoVo.getUnitPensionMoney().compareTo(BigDecimal.ZERO) > CommonConstants.ZERO_INT)
|| (null != infoVo.getUnitMedicalMoney() && infoVo.getUnitMedicalMoney().compareTo(BigDecimal.ZERO) > CommonConstants.ZERO_INT)
|| (null != infoVo.getUnitUnemploymentMoney() && infoVo.getUnitUnemploymentMoney().compareTo(BigDecimal.ZERO) > CommonConstants.ZERO_INT)
|| (null != infoVo.getUnitBirthMoney() && infoVo.getUnitBirthMoney().compareTo(BigDecimal.ZERO) > CommonConstants.ZERO_INT);
// 非兼职工伤 非退费 处理
handleSocialAndRefundMoney(pageVo, isRefund, isSocial, infoVo);
// 处理兼职工伤数据
isInjury = BigDecimalUtils.safeAdd(infoVo.getUnitPensionMoney(),infoVo.getUnitMedicalMoney(),infoVo.getUnitUnemploymentMoney(),infoVo.getUnitBirthMoney()).compareTo(BigDecimal.ZERO) == 0
&& null != infoVo.getUnitInjuryMoney()
&& infoVo.getUnitInjuryMoney().compareTo(BigDecimal.ZERO) > 0;
// 处理 公积金和 非兼职工伤的退费数据
handleSocialAndInjuryMoney(pageVo, isRefund, isInjury, infoVo);
}
}
return pageVo;
}
/**
* 处理社保和退费金额
* @Author fxj
* @Date 2020-08-31
* @param pageVo
* @param isRefund
* @param isSocial
* @param infoVo
* @return
**/
private void handleSocialAndRefundMoney(PaymentBusinessPageVo pageVo, boolean isRefund, boolean isSocial, TPaymentAllInfoVo infoVo) {
if (isSocial && !isRefund){
pageVo.setPersonalPensionSet(infoVo.getPersonalPensionSet());
pageVo.setPersonalMedicalSet(infoVo.getPersonalMedicalSet());
pageVo.setPersonalUnemploymentSet(infoVo.getPersonalUnemploymentSet());
pageVo.setUnitPensionSet(infoVo.getUnitPensionSet());
pageVo.setUnitMedicalSet(infoVo.getUnitMedicalSet());
pageVo.setUnitInjurySet(infoVo.getUnitInjurySet());
pageVo.setUnitUnemploymentSet(infoVo.getUnitUnemploymentSet());
pageVo.setUnitBirthSet(infoVo.getUnitBirthSet());
pageVo.setPersonalPensionPer(infoVo.getPersonalPensionPer());
pageVo.setPersonalMedicalPer(infoVo.getPersonalMedicalPer());
pageVo.setPersonalUnemploymentPer(infoVo.getPersonalUnemploymentPer());
pageVo.setUnitPensionPer(infoVo.getUnitPensionPer());
pageVo.setUnitMedicalPer(infoVo.getUnitMedicalPer());
pageVo.setUnitInjuryPer(infoVo.getUnitInjuryPer());
pageVo.setUnitUnemploymentPer(infoVo.getUnitUnemploymentPer());
pageVo.setUnitBirthPer(infoVo.getUnitBirthPer());
}
}
/**
* 处理退费金额
* @Author fxj
* @Date 2020-08-31
* @param pageVo
* @param isRefund
* @param infoVo
* @return
**/
private void handleRefundMoney(PaymentBusinessPageVo pageVo, boolean isRefund, TPaymentAllInfoVo infoVo) {
if (isRefund){
pageVo.setPersonalRefund(BigDecimalUtils.safeAdd(pageVo.getPersonalRefund(),
infoVo.getPersonalPensionMoney(),
infoVo.getPersonalMedicalMoney(),
infoVo.getPersonalUnemploymentMoney(),
infoVo.getPersonalBigmailmentMoney(),
infoVo.getPersonalProvidentSum()));
pageVo.setUnitRefund(BigDecimalUtils.safeAdd(pageVo.getUnitRefund(),
infoVo.getUnitPensionMoney(),
infoVo.getUnitMedicalMoney(),
infoVo.getUnitInjuryMoney(),
infoVo.getUnitBirthMoney(),
infoVo.getUnitUnemploymentMoney(),
infoVo.getUnitBigmailmentMoney(),
infoVo.getUnitProvidentSum()));
}
}
/**
* 处理兼职工伤金额
* @Author fxj
* @Date 2020-08-31
* @param pageVo
* @param isRefund
* @param isInjury
* @param infoVo
* @return
**/
private void handleSocialAndInjuryMoney(PaymentBusinessPageVo pageVo, boolean isRefund, boolean isInjury, TPaymentAllInfoVo infoVo) {
if (isInjury){
pageVo.setInjuryAloneSet(infoVo.getUnitInjurySet());
pageVo.setInjuryAloneMoney(BigDecimalUtils.safeAdd(pageVo.getInjuryAloneMoney(),infoVo.getUnitInjuryMoney()));
pageVo.setInjuryAlonePer(infoVo.getUnitInjuryPer());
}
// 处理公积金
if (null != infoVo.getProvidentPercent()){
pageVo.setProvidentPercent(infoVo.getProvidentPercent());
}
if (null != infoVo.getUnitProvidentSet()){
pageVo.setPersonalProidentSet(infoVo.getUnitProvidentSet());
pageVo.setUnitProvidentSet(infoVo.getUnitProvidentSet());
}
// 处理非兼职工伤非退费数据
if (!isInjury && !isRefund){
pageVo.setPersonalPensionMoney(BigDecimalUtils.safeAdd(pageVo.getPersonalPensionMoney(),infoVo.getPersonalPensionMoney()));
pageVo.setPersonalMedicalMoney(BigDecimalUtils.safeAdd(pageVo.getPersonalMedicalMoney(),infoVo.getPersonalMedicalMoney()));
pageVo.setPersonalUnemploymentMoney(BigDecimalUtils.safeAdd(pageVo.getPersonalUnemploymentMoney(),infoVo.getPersonalUnemploymentMoney()));
pageVo.setPersonalBigmailmentMoney(BigDecimalUtils.safeAdd(pageVo.getPersonalBigmailmentMoney(),infoVo.getPersonalBigmailmentMoney()));
pageVo.setUnitPensionMoney(BigDecimalUtils.safeAdd(pageVo.getUnitPensionMoney(),infoVo.getUnitPensionMoney()));
pageVo.setUnitMedicalMoney(BigDecimalUtils.safeAdd(pageVo.getUnitMedicalMoney(),infoVo.getUnitMedicalMoney()));
pageVo.setUnitInjuryMoney(BigDecimalUtils.safeAdd(pageVo.getUnitInjuryMoney(),infoVo.getUnitInjuryMoney()));
pageVo.setUnitBirthMoney(BigDecimalUtils.safeAdd(pageVo.getUnitBirthMoney(),infoVo.getUnitBirthMoney()));
pageVo.setUnitUnemploymentMoney(BigDecimalUtils.safeAdd(pageVo.getUnitUnemploymentMoney(),infoVo.getUnitUnemploymentMoney()));
pageVo.setUnitBigmailmentMoney(BigDecimalUtils.safeAdd(pageVo.getUnitBigmailmentMoney(),infoVo.getUnitBigmailmentMoney()));
}
}
/**
* 合计缴费库对应数据
* @Author fxj
* @Date 2020-08-25
* @param pageVo
* @param infoVo
* @return
**/
private void initPaymentSum(PaymentBusinessPageVo pageVo,boolean isRefund, TPaymentAllInfoVo infoVo) {
if (!isRefund){
pageVo.setFundPersonalSum(BigDecimalUtils.safeAdd(pageVo.getFundPersonalSum(), infoVo.getPersonalProvidentSum()));
pageVo.setFundUnitSum(BigDecimalUtils.safeAdd(pageVo.getFundUnitSum(), infoVo.getUnitProvidentSum()));
}
pageVo.setCompanyAccrual(BigDecimalUtils.safeAdd(pageVo.getCompanyAccrual(), infoVo.getCompanyAccrual()));
pageVo.setPersonalAccrual(BigDecimalUtils.safeAdd(pageVo.getPersonalAccrual(), infoVo.getPersonalAccrual()));
pageVo.setSocialUnitSum(BigDecimalUtils.safeAdd(pageVo.getSocialUnitSum(),
infoVo.getUnitPensionMoney(),
infoVo.getUnitMedicalMoney(),
infoVo.getUnitInjuryMoney(),
infoVo.getUnitBirthMoney(),
infoVo.getUnitUnemploymentMoney(),
infoVo.getUnitBigmailmentMoney()));
pageVo.setSocialPersonalSum(BigDecimalUtils.safeAdd(pageVo.getSocialPersonalSum(),
infoVo.getPersonalPensionMoney(),
infoVo.getPersonalMedicalMoney(),
infoVo.getPersonalUnemploymentMoney(),
infoVo.getPersonalBigmailmentMoney()));
pageVo.setSum(BigDecimalUtils.safeAdd(pageVo.getSum(),infoVo.getCompanyAccrual(),
infoVo.getPersonalAccrual(),
infoVo.getPersonalProvidentSum(),
infoVo.getUnitProvidentSum(),
infoVo.getSocialSecurityPersonalSum(),
infoVo.getUnitSocialSum()));
}
/**
* B端社保公积金列表查询
* @Author fxj
* @Date 2020-08-28
* @param page
* @param socialAndFundBusinessPageVo
* @param settleDomainIds
* @return
**/
@Override
public List<SocialAndFundBusinessPageVo> getSocialAndFundBusinessPage(Page<SocialAndFundBusinessPageVo> page, SocialAndFundBusinessPageVo socialAndFundBusinessPageVo, List<String> settleDomainIds) {
List<SocialAndFundBusinessPageVo> pageVo = baseMapper.getSocialAndFundBusinessDataPage(socialAndFundBusinessPageVo, settleDomainIds);
List<SocialAndFundBusinessPageVo> pageVosEmpCount = baseMapper.getSocialAndFundBusinessDataCount(socialAndFundBusinessPageVo, settleDomainIds);
if (Common.isNotNull(pageVo) && Common.isNotNull(pageVosEmpCount)){
HashMap<String ,Integer> monthPeopleCount = new HashMap<>();
for (SocialAndFundBusinessPageVo vo:pageVosEmpCount){
monthPeopleCount.put(vo.getMonth(),vo.getPeopleCount());
}
for (SocialAndFundBusinessPageVo vo:pageVo){
vo.setPeopleCount(monthPeopleCount.get(vo.getMonth()));
}
}
return pageVo;
}
/**
* 按月查询对应权限的缴费库数据
* @Author fxj
* @Date 2020-08-25
* @param page
* @param paymentBusinessPageVo
* @param type
* @return
**/
@Override
public IPage<PaymentBusinessPageVo> getPaymentByMonthAndAuth(Page<PaymentBusinessPageVo> page, PaymentBusinessPageVo paymentBusinessPageVo, List<String> settleDomainIds, String type) {
List<String> empIds = null;
if (CommonConstants.ONE_STRING.equals(type)) {
empIds = baseMapper.getSocialOrFundAddEmpIds(paymentBusinessPageVo.getMonth(),paymentBusinessPageVo.getSettleDomainId(),settleDomainIds);
if (empIds.isEmpty()) {
return page;
}
}
IPage<PaymentBusinessPageVo> pageVo = baseMapper.getPaymentBusinessPageVo(page,paymentBusinessPageVo,settleDomainIds,empIds);
List<PaymentBusinessPageVo> pageVos = pageVo.getRecords();
if (Common.isNotNull(pageVos)){
for (PaymentBusinessPageVo vo:pageVos){
vo.setSum(BigDecimalUtils.safeAdd(vo.getUnitSum(),vo.getPersonalSum()));
}
}
page.setRecords(pageVos);
return page;
}
/**
* 按年月查询指定结算主体或权限内的缴费库数据统计
* @Author fxj
* @Date 2020-08-31
* @param month
* @param settleDomainId
* @return
**/
@Override
public PaymentBusinessPageDetail getPaymentBusinessPageDetailByMonthAndAuth(String month, String settleDomainId, List<String> settleDomainIds) {
PaymentBusinessPageDetail detail = new PaymentBusinessPageDetail();
// 1.派增办理成功的社保和公积金人数
detail.setPersonalCount(baseMapper.getSocialOrFundAddCount(month,settleDomainId,settleDomainIds,CommonConstants.ZERO_INT));
// 2.当月派增办理成功的社保和公积金人数
detail.setPersonalAdd(baseMapper.getSocialOrFundAddCount(month,settleDomainId,settleDomainIds, CommonConstants.ONE_INT));
// 3.当月派减办理成功的社保和公积金人数
detail.setPersonalReduce(baseMapper.getSocialOrFundReduceCount(month,settleDomainId,settleDomainIds));
return detail;
}
/**
* 查询派减的社保和公积金的分页数据
* @Author fxj
* @Date 2020-08-31
* @param page
* @param month
* @param settleDomainId
* @return
**/
@Override
public IPage<SocialAndFundReduceBusinessVo> getSocialAndFundReduceInfo(Page<SocialAndFundReduceBusinessVo> page, String month, String settleDomainId, List<String> settleDomainIds) {
IPage<SocialAndFundReduceBusinessVo> pageVos = baseMapper.getSocialAndFundReduceInfo(page,month,settleDomainId,settleDomainIds);
if (null != pageVos && Common.isNotNull(pageVos.getRecords())){
for (SocialAndFundReduceBusinessVo vo:pageVos.getRecords()){
initReduceBusinessData(vo);
}
}
return pageVos;
}
private void initReduceBusinessData(SocialAndFundReduceBusinessVo vo) {
int index;
if (Common.isNotNull(vo.getLeaveDate())){
index = vo.getLeaveDate().indexOf(CommonConstants.COMMA_CHAR);
if (index > 0){
vo.setLeaveDate(vo.getLeaveDate().substring(CommonConstants.ZERO_INT,index));
}
}
if (Common.isNotNull(vo.getSocialReduceDate())){
index = vo.getSocialReduceDate().indexOf(CommonConstants.COMMA_CHAR);
if (index > 0){
vo.setSocialReduceDate(vo.getSocialReduceDate().substring(CommonConstants.ZERO_INT,index));
}
}
if (Common.isNotNull(vo.getFundReduceDate())){
index = vo.getFundReduceDate().indexOf(CommonConstants.COMMA_CHAR);
if (index > 0){
vo.setFundReduceDate(vo.getFundReduceDate().substring(CommonConstants.ZERO_INT,index));
}
}
}
// hgw2023-1-6 10:44:31以上,B端相关
} }
...@@ -33,11 +33,17 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -33,11 +33,17 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*; import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity; import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import com.yifu.cloud.plus.v1.yifu.social.entity.SysHouseHoldInfo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TDispatchInfo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TProvidentFund; import com.yifu.cloud.plus.v1.yifu.social.entity.TProvidentFund;
import com.yifu.cloud.plus.v1.yifu.social.mapper.SysHouseHoldInfoMapper;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TDispatchInfoMapper;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TProvidentFundMapper; import com.yifu.cloud.plus.v1.yifu.social.mapper.TProvidentFundMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.TProvidentFundService; import com.yifu.cloud.plus.v1.yifu.social.service.TProvidentFundService;
import com.yifu.cloud.plus.v1.yifu.social.vo.FundAddAndReduceVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TProvidentFundSearchVo; import com.yifu.cloud.plus.v1.yifu.social.vo.TProvidentFundSearchVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TProvidentFundVo; import com.yifu.cloud.plus.v1.yifu.social.vo.TProvidentFundVo;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -54,9 +60,15 @@ import java.util.List; ...@@ -54,9 +60,15 @@ import java.util.List;
* @author fxj * @author fxj
* @date 2022-07-15 11:38:05 * @date 2022-07-15 11:38:05
*/ */
@AllArgsConstructor
@Log4j2 @Log4j2
@Service @Service
public class TProvidentFundServiceImpl extends ServiceImpl<TProvidentFundMapper, TProvidentFund> implements TProvidentFundService { public class TProvidentFundServiceImpl extends ServiceImpl<TProvidentFundMapper, TProvidentFund> implements TProvidentFundService {
private final TDispatchInfoMapper dispatchInfoMapper;
private final SysHouseHoldInfoMapper sysHouseHoldInfoMapper;
/** /**
* 公积金信息简单分页查询 * 公积金信息简单分页查询
* @param tProvidentFund 公积金信息 * @param tProvidentFund 公积金信息
...@@ -244,4 +256,141 @@ public class TProvidentFundServiceImpl extends ServiceImpl<TProvidentFundMapper, ...@@ -244,4 +256,141 @@ public class TProvidentFundServiceImpl extends ServiceImpl<TProvidentFundMapper,
BeanUtil.copyProperties(excel, insert); BeanUtil.copyProperties(excel, insert);
this.save(insert); this.save(insert);
} }
/**
* 通过ID查询员工对应的派增派减数据
* @Author fxj
* @Date 2020-08-25
* @param empId
* @return
**/
@Override
public FundAddAndReduceVo getAddOrReduceInfoByEmpId(String empId) {
FundAddAndReduceVo fundAddAndReduceVo = new FundAddAndReduceVo();
TProvidentFund fund = null;
TDispatchInfo dispatchInfoAdd = dispatchInfoMapper.selectOne(Wrappers.<TDispatchInfo>query().lambda()
.eq(TDispatchInfo::getEmpId,empId)
.eq(TDispatchInfo::getDeleteFlag,CommonConstants.ZERO_STRING)
.eq(TDispatchInfo::getType,CommonConstants.ZERO_STRING)
.isNotNull(TDispatchInfo::getFundId)
.orderByDesc(TDispatchInfo::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL));
if (null != dispatchInfoAdd){
fund = baseMapper.selectById(dispatchInfoAdd.getFundId());
initFundAddAndReduce(fundAddAndReduceVo, fund, dispatchInfoAdd);
if (null != dispatchInfoAdd.getCreateTime()){
fundAddAndReduceVo.setFundAddDispatchDate(LocalDateTimeUtils.formatTime(dispatchInfoAdd.getCreateTime()
,LocalDateTimeUtils.DATE_TIME_PATTERN_DEFAULT));
}
}
TDispatchInfo dispatchInfoReduce = dispatchInfoMapper.selectOne(Wrappers.<TDispatchInfo>query().lambda()
.eq(TDispatchInfo::getEmpId,empId)
.eq(TDispatchInfo::getDeleteFlag,CommonConstants.ZERO_STRING)
.eq(TDispatchInfo::getType,CommonConstants.ONE_STRING)
.isNotNull(TDispatchInfo::getFundId)
.orderByDesc(TDispatchInfo::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL));
if (null != dispatchInfoReduce){
fund = baseMapper.selectById(dispatchInfoReduce.getFundId());
initFundAddAndReduce(fundAddAndReduceVo, fund, dispatchInfoReduce);
if (Common.isNotNull(dispatchInfoReduce.getFundReduceDate())) {
fundAddAndReduceVo.setFundEndDate(DateUtil.formatDate(dispatchInfoReduce.getFundReduceDate()));
}
if (null != dispatchInfoReduce.getCreateTime()){
fundAddAndReduceVo.setFundReduceDispatchDate(LocalDateTimeUtils.formatTime(
dispatchInfoReduce.getCreateTime(),LocalDateTimeUtils.DATE_TIME_PATTERN_DEFAULT));
}
}
return fundAddAndReduceVo;
}
/**
* 初始化社保派增派减数据
* @Author fxj
* @Date 2020-08-25
* @param fundAddAndReduceVo
* @param fund
* @param dispatchInfo
* @return
**/
private void initFundAddAndReduce(FundAddAndReduceVo fundAddAndReduceVo, TProvidentFund fund, TDispatchInfo dispatchInfo) {
SysHouseHoldInfo houseHoldInfo = null;
if (null != fund) {
if (null != fund.getProvidentHousehold()){
houseHoldInfo = sysHouseHoldInfoMapper.selectById(fund.getProvidentHousehold());
}
// 派增派单状态处理 待提交和待审核都属于派单开始
if (CommonConstants.ZERO_STRING.equals(dispatchInfo.getType())){
fundAddAndReduceVo.setFundHouse(null==houseHoldInfo?"":houseHoldInfo.getName());
fundAddAndReduceVo.setFundProvince(Common.isNotNull(fund.getFundProvince())? Integer.parseInt(fund.getFundProvince()):null);
fundAddAndReduceVo.setFundCity(Common.isNotNull(fund.getFundCity())? Integer.parseInt(fund.getFundCity()):null);
fundAddAndReduceVo.setFundTown(Common.isNotNull(fund.getFundTown())? Integer.parseInt(fund.getFundTown()):null);
if (null != fund.getProvidentStart()) {
fundAddAndReduceVo.setFundStartDate(DateUtil.formatDate(fund.getProvidentStart()));
}
initFundAddStatus(fundAddAndReduceVo, dispatchInfo);
// 派减派单状态处理 待提交和待审核都属于派单开始
}else {
fundAddAndReduceVo.setFundHouseReduce(null==houseHoldInfo?"":houseHoldInfo.getName());
fundAddAndReduceVo.setFundProvinceReduce(Common.isNotNull(fund.getFundProvince())? Integer.parseInt(fund.getFundProvince()):null);
fundAddAndReduceVo.setFundCityReduce(Common.isNotNull(fund.getFundCity())? Integer.parseInt(fund.getFundCity()):null);
fundAddAndReduceVo.setFundTownReduce(Common.isNotNull(fund.getFundTown())? Integer.parseInt(fund.getFundTown()):null);
if (null != fund.getProvidentStart()) {
fundAddAndReduceVo.setFundStartDate(DateUtil.formatDate(fund.getProvidentStart()));
}
initFundReduceStatus(fundAddAndReduceVo, dispatchInfo);
}
}
}
/**
* 初始化公积金派减状态
* @Author fxj
* @Date 2020-08-25
* @param fundAddAndReduceVo
* @param dispatchInfo
* @return
**/
private void initFundReduceStatus(FundAddAndReduceVo fundAddAndReduceVo, TDispatchInfo dispatchInfo) {
if (CommonConstants.ZERO_STRING.equals(dispatchInfo.getStatus())
|| CommonConstants.ONE_STRING.equals(dispatchInfo.getStatus())
|| CommonConstants.THREE_STRING.equals(dispatchInfo.getStatus())
|| CommonConstants.TWO_STRING.equals(dispatchInfo.getStatus())) {
fundAddAndReduceVo.setFundReduceStatus(CommonConstants.ZERO_STRING);
}
// 办理成功
if (CommonConstants.ONE_STRING.equals(dispatchInfo.getFundHandleStatus())) {
fundAddAndReduceVo.setFundReduceStatus(CommonConstants.ONE_STRING);
}
// 办理失败
if (CommonConstants.TWO_STRING.equals(dispatchInfo.getFundHandleStatus())) {
fundAddAndReduceVo.setFundReduceStatus(CommonConstants.TWO_STRING);
}
// 部分办理失败 TODO
}
/**
* 初始化公积金派增办理状态
* @Author fxj
* @Date 2020-08-25
* @param fundAddAndReduceVo
* @param dispatchInfo
* @return
**/
private void initFundAddStatus(FundAddAndReduceVo fundAddAndReduceVo, TDispatchInfo dispatchInfo) {
if (CommonConstants.ZERO_STRING.equals(dispatchInfo.getStatus())
|| CommonConstants.ONE_STRING.equals(dispatchInfo.getStatus())
|| CommonConstants.THREE_STRING.equals(dispatchInfo.getStatus())
||CommonConstants.TWO_STRING.equals(dispatchInfo.getStatus())) {
fundAddAndReduceVo.setFundAddStatus(CommonConstants.ZERO_STRING);
}
// 办理成功
if (CommonConstants.ONE_STRING.equals(dispatchInfo.getFundHandleStatus())) {
fundAddAndReduceVo.setFundAddStatus(CommonConstants.ONE_STRING);
}
// 办理失败
if (CommonConstants.TWO_STRING.equals(dispatchInfo.getFundHandleStatus())) {
fundAddAndReduceVo.setFundAddStatus(CommonConstants.TWO_STRING);
}
}
} }
...@@ -33,11 +33,17 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -33,11 +33,17 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*; import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity; import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import com.yifu.cloud.plus.v1.yifu.social.entity.SysHouseHoldInfo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TDispatchInfo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialInfo; import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialInfo;
import com.yifu.cloud.plus.v1.yifu.social.mapper.SysHouseHoldInfoMapper;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TDispatchInfoMapper;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialInfoMapper; import com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialInfoMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialInfoService; import com.yifu.cloud.plus.v1.yifu.social.service.TSocialInfoService;
import com.yifu.cloud.plus.v1.yifu.social.vo.SocialAddAndReduceVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TSocialInfoSearchVo; import com.yifu.cloud.plus.v1.yifu.social.vo.TSocialInfoSearchVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TSocialInfoVo; import com.yifu.cloud.plus.v1.yifu.social.vo.TSocialInfoVo;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -54,9 +60,15 @@ import java.util.List; ...@@ -54,9 +60,15 @@ import java.util.List;
* @author fxj * @author fxj
* @date 2022-07-15 11:38:05 * @date 2022-07-15 11:38:05
*/ */
@AllArgsConstructor
@Log4j2 @Log4j2
@Service @Service
public class TSocialInfoServiceImpl extends ServiceImpl<TSocialInfoMapper, TSocialInfo> implements TSocialInfoService { public class TSocialInfoServiceImpl extends ServiceImpl<TSocialInfoMapper, TSocialInfo> implements TSocialInfoService {
private final TDispatchInfoMapper dispatchInfoMapper;
private final SysHouseHoldInfoMapper sysHouseHoldInfoMapper;
/** /**
* 社保明细表简单分页查询 * 社保明细表简单分页查询
* @param tSocialInfo 社保明细表 * @param tSocialInfo 社保明细表
...@@ -243,4 +255,177 @@ public class TSocialInfoServiceImpl extends ServiceImpl<TSocialInfoMapper, TSoci ...@@ -243,4 +255,177 @@ public class TSocialInfoServiceImpl extends ServiceImpl<TSocialInfoMapper, TSoci
BeanUtil.copyProperties(excel, insert); BeanUtil.copyProperties(excel, insert);
this.save(insert); this.save(insert);
} }
/**
* 通过ID查询员工对应的派增派减数据
* @Author fxj
* @Date 2020-08-25
* @param empId
* @return
**/
@Override
public SocialAddAndReduceVo getAddOrReduceInfoByEmpId(String empId) {
SocialAddAndReduceVo socialAddAndReduceVo = new SocialAddAndReduceVo();
TSocialInfo socialInfo;
TDispatchInfo dispatchInfoAdd = dispatchInfoMapper.selectOne(Wrappers.<TDispatchInfo>query().lambda()
.eq(TDispatchInfo::getEmpId,empId)
.eq(TDispatchInfo::getDeleteFlag,CommonConstants.ZERO_STRING)
.eq(TDispatchInfo::getType,CommonConstants.ZERO_STRING)
.isNotNull(TDispatchInfo::getSocialId)
.orderByDesc(TDispatchInfo::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL));
if (null != dispatchInfoAdd){
socialInfo = baseMapper.selectById(dispatchInfoAdd.getSocialId());
initSocialAddAndReduce(socialAddAndReduceVo, socialInfo, dispatchInfoAdd);
if (null != dispatchInfoAdd.getCreateTime()){
socialAddAndReduceVo.setSocialAddDispatchDate(LocalDateTimeUtils.formatTime(dispatchInfoAdd.getCreateTime(),LocalDateTimeUtils.DATE_TIME_PATTERN_DEFAULT));
}
}
TDispatchInfo dispatchInfoReduce = dispatchInfoMapper.selectOne(Wrappers.<TDispatchInfo>query().lambda()
.eq(TDispatchInfo::getEmpId,empId)
.eq(TDispatchInfo::getDeleteFlag,CommonConstants.ZERO_STRING)
.eq(TDispatchInfo::getType,CommonConstants.ONE_STRING)
.isNotNull(TDispatchInfo::getSocialId)
.orderByDesc(TDispatchInfo::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL));
if (null != dispatchInfoReduce){
socialInfo = baseMapper.selectById(dispatchInfoReduce.getSocialId());
initSocialAddAndReduce(socialAddAndReduceVo, socialInfo, dispatchInfoReduce);
if (Common.isNotNull(dispatchInfoReduce.getSocialReduceDate())) {
socialAddAndReduceVo.setSocialEndDate(DateUtil.formatDate(dispatchInfoReduce.getSocialReduceDate()));
}
if (null != dispatchInfoReduce.getCreateTime()){
socialAddAndReduceVo.setSocialReduceDispatchDate(LocalDateTimeUtils.formatTime(dispatchInfoReduce.getCreateTime(),LocalDateTimeUtils.DATE_TIME_PATTERN_DEFAULT));
}
}
return socialAddAndReduceVo;
}
/**
* 初始化社保派增派减数据
* @Author fxj
* @Date 2020-08-25
* @param socialAddAndReduceVo
* @param socialInfo
* @param dispatchInfo
* @return
**/
private void initSocialAddAndReduce(SocialAddAndReduceVo socialAddAndReduceVo, TSocialInfo socialInfo, TDispatchInfo dispatchInfo) {
// 初始化户和区域数据
initSocialHouseAndAddress(socialAddAndReduceVo, socialInfo,dispatchInfo.getType());
// 派增派单状态处理 待提交和待审核都属于派单开始
if (CommonConstants.ZERO_STRING.equals(dispatchInfo.getType())){
initSocialAddStatus(socialAddAndReduceVo, dispatchInfo);
// 派减派单状态处理 待提交和待审核都属于派单开始
}else {
initSocialReduceStatus(socialAddAndReduceVo, dispatchInfo);
}
}
/**
* 初始化派增派减地址
* @Author fxj
* @Date 2020-08-25
* @param socialAddAndReduceVo
* @param socialInfo
* @param type
* @param houseHoldInfo
* @return
**/
private void initSocialAddress(SocialAddAndReduceVo socialAddAndReduceVo, TSocialInfo socialInfo, String type, SysHouseHoldInfo houseHoldInfo) {
if (CommonConstants.ZERO_STRING.equals(type)){
socialAddAndReduceVo.setSocialHouse(null == houseHoldInfo?"":houseHoldInfo.getName());
socialAddAndReduceVo.setSocialProvince(Common.isNotNull(socialInfo.getSocialProvince())? Integer.parseInt(socialInfo.getSocialProvince()):null);
socialAddAndReduceVo.setSocialCity(Common.isNotNull(socialInfo.getSocialCity())? Integer.parseInt(socialInfo.getSocialCity()):null);
socialAddAndReduceVo.setSocialTown(Common.isNotNull(socialInfo.getSocialTown())? Integer.parseInt(socialInfo.getSocialTown()):null);
if (null != socialInfo.getSocialStartDate()) {
socialAddAndReduceVo.setSocialStartDate(DateUtil.formatDate(socialInfo.getSocialStartDate()));
}
}else {
socialAddAndReduceVo.setSocialHouseReduce(null==houseHoldInfo?"":houseHoldInfo.getName());
socialAddAndReduceVo.setSocialProvinceReduce(Common.isNotNull(socialInfo.getSocialProvince())? Integer.parseInt(socialInfo.getSocialProvince()):null);
socialAddAndReduceVo.setSocialCityReduce(Common.isNotNull(socialInfo.getSocialCity())? Integer.parseInt(socialInfo.getSocialCity()):null);
socialAddAndReduceVo.setSocialTownReduce(Common.isNotNull(socialInfo.getSocialTown())? Integer.parseInt(socialInfo.getSocialTown()):null);
if (null != socialInfo.getSocialStartDate()) {
socialAddAndReduceVo.setSocialStartDate(DateUtil.formatDate(socialInfo.getSocialStartDate()));
}
}
}
/**
* 初始化社保派减办理状态
* @Author fxj
* @Date 2020-08-25
* @param socialAddAndReduceVo
* @param dispatchInfo
* @return
**/
private void initSocialAddStatus(SocialAddAndReduceVo socialAddAndReduceVo, TDispatchInfo dispatchInfo) {
//new:社保办理状态 0 未办理 1 全部办理成功(原-已办理) 2 全部办理失败(原-办理失败) 3已派减 4办理中 (20210609派单拆分新增fxj) 5部分办理失败 (20210609派单拆分新增fxj)
if (CommonConstants.ZERO_STRING.equals(dispatchInfo.getStatus())
|| CommonConstants.ONE_STRING.equals(dispatchInfo.getStatus())
|| CommonConstants.THREE_STRING.equals(dispatchInfo.getStatus())) {
socialAddAndReduceVo.setSocialAddStatus(CommonConstants.ZERO_STRING);
// 审核不通过和 审核通过 都属于办理中
} else if (CommonConstants.TWO_STRING.equals(dispatchInfo.getStatus())) {
socialAddAndReduceVo.setSocialAddStatus(CommonConstants.ONE_STRING);
}
// 办理成功
if (CommonConstants.ONE_STRING.equals(dispatchInfo.getSocialHandleStatus())) {
socialAddAndReduceVo.setSocialAddStatus(CommonConstants.TWO_STRING);
}
// 办理失败
if (CommonConstants.TWO_STRING.equals(dispatchInfo.getSocialHandleStatus())) {
socialAddAndReduceVo.setSocialAddStatus(CommonConstants.THREE_STRING);
}
// 部分办理失败
if (CommonConstants.FIVE_STRING.equals(dispatchInfo.getSocialHandleStatus())) {
socialAddAndReduceVo.setSocialAddStatus(CommonConstants.FOUR_STRING);
}
}
/**
* 初始化社保户和社保缴纳地
* @Author fxj
* @Date 2020-08-25
* @param socialAddAndReduceVo
* @param socialInfo
* @param type
* @return
**/
private void initSocialHouseAndAddress(SocialAddAndReduceVo socialAddAndReduceVo, TSocialInfo socialInfo, String type) {
if (null != socialInfo) {
SysHouseHoldInfo houseHoldInfo = null;
if (null != socialInfo.getSocialHousehold()) {
houseHoldInfo = sysHouseHoldInfoMapper.selectById(socialInfo.getSocialHousehold());
}
initSocialAddress(socialAddAndReduceVo, socialInfo, type, houseHoldInfo);
}
}
/**
* 初始化派增办理状态
* @Author fxj
* @Date 2020-08-25
* @param socialAddAndReduceVo
* @param dispatchInfo
* @return
**/
private void initSocialReduceStatus(SocialAddAndReduceVo socialAddAndReduceVo, TDispatchInfo dispatchInfo) {
if (CommonConstants.ZERO_STRING.equals(dispatchInfo.getStatus())
|| CommonConstants.ONE_STRING.equals(dispatchInfo.getStatus())
|| CommonConstants.THREE_STRING.equals(dispatchInfo.getStatus())) {
socialAddAndReduceVo.setSocialReduceStatus(CommonConstants.ZERO_STRING);
// 审核不通过和 审核通过 都属于办理中
} else if (CommonConstants.TWO_STRING.equals(dispatchInfo.getStatus())) {
socialAddAndReduceVo.setSocialReduceStatus(CommonConstants.ONE_STRING);
}
// 办理成功
if (CommonConstants.ONE_STRING.equals(dispatchInfo.getSocialHandleStatus())) {
socialAddAndReduceVo.setSocialReduceStatus(CommonConstants.TWO_STRING);
}
// 办理失败
if (CommonConstants.TWO_STRING.equals(dispatchInfo.getSocialHandleStatus())) {
socialAddAndReduceVo.setSocialReduceStatus(CommonConstants.THREE_STRING);
}
}
} }
...@@ -1374,4 +1374,589 @@ ...@@ -1374,4 +1374,589 @@
<include refid="tPaymentInfo_export_where"/> <include refid="tPaymentInfo_export_where"/>
</where> </where>
</select> </select>
<!--tPaymentInfo 缴费库包含明细的数据查询查询 核准表生成查询专用-->
<select id="getPaymentAllInfoList" resultMap="tPaymentAllInfoMap">
SELECT
a.ID,
a.EMP_NAME,
a.EMP_NO,
a.EMP_ID,
a.EMP_IDCARD,
a.UNIT_ID,
a.SETTLE_DOMAIN_ID,
a.SOCIAL_HOUSEHOLD,
a.SOCIAL_SECURITY_NO,
a.SOCIAL_PAY_ADDR,
a.SOCIAL_PAY_MONTH,
a.SOCIAL_CREATE_MONTH,
a.CREATE_BY,
a.CREATE_TIME,
a.UPDATE_BY,
a.UPDATE_TIME,
a.LOCK_STATUS,
a.SUM_ALL,
a.PROVIDENT_PAY_MONTH,
a.PROVIDENT_CREATE_MONTH,
a.PROVIDENT_HOUSEHOLD,
a.PROVIDENT_PAY_ADDR,
a.FUND_PROVINCE,
a.FUND_CITY,
a.FUND_TOWN,
a.SOCIAL_PROVINCE,
a.SOCIAL_CITY,
a.SOCIAL_TOWN,
a.SOCIAL_ID,
a.FUND_ID,
a.SOCIAL_SUM,
a.UNIT_SOCIAL_SUM,
a.SOCIAL_SECURITY_PERSONAL_SUM,
a.PROVIDENT_SUM,
a.INAUGURAL_TEAM,
a.SALARY_SOCIAL_FLAG,
a.SALARY_FUND_FLAG,
a.COMPANY_ACCRUAL,
a.PERSONAL_ACCRUAL,
a.UNIT_PENSION_SET,
a.UNIT_MEDICAL_SET,
a.UNIT_UNEMPLOYMENT_SET,
a.UNIT_INJURY_SET,
a.UNIT_BIRTH_SET,
a.PERSONAL_PENSION_SET,
a.PERSONAL_MEDICAL_SET,
a.PERSONAL_UNEMPLOYMENT_SET,
a.UNIT_PENSION_PER,
a.UNIT_MEDICAL_PER,
a.UNIT_UNEMPLOYMENT_PER,
a.UNIT_INJURY_PER,
a.UNIT_BIRTH_PER,
a.PERSONAL_PENSION_PER,
a.PERSONAL_MEDICAL_PER,
a.PERSONAL_UNEMPLOYMENT_PER,
a.UNIT_BIGAILMENT_PER,
a.PERSONAL_BIGAILMENT_PER,
a.UNIT_PENSION_MONEY,
a.UNIT_MEDICAL_MONEY,
a.UNIT_UNEMPLOYMENT_MONEY,
a.UNIT_INJURY_MONEY,
a.UNIT_BIRTH_MONEY,
a.UNIT_BIGMAILMENT_MONEY,
a.PERSONAL_PENSION_MONEY,
a.PERSONAL_MEDICAL_MONEY,
a.PERSONAL_UNEMPLOYMENT_MONEY,
a.PERSONAL_BIGMAILMENT_MONEY,
a.PROVIDENT_NO,
a.UNIT_PROVIDENT_SET,
a.PROVIDENT_PERCENT,
a.UNIT_PROVIDENT_SUM,
a.PERSONAL_PROIDENT_SET,
a.PERSONAL_PROVIDENT_SUM
FROM t_payment_info a
<where>
1=1
<if test="idsStr != null and idsStr.size > 0">
AND a.ID in
<foreach item="item" index="index" collection="idsStr" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="tPaymentInfo != null">
<!-- 按年模糊查询B端查询个人指定年费的缴费库数据 -->
<if test="tPaymentInfo.likeYear != null and tPaymentInfo.likeYear.trim() != ''">
AND a.SOCIAL_PAY_MONTH like CONCAT(#{tPaymentInfo.likeYear},'%')
</if>
<if test="tPaymentInfo.id != null and tPaymentInfo.id.trim() != ''">
AND a.ID = #{tPaymentInfo.id}
</if>
<if test="tPaymentInfo.empName != null and tPaymentInfo.empName.trim() != ''">
AND a.EMP_NAME like CONCAT(#{tPaymentInfo.empName},'%')
</if>
<if test="tPaymentInfo.empNo != null and tPaymentInfo.empNo.trim() != ''">
AND a.EMP_NO like CONCAT(#{tPaymentInfo.empNo},'%')
</if>
<if test="tPaymentInfo.empId != null and tPaymentInfo.empId.trim() != ''">
AND a.EMP_ID = #{tPaymentInfo.empId}
</if>
<if test="tPaymentInfo.empIdcard != null and tPaymentInfo.empIdcard.trim() != ''">
AND a.EMP_IDCARD like CONCAT(#{tPaymentInfo.empIdcard},'%')
</if>
<if test="tPaymentInfo.unitId != null and tPaymentInfo.unitId.trim() != ''">
AND a.UNIT_ID = #{tPaymentInfo.unitId}
</if>
<if test="tPaymentInfo.settleDomainId != null and tPaymentInfo.settleDomainId.trim() != ''">
AND a.SETTLE_DOMAIN_ID = #{tPaymentInfo.settleDomainId}
</if>
<if test="tPaymentInfo.socialHousehold != null and tPaymentInfo.socialHousehold.trim() != ''">
AND a.SOCIAL_HOUSEHOLD = #{tPaymentInfo.socialHousehold}
</if>
<if test="tPaymentInfo.socialSecurityNo != null and tPaymentInfo.socialSecurityNo.trim() != ''">
AND a.SOCIAL_SECURITY_NO like CONCAT(#{tPaymentInfo.socialSecurityNo},'%')
</if>
<if test="tPaymentInfo.socialPayAddr != null and tPaymentInfo.socialPayAddr.trim() != ''">
AND a.SOCIAL_PAY_ADDR = #{tPaymentInfo.socialPayAddr}
</if>
<if test="tPaymentInfo.socialPayMonth != null and tPaymentInfo.socialPayMonth.trim() != ''">
AND a.SOCIAL_PAY_MONTH = #{tPaymentInfo.socialPayMonth}
</if>
<if test="tPaymentInfo.socialCreateMonth != null and tPaymentInfo.socialCreateMonth.trim() != ''">
AND a.SOCIAL_CREATE_MONTH = #{tPaymentInfo.socialCreateMonth}
</if>
<if test="tPaymentInfo.createUser != null and tPaymentInfo.createUser.trim() != ''">
AND a.CREATE_BY = #{tPaymentInfo.createUser}
</if>
<if test="tPaymentInfo.createTime != null">
AND a.CREATE_TIME = #{tPaymentInfo.createTime}
</if>
<if test="tPaymentInfo.lastUpdateUser != null and tPaymentInfo.lastUpdateUser.trim() != ''">
AND a.UPDATE_BY = #{tPaymentInfo.lastUpdateUser}
</if>
<if test="tPaymentInfo.lastUpdateTime != null">
AND a.UPDATE_TIME = #{tPaymentInfo.lastUpdateTime}
</if>
<if test="tPaymentInfo.lockStatus != null and tPaymentInfo.lockStatus.trim() != ''">
AND a.LOCK_STATUS = #{tPaymentInfo.lockStatus}
</if>
<if test="tPaymentInfo.sumAll != null">
AND a.SUM_ALL = #{tPaymentInfo.sumAll}
</if>
<if test="tPaymentInfo.providentPayMonth != null and tPaymentInfo.providentPayMonth.trim() != ''">
AND a.PROVIDENT_PAY_MONTH = #{tPaymentInfo.providentPayMonth}
</if>
<if test="tPaymentInfo.providentCreateMonth != null and tPaymentInfo.providentCreateMonth.trim() != ''">
AND a.PROVIDENT_CREATE_MONTH = #{tPaymentInfo.providentCreateMonth}
</if>
<if test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != ''">
AND a.PROVIDENT_HOUSEHOLD = #{tPaymentInfo.providentHousehold}
</if>
<if test="tPaymentInfo.providentPayAddr != null and tPaymentInfo.providentPayAddr.trim() != ''">
AND a.PROVIDENT_PAY_ADDR = #{tPaymentInfo.providentPayAddr}
</if>
<if test="tPaymentInfo.socialProvince != null">
AND a.SOCIAL_PROVINCE = '${tPaymentInfo.socialProvince}'
</if>
<if test="tPaymentInfo.socialCity != null">
AND a.SOCIAL_CITY = '${tPaymentInfo.socialCity}'
<if test="tPaymentInfo.socialTown == null">
<if test="tPaymentInfo.haveContain != null and tPaymentInfo.haveContain == 1">
AND a.SOCIAL_TOWN is null
</if>
</if>
</if>
<if test="tPaymentInfo.socialTown != null">
AND a.SOCIAL_TOWN = '${tPaymentInfo.socialTown}'
</if>
<if test="tPaymentInfo.fundProvince != null">
AND a.FUND_PROVINCE = '${tPaymentInfo.fundProvince}'
</if>
<if test="tPaymentInfo.fundCity != null">
AND (a.FUND_CITY = #{tPaymentInfo.fundCity}
<if test="tPaymentInfo.settleProvince != null and tPaymentInfo.settleProvince == 0">
or a.FUND_CITY is null
</if>
)
<if test="tPaymentInfo.fundTown == null">
<if test="tPaymentInfo.haveContain != null and tPaymentInfo.haveContain == 1">
AND a.FUND_TOWN is null
</if>
</if>
</if>
<if test="tPaymentInfo.fundTown != null">
AND a.FUND_TOWN = '${tPaymentInfo.fundTown}'
</if>
<if test="tPaymentInfo.socialId != null">
AND a.SOCIAL_ID = #{tPaymentInfo.socialId}
</if>
<if test="tPaymentInfo.fundId != null">
AND a.FUND_ID = #{tPaymentInfo.fundId}
</if>
</if>
<if test="settleDomainIds != null and settleDomainIds.size > 0">
AND a.SETTLE_DOMAIN_ID in
<foreach item="item" index="index" collection="settleDomainIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="empIds != null and empIds.size > 0">
AND a.EMP_ID in
<foreach item="item" index="index" collection="empIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
ORDER BY a.SOCIAL_CREATE_MONTH DESC,a.PROVIDENT_CREATE_MONTH DESC
</select>
<!--***********************************************B端查询社保和公积金列表*****************************************************************-->
<!--tEmployeeInfo B端简单分页查询-->
<select id="getSocialAndFundBusinessDataPage" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SocialAndFundBusinessPageVo">
SELECT
a.SOCIAL_PAY_MONTH as 'month',
a.SETTLE_DOMAIN_ID as 'settleDomainId',
SUM(
IF(a.PERSONAL_ACCRUAL,a.PERSONAL_ACCRUAL,0) +
IF(a.PERSONAL_BIGMAILMENT_MONEY,a.PERSONAL_BIGMAILMENT_MONEY,0) +
IF(a.PERSONAL_MEDICAL_MONEY,a.PERSONAL_MEDICAL_MONEY,0) +
IF(a.PERSONAL_UNEMPLOYMENT_MONEY,a.PERSONAL_UNEMPLOYMENT_MONEY,0) +
IF(a.PERSONAL_PENSION_MONEY,a.PERSONAL_PENSION_MONEY,0) +
IF(a.PERSONAL_PROVIDENT_SUM,a.PERSONAL_PROVIDENT_SUM,0)
) AS "personalSum",
SUM(
IF(a.UNIT_BIGMAILMENT_MONEY,a.UNIT_BIGMAILMENT_MONEY,0) +
IF(a.COMPANY_ACCRUAL,a.COMPANY_ACCRUAL,0) +
IF(a.UNIT_PENSION_MONEY,a.UNIT_PENSION_MONEY,0) +
IF(a.UNIT_MEDICAL_MONEY,a.UNIT_MEDICAL_MONEY,0) +
IF(a.UNIT_INJURY_MONEY,a.UNIT_INJURY_MONEY,0) +
IF(a.UNIT_UNEMPLOYMENT_MONEY,a.UNIT_UNEMPLOYMENT_MONEY,0) +
IF(a.UNIT_BIRTH_MONEY,a.UNIT_BIRTH_MONEY,0) +
IF(a.UNIT_PROVIDENT_SUM,a.UNIT_PROVIDENT_SUM,0)
) AS "unitSum"
FROM t_payment_info a
<where>
1=1
<if test="socialAndFundBusinessPageVo != null">
<if test="socialAndFundBusinessPageVo.settleDomainId != null and socialAndFundBusinessPageVo.settleDomainId.trim() != ''">
AND a.SETTLE_DOMAIN_ID = #{socialAndFundBusinessPageVo.settleDomainId}
</if>
<if test="socialAndFundBusinessPageVo.year != null and socialAndFundBusinessPageVo.year.trim() != ''">
AND a.SOCIAL_PAY_MONTH in(
CONCAT(#{socialAndFundBusinessPageVo.year},'01'),
CONCAT(#{socialAndFundBusinessPageVo.year},'02'),
CONCAT(#{socialAndFundBusinessPageVo.year},'03'),
CONCAT(#{socialAndFundBusinessPageVo.year},'04'),
CONCAT(#{socialAndFundBusinessPageVo.year},'05'),
CONCAT(#{socialAndFundBusinessPageVo.year},'06'),
CONCAT(#{socialAndFundBusinessPageVo.year},'07'),
CONCAT(#{socialAndFundBusinessPageVo.year},'08'),
CONCAT(#{socialAndFundBusinessPageVo.year},'09'),
CONCAT(#{socialAndFundBusinessPageVo.year},'10'),
CONCAT(#{socialAndFundBusinessPageVo.year},'11'),
CONCAT(#{socialAndFundBusinessPageVo.year},'12')
)
AND a.SOCIAL_PAY_MONTH >= CONCAT(#{socialAndFundBusinessPageVo.year},'01')
</if>
</if>
<if test="settleDomainIds != null and settleDomainIds.size > 0">
AND a.SETTLE_DOMAIN_ID in
<foreach item="item" index="index" collection="settleDomainIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
GROUP BY
a.SOCIAL_PAY_MONTH desc
</where>
</select>
<!--tEmployeeInfo B端简单分页查询-->
<select id="getSocialAndFundBusinessDataCount" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SocialAndFundBusinessPageVo">
SELECT x.SOCIAL_PAY_MONTH as 'month',COUNT(DISTINCT x.EMP_IDCARD) as 'peopleCount' FROM
(
SELECT
a.SOCIAL_PAY_MONTH,
a.EMP_IDCARD
FROM
t_payment_info a
<where>
1=1
<if test="socialAndFundBusinessPageVo != null">
<if test="socialAndFundBusinessPageVo.settleDomainId != null and socialAndFundBusinessPageVo.settleDomainId.trim() != ''">
AND a.SETTLE_DOMAIN_ID = #{socialAndFundBusinessPageVo.settleDomainId}
</if>
<if test="socialAndFundBusinessPageVo.year != null and socialAndFundBusinessPageVo.year.trim() != ''">
AND a.SOCIAL_PAY_MONTH like CONCAT(#{socialAndFundBusinessPageVo.year},'%')
</if>
</if>
<if test="settleDomainIds != null and settleDomainIds.size > 0">
AND a.SETTLE_DOMAIN_ID in
<foreach item="item" index="index" collection="settleDomainIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
) x
</where>
GROUP BY x.SOCIAL_PAY_MONTH;
</select>
<!-- B端 -->
<select id="getSocialOrFundAddEmpIds" resultType="java.lang.String">
select x.EMP_ID from (
SELECT a.EMP_ID FROM t_social_info a
<where>
a.DELETE_FLAG=0 and a.HANDLE_STATUS=1
<if test="month != null and month.trim() != ''">
AND a.HANDLE_TIME <![CDATA[>=]]> DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d")
AND a.HANDLE_TIME <![CDATA[<=]]> last_day(DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d"))
</if>
<if test="settleDomainId != null and settleDomainId.trim() != ''">
AND a.SETTLE_DOMAIN = #{settleDomainId}
</if>
<if test="settleDomainIds != null and settleDomainIds.size > 0">
AND a.SETTLE_DOMAIN in
<foreach item="item" index="index" collection="settleDomainIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
UNION
SELECT b.EMP_ID FROM t_provident_fund b
<where>
b.DELETE_FLAG=0 and b.HANDLE_STATUS=1
<!--type 0 获取所有办理成功的社保或公积金 1 获取对应月份的办理成功的社保或公积金-->
<if test="month != null and month.trim() != ''">
AND b.HANDLE_TIME <![CDATA[>=]]> DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d")
AND b.HANDLE_TIME <![CDATA[<=]]> last_day(DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d"))
</if>
<if test="settleDomainId != null and settleDomainId.trim() != ''">
AND b.SETTLE_DOMAIN = #{settleDomainId}
</if>
<if test="settleDomainIds != null and settleDomainIds.size > 0">
AND b.SETTLE_DOMAIN in
<foreach item="item" index="index" collection="settleDomainIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
) x
</select>
<!--缴费库列表B端查询接口-->
<select id="getPaymentBusinessPageVo" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.PaymentBusinessPageVo">
SELECT
a.EMP_NAME as 'empName',
a.EMP_ID as 'empId',
a.SOCIAL_PAY_MONTH as 'month',
SUM(
IF(a.PERSONAL_ACCRUAL,a.PERSONAL_ACCRUAL,0) +
IF(a.PERSONAL_BIGMAILMENT_MONEY,a.PERSONAL_BIGMAILMENT_MONEY,0) +
IF(a.PERSONAL_MEDICAL_MONEY,a.PERSONAL_MEDICAL_MONEY,0) +
IF(a.PERSONAL_UNEMPLOYMENT_MONEY,a.PERSONAL_UNEMPLOYMENT_MONEY,0) +
IF(a.PERSONAL_PENSION_MONEY,a.PERSONAL_PENSION_MONEY,0) +
IF(a.PERSONAL_PROVIDENT_SUM,a.PERSONAL_PROVIDENT_SUM,0)
) AS "personalSum",
SUM(
IF(a.UNIT_BIGMAILMENT_MONEY,a.UNIT_BIGMAILMENT_MONEY,0) +
IF(a.COMPANY_ACCRUAL,a.COMPANY_ACCRUAL,0) +
IF(a.UNIT_PENSION_MONEY,a.UNIT_PENSION_MONEY,0) +
IF(a.UNIT_MEDICAL_MONEY,a.UNIT_MEDICAL_MONEY,0) +
IF(a.UNIT_INJURY_MONEY,a.UNIT_INJURY_MONEY,0) +
IF(a.UNIT_UNEMPLOYMENT_MONEY,a.UNIT_UNEMPLOYMENT_MONEY,0) +
IF(a.UNIT_BIRTH_MONEY,a.UNIT_BIRTH_MONEY,0) +
IF(a.UNIT_PROVIDENT_SUM,a.UNIT_PROVIDENT_SUM,0)
) AS "unitSum",
SUM(
IF(a.PERSONAL_PROVIDENT_SUM,a.PERSONAL_PROVIDENT_SUM,0)
) AS "fundPersonalSum",
SUM(
IF(a.UNIT_PROVIDENT_SUM,a.UNIT_PROVIDENT_SUM,0)
) AS "fundUnitSum",
SUM(
IF(a.PERSONAL_ACCRUAL,a.PERSONAL_ACCRUAL,0) +
IF(a.PERSONAL_BIGMAILMENT_MONEY,a.PERSONAL_BIGMAILMENT_MONEY,0) +
IF(a.PERSONAL_MEDICAL_MONEY,a.PERSONAL_MEDICAL_MONEY,0) +
IF(a.PERSONAL_UNEMPLOYMENT_MONEY,a.PERSONAL_UNEMPLOYMENT_MONEY,0) +
IF(a.PERSONAL_PENSION_MONEY,a.PERSONAL_PENSION_MONEY,0)
) AS "socialPersonalSum",
SUM(
IF(a.UNIT_BIGMAILMENT_MONEY,a.UNIT_BIGMAILMENT_MONEY,0) +
IF(a.COMPANY_ACCRUAL,a.COMPANY_ACCRUAL,0) +
IF(a.UNIT_PENSION_MONEY,a.UNIT_PENSION_MONEY,0) +
IF(a.UNIT_MEDICAL_MONEY,a.UNIT_MEDICAL_MONEY,0) +
IF(a.UNIT_INJURY_MONEY,a.UNIT_INJURY_MONEY,0) +
IF(a.UNIT_UNEMPLOYMENT_MONEY,a.UNIT_UNEMPLOYMENT_MONEY,0) +
IF(a.UNIT_BIRTH_MONEY,a.UNIT_BIRTH_MONEY,0)
) AS "socialUnitSum"
FROM t_payment_info a
<where>
1=1
<if test="paymentBusinessPageVo != null">
<if test="paymentBusinessPageVo.settleDomainId != null and paymentBusinessPageVo.settleDomainId.trim() != ''">
AND a.SETTLE_DOMAIN_ID = #{paymentBusinessPageVo.settleDomainId}
</if>
<if test="paymentBusinessPageVo.month != null and paymentBusinessPageVo.month.trim() != ''">
AND a.SOCIAL_PAY_MONTH = #{paymentBusinessPageVo.month}
</if>
</if>
<if test="settleDomainIds != null and settleDomainIds.size > 0">
AND a.SETTLE_DOMAIN_ID in
<foreach item="item" index="index" collection="settleDomainIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="empIds != null and empIds.size > 0">
AND a.EMP_ID in
<foreach item="item" index="index" collection="empIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
GROUP BY
a.SOCIAL_PAY_MONTH,a.EMP_ID
</where>
</select>
<select id="getSocialOrFundAddCount" resultType="java.lang.Integer">
select count(DISTINCT x.EMP_ID) from (
SELECT a.EMP_ID FROM t_social_info a
<where>
a.DELETE_FLAG=0 and a.HANDLE_STATUS in ('1','3')
<!--type 0 获取所有办理成功的社保或公积金 1 获取对应月份的办理成功的社保或公积金 -->
<if test="type != null and type == 1">
<if test="month != null and month.trim() != ''">
AND a.HANDLE_TIME <![CDATA[>=]]> DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d")
AND a.HANDLE_TIME <![CDATA[<=]]> last_day(DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d"))
</if>
</if>
<if test="settleDomainId != null and settleDomainId.trim() != ''">
AND a.SETTLE_DOMAIN = #{settleDomainId}
</if>
<if test="settleDomainIds != null and settleDomainIds.size > 0">
AND a.SETTLE_DOMAIN in
<foreach item="item" index="index" collection="settleDomainIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
UNION
SELECT b.EMP_ID FROM t_provident_fund b
<where>
b.DELETE_FLAG=0 and b.HANDLE_STATUS in ('1','3')
<!--type 0 获取所有办理成功的社保或公积金 1 获取对应月份的办理成功的社保或公积金-->
<if test="type != null and type == 1">
<if test="month != null and month.trim() != ''">
AND b.HANDLE_TIME <![CDATA[>=]]> DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d")
AND b.HANDLE_TIME <![CDATA[<=]]> last_day(DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d"))
</if>
</if>
<if test="settleDomainId != null and settleDomainId.trim() != ''">
AND b.SETTLE_DOMAIN = #{settleDomainId}
</if>
<if test="settleDomainIds != null and settleDomainIds.size > 0">
AND b.SETTLE_DOMAIN in
<foreach item="item" index="index" collection="settleDomainIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
) x
</select>
<select id="getSocialOrFundReduceCount" resultType="java.lang.Integer">
select count(DISTINCT x.EMP_ID) from (
SELECT a.EMP_ID FROM t_dispatch_info a
<where>
a.DELETE_FLAG=0
AND a.TYPE =1
AND a.SOCIAL_ID is not NULL
AND a.SOCIAL_HANDLE_STATUS=1
<if test="month != null and month.trim() != ''">
AND a.CREATE_TIME <![CDATA[>=]]> DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d")
AND a.CREATE_TIME <![CDATA[<=]]> last_day(DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d"))
</if>
<if test="settleDomainId != null and settleDomainId.trim() != ''">
AND a.SETTLE_DOMAIN = #{settleDomainId}
</if>
<if test="settleDomainIds != null and settleDomainIds.size > 0">
AND a.SETTLE_DOMAIN in
<foreach item="item" index="index" collection="settleDomainIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
UNION
SELECT b.EMP_ID FROM t_dispatch_info b
<where>
b.DELETE_FLAG=0 and b.TYPE=1
AND b.FUND_ID is not NULL
AND b.FUND_HANDLE_STATUS=1
<if test="month != null and month.trim() != ''">
AND b.CREATE_TIME <![CDATA[>=]]> DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d")
AND b.CREATE_TIME <![CDATA[<=]]> last_day(DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d"))
</if>
<if test="settleDomainId != null and settleDomainId.trim() != ''">
AND b.SETTLE_DOMAIN = #{settleDomainId}
</if>
<if test="settleDomainIds != null and settleDomainIds.size > 0">
AND b.SETTLE_DOMAIN in
<foreach item="item" index="index" collection="settleDomainIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
) x
</select>
<!--B端查询指定月份的派减分页数据-->
<select id="getSocialAndFundReduceInfo" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SocialAndFundReduceBusinessVo">
SELECT
z.EMP_NAME as 'empName',
GROUP_CONCAT(z.LEAVE_DATE) as 'leaveDate',
GROUP_CONCAT(z.SOCIAL_HANDLE_STATUS) as 'socialStatus',
GROUP_CONCAT(z.FUND_HANDLE_STATUS) as 'fundStatus',
GROUP_CONCAT(z.SOCIAL_REDUCE_DATE) as 'socialReduceDate',
GROUP_CONCAT(z.FUND_REDUCE_DATE) as 'fundReduceDate'
FROM (
SELECT
a.EMP_ID,
a.EMP_NAME,
a.LEAVE_DATE,
a.SOCIAL_HANDLE_STATUS,
NULL as 'FUND_HANDLE_STATUS',
a.SOCIAL_REDUCE_DATE as 'SOCIAL_REDUCE_DATE',
NULL as 'FUND_REDUCE_DATE'
FROM t_dispatch_info a
<where>
a.DELETE_FLAG=0
AND a.TYPE =1
AND a.SOCIAL_ID is not NULL
AND a.SOCIAL_HANDLE_STATUS=1
<if test="month != null and month.trim() != ''">
AND a.CREATE_TIME <![CDATA[>=]]> DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d")
AND a.CREATE_TIME <![CDATA[<=]]> last_day(DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d"))
</if>
<if test="settleDomainId != null and settleDomainId.trim() != ''">
AND a.SETTLE_DOMAIN = #{settleDomainId}
</if>
<if test="settleDomainIds != null and settleDomainIds.size > 0">
AND a.SETTLE_DOMAIN in
<foreach item="item" index="index" collection="settleDomainIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
UNION ALL
SELECT
b.EMP_ID,
b.EMP_NAME,
b.LEAVE_DATE,
NULL as 'SOCIAL_HANDLE_STATUS',
b.FUND_HANDLE_STATUS,
NULL as 'SOCIAL_REDUCE_DATE',
b.FUND_REDUCE_DATE as 'FUND_REDUCE_DATE'
FROM t_dispatch_info b
<where>
b.DELETE_FLAG=0
AND b.TYPE=1
AND b.FUND_ID is not NULL
AND b.FUND_HANDLE_STATUS=1
<if test="month != null and month.trim() != ''">
AND b.CREATE_TIME <![CDATA[>=]]> DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d")
AND b.CREATE_TIME <![CDATA[<=]]> last_day(DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d"))
</if>
<if test="settleDomainId != null and settleDomainId.trim() != ''">
AND b.SETTLE_DOMAIN = #{settleDomainId}
</if>
<if test="settleDomainIds != null and settleDomainIds.size > 0">
AND b.SETTLE_DOMAIN in
<foreach item="item" index="index" collection="settleDomainIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
) z GROUP BY z.EMP_ID
</select>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment