Commit 1b2f07d8 authored by huyuchen's avatar huyuchen

huych-含风险项目商险不购买申请提交

parent 93fea044
package com.yifu.cloud.plus.v1.yifu.salary.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TInsuranceUnpurchasePersonAddVo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
......@@ -84,6 +86,13 @@ public class TInsuranceUnpurchaseApply extends BaseEntity {
@Schema(description ="不购买人数")
private String unbuyNum;
/**
* 创建时间 暂存不存创建时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@Schema(description = "创建时间")
private LocalDateTime createTimeZc;
@Schema(description ="明细数据集")
@TableField(exist = false)
private List<TInsuranceUnpurchasePersonAddVo> personList;
......
......@@ -87,6 +87,12 @@ public class TInsuranceUnpurchasePerson extends BaseEntity {
@Schema(description = "申请状态 0 草稿 1待提交 2 待审核 3 审核通过 4 审核不通过")
private String status;
/**
* 印章附件
*/
@TableField(exist = false)
private List<TSalaryAtta> attaInfoList;
@Schema(description = "工资人员明细")
@TableField(exist = false)
private List<TInsuranceUnpurchasePersonSalary> personInfoList;
......
......@@ -3,14 +3,12 @@ package com.yifu.cloud.plus.v1.yifu.salary.service.impl;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.lock.annotation.Lock4j;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
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.admin.api.entity.SysUser;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ResultConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.CheckedException;
......@@ -37,9 +35,6 @@ import com.yifu.cloud.plus.v1.yifu.salary.vo.TInsuranceUnpurchasePersonCardVo;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.support.SimpleValueWrapper;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -73,8 +68,6 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
@Resource
private ArchivesDaprUtil archivesDaprUtil;
@Resource
private CacheManager cacheManager;
@Resource
private TSalaryAttaService tSalaryAttaService;
@Resource
private OSSUtil ossUtil;
......@@ -166,8 +159,6 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
String applyDetail = baseMapper.getMaxInusuranceDetailCode();
//暂存不做校验
if (CommonConstants.ONE_STRING.equals(tInsuranceUnpurchaseApply.getSaveFlag())) {
tInsuranceUnpurchaseApply.setCreateTime(null);
tInsuranceUnpurchaseApply.setUpdateTime(null);
if (Common.isEmpty(tInsuranceUnpurchaseApply.getId())) {
tInsuranceUnpurchaseApply.setApplyNo(applyNo);
tInsuranceUnpurchaseApply.setCreateBy(user.getId());
......@@ -209,8 +200,7 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
//申请人是否属于子分公司和该项目是否有审批通过记录赋值
setValue(tInsuranceUnpurchaseApply,user);
if (Common.isNotNull(tInsuranceUnpurchaseApply.getId())) {
//同倩倩确认申请时间实时更新
tInsuranceUnpurchaseApply.setCreateTime(LocalDateTime.now());
tInsuranceUnpurchaseApply.setCreateTimeZc(LocalDateTime.now());
baseMapper.updateById(tInsuranceUnpurchaseApply);
//更新附件
updateFileId(tInsuranceUnpurchaseApply);
......@@ -224,11 +214,13 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
person.setEmpName(vo.getEmpName());
person.setPost(vo.getPost());
person.setApplyNoDetail(getDetailCode(applyDetail, vo.getRowIndex()));
person.setCreateTime(tInsuranceUnpurchaseApply.getCreateTimeZc());
initValue(tInsuranceUnpurchaseApply, person);
personInfoList.add(person);
}
personService.saveBatch(personInfoList);
} else {
tInsuranceUnpurchaseApply.setCreateTimeZc(LocalDateTime.now());
tInsuranceUnpurchaseApply.setCreateBy(user.getId());
tInsuranceUnpurchaseApply.setCreateName(user.getNickname());
tInsuranceUnpurchaseApply.setCreateUserDeptName(user.getDeptName());
......@@ -244,6 +236,7 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
person.setEmpName(vo.getEmpName());
person.setPost(vo.getPost());
person.setApplyNoDetail(getDetailCode(applyDetail, vo.getRowIndex()));
person.setCreateTime(tInsuranceUnpurchaseApply.getCreateTimeZc());
initValue(tInsuranceUnpurchaseApply, person);
personInfoList.add(person);
}
......@@ -349,7 +342,7 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
private void setValue(TInsuranceUnpurchaseApply tInsuranceUnpurchaseApply,YifuUser user) {
if (Common.isNotNull(tInsuranceUnpurchaseApply.getDeptNo())) {
List<String> deptList = CommonConstants.deptList;
tInsuranceUnpurchaseApply.setCompanyFlag(deptList.stream().noneMatch(e -> e.equals(user.getDeptName())) ? CommonConstants.ZERO_STRING : CommonConstants.ONE_STRING);
tInsuranceUnpurchaseApply.setCompanyFlag(deptList.stream().noneMatch(e -> e.equals(user.getDeptName())) ? CommonConstants.ONE_STRING : CommonConstants.ZERO_STRING);
if (CommonConstants.ONE_STRING.equals(tInsuranceUnpurchaseApply.getReasonType())) {
long count = baseMapper.selectCount(Wrappers.<TInsuranceUnpurchaseApply>query().lambda()
.eq(TInsuranceUnpurchaseApply::getDeptNo, tInsuranceUnpurchaseApply.getDeptNo())
......@@ -397,26 +390,16 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
}
//获取申请编码
@Lock4j(expire = 60000, acquireTimeout = 1000)
public String getCode() {
String nowDay = DateUtil.getThisDay();
Cache cache = cacheManager.getCache(CacheConstants.EVERYDAY_UNBUY_CODE);
assert cache != null;
Object nowNumObj = cache.get(nowDay);
int nowNums = 1;
if (Common.isNotNull(nowNumObj)) {
SimpleValueWrapper value = (SimpleValueWrapper) nowNumObj;
nowNums = (Integer) value.get() + 1;
} else {
String empCode = null;
try {
empCode = baseMapper.getMaxInusuranceCode();
nowNums = Integer.parseInt(empCode) + 1;
} catch (NumberFormatException e) {
log.error("获取含风险项目不购买商险申请时出错:" + empCode);
}
String empCode = null;
try {
empCode = baseMapper.getMaxInusuranceCode();
nowNums = Integer.parseInt(empCode) + 1;
} catch (NumberFormatException e) {
log.error("获取含风险项目不购买商险申请时出错:" + empCode);
}
cache.put(nowDay, nowNums);
return "SXBGM" + nowDay + this.getThreeNum(String.valueOf(nowNums));
}
......
......@@ -10,20 +10,25 @@ 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.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.OSSUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.SocialDaprUtils;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TInsuranceUnpurchasePerson;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TInsuranceUnpurchasePersonSalary;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAtta;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TInsuranceUnpurchasePersonMapper;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TInsuranceUnpurchasePersonSalaryMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.TInsuranceUnpurchasePersonService;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryAttaService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.*;
import lombok.extern.log4j.Log4j2;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.net.URL;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
......@@ -44,6 +49,11 @@ public class TInsuranceUnpurchasePersonServiceImpl extends ServiceImpl<TInsuranc
private SocialDaprUtils socialDaprUtil;
@Resource
TInsuranceUnpurchasePersonSalaryMapper salaryMapper;
@Resource
@Lazy
private TSalaryAttaService tSalaryAttaService;
@Resource
private OSSUtil ossUtil;
/**
* 含风险项目不购买申请明细表简单分页查询
......@@ -149,6 +159,15 @@ public class TInsuranceUnpurchasePersonServiceImpl extends ServiceImpl<TInsuranc
} else {
return R.failed(CommonConstants.NO_DATA_TO_HANDLE);
}
List<TSalaryAtta> attaInfo = tSalaryAttaService.list(Wrappers.<TSalaryAtta>query().lambda().eq(TSalaryAtta::getLinkId, person.getParnetId()));
if (attaInfo != null && !attaInfo.isEmpty()) {
URL url;
for (TSalaryAtta a: attaInfo) {
url = ossUtil.getObjectUrl(null, a.getAttaSrc());
a.setAttaUrl(url.toString());
}
}
person.setAttaInfoList(attaInfo);
return R.ok(person);
}
......
......@@ -19,6 +19,7 @@
<result property="createBy" column="CREATE_BY"/>
<result property="createName" column="CREATE_NAME"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="createTimeZc" column="CREATE_TIME_ZC"/>
<result property="updateBy" column="UPDATE_BY"/>
<result property="updateTime" column="UPDATE_TIME"/>
<result property="deleteFlag" column="DELETE_FLAG"/>
......@@ -49,7 +50,7 @@
a.CREATE_USER_DEPT_NAME, a.REASON_TYPE, a.REASON_INFO, a.APPLY_NO,
a.AUDIT_FLAG, a.COMPANY_FLAG, a.CREATE_BY, a.CREATE_NAME, a.CREATE_TIME,
a.UPDATE_BY, a.UPDATE_TIME, a.DELETE_FLAG, a.STATUS, a.HAS_CONTAIN_RISKS,
a.NEW_LINE, a.DIVISION, a.INSURANCE_FLAG, a.AUDIT_USER, a.AUDIT_USER_ID
a.NEW_LINE, a.DIVISION, a.INSURANCE_FLAG, a.AUDIT_USER, a.AUDIT_USER_ID,a.CREATE_TIME_ZC
</sql>
<sql id="tInsuranceUnpurchaseApply_where">
<if test="tInsuranceUnpurchaseApply != null">
......@@ -72,10 +73,10 @@
AND a.CREATE_NAME = #{tInsuranceUnpurchaseApply.createName}
</if>
<if test="tInsuranceUnpurchaseApply.createTimeStart != null">
AND a.CREATE_TIME <![CDATA[ >= ]]> #{tInsuranceUnpurchaseApply.createTimeStart}
AND a.CREATE_TIME_ZC <![CDATA[ >= ]]> #{tInsuranceUnpurchaseApply.createTimeStart}
</if>
<if test="tInsuranceUnpurchaseApply.createTimeEnd != null">
AND a.CREATE_TIME <![CDATA[ <= ]]> #{tInsuranceUnpurchaseApply.createTimeEnd}
AND a.CREATE_TIME_ZC <![CDATA[ <= ]]> #{tInsuranceUnpurchaseApply.createTimeEnd}
</if>
<if test="tInsuranceUnpurchaseApply.status != null and tInsuranceUnpurchaseApply.status.trim() != ''">
AND a.STATUS = #{tInsuranceUnpurchaseApply.status}
......@@ -101,7 +102,7 @@
1=1 and a.DELETE_FLAG = '0'
<include refid="tInsuranceUnpurchaseApply_where"/>
</where>
order by a.CREATE_TIME desc
order by a.CREATE_TIME_ZC desc
</select>
<!-- tInsuranceUnpurchaseApply简单分页查询 -->
......@@ -137,7 +138,7 @@
a.DELETE_FLAG = '0'
<include refid="tInsuranceUnpurchaseApply_where"/>
</where>
order by a.CREATE_TIME desc
order by a.CREATE_TIME_ZC desc
<if test="tInsuranceUnpurchaseApply.limitStart != null">
limit #{tInsuranceUnpurchaseApply.limitStart},#{tInsuranceUnpurchaseApply.limitEnd}
</if>
......@@ -212,7 +213,7 @@
SELECT ifnull(max(right (e.APPLY_NO, 3)), 0) EMP_CODE
FROM t_insurance_unpurchase_apply e
where e.DELETE_FLAG = '0'
and e.CREATE_TIME > DATE_FORMAT(now(), '%Y-%m-%d')
and e.CREATE_TIME_ZC > DATE_FORMAT(now(), '%Y-%m-%d')
</select>
<!-- 获取当日最大的编码 -->
......
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