Commit 60274e00 authored by hongguangwu's avatar hongguangwu

MVP1.5.1-收入证明等

parent 5c6ef5fe
package com.yifu.cloud.plus.v1.yifu.archives.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
/**
* @author pwang
* @date 2019-11-05 15:24:25
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("l_unit_info_for_prove")
@Schema(description = "工资证明用户操作数据表")
public class LUnitInfoForProve extends Model<LUnitInfoForProve> {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private String id;
/**
*
*/
@NotBlank(message = "创建人不能为空")
@ExcelAttribute(name = "", isNotEmpty = true, errorInfo = "不能为空")
@Schema(description = "创建人", name = "creatUser")
private String creatUser;
/**
*
*/
@NotBlank(message = "单位全称不能为空")
@Length(max = 20, message = "单位全称不能超过20个字符")
@Schema(description = "单位全称", name = "unitName")
private String unitName;
/**
*
*/
@NotBlank(message = "单位地址不能为空")
@Length(max = 50, message = "单位地址不能超过50个字符")
@Schema(description = "单位地址", name = "unitAddr")
private String unitAddr;
/**
* 单位固定电话
*/
@NotBlank(message = "单位固定电话不能为空")
@Length(max = 20, message = "单位固定电话不能超过20个字符")
@ExcelAttribute(name = "单位固定电话", isNotEmpty = true, errorInfo = "单位固定电话不能为空", maxLength = 20)
@Schema(description = "单位固定电话", name = "phone")
private String phone;
}
package com.yifu.cloud.plus.v1.yifu.archives.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
/**
* 收入证明附件关系表
*
* @author pwang
* @date 2019-11-08 11:23:53
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("m_salary_prova_atta")
@Schema(description = "收入证明附件关系表")
public class MSalaryProvaAtta extends Model<MSalaryProvaAtta> {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键", name = "id")
private String id;
/**
* 收入证明申请id
*/
@NotBlank(message = "收入证明申请id不能为空")
@Length(max = 32, message = "收入证明申请id不能超过32个字符")
private String salaryProvaId;
/**
* 附件id
*/
@NotBlank(message = "附件id不能为空")
@Length(max = 32, message = "附件id不能超过32个字符")
private String attaId;
}
package com.yifu.cloud.plus.v1.yifu.archives.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDate;
/**
* @author pwang
* @date 2019-11-05 15:24:25
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_prove_apply")
@Schema(description = "工资证明申请表")
public class TProveApply extends Model<TProveApply> {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键", name = "id")
private String id;
/**
* 员工id
*/
@NotBlank(message = "员工id不能为空")
@Length(max = 32, message = "员工id不能超过32个字符")
@ExcelAttribute(name = "员工id", isNotEmpty = true, errorInfo = "员工id不能为空", maxLength = 32)
@Schema(description = "员工id", name = "employeeInfo")
private String employeeInfo;
/**
* 申请人
*/
@ExcelAttribute(name = "申请人", isNotEmpty = true, errorInfo = "申请人不能为空")
@Schema(description = "申请人", name = "creatUser")
private String creatUser;
@Schema(description = "申请人名称")
private String creatUserName;
/**
* 申请日期
*/
@ExcelAttribute(name = "申请日期", isNotEmpty = true, errorInfo = "申请日期不能为空")
@Schema(description = "申请日期", name = "creatDate")
private LocalDate creatDate;
/**
* 开始月
*/
@NotBlank(message = "开始月不能为空")
@Length(max = 6, message = "开始月不能超过6个字符")
@ExcelAttribute(name = "开始月", isNotEmpty = true, errorInfo = "开始月不能为空", maxLength = 6)
@Schema(description = "开始月", name = "startMonth")
private String startMonth;
/**
* 结束月
*/
@NotBlank(message = "结束月不能为空")
@Length(max = 6, message = "结束月不能超过6个字符")
@ExcelAttribute(name = "结束月", isNotEmpty = true, errorInfo = "结束月不能为空", maxLength = 6)
@Schema(description = "结束月", name = "endMonth")
private String endMonth;
/**
* 证明的工资
*/
@NotNull(message = "证明的工资不能为空")
@ExcelAttribute(name = "证明的工资")
@Schema(description = "证明的工资", name = "proveSalary")
private BigDecimal proveSalary;
/**
* 申请理由
*/
@Length(max = 100, message = "申请理由不能超过100个字符")
@ExcelAttribute(name = "申请理由", maxLength = 100)
@Schema(description = "申请理由", name = "applyReason")
private String applyReason;
/**
* 审核状态 0待审核1审核通过2审核不通过
*/
@Length(max = 1, message = "审核状态不能超过1个字符")
@Schema(description = "审核状态 0待审核1审核通过2审核不通过", name = "auditStatus")
private String auditStatus;
/**
* 审核人
*/
@ExcelAttribute(name = "审核人")
@Schema(description = "审核人", name = "auditUser")
private String auditUser;
@Schema(description = "审核人名称")
private String auditUserName;
/**
* 审核日期
*/
@ExcelAttribute(name = "审核日期")
@Schema(description = "审核日期", name = "auditDate")
private LocalDate auditDate;
/* @Length(max = 100, message = "附件id逗号隔开不能超过100个字符")
@ExcelAttribute(name = "附件id逗号隔开", maxLength = 100)
@Schema(description = "附件id逗号隔开", name = "fileId")
private String fileId;*/
/**
* 0实发平均1应发平均
*/
@NotBlank(message = "实发应发不能为空")
@Length(max = 1, message = "实发应发类型不能超过1个字符")
@Schema(description = "0实发平均1应发平均", name = "sumType")
private String sumType;
/**
* 实际工资
*/
@NotNull(message = "实际工资不能为空")
@ExcelAttribute(name = "实际工资")
@Schema(description = "实际工资", name = "salary")
private BigDecimal salary;
/**
* 员工身份证号
*
* @Author pwang
* @Date 2019-11-07 10:27
* @return
**/
@Schema(description = "员工身份证号")
private String employeeIdCard;
@Schema(description = "员工姓名")
@ExcelAttribute(name = "姓名")
private String employeeName;
/**
* 结算主体id
*
* @Author pwang
* @Date 2019-11-07 10:27
* @return
**/
@Schema(description = "结算主体id")
private String settleDomain;
@Schema(description = "结算主体名称")
private String settleDomainName;
}
package com.yifu.cloud.plus.v1.yifu.archives.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
import java.util.Set;
/**
* @author pwang
* @date 2019-11-05 15:24:25
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_prove_record")
@Schema(description = "工资证明记录表")
public class TProveRecord extends Model<TProveRecord> {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**
* 员工id
*/
@NotBlank(message = "员工id不能为空")
@Length(max = 32, message = "员工id不能超过32个字符")
private String employeeInfo;
/**
* 员工姓名
*
* @Author pwang
* @Date 2019-11-07 10:27
* @return
**/
@Schema(description = "员工姓名")
@ExcelAttribute(name = "姓名")
@NotBlank(message = "员工姓名不能为空")
@ExcelProperty("姓名")
private String employeeName;
/**
* 员工身份证号
*
* @Author pwang
* @Date 2019-11-07 10:27
* @return
**/
@Schema(description = "员工身份证号")
@NotBlank(message = "员工身份证号不能为空")
@ExcelAttribute(name = "身份证")
@ExcelProperty("身份证")
private String employeeIdCard;
/**
* 结算主体(部门)名称
*
* @Author pwang
* @Date 2019-11-07 10:27
* @return
**/
@Schema(description = "结算主体(部门)名称")
@NotBlank(message = "结算主体名称不能为空")
@ExcelAttribute(name = "结算主体")
@ExcelProperty("结算主体")
private String employeeSettleDepartName;
/**
*
*/
private String creatUser;
@Schema(description = "申请人名称")
@ExcelAttribute(name = "开具人")
@ExcelProperty("开具人")
private String creatUserName;
/**
* 创建日期
*/
@Schema(description = "创建日期", name = "creatDate")
@ExcelAttribute(name = "开具日期")
@ExcelProperty("开具日期")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDate creatDate;
/**
* 开始月份
*/
@NotBlank(message = "开始月份不能为空")
@Length(max = 6, message = "开始月份(yyyyMM)不能超过6个字符")
@ExcelAttribute(name = "开始月份", isNotEmpty = true, errorInfo = "不能为空", maxLength = 6)
@Schema(description = "开始月份", name = "startMonth")
@ExcelProperty("开始月份")
private String startMonth;
/**
* 结束月份
*/
@NotBlank(message = "结束月份不能为空")
@Length(max = 6, message = "结束月份(yyyyMM)不能超过6个字符")
@ExcelAttribute(name = "结束月份", isNotEmpty = true, errorInfo = "不能为空", maxLength = 6)
@Schema(description = "结束月份", name = "endMonth")
@ExcelProperty("结束月份")
private String endMonth;
/**
* 计算的工资
*/
@NotNull(message = "计算的工资不能为空")
@ExcelAttribute(name = "计算的工资")
@Schema(description = "计算的工资(数据库数字)", name = "salary")
private BigDecimal salary;
/**
* 证明的工资
*/
@NotNull(message = "证明的工资不能为空")
@ExcelAttribute(name = "平均工资")
@Schema(description = "证明的工资(显示的数字)", name = "proveSalary")
@ExcelProperty("平均工资")
private BigDecimal proveSalary;
/**
* 是否作废 0否1是
*/
@Length(max = 1, message = "是否作废不能超过1个字符")
@ExcelAttribute(name = "是否作废", dataType = "isInvalid", isDataId = true)
@ExcelProperty("是否作废")
private String isInvalid;
/**
* 作废原因
*/
@Length(max = 100, message = "作废原因不能超过100个字符")
@ExcelAttribute(name = "作废原因")
@ExcelProperty("作废原因")
@Schema(description = "作废原因", name = "invalidReason")
private String invalidReason;
/**
* 证明编号
*/
@Length(max = 20, message = "证明编号不能超过20个字符")
@ExcelAttribute(name = "证明编号")
@Schema(description = "证明编号", name = "no")
@ExcelProperty("证明编号")
private String no;
/**
* 用途
*/
@Length(max = 100, message = "用途不能超过100个字符")
@ExcelAttribute(name = "用途")
@Schema(description = "用途", name = "purpose")
@ExcelProperty("用途")
private String purpose;
/**
* 0实发平均1应发平均
*/
@NotBlank(message = "实发应发不能为空")
@Length(max = 1, message = "实发应发不能超过1个字符")
@ExcelAttribute(name = "计算类型", dataType = "sumType", isDataId = true)
@Schema(description = "0实发平均1应发平均", name = "sumType")
@ExcelProperty("计算类型")
private String sumType;
/**
* 证明类型 0正式员工证明1试用期员工证明
*/
@NotBlank(message = "证明类型不能为空")
@Length(max = 1, message = "证明类型不能超过1个字符")
@Schema(description = "证明类型 0正式员工证明1试用期员工证明", name = "proveType")
private String proveType;
/**
* 打印次数
*/
@ExcelAttribute(name = "打印次数")
@Schema(description = "打印次数", name = "number")
private Integer number;
/**
*
*/
@NotBlank(message = "单位全称不能为空")
@Length(max = 20, message = "不能超过20个字符")
@Schema(description = "单位全称", name = "unitName")
private String unitName;
/**
*
*/
@NotBlank(message = "单位地址不能为空")
@Length(max = 50, message = "不能超过50个字符")
@Schema(description = "单位地址", name = "unitAddr")
private String unitAddr;
/**
* 单位固定电话
*/
@NotBlank(message = "单位固定电话不能为空")
@Length(max = 20, message = "单位固定电话不能超过20个字符")
@Schema(description = "单位固定电话", name = "phone")
private String phone;
/**
* 合同结束时间
*/
@Schema(description = "合同结束时间")
private Date contractEndDate;
/**
* 入职时间
*/
@Schema(description = "入职时间")
private LocalDate entryDate;
/**
* 合同类型
*/
@Schema(description = "合同类型")
private String contractType;
/**
* 岗位
*
* @Author
* @Date 2019-11-07 10:27pwang
* @return
**/
@Schema(description = "岗位")
private String post;
@Schema(description = "计算月份数")
private Integer mouthCount;
/**
* 申请人部门所在城市id
*
* @Author pwang
* @Date 2019-11-07 18:18
* @param null
* @return
**/
private String belongDepartCity;
/**
* 根据证明工资手动在方法中转换NumberToCN.number2CNMontrayUnit(re.getProveSalary())
*
* @Author pwang
* @Date 2019-11-07 10:43
* @return
**/
@Schema(description = "大写")
@TableField(exist = false)
private String capital;
@TableField(exist = false)
private List<String> idList;
@TableField(exist = false)
@Schema(description = "导出的表头的Set")
private Set<String> exportFields;
@Schema(description = "查询limit 开始")
private int limitStart;
@Schema(description = "查询limit 数据条数")
private int limitEnd;
}
......@@ -51,7 +51,7 @@ public class FileUploadController {
@Operation(description = "OSS文件上传接口" +
"@ApiImplicitParam(name = \"file\", value = \"Form文件上传\", required = true, dataType = \"__file\", paramType = \"form\"),\n" +
"\t\t\t@ApiImplicitParam(name = \"filePath\", value = \"文件上传路径\", required = false, dataType = \"String\", paramType = \"form\"),\n" +
"\t\t\t@ApiImplicitParam(name = \"type\", value = \"关系类型(0员工附件-学历 1 员工附件-伤残 2.员工附件-职业 3.员工附件-不良记录 4.员工附件-合同)\", required = true, dataType = \"int\", paramType = \"form\"),\n" +
"\t\t\t@ApiImplicitParam(name = \"type\", value = \"关系类型(0员工附件-学历 1 员工附件-伤残 2.员工附件-职业 3.员工附件-不良记录 4.员工附件-合同;5收入证明)\", required = true, dataType = \"int\", paramType = \"form\"),\n" +
"\t\t\t@ApiImplicitParam(name = \"domain\", value = \"实体id(传入就插入对应关系,用于编辑)\", required = false, paramType = \"form\")\n" +
"\t")
/*@ApiImplicitParams({
......
package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.*;
import com.yifu.cloud.plus.v1.yifu.archives.service.*;
import com.yifu.cloud.plus.v1.yifu.archives.utils.NumberToCN;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.LocalDateTimeUtils;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprSalaryProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.salary.vo.WageProofDto;
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.boot.context.properties.EnableConfigurationProperties;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;
/**
* @author pwang
* @date 2019-11-05 15:24:25
*/
@RestController
@AllArgsConstructor
@RequestMapping("/salaryProve")
@Tag(name = "工资证明")
@Slf4j
@EnableConfigurationProperties(DaprSalaryProperties.class)
public class SalaryProveController {
private final TProveApplyService tProveApplyService;
private final TProveRecordService tProveRecordService;
private final TEmployeeProjectService employeeProjectService;
private final TEmployeeContractInfoService employeeContractInfoService;
private final LUnitInfoForProveService unitInfoForProveService;
private final TAttaInfoService attaInfoService;
private final DaprSalaryProperties daprSalaryProperties;
private static final String CREAT_DATE = "CREAT_DATE";//证明申请的申请时间
/**
* 简单分页查询
*
* @param page 分页对象
* @param tProveApply
* @return
*/
@Operation(summary = "简单分页查询")
@GetMapping("/page")
public R<IPage<TProveApply>> getTProveApplyPage(Page<TProveApply> page, TProveApply tProveApply) {
return new R<>(tProveApplyService.getTProveApplyPage(page, tProveApply));
}
/**
* 通过id查询单条记录
* @return R
*/
@Operation(summary = "id查询")
@GetMapping("/{id}")
public R<TProveApply> getById(@PathVariable("id") String id) {
return new R<>(tProveApplyService.getById(id));
}
/**
* 新增记录
* @return R
*/
@Operation(summary = "新增(tproveapply_add)")
@PostMapping
@PreAuthorize("@pms.hasPermission('tproveapply_add')")
public R save(@Valid @RequestBody TProveApply tProveApply) {
return new R<>(tProveApplyService.save(tProveApply));
}
/**
* 修改记录
*
* @param tProveApply
* @return R
*/
@Operation(summary = "修改(tproveapply_edit)")
@SysLog("修改")
@PutMapping
@PreAuthorize("@pms.hasPermission('tproveapply_edit')")
public R update(@RequestBody TProveApply tProveApply) {
return new R<>(tProveApplyService.updateById(tProveApply));
}
/**
* 通过id删除一条记录
*
* @param id
* @return R
*/
@Operation(summary = "删除(tproveapply_del)")
@SysLog("删除")
@DeleteMapping("/{id}")
@PreAuthorize("@pms.hasPermission('tproveapply_del')")
public R removeById(@PathVariable String id) {
return new R<>(tProveApplyService.removeById(id));
}
/**
* 证明预览页面
*
* @param record
* @return
*/
@Operation(summary = "证明预览")
@PostMapping(value = "/prove")
public R<TProveRecord> prove(@RequestBody TProveRecord record) {
String startDate;
String endDate;
String sumType;
String emId;
int count;
String proveType;
if (record != null) {
startDate = record.getStartMonth();
endDate = record.getEndMonth();
sumType = record.getSumType();
emId = record.getEmployeeInfo();
proveType = record.getProveType();
} else {
return R.failed("参数错误!");
}
if (Common.isNotNull(startDate) && Common.isNotNull(endDate) && Common.isNotNull(sumType) && Common.isNotNull(emId) && Common.isNotNull(proveType)) {
//员工信息
TEmployeeProject em = employeeProjectService.getById(emId);
if (null == em) {
return R.failed("无此员工");
}
record.setEmployeeName(em.getEmpName());
record.setEmployeeIdCard(em.getEmpIdcard());
record.setEmployeeInfo(emId);
record.setCreatDate(LocalDate.now());
record.setEmployeeSettleDepartName(em.getDeptName());
record.setPost(em.getPost());
count = LocalDateTimeUtils.getBeginOfMonth(endDate.concat("01"), startDate.concat("01"), "yyyyMMdd") + 1;
record.setMouthCount(count);
if (CommonConstants.ZERO_STRING.equals(proveType)) {
//正式员工证明
//合同信息
List<TEmployeeContractInfo> contractList = employeeContractInfoService.list(Wrappers.<TEmployeeContractInfo>lambdaQuery().eq(TEmployeeContractInfo::getEmpId, emId).eq(TEmployeeContractInfo::getIsObsolete, CommonConstants.ZERO_STRING).orderByDesc(TEmployeeContractInfo::getContractStart));
if (Common.isNotNull(contractList)) {
record.setContractEndDate(contractList.get(0).getContractEnd());
record.setContractType(contractList.get(0).getContractType());
}
} else {
//试用期证明
record.setEntryDate(em.getEnjoinDate() == null ? em.getCreateTime().toLocalDate() : em.getEnjoinDate());
}
//申请信息
LambdaQueryWrapper<TProveApply> eq = Wrappers.<TProveApply>lambdaQuery().eq(TProveApply::getEmployeeInfo, emId).eq(TProveApply::getAuditStatus, CommonConstants.dingleDigitStrArray[1])
.eq(TProveApply::getSumType, sumType).eq(TProveApply::getStartMonth, startDate).eq(TProveApply::getEndMonth, endDate);
List<TProveApply> list = tProveApplyService.list(eq);
if (list != null && !list.isEmpty()) {//通过的申请
BigDecimal salary = list.get(0).getProveSalary();
record.setProveSalary(salary);
record.setSalary(list.get(0).getSalary());
record.setCapital(NumberToCN.number2CNMontrayUnit(salary));
} else {
try {
WageProofDto pd = new WageProofDto();
pd.setStartMouth(startDate);
pd.setEndMouth(endDate);
pd.setEmIdCard(em.getEmpIdcard());
pd.setSumType(sumType);
R<WageProofDto> wpR = HttpDaprUtil.invokeMethodPost(daprSalaryProperties.getAppUrl(), daprSalaryProperties.getAppId()
, "/tsalaryaccount/inner/findAverageSalaryForProve", pd, WageProofDto.class, SecurityConstants.FROM_IN);
if (null != wpR) {
WageProofDto wp = wpR.getData();
if (CommonConstants.SUCCESS.equals(wpR.getCode()) && null != wp) {
record.setProveSalary(wp.getSalary());
record.setSalary(wp.getSalary());
record.setCapital(NumberToCN.number2CNMontrayUnit(wp.getSalary()));
} else {
return R.failed(Common.isNotNull(wpR.getMsg()) ? wpR.getMsg() : "调取工资服务返回数据出错!");
}
} else {
return R.failed("调取工资服务返回数据出错!");
}
} catch (Exception e) {
log.error("调取工资服务出错!", e);
return R.failed("调取工资服务出错!");
}
}
} else {
return R.failed("参数出错!");
}
return new R(record);
}
/**
* 证明记录展示页面
*/
@Operation(summary = "证明记录展示页面")
@GetMapping(value = "/printing/{id}")
public R printing(@PathVariable String id) {
TProveRecord re = tProveRecordService.getById(id);
if (re != null) {
re.setCapital(NumberToCN.number2CNMontrayUnit(re.getProveSalary()));
} else {
return R.failed("无此记录!");
}
return new R(re);
}
/**
* 打印次数加一
*
* @param id
*/
@Operation(summary = "打印次数加一")
@GetMapping(value = "/addone/{id}")
public R addone(@PathVariable String id) {
TProveRecord re = tProveRecordService.getById(id);
if (null != re && null != re.getNumber()) {
re.setNumber(re.getNumber() + 1);
tProveRecordService.updateById(re);
return R.ok("操作成功");
} else {
return R.failed("无此记录");
}
}
/**
* 证明记录处理
*/
@Operation(summary = "证明记录处理")
@PostMapping(value = "/proveRecord")
public R<String> proveRecord(@Valid @RequestBody TProveRecord record) {
YifuUser user = SecurityUtils.getUser();
//记录用户单位信息
String userId = String.valueOf(user.getId());
if (!Common.isNotNull(record.getUnitAddr()) && !Common.isNotNull(record.getUnitName()) && !Common.isNotNull(record.getPhone())) {//有效数据
try {
LUnitInfoForProve unitInfo = new LUnitInfoForProve();
unitInfo.setPhone(record.getPhone());
unitInfo.setUnitAddr(record.getUnitAddr());
unitInfo.setUnitName(record.getUnitName());
unitInfo.setCreatUser(userId);
if (null != record.getId()) {
unitInfo.setId(record.getId());
unitInfoForProveService.updateById(unitInfo);
} else {
//没有id检查数据有没有名称重复
if (CommonConstants.dingleDigitIntArray[0] == unitInfoForProveService.count(Wrappers.<LUnitInfoForProve>lambdaQuery()
.eq(LUnitInfoForProve::getCreatUser, userId).eq(LUnitInfoForProve::getUnitName, unitInfo.getUnitName()))) {
unitInfoForProveService.save(unitInfo);
}
}
} catch (Exception e) {
log.error("用户操作数据保存出错", e);
}
}
record.setId(null);
if (CommonConstants.dingleDigitStrArray[0].equals(record.getProveType()) && Common.isEmpty(record.getPost())) {
return R.failed("正式员工证明岗位不能为空!");
}
//处理证明记录
record.setNumber(CommonConstants.dingleDigitIntArray[1]);
record.setCreatUser(userId);
record.setCreatUserName(user.getNickname());
record.setIsInvalid(CommonConstants.ZERO_STRING);
tProveRecordService.saveNo(record);//保存并自动生成编号
return new R(record.getNo());
}
/**
* 证明记录分页
*/
@Operation(summary = "证明记录分页查询")
@GetMapping("/findProveRecordPage")
public R<IPage<TProveRecord>> findProveRecordPage(Page<TProveRecord> page, TProveRecord pr) {
YifuUser user = SecurityUtils.getUser();
if (user != null && Common.isNotNull(user.getId()) && CommonConstants.ONE_STRING.equals(user.getSystemFlag())) {
pr.setCreatUser(String.valueOf(user.getId()));
}
page.addOrder(OrderItem.desc(CREAT_DATE));
return new R<>(tProveRecordService.getTProveRecordPage(page, pr));
}
/**
* 修改作废状态
*/
@Operation(summary = "收入证明修改作废状态(tproveapply_invalid) status:是否作废(0否1是);invalidReason:作废理由")
@SysLog("收入证明修改作废状态")
@PostMapping(value = "/updateStatus")
@PreAuthorize("@pms.hasPermission('tproveapply_invalid')")
public R updateStatus(String id, String status, String invalidReason) {
if (id != null) {
if (Common.isEmpty(status)) {
return R.failed("作废状态不能为空!");
}
if (!CommonConstants.ZERO_STRING.equals(status) && invalidReason == null) {
return R.failed("作废原因不能为空!");
} else {
TProveRecord pr = tProveRecordService.getById(id);
if (pr != null) {
pr.setIsInvalid(status);
if (!CommonConstants.ZERO_STRING.equals(status)) {
pr.setInvalidReason(invalidReason);
}
tProveRecordService.updateById(pr);
return R.ok("操作成功!");
} else {
return R.failed("无此证明记录!");
}
}
} else {
return R.failed("id不能为空!");
}
}
/**
* 证明记录
*/
@Operation(summary = "证明记录导出(tproveRecord_export接收流返回的文件,文件格式xls),idList:id 集合")
@PostMapping(value = "/exportProveRecord")
@PreAuthorize("@pms.hasPermission('tproveRecord_export')")
public void exportProveRecord(HttpServletResponse response, @RequestBody TProveRecord pr) {
YifuUser user = SecurityUtils.getUser();
if (user != null && Common.isNotNull(user.getId()) && CommonConstants.ONE_STRING.equals(user.getSystemFlag())) {
pr.setCreatUser(String.valueOf(user.getId()));
}
tProveRecordService.listExport(response, pr);
}
/**
* 新增证明申请
*/
@Operation(summary = "新增证明申请(tproveapply_apply)")
@PostMapping(value = "/proveApply")
@PreAuthorize("@pms.hasPermission('tproveapply_apply')")
public R proveApply(@Valid @RequestBody TProveApply proveApply, String[] attaIdArray) {
TEmployeeProject em = employeeProjectService.getById(proveApply.getEmployeeInfo());
if (null == em) {
return R.failed("无此员工!");
}
proveApply.setEmployeeIdCard(em.getEmpIdcard());
proveApply.setEmployeeName(em.getEmpName());
proveApply.setSettleDomain(em.getDeptId());
proveApply.setSettleDomainName(em.getDeptName());
return tProveApplyService.validSave(proveApply, attaIdArray);
}
/**
* 证明申请审核分页
*/
@Operation(summary = "证明申请分页查询")
@GetMapping("/proveApplyPage")
public R<IPage<TProveApply>> findproveApplyPage(Page<TProveApply> page, TProveApply proveApply) {
YifuUser user = SecurityUtils.getUser();
if (user != null && Common.isNotNull(user.getId()) && CommonConstants.ONE_STRING.equals(user.getSystemFlag())) {
proveApply.setCreatUser(String.valueOf(user.getId()));
}
if (Common.isEmpty(proveApply.getAuditStatus()) || !CommonConstants.dingleDigitStrArray[1].equals(proveApply.getAuditStatus())) {
page.addOrder(OrderItem.desc(CREAT_DATE));
}
return new R<>(tProveApplyService.getTProveApplyPage(page, proveApply));
}
/**
* @Author pwang
* @Date 2019-11-08 14:32
**/
@Operation(summary = "证明申请详情查询")
@GetMapping("/lookApply/{id}")
public R<TProveApply> lookApply(@PathVariable(value = "id", required = true) String id) {
return new R(tProveApplyService.getById(id));
}
@Operation(summary = "证明申请附件查询")
@GetMapping("/atta/{applyId}")
public R<List<TAttaInfo>> lookApplyAtta(@PathVariable(value = "applyId") String applyId) {
return attaInfoService.getAttaByApplyId(applyId);
}
/**
* 审核接口
*/
@Operation(summary = "审核接口(tproveapply_audit) auditStatus:审核结果(1审核通过2审核不通过)")
@GetMapping("/updateApplyStatus")
@PreAuthorize("@pms.hasPermission('tproveapply_audit')")
public R updateApplyStatus(@RequestParam String id, @RequestParam String auditStatus) {
TProveApply pa = tProveApplyService.getById(id);
if (pa != null) {
if (!CommonConstants.dingleDigitStrArray[1].equals(auditStatus) && !CommonConstants.dingleDigitStrArray[2].equals(auditStatus)) {
return R.failed("审核结果出错!");
}
YifuUser user = SecurityUtils.getUser();
pa.setAuditUser(String.valueOf(user.getId()));
pa.setAuditUserName(user.getNickname());
pa.setAuditDate(LocalDate.now());
pa.setAuditStatus(auditStatus);
tProveApplyService.updateById(pa);
return R.ok("操作成功!");
} else {
return R.failed("无此证明记录!");
}
}
}
package com.yifu.cloud.plus.v1.yifu.archives.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.archives.entity.LUnitInfoForProve;
import org.apache.ibatis.annotations.Mapper;
/**
* @author pwang
* @date 2019-11-05 15:24:25
*/
@Mapper
public interface LUnitInfoForProveMapper extends BaseMapper<LUnitInfoForProve> {
}
package com.yifu.cloud.plus.v1.yifu.archives.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.archives.entity.MSalaryProvaAtta;
import org.apache.ibatis.annotations.Mapper;
/**
* 收入证明附件关系表
*
* @author pwang
* @date 2019-11-08 11:23:53
*/
@Mapper
public interface MSalaryProvaAttaMapper extends BaseMapper<MSalaryProvaAtta> {
}
......@@ -39,4 +39,6 @@ public interface TAttaInfoMapper extends BaseMapper<TAttaInfo> {
List<TAttaInfo> getKeenAtta(@Param("dayStart")LocalDateTime dayStart, @Param("values")Collection<String> values);
int updateDomainId(@Param("domainId")String domainId, @Param("ids")List<String> ids);
List<TAttaInfo> getAttaByApplyId(@Param("applyId")String applyId);
}
package com.yifu.cloud.plus.v1.yifu.archives.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TProveApply;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* @author pwang
* @date 2019-11-05 15:24:25
*/
@Mapper
public interface TProveApplyMapper extends BaseMapper<TProveApply> {
/**
* 简单分页查询
*
* @param tProveApply
* @return
*/
IPage<TProveApply> getTProveApplyPage(Page page, @Param("tProveApply") TProveApply tProveApply);
}
package com.yifu.cloud.plus.v1.yifu.archives.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TProveRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author pwang
* @date 2019-11-05 15:24:25
*/
@Mapper
public interface TProveRecordMapper extends BaseMapper<TProveRecord> {
/**
* 简单分页查询
*
* @param tProveRecord
* @return
*/
IPage<TProveRecord> getTProveRecordPage(Page page, @Param("tProveRecord") TProveRecord tProveRecord);
/**
* @param tProveRecord
* @Description: 导出查条数
* @Author: hgw
* @Date: 2023/2/22 14:56
* @return: int
**/
int getCountByExport(@Param("tProveRecord") TProveRecord tProveRecord);
/**
* @param tProveRecord
* @Description: 导出list
* @Author: hgw
* @Date: 2023/2/22 14:56
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.archives.entity.TProveRecord>
**/
List<TProveRecord> getRecordInfoNoPage(@Param("tProveRecord") TProveRecord tProveRecord);
Integer createNo(@Param("str") String str);
}
package com.yifu.cloud.plus.v1.yifu.archives.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.LUnitInfoForProve;
/**
* @author pwang
* @date 2019-11-05 15:24:25
*/
public interface LUnitInfoForProveService extends IService<LUnitInfoForProve> {
}
package com.yifu.cloud.plus.v1.yifu.archives.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.MSalaryProvaAtta;
/**
* 收入证明附件关系表
*
* @author pwang
* @date 2019-11-08 11:23:53
*/
public interface MSalaryProvaAttaService extends IService<MSalaryProvaAtta> {
}
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TAttaInfo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import java.time.LocalDateTime;
import java.util.Collection;
......@@ -51,4 +52,14 @@ public interface TAttaInfoService extends IService<TAttaInfo> {
List<TAttaInfo> getKeenAtta(LocalDateTime dayStart, Collection<String> values);
Boolean updateDomainId(String domainId, List<String> ids);
/**
* @param applyId
* @Description: 收入证明使用
* @Author: hgw
* @Date: 2023/2/22 10:50
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.archives.entity.TAttaInfo>>
**/
R<List<TAttaInfo>> getAttaByApplyId(String applyId);
}
package com.yifu.cloud.plus.v1.yifu.archives.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TProveApply;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
/**
* @author pwang
* @date 2019-11-05 15:24:25
*/
public interface TProveApplyService extends IService<TProveApply> {
/**
* 简单分页查询
*
* @param tProveApply
* @return
*/
IPage<TProveApply> getTProveApplyPage(Page<TProveApply> page, TProveApply tProveApply);
R validSave(TProveApply proveApply, String[] attaIdArray);
}
package com.yifu.cloud.plus.v1.yifu.archives.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TProveRecord;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* @author pwang
* @date 2019-11-05 15:24:25
*/
public interface TProveRecordService extends IService<TProveRecord> {
/**
* 简单分页查询
*/
IPage<TProveRecord> getTProveRecordPage(Page<TProveRecord> page, TProveRecord tProveRecord);
void saveNo(TProveRecord record);
List<TProveRecord> getRecordInfoNoPage(TProveRecord pr);
void listExport(HttpServletResponse response, TProveRecord searchVo);
}
package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.LUnitInfoForProve;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.LUnitInfoForProveMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.LUnitInfoForProveService;
import org.springframework.stereotype.Service;
/**
* @author pwang
* @date 2019-11-05 15:24:25
*/
@Service
public class LUnitInfoForProveServiceImpl extends ServiceImpl<LUnitInfoForProveMapper, LUnitInfoForProve> implements LUnitInfoForProveService {
}
package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.MSalaryProvaAtta;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.MSalaryProvaAttaMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.MSalaryProvaAttaService;
import org.springframework.stereotype.Service;
/**
* 收入证明附件关系表
*
* @author pwang
* @date 2019-11-08 11:23:53
*/
@Service
public class MSalaryProvaAttaServiceImpl extends ServiceImpl<MSalaryProvaAttaMapper, MSalaryProvaAtta> implements MSalaryProvaAttaService {
}
......@@ -8,9 +8,11 @@ import com.yifu.cloud.plus.v1.yifu.archives.mapper.TAttaInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TAttaInfoService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.OSSUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.net.URL;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;
......@@ -107,4 +109,19 @@ public class TAttaInfoServiceImpl extends ServiceImpl<TAttaInfoMapper, TAttaInfo
}
return baseMapper.updateDomainId(domainId,ids) > 0;
}
@Override
public R<List<TAttaInfo>> getAttaByApplyId(String applyId) {
List<TAttaInfo> list = baseMapper.getAttaByApplyId(applyId);
if (Common.isNotNull(list)) {
URL url;
for (TAttaInfo atta:list) {
url = ossUtil.getObjectUrl(null, atta.getAttaSrc());
atta.setAttaUrl(url.toString());
}
return R.ok(list);
}else{
return R.failed("没有附件");
}
}
}
package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.MSalaryProvaAtta;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TProveApply;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TProveApplyMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.MSalaryProvaAttaService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TProveApplyService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
/**
* @author pwang
* @date 2019-11-05 15:24:25
*/
@Service
public class TProveApplyServiceImpl extends ServiceImpl<TProveApplyMapper, TProveApply> implements TProveApplyService {
@Autowired
private MSalaryProvaAttaService salaryProvaAttaService;
/**
* 简单分页查询
*
* @param tProveApply
* @return
*/
@Override
public IPage<TProveApply> getTProveApplyPage(Page<TProveApply> page, TProveApply tProveApply) {
return baseMapper.getTProveApplyPage(page, tProveApply);
}
@Override
public R validSave(TProveApply proveApply, String[] attaIdArray) {
YifuUser user = SecurityUtils.getUser();
//查重
long count = this.count(Wrappers.<TProveApply>lambdaQuery()
.eq(TProveApply::getEmployeeInfo, proveApply.getEmployeeInfo())
.eq(TProveApply::getStartMonth, proveApply.getStartMonth())
.eq(TProveApply::getEndMonth, proveApply.getEndMonth())
.eq(TProveApply::getSumType, proveApply.getSumType())
.ne(TProveApply::getAuditStatus, CommonConstants.dingleDigitStrArray[2]));
if (count > 0) {
return R.failed("该员工这段时间内已存在申请记录");
}
proveApply.setId(null);
//初始化数据填充
proveApply.setAuditStatus(CommonConstants.ZERO_STRING);//待审核
proveApply.setCreatDate(LocalDate.now());
proveApply.setCreatUser(user.getId());
proveApply.setCreatUserName(user.getNickname());
//保存数据
this.save(proveApply);
if (Common.isNotNull(attaIdArray)) {
//保存关系
List<MSalaryProvaAtta> mList = new ArrayList<>();
MSalaryProvaAtta m;
for (String id : attaIdArray) {
m = new MSalaryProvaAtta();
m.setAttaId(id);
m.setSalaryProvaId(proveApply.getId());
mList.add(m);
}
salaryProvaAttaService.saveBatch(mList);
}
return R.ok("操作成功!");
}
}
package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
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.yifu.archives.entity.TProveRecord;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TProveRecordMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TProveRecordService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors;
/**
* @author pwang
* @date 2019-11-05 15:24:25
*/
@Service
public class TProveRecordServiceImpl extends ServiceImpl<TProveRecordMapper, TProveRecord> implements TProveRecordService {
private Lock lock = new ReentrantLock();
/**
* 简单分页查询
*
* @param tProveRecord
* @return
*/
@Override
public IPage<TProveRecord> getTProveRecordPage(Page<TProveRecord> page, TProveRecord tProveRecord) {
return baseMapper.getTProveRecordPage(page, tProveRecord);
}
@Override
public synchronized void saveNo(TProveRecord record) {
String str = "WX-";
if (record.getUnitName() != null) {
if (record.getUnitName().contains("易服")) {
str = "YF-";
} else if (record.getUnitName().contains("柯恩")) {
str = "KE-";
}
}
Integer count = 0;
//cityName = cityName.replace("市", "");
//str += PingYinUtil.getPYIndexStr(cityName, true) + "-";
count = baseMapper.createNo(str);
if (count != null) {
count++;
if (count < 10000) {
str += new DecimalFormat("00000").format(count);
} else {
str += String.valueOf(count);
}
} else {
str += "00001";
}
record.setNo(str);
this.save(record);
}
@Override
public List<TProveRecord> getRecordInfoNoPage(TProveRecord pr) {
return baseMapper.getRecordInfoNoPage(pr);
}
/**
* 工资报账主表(工资条)批量导出
*
* @return
*/
@Override
public void listExport(HttpServletResponse response, TProveRecord searchVo) {
String fileName = "证明记录导出" + DateUtil.getThisTime() + CommonConstants.XLSX;
//获取要导出的列表
List<TProveRecord> list = new ArrayList<>();
int count = baseMapper.getCountByExport(searchVo);
ServletOutputStream out = null;
try {
out = response.getOutputStream();
response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setCharacterEncoding("utf-8");
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
if (Common.isEmpty(searchVo.getExportFields())) {
//String[] exportFields = {"姓名", "证明编号", "身份证", "结算主体", "计算类型", "开始月份", "结束月份"
// , "平均工资", "开具人", "开具日期", "用途", "是否作废", "作废原因"}
String[] exportFields = {"employeeName", "no", "employeeIdCard", "employeeSettleDepartName", "sumType"
, "startMonth", "endMonth", "proveSalary", "creatUserName", "creatDate", "purpose", "isInvalid"
, "invalidReason"};
Set<String> exportSet = Arrays.stream(exportFields).collect(Collectors.toSet());
searchVo.setExportFields(exportSet);
}
ExcelWriter excelWriter = EasyExcelFactory.write(out, TProveRecord.class).includeColumnFiledNames(searchVo.getExportFields()).build();
int index = 0;
WriteSheet writeSheet;
if (count > CommonConstants.ZERO_INT) {
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT_3) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT_3);
list = baseMapper.getRecordInfoNoPage(searchVo);
if (Common.isNotNull(list)) {
writeSheet = EasyExcelFactory.writerSheet("证明记录" + index).build();
excelWriter.write(list, writeSheet);
index++;
list.clear();
}
}
} else {
writeSheet = EasyExcelFactory.writerSheet("证明记录" + index).build();
excelWriter.write(list, writeSheet);
}
if (Common.isNotNull(list)) {
list.clear();
}
out.flush();
excelWriter.finish();
} catch (Exception e) {
log.error("执行异常", e);
} finally {
try {
if (null != out) {
out.close();
}
} catch (IOException e) {
log.error("执行异常", e);
}
}
}
}
/**
* Copyright © 2017yifu. All rights reserved.
*
* @Title: NumberToCN.java
* @Prject: wanxin_hr
* @Package: com.yifu.util
* @Description: TODO
* @author: Administrator
* @date: 2017年5月8日 下午6:45:01
* @version: V1.0
*/
package com.yifu.cloud.plus.v1.yifu.archives.utils;
import java.math.BigDecimal;
/**
* @Author: wangan
* @Date: 2019/8/9
* @Description: 金额转换金额大写, 从老hr复制过
* @return:
**/
public class NumberToCN {
/**
* 汉语中数字大写
*/
private static final String[] CN_UPPER_NUMBER = {"零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"};
/**
* 汉语中货币单位大写,这样的设计类似于占位符
*/
private static final String[] CN_UPPER_MONETRAY_UNIT = {"分", "角", "元", "拾", "佰", "仟", "万", "拾", "佰", "仟", "亿", "拾",
"佰", "仟", "兆", "拾", "佰", "仟"};
/**
* 特殊字符:整
*/
private static final String CN_FULL = "整";
/**
* 特殊字符:负
*/
private static final String CN_NEGATIVE = "负";
/**
* 金额的精度,默认值为2
*/
private static final int MONEY_PRECISION = 2;
/**
* 特殊字符:零元整
*/
private static final String CN_ZEOR_FULL = "零元" + CN_FULL;
/**
* 把输入的金额转换为汉语中人民币的大写
*
* @param numberOfMoney
* 输入的金额
* @return 对应的汉语大写
*/
public static String number2CNMontrayUnit(BigDecimal numberOfMoney) {
if (null == numberOfMoney) {
numberOfMoney = BigDecimal.ZERO;
}
StringBuffer sb = new StringBuffer();
// -1, 0, or 1 as the value of this BigDecimal is negative, zero, or
// positive.
int signum = numberOfMoney.signum();
// 零元整的情况
if (signum == 0) {
return CN_ZEOR_FULL;
}
// 这里会进行金额的四舍五入
long number = numberOfMoney.movePointRight(MONEY_PRECISION).setScale(0, 4).abs().longValue();
// 得到小数点后两位值
long scale = number % 100;
int numUnit = 0;
int numIndex = 0;
boolean getZero = false;
// 判断最后两位数,一共有四中情况:00 = 0, 01 = 1, 10, 11
if (!(scale > 0)) {
numIndex = 2;
number = number / 100;
getZero = true;
}
if ((scale > 0) && (!(scale % 10 > 0))) {
numIndex = 1;
number = number / 10;
getZero = true;
}
int zeroSize = 0;
while (true) {
if (number <= 0) {
break;
}
// 每次获取到最后一个数
numUnit = (int) (number % 10);
if (numUnit > 0) {
if ((numIndex == 9) && (zeroSize >= 3)) {
sb.insert(0, CN_UPPER_MONETRAY_UNIT[6]);
}
if ((numIndex == 13) && (zeroSize >= 3)) {
sb.insert(0, CN_UPPER_MONETRAY_UNIT[10]);
}
sb.insert(0, CN_UPPER_MONETRAY_UNIT[numIndex]);
sb.insert(0, CN_UPPER_NUMBER[numUnit]);
getZero = false;
zeroSize = 0;
} else {
++zeroSize;
if (!(getZero)) {
sb.insert(0, CN_UPPER_NUMBER[numUnit]);
}
if (numIndex == 2) {
if (number > 0) {
sb.insert(0, CN_UPPER_MONETRAY_UNIT[numIndex]);
}
} else if (((numIndex - 2) % 4 == 0) && (number % 1000 > 0)) {
sb.insert(0, CN_UPPER_MONETRAY_UNIT[numIndex]);
}
getZero = true;
}
// 让number每次都去掉最后一个数
number = number / 10;
++numIndex;
}
// 如果signum == -1,则说明输入的数字为负数,就在最前面追加特殊字符:负
if (signum == -1) {
sb.insert(0, CN_NEGATIVE);
}
// 输入的数字小数点后两位为"00"的情况,则要在最后追加特殊字符:整
if (!(scale > 0)) {
sb.append(CN_FULL);
}
return sb.toString();
}
}
<?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.yifu.archives.mapper.LUnitInfoForProveMapper">
<resultMap id="lUnitInfoForProveMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.LUnitInfoForProve">
<id property="id" column="id"/>
<result property="creatUser" column="creat_user"/>
<result property="unitName" column="unit_name"/>
<result property="unitAddr" column="unit_addr"/>
<result property="phone" column="phone"/>
</resultMap>
<sql id="Base_Column_List">
a.id,
a.creat_user,
a.unit_name,
a.unit_addr,
a.phone
</sql>
<sql id="lUnitInfoForProve_where">
<if test="lUnitInfoForProve != null">
<if test="lUnitInfoForProve.id != null">
AND a.id = #{lUnitInfoForProve.id}
</if>
<if test="lUnitInfoForProve.creatUser != null">
AND a.creat_user = #{lUnitInfoForProve.creatUser}
</if>
<if test="lUnitInfoForProve.unitName != null and lUnitInfoForProve.unitName.trim() != ''">
AND a.unit_name = #{lUnitInfoForProve.unitName}
</if>
<if test="lUnitInfoForProve.unitAddr != null and lUnitInfoForProve.unitAddr.trim() != ''">
AND a.unit_addr = #{lUnitInfoForProve.unitAddr}
</if>
<if test="lUnitInfoForProve.phone != null and lUnitInfoForProve.phone.trim() != ''">
AND a.phone = #{lUnitInfoForProve.phone}
</if>
</if>
</sql>
</mapper>
<?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.yifu.archives.mapper.MSalaryProvaAttaMapper">
<resultMap id="mSalaryProvaAttaMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.MSalaryProvaAtta">
<id property="id" column="id"/>
<result property="salaryProvaId" column="SALARY_PROVA_ID"/>
<result property="attaId" column="ATTA_ID"/>
</resultMap>
<sql id="Base_Column_List">
a.id,
a.SALARY_PROVA_ID,
a.ATTA_ID
</sql>
<sql id="mSalaryProvaAtta_where">
<if test="mSalaryProvaAtta != null">
<if test="mSalaryProvaAtta.id != null and mSalaryProvaAtta.id.trim() != ''">
AND a.id = #{mSalaryProvaAtta.id}
</if>
<if test="mSalaryProvaAtta.salaryProvaId != null and mSalaryProvaAtta.salaryProvaId.trim() != ''">
AND a.SALARY_PROVA_ID = #{mSalaryProvaAtta.salaryProvaId}
</if>
<if test="mSalaryProvaAtta.attaId != null and mSalaryProvaAtta.attaId.trim() != ''">
AND a.ATTA_ID = #{mSalaryProvaAtta.attaId}
</if>
</if>
</sql>
</mapper>
......@@ -8,7 +8,7 @@
<result property="attaSrc" column="atta_src"/>
<result property="attaSize" column="atta_size"/>
<result property="attaType" column="atta_type"/>
<result property="createUser" column="create_user"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="relationType" column="relation_type"/>
<result property="domainId" column="domain_id"/>
......@@ -19,7 +19,7 @@
a.atta_src,
a.atta_size,
a.atta_type,
a.create_user,
a.create_by,
a.create_time,
a.relation_type,
a.domain_id
......@@ -41,8 +41,8 @@
<if test="tAttaInfo.attaType != null and tAttaInfo.attaType.trim() != ''">
AND a.atta_type = #{tAttaInfo.attaType}
</if>
<if test="tAttaInfo.createUser != null and tAttaInfo.createUser.trim() != ''">
AND a.create_user = #{tAttaInfo.createUser}
<if test="tAttaInfo.createBy != null and tAttaInfo.createBy.trim() != ''">
AND a.create_by = #{tAttaInfo.createBy}
</if>
<if test="tAttaInfo.createTime != null">
AND a.create_time = #{tAttaInfo.createTime}
......@@ -106,4 +106,12 @@
</foreach>
</if>
</update>
<select id="getAttaByApplyId" resultMap="tAttaInfoMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_atta_info a
where EXISTS (select 1 from m_salary_prova_atta b where b.SALARY_PROVA_ID = #{applyId} and a.id = b.ATTA_ID);
</select>
</mapper>
<?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.yifu.archives.mapper.TProveApplyMapper">
<resultMap id="tProveApplyMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.TProveApply">
<id property="id" column="id"/>
<result property="employeeInfo" column="employee_info"/>
<result property="creatUser" column="creat_user"/>
<result property="creatDate" column="creat_date"/>
<result property="startMonth" column="start_month"/>
<result property="endMonth" column="end_month"/>
<result property="proveSalary" column="prove_salary"/>
<result property="applyReason" column="apply_reason"/>
<result property="auditStatus" column="audit_status"/>
<result property="auditUser" column="audit_user"/>
<result property="auditDate" column="audit_date"/>
<result property="sumType" column="sum_type"/>
<result property="salary" column="salary"/>
<result property="employeeName" column="EMPLOYEE_NAME"/>
<result property="employeeIdCard" column="EMPLOYEE_ID_CARD"/>
<result property="settleDomainName" column="SETTLE_DOMAIN_NAME"/>
<result property="creatUserName" column="CREAT_USER_NAME"/>
</resultMap>
<sql id="Base_Column_List">
a.id,
a.employee_info,
a.creat_user,
a.creat_date,
a.start_month,
a.end_month,
a.prove_salary,
a.apply_reason,
a.audit_status,
a.audit_user,
a.audit_date,
a.sum_type,
a.salary,
a.EMPLOYEE_NAME,
a.EMPLOYEE_ID_CARD,
a.SETTLE_DOMAIN_NAME,
a.AUDIT_USER_NAME,
a.CREAT_USER_NAME
</sql>
<sql id="tProveApply_where">
<if test="tProveApply != null">
<if test="tProveApply.employeeIdCard != null and tProveApply.employeeIdCard.trim() != ''">
AND a.EMPLOYEE_ID_CARD like '%${tProveApply.employeeIdCard}%'
</if>
<if test="tProveApply.employeeName != null and tProveApply.employeeName.trim() != ''">
AND a.EMPLOYEE_NAME like '%${tProveApply.employeeName}%'
</if>
<if test="tProveApply.employeeInfo != null and tProveApply.employeeInfo.trim() != ''">
AND a.employee_info = #{tProveApply.employeeInfo}
</if>
<if test="tProveApply.creatUser != null">
AND a.creat_user = #{tProveApply.creatUser}
</if>
<if test="tProveApply.creatDate != null">
AND a.creat_date = #{tProveApply.creatDate}
</if>
<if test="tProveApply.startMonth != null and tProveApply.startMonth.trim() != ''">
AND a.start_month = #{tProveApply.startMonth}
</if>
<if test="tProveApply.endMonth != null and tProveApply.endMonth.trim() != ''">
AND a.end_month = #{tProveApply.endMonth}
</if>
<if test="tProveApply.proveSalary != null">
AND a.prove_salary = #{tProveApply.proveSalary}
</if>
<if test="tProveApply.applyReason != null and tProveApply.applyReason.trim() != ''">
AND a.apply_reason = #{tProveApply.applyReason}
</if>
<if test="tProveApply.auditStatus != null">
AND a.audit_status = #{tProveApply.auditStatus}
</if>
<if test="tProveApply.auditUser != null">
AND a.audit_user = #{tProveApply.auditUser}
</if>
<if test="tProveApply.auditDate != null">
AND a.audit_date = #{tProveApply.auditDate}
</if>
<if test="tProveApply.sumType != null">
AND a.sum_type = #{tProveApply.sumType}
</if>
<if test="tProveApply.salary != null">
AND a.salary = #{tProveApply.salary}
</if>
</if>
</sql>
<!--tProveApply简单分页查询-->
<select id="getTProveApplyPage" resultMap="tProveApplyMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_prove_apply a
<where>
1=1
<include refid="tProveApply_where"/>
</where>
</select>
</mapper>
<?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.yifu.archives.mapper.TProveRecordMapper">
<resultMap id="tProveRecordMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.TProveRecord">
<id property="id" column="id"/>
<result property="employeeInfo" column="employee_info"/>
<result property="creatUser" column="creat_user"/>
<result property="creatDate" column="creat_date"/>
<result property="startMonth" column="start_month"/>
<result property="endMonth" column="end_month"/>
<result property="salary" column="salary"/>
<result property="proveSalary" column="prove_salary"/>
<result property="isInvalid" column="is_invalid"/>
<result property="invalidReason" column="invalid_reason"/>
<result property="no" column="no"/>
<result property="purpose" column="purpose"/>
<result property="sumType" column="sum_type"/>
<result property="proveType" column="prove_type"/>
<result property="number" column="number"/>
<result property="unitName" column="unit_name"/>
<result property="unitAddr" column="unit_addr"/>
<result property="phone" column="phone"/>
<result property="employeeIdCard" column="EMPLOYEE_ID_CARD"/>
<result property="employeeName" column="EMPLOYEE_NAME"/>
<result property="employeeSettleDepartName" column="EMPLOYEE_SETTLE_DEPART_NAME"/>
<result property="creatUserName" column="CREAT_USER_NAME"/>
</resultMap>
<sql id="Base_Column_List">
a.id,
a.employee_info,
a.creat_user,
a.creat_date,
a.start_month,
a.end_month,
a.salary,
a.prove_salary,
a.is_invalid,
a.invalid_reason,
a.no,
a.purpose,
a.sum_type,
a.prove_type,
a.number,
a.unit_name,
a.unit_addr,
a.phone,
a.EMPLOYEE_ID_CARD,
a.EMPLOYEE_NAME,
a.EMPLOYEE_SETTLE_DEPART_NAME,
a.CREAT_USER_NAME
</sql>
<sql id="tProveRecord_where">
<if test="tProveRecord != null">
<if test="tProveRecord.idList != null and tProveRecord.idList.size>0">
AND a.id in
<foreach item="idStr" index="index" collection="tProveRecord.idList" open="(" separator="," close=")">
#{idStr}
</foreach>
</if>
<if test="tProveRecord.creatUser != null">
AND a.creat_user = #{tProveRecord.creatUser}
</if>
<if test="tProveRecord.employeeIdCard != null and tProveRecord.employeeIdCard.trim() != ''">
AND a.EMPLOYEE_ID_CARD like '%${tProveRecord.employeeIdCard}%'
</if>
<if test="tProveRecord.employeeName != null and tProveRecord.employeeName.trim() != ''">
AND a.EMPLOYEE_NAME like '%${tProveRecord.employeeName}%'
</if>
<if test="tProveRecord.creatDate != null">
AND a.creat_date = #{tProveRecord.creatDate}
</if>
<if test="tProveRecord.startMonth != null and tProveRecord.startMonth.trim() != ''">
AND a.start_month = #{tProveRecord.startMonth}
</if>
<if test="tProveRecord.endMonth != null and tProveRecord.endMonth.trim() != ''">
AND a.end_month = #{tProveRecord.endMonth}
</if>
<if test="tProveRecord.salary != null">
AND a.salary = #{tProveRecord.salary}
</if>
<if test="tProveRecord.proveSalary != null">
AND a.prove_salary = #{tProveRecord.proveSalary}
</if>
<if test="tProveRecord.isInvalid != null">
AND a.is_invalid = #{tProveRecord.isInvalid}
</if>
<if test="tProveRecord.invalidReason != null and tProveRecord.invalidReason.trim() != ''">
AND a.invalid_reason = #{tProveRecord.invalidReason}
</if>
<if test="tProveRecord.no != null and tProveRecord.no.trim() != ''">
AND a.no = #{tProveRecord.no}
</if>
<if test="tProveRecord.purpose != null and tProveRecord.purpose.trim() != ''">
AND a.purpose = #{tProveRecord.purpose}
</if>
<if test="tProveRecord.sumType != null">
AND a.sum_type = #{tProveRecord.sumType}
</if>
<if test="tProveRecord.proveType != null">
AND a.prove_type = #{tProveRecord.proveType}
</if>
<if test="tProveRecord.number != null">
AND a.number = #{tProveRecord.number}
</if>
<if test="tProveRecord.unitName != null and tProveRecord.unitName.trim() != ''">
AND a.unit_name = #{tProveRecord.unitName}
</if>
<if test="tProveRecord.unitAddr != null and tProveRecord.unitAddr.trim() != ''">
AND a.unit_addr = #{tProveRecord.unitAddr}
</if>
<if test="tProveRecord.phone != null and tProveRecord.phone.trim() != ''">
AND a.phone = #{tProveRecord.phone}
</if>
</if>
</sql>
<!--tProveRecord简单分页查询-->
<select id="getTProveRecordPage" resultMap="tProveRecordMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_prove_record a
<where>
1=1
<include refid="tProveRecord_where"/>
</where>
</select>
<!--导出查条数-->
<select id="getCountByExport" resultType="java.lang.Integer">
SELECT
count(1)
FROM t_prove_record a
<where>
1=1
<include refid="tProveRecord_where"/>
</where>
</select>
<!--导出list-->
<select id="getRecordInfoNoPage" resultMap="tProveRecordMap">
SELECT
a.id,
a.creat_date,
a.start_month,
a.end_month,
a.salary,
a.prove_salary,
if(a.is_invalid='0','否','是') as is_invalid,
a.invalid_reason,
a.no,
a.purpose,
if(a.sum_type='0','实发平均','应发平均') as sum_type,
if(a.prove_type='0','正式员工证明','试用期员工证明') as prove_type,
a.number,
a.unit_name,
a.unit_addr,
a.phone,
a.EMPLOYEE_ID_CARD,
a.EMPLOYEE_NAME,
a.EMPLOYEE_SETTLE_DEPART_NAME,
a.CREAT_USER_NAME
FROM t_prove_record a
<where>
1=1
<include refid="tProveRecord_where"/>
</where>
<if test="tProveRecord != null">
<if test="tProveRecord.limitStart != null">
limit #{tProveRecord.limitStart},#{tProveRecord.limitEnd}
</if>
</if>
</select>
<select id="createNo" resultType="java.lang.Integer">
select max(right(a.`no`,5))+1 from t_prove_record a where a.`no` like '${str}%'
</select>
</mapper>
package com.yifu.cloud.plus.v1.yifu.salary.vo;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @program: master
* @description: 工资证明数据
* @author: pwang
* @create: 2019-11-06 12:01
**/
@Data
public class WageProofDto implements Serializable {
private static final long serialVersionUID = 1L;
private BigDecimal salary;//应发平均
private Integer realMonthCount;//实发月数
private String startMouth;
private String endMouth;
private String emIdCard;
private String sumType;
}
......@@ -24,6 +24,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainListVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.LocalDateTimeUtils;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprArchivesProperties;
......@@ -39,8 +40,10 @@ import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccountItem;
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.util.SalaryCommonUtil;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountSearchVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryDetailVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.WageProofDto;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
......@@ -48,6 +51,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -316,4 +320,73 @@ public class TSalaryAccountController {
public Boolean updateSalarySettleStatus(@RequestBody List<EkpSocialViewVo> viewVo) {
return tSalaryAccountService.updateSalarySettleStatus(viewVo);
}
/**
* 服务间调用
* @Author pwang
* @Date 2019-11-06 17:14
* @return
**/
@Inner
@PostMapping("/inner/findAverageSalaryForProve")
public R<WageProofDto> findAverageSalaryForProve(WageProofDto pd) {
return getWageProofDtoR(pd.getStartMouth(), pd.getEndMouth(), pd.getEmIdCard(), pd.getSumType(), null);
}
/**
* 获取证明工资数据接口
* @Author pwang
* @Date 2019-11-06 17:14
* @param startMouth 开始月
* @param endMouth 结束月
* @param emIdCard 员工身份证
* @param settleDepartId 结算主体id
* @param sumType 0实发平均 1应发平均
* @return
**/
@Operation(summary = "获取证明工资数据", description = "获取证明工资数据")
@GetMapping("/getAverageSalaryForProve")
public R<WageProofDto> getAverageSalaryForProve(String startMouth, String endMouth, String emIdCard,String sumType, String settleDepartId) {
if( Common.isEmpty(startMouth) || Common.isEmpty(endMouth) || Common.isEmpty(emIdCard) || Common.isEmpty(sumType) ){
return R.failed("参数不完整");
}
return getWageProofDtoR(startMouth, endMouth, emIdCard, sumType, settleDepartId);
}
private R<WageProofDto> getWageProofDtoR(String startMouth, String endMouth, String emIdCard, String sumType, String settleDepartId) {
WageProofDto wp = new WageProofDto();
List<String> accountIdForProve = tSalaryAccountService.getAccountIdForProve(startMouth, endMouth, emIdCard, settleDepartId);
String accIdStr;
int realMonthCount = 0;
BigDecimal salary = null;
List<String> accountMonthForProve = null;
if (Common.isNotNull(accountIdForProve)) {
accountMonthForProve = tSalaryAccountService.getAccountMonthForProve(startMouth, endMouth, emIdCard, settleDepartId);
if (Common.isNotNull(accountMonthForProve)) {
realMonthCount = accountMonthForProve.size();
int count = LocalDateTimeUtils.getBeginOfMonth(endMouth.concat("01"), startMouth.concat("01"), "yyyyMMdd") + 1;
if (count != realMonthCount) {
return R.failed("信息不一致,实际发工资月份为:" + SalaryCommonUtil.listToStrEasy(accountMonthForProve));
}
} else {
return R.failed("实发工资月份有误!");
}
//普通工资信息
accIdStr = SalaryCommonUtil.listForSqlIn(accountIdForProve);
if ("0".equals(sumType)) {
salary = tSalaryAccountItemService.getAllMoneyByAccountIdAndFiedName(accIdStr, SalaryConstants.ACTUAL_SALARY_SUM_JAVA);//实发合计
} else {
salary = tSalaryAccountItemService.getAllMoneyByAccountIdAndFiedName(accIdStr, SalaryConstants.RELAY_SALARY_JAVA);//应发合计
}
}
if (null == salary) {
return R.failed("无工资信息!");
}
wp.setRealMonthCount(realMonthCount);
wp.setSalary(salary.divide(new BigDecimal(realMonthCount), SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP));
return new R(wp);
}
}
......@@ -176,4 +176,10 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> {
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount>
**/
List<TSalaryAccount> getListByIdList(@Param("idList") List<String> idList);
List<String> getAccountIdForProve(@Param("startMouth") String startMouth, @Param("endMouth") String endMouth
, @Param("emIdCard") String emIdCard, @Param("settleDepartId") String settleDepartId);
List<String> getAccountMonthForProve(@Param("startMouth") String startMouth, @Param("endMouth") String endMouth
, @Param("emIdCard") String emIdCard, @Param("settleDepartId") String settleDepartId);
}
......@@ -193,4 +193,8 @@ public interface TSalaryAccountService extends IService<TSalaryAccount> {
**/
List<TSalaryAccount> getListByIdList(List<String> idList);
// 收入证明使用的
List<String> getAccountIdForProve(String startMouth, String endMouth, String emIdCard, String settleDepartId);
List<String> getAccountMonthForProve(String startMouth, String endMouth, String emIdCard, String settleDepartId);
}
......@@ -365,4 +365,13 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
public List<TSalaryAccount> getListByIdList(List<String> idList) {
return baseMapper.getListByIdList(idList);
}
@Override
public List<String> getAccountIdForProve(String startMouth, String endMouth, String emIdCard, String settleDepartId) {
return baseMapper.getAccountIdForProve(startMouth, endMouth, emIdCard, settleDepartId);
}
@Override
public List<String> getAccountMonthForProve(String startMouth, String endMouth, String emIdCard, String settleDepartId) {
return baseMapper.getAccountMonthForProve(startMouth, endMouth, emIdCard, settleDepartId);
}
}
......@@ -18,9 +18,7 @@ import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -524,4 +522,47 @@ public class SalaryCommonUtil implements Serializable {
entity.setFormType(salaryType);
}
/**
* @param strList
* @Description: 简单的list转化为String
* @Author: hgw
* @Date: 2019/9/27 17:19
* @return: java.lang.String
**/
public static String listToStrEasy(List<String> strList) {
StringBuilder result = new StringBuilder();
if (strList != null && !strList.isEmpty()) {
for (int i = 0; i < strList.size(); i++) {
if (i == 0) {
result.append(strList.get(0));
} else {
result.append(",").append(strList.get(i));
}
}
}
return result.toString();
}
/**
* 拼成带'的串xml里用$取值
*
* @param list
* @return
*/
public static String listForSqlIn(List<String> list) {
String result = "";
if (Common.isNotNull(list)) {
// 去重
Set<String> set = new HashSet<String>(list);
for (String str : set) {
if ("".equals(result)) {
result = "'" + str + "'";
} else {
result += ",'" + str + "'";
}
}
}
return result;
}
}
......@@ -1136,4 +1136,29 @@
#{ids}
</foreach>
</select>
<!-- 收入证明使用的 -->
<select id="getAccountIdForProve" resultType="java.lang.String">
SELECT a.id
FROM t_salary_account a
WHERE a.EMP_IDCARD = #{emIdCard}
<if test="settleDepartId != null">
and a.DEPT_ID = #{settleDepartId}
</if>
and a.DELETE_FLAG = 0
AND PERIOD_DIFF(a.SALARY_MONTH, #{startMouth}) >= 0
AND PERIOD_DIFF(#{endMouth}, a.SALARY_MONTH) >= 0
</select>
<select id="getAccountMonthForProve" resultType="java.lang.String">
SELECT a.SALARY_MONTH
FROM t_salary_account a
WHERE a.EMP_IDCARD = #{emIdCard}
<if test="settleDepartId != null">
and a.DEPT_ID = #{settleDepartId}
</if>
and a.DELETE_FLAG = 0
AND PERIOD_DIFF(a.SALARY_MONTH, #{startMouth}) >= 0
AND PERIOD_DIFF(#{endMouth}, a.SALARY_MONTH) >= 0
group by a.SALARY_MONTH
</select>
</mapper>
......@@ -473,6 +473,9 @@
<if test="searchVo.status != null">
AND a.STATUS = #{searchVo.status}
</if>
<if test="searchVo.createName != null and searchVo.createName.trim() != ''">
AND a.CREATE_NAME = #{searchVo.createName}
</if>
</if>
</sql>
......
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