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 {
// B端人员使用的
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;
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.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 org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -129,4 +131,36 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> {
* @return: void
**/
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;
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.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 javax.servlet.http.HttpServletResponse;
......@@ -133,4 +135,35 @@ public interface TSalaryAccountService extends IService<TSalaryAccount> {
* @return: R
**/
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;
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.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 lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
......@@ -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 @@
<result property="payCollectFlag" column="PAY_SETTLE_FLAG"/>
</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的参数 -->
<resultMap id="ekpSalaryParamVoMap" type="com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParamVo">
<result property="fd_3b10af838eab5c" column="fd_3b10af838eab5c"/>
......@@ -848,4 +879,79 @@
<update id="backSalaryBySalaryId" >
update t_salary_account a set a.SEND_STATUS = '0' where a.SALARY_FORM_ID = #{salaryId}
</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>
......@@ -714,5 +714,11 @@ public class TPaymentInfo extends BaseEntity {
@ExcelIgnore
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;
}
......@@ -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.UpdateSocialFoundVo;
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.TPaymentInfoExportVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoSearchVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -240,4 +237,76 @@ public interface TPaymentInfoMapper extends BaseMapper<TPaymentInfo> {
*/
long getTPaymentFundIncomeCount(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo,
@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;
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.social.entity.TPaymentInfo;
import com.yifu.cloud.plus.v1.yifu.social.vo.ChangeDeptVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoSearchVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.*;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
......@@ -171,4 +169,65 @@ public interface TPaymentInfoService extends IService<TPaymentInfo> {
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;
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.social.entity.TProvidentFund;
import com.yifu.cloud.plus.v1.yifu.social.vo.FundAddAndReduceVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TProvidentFundSearchVo;
import javax.servlet.http.HttpServletResponse;
......@@ -47,4 +48,13 @@ public interface TProvidentFundService extends IService<TProvidentFund> {
void listExport(HttpServletResponse response, 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;
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.social.entity.TSocialInfo;
import com.yifu.cloud.plus.v1.yifu.social.vo.SocialAddAndReduceVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TSocialInfoSearchVo;
import javax.servlet.http.HttpServletResponse;
......@@ -47,4 +48,13 @@ public interface TSocialInfoService extends IService<TSocialInfo> {
void listExport(HttpServletResponse response, TSocialInfoSearchVo searchVo);
List<TSocialInfo> noPageDiy(TSocialInfoSearchVo searchVo);
/**
* B端使用-通过ID查询员工对应的派增派减数据
* @Author fxj
* @Date 2020-08-25
* @param empId
* @return
**/
SocialAddAndReduceVo getAddOrReduceInfoByEmpId(String empId);
}
......@@ -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.util.*;
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.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.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.TProvidentFundVo;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
......@@ -54,9 +60,15 @@ import java.util.List;
* @author fxj
* @date 2022-07-15 11:38:05
*/
@AllArgsConstructor
@Log4j2
@Service
public class TProvidentFundServiceImpl extends ServiceImpl<TProvidentFundMapper, TProvidentFund> implements TProvidentFundService {
private final TDispatchInfoMapper dispatchInfoMapper;
private final SysHouseHoldInfoMapper sysHouseHoldInfoMapper;
/**
* 公积金信息简单分页查询
* @param tProvidentFund 公积金信息
......@@ -244,4 +256,141 @@ public class TProvidentFundServiceImpl extends ServiceImpl<TProvidentFundMapper,
BeanUtil.copyProperties(excel, 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;
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.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.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.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.TSocialInfoVo;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
......@@ -54,9 +60,15 @@ import java.util.List;
* @author fxj
* @date 2022-07-15 11:38:05
*/
@AllArgsConstructor
@Log4j2
@Service
public class TSocialInfoServiceImpl extends ServiceImpl<TSocialInfoMapper, TSocialInfo> implements TSocialInfoService {
private final TDispatchInfoMapper dispatchInfoMapper;
private final SysHouseHoldInfoMapper sysHouseHoldInfoMapper;
/**
* 社保明细表简单分页查询
* @param tSocialInfo 社保明细表
......@@ -114,7 +126,7 @@ public class TSocialInfoServiceImpl extends ServiceImpl<TSocialInfoMapper, TSoci
WriteSheet writeSheet = EasyExcel.writerSheet("社保明细表"+index).build();
excelWriter.write(list,writeSheet);
}
if (Common.isNotNull(list)){
if (Common.isNotNull(list)){
list.clear();
}
out.flush();
......@@ -243,4 +255,177 @@ public class TSocialInfoServiceImpl extends ServiceImpl<TSocialInfoMapper, TSoci
BeanUtil.copyProperties(excel, 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);
}
}
}
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