Commit d6c2011e authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/develop' into develop

parents 9da756c3 412709b9
ekp.url=http://119.96.227.251:8080/api/sys-modeling/appModelRestService/addModel
ekp.fdModelId='181d7633ff8bc797276d0d3a54e80ad6'
ekp.fdFlowId='182b40249c1bc940d7226b941c7a4183'
ekp.docStatus='20'
ekp.LoginName='admin'
ekp.docSubject='\u85AA\u8D44\u8BA2\u5355\u660E\u7EC6\u6570\u636E\u63A5\u53E3'
ekp.fdModelId=181d7633ff8bc797276d0d3a54e80ad6
ekp.fdFlowId=182b40249c1bc940d7226b941c7a4183
ekp.docStatus=20
ekp.LoginName=admin
ekp.docSubject=\u85AA\u8D44\u8BA2\u5355\u660E\u7EC6\u6570\u636E\u63A5\u53E3
......@@ -1009,6 +1009,21 @@ public class InsurancesConstants {
*/
public static final String SETTLE_THREE = "无需结算";
/**
* 订单编号不能为空
*/
public static final String ORDER_NO_IS_EMPTY = "订单编号不能为空";
/**
* 购买类型为空
*/
public static final String BUY_TYPE_IS_EMPTY = "购买类型为空";
/**
* 购买类型错误
*/
public static final String BUY_TYPE_ERROR = "购买类型错误";
......
......@@ -285,5 +285,29 @@ public class TInsuranceDetail extends BaseEntity {
@Schema(description = "商险办理时间")
private LocalDateTime handledTime;
private static final long serialVersionUID = 1L;
/**
* 订单编号
*/
@Schema(description = "订单编号")
private String orderNo;
/**
* 创建人所在部门
*/
@Schema(description = "创建人所在部门")
private String createUserDeptId;
/**
* 创建人所在部门名称
*/
@Schema(description = "创建人所在部门名称")
private String createUserDeptName;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -32,6 +32,12 @@ public class TInsuranceRefund extends BaseEntity {
@Schema(description = "保单信息主键")
private String insDetailId;
/**
* 订单编号
*/
@Schema(description = "订单编号")
private String orderNo;
/**
* 减员状态
*/
......@@ -56,7 +62,17 @@ public class TInsuranceRefund extends BaseEntity {
@Schema(description = "是否删除 0否/1是")
private Integer deleteFlag;
/**
* 创建人所在部门
*/
@Schema(description = "创建人所在部门")
private String createUserDeptId;
/**
* 创建人所在部门名称
*/
@Schema(description = "创建人所在部门名称")
private String createUserDeptName;
private static final long serialVersionUID = 1L;
......
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import lombok.Data;
import java.util.List;
/**
* @author zhaji
* @description TODO
* @date 2022-08-29 11:57:55
*/
@Data
public class InsuranceListOrderParam {
private String orderNo;
private List<InsuranceAddParam> data;
}
......@@ -22,6 +22,12 @@ public class InsuranceListParam implements Serializable {
@Schema(description = "项目编码")
private String deptNo;
/**
* 订单编号
*/
@Schema(description = "订单编号")
private String orderNo;
/**
* 投保状态 1待投保 2投保中 3已投保 4投保退回 5 已减员
*/
......
......@@ -104,6 +104,12 @@ public class InsuranceListVO implements Serializable {
@Schema(description = "创建人(派单人)")
private String createName;
/**
* 创建人部门名称
*/
@Schema(description = "创建人部门名称(派单人)")
private String createUserDeptName;
/**
* 创建者
*/
......
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import lombok.Data;
import java.util.List;
/**
* @author zhaji
* @description TODO
* @date 2022-08-29 12:13:48
*/
@Data
public class InsuranceOrderBatchParam {
private String orderNo;
private List<InsuranceBatchParam> data;
}
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
/**
* @author zhaji
* @description TODO
* @date 2022-08-29 12:35:52
*/
@Data
public class InsuranceOrderRefundParam {
/**
* 订单编号
*/
@Schema(description = "订单编号")
private String orderNo;
private List<InsuranceRefundCheck> data;
}
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import lombok.Data;
import java.util.List;
/**
* @author zhaji
* @description TODO
* @date 2022-08-29 12:29:28
*/
@Data
public class InsuranceOrderReplaceParam {
private String orderNo;
private List<InsuranceReplaceParam> data;
}
......@@ -23,6 +23,12 @@ public class InsuranceRefundCheck implements Serializable {
@Schema(description = "主键")
private String id;
/**
* 订单编号
*/
@Schema(description = "订单编号")
private String orderNo;
/**
* 员工姓名
*/
......
......@@ -170,6 +170,11 @@ public class InsuranceRefundListVo implements Serializable {
*/
@Schema(description = "减员状态 1待减员 2减员中3减员退回")
private Integer reduceHandleStatus;
/**
* 创建人所在部门名称
*/
@Schema(description = "创建人所在部门名称")
private String createUserDeptName;
/**
* 购买月数
......
......@@ -232,8 +232,11 @@ public class InsuredListVo implements Serializable {
@Schema(description = "购买月数")
private Long buyMonth;
/**
* 创建人所在部门名称
*/
@Schema(description = "创建人所在部门名称")
private String createUserDeptName;
//订单编号、姓名、身份证号、投保类型、项目、岗位、保单开始日期、保单结束日期、保险公司、险种、购买标准、医保、身故或残疾、预估保费、实际保费、保单号、发票号、保单生效日期、商险购买地、商险办理地、是否出险、是否过期、是否失效、派单日期、派单人
}
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
* @author zhaji
* @description TODO
* @date 2022-08-29 14:47:46
*/
@Data
public class InsuredOrderListVo implements Serializable {
/**
* 主键
*/
@Schema(description = "主键")
private String id;
/**
* 投保类型, 1新增、3批增、4替换
*/
@Schema(description = " 投保类型, 1新增、3批增、4替换")
private Integer buyType;
/**
* 员工姓名
*/
@Schema(description = "员工姓名")
private String empName;
/**
* 员工身份证号
*/
@Schema(description = "员工身份证号")
private String empIdcardNo;
/**
* 保险公司名称
*/
@Schema(description = "保险公司名称")
private String insuranceCompanyName;
/**
* 险种名称
*/
@Schema(description = "险种名称")
private String insuranceTypeName;
/**
* 购买标准
*/
@Schema(description = "购买标准")
private String buyStandard;
/**
* 医疗额度
*/
@Schema(description = "医疗额度")
private String medicalQuota;
/**
* 身故或残疾额度
*/
@Schema(description = "身故或残疾额度")
private String dieDisableQuota;
/**
* 创建人姓名
*/
@Schema(description = "创建人(派单人)")
private String createName;
/**
* 创建人部门名称
*/
@Schema(description = "创建人部门名称(派单人)")
private String createUserDeptName;
/**
* 创建时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@Schema(description = "创建时间")
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
/**
* 投保状态 1待投保 2投保中 3已投保 4投保退回 5 已减员
*/
@Schema(description = "投保状态 1待投保 2投保中 3已投保 4投保退回 5 已减员")
private Integer buyHandleStatus;
/**
* 减员状态 1待减员 2减员中3减员退回
*/
@Schema(description = "减员状态 1待减员 2减员中3减员退回,4减员成功")
private Integer reduceHandleStatus;
/**
* 减员ID
*/
@Schema(description = "减员ID")
private Integer refundId;
}
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaji
* @description 订单商险列表查询
* @date 2022-08-29 14:44:25
*/
@Data
@Tag(name = "订单商险列表查询")
public class InsuredOrderParam implements Serializable {
/**
* 订单编号
*/
@Schema(description = "订单编号")
private String orderNo;
/**
* 员工姓名
*/
@Schema(description = "员工姓名")
private String empName;
/**
* 员工身份证号
*/
@Schema(description = "员工身份证号")
private String empIdcardNo;
/**
* 开始日期
*/
@Schema(description = "开始日期")
private String startDate;
/**
* 结束日期
*/
@Schema(description = "结束日期")
private String endDate;
/**
* 项目编码列表
*/
@Schema(description = "项目编码列表")
private List<String> deptNoList;
}
......@@ -119,7 +119,7 @@ public class TInsuranceDetailController {
@Operation(summary = "投保新增", description = "投保新增")
@PostMapping("/addInsurance")
public R<List<InsuranceAddParam>> addInsurance(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<InsuranceAddParam> paramList){
return tInsuranceDetailService.addInsurance(paramList);
return tInsuranceDetailService.addInsurance(paramList,null);
}
/**
......@@ -132,7 +132,7 @@ public class TInsuranceDetailController {
@Operation(summary = "投保批增", description = "投保批增")
@PostMapping("/batchInsurance")
public R<List<InsuranceBatchParam>> batchInsurance(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<InsuranceBatchParam> paramList){
return tInsuranceDetailService.batchInsurance(paramList);
return tInsuranceDetailService.batchInsurance(paramList,null);
}
/**
......@@ -145,7 +145,7 @@ public class TInsuranceDetailController {
@Operation(summary = "投保替换", description = "投保替换")
@PostMapping("/replaceInsurance")
public R<List<InsuranceReplaceParam>> replaceInsurance(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<InsuranceReplaceParam> paramList){
return tInsuranceDetailService.replaceInsurance(paramList);
return tInsuranceDetailService.replaceInsurance(paramList,null);
}
/**
......@@ -288,7 +288,7 @@ public class TInsuranceDetailController {
*/
@PostMapping("/saveInsuranceRefund")
public R saveInsuranceRefund(@RequestBody @Valid @Size(min = 1,message = "导入减员列表不能为空") List<InsuranceRefundCheck> insuranceRefundCheckList){
return tInsuranceDetailService.saveInsuranceRefund(insuranceRefundCheckList);
return tInsuranceDetailService.saveInsuranceRefund(insuranceRefundCheckList,null);
}
/**
......@@ -353,7 +353,7 @@ public class TInsuranceDetailController {
*/
@Operation(summary = "已减员列表分页查询", description = "已减员列表分页查询")
@PostMapping("/getInsuranceRefundPageList")
public R<IPage<InsuranceRefundListVo>> getInsuranceRefundPageList(Page<InsuranceRefundParam> page, @RequestBody InsuranceRefundParam param) {
public R getInsuranceRefundPageList(Page<InsuranceRefundParam> page, @RequestBody InsuranceRefundParam param) {
return tInsuranceDetailService.getInsuranceRefundPageList(page,param);
}
......@@ -524,4 +524,71 @@ public class TInsuranceDetailController {
public R<IPage<InsuranceListByIdCardVo>> getInsuranceListByIdCard(Page page, String idCard,String deptNo) {
return new R<>(tInsuranceDetailService.getInsuranceListByIdCard(page, idCard,deptNo));
}
/**
* 订单商险新增
*
* @author zhaji
* @param paramList
* @return {@link R<List<InsuranceAddParam>>}
*/
@Operation(summary = "订单商险新增", description = "订单商险新增")
@PostMapping("/addOrderInsurance")
public R<List<InsuranceAddParam>> addOrderInsurance(@RequestBody InsuranceListOrderParam paramList ){
return tInsuranceDetailService.addOrderInsurance(paramList);
}
/**
* 订单商险批增
*
* @author zhaji
* @param paramList
* @return {@link R<List<InsuranceBatchParam>>}
*/
@Operation(summary = "订单商险批增", description = "订单商险批增")
@PostMapping("/batchOrderInsurance")
public R<List<InsuranceBatchParam>> batchOrderInsurance(@RequestBody InsuranceOrderBatchParam paramList){
return tInsuranceDetailService.batchOrderInsurance(paramList);
}
/**
* 订单商险替换
*
* @author zhaji
* @param paramList
* @return {@link R<List<InsuranceReplaceParam>>}
*/
@Operation(summary = "订单商险替换", description = "订单商险替换")
@PostMapping("/replaceOrderInsurance")
public R<List<InsuranceReplaceParam>> replaceOrderInsurance(@RequestBody InsuranceOrderReplaceParam paramList){
return tInsuranceDetailService.replaceOrderInsurance(paramList);
}
/**
* 订单商险减员
* @param paramList 订单商险减员
* @author zhaji
* @date 2022-07-19
* @since v1.0
*/
@PostMapping("/refundOrderInsurance")
public R refundOrderInsurance(@RequestBody InsuranceOrderRefundParam paramList){
return tInsuranceDetailService.refundOrderInsurance(paramList);
}
/**
* 订单商险列表查询
*
* @author zhaji
* @param page 分页参数
* @param param 查询条件
* @return {@link R<IPage<InsuredListVo>>}
*/
@Operation(summary = "订单商险列表查询", description = "订单商险列表查询")
@PostMapping("/getOrderInsuredListPage")
public R getOrderInsuredListPage(Page<InsuredOrderListVo> page, @RequestBody InsuredOrderParam param) {
return tInsuranceDetailService.getOrderInsuredListPage(page,param);
}
}
......@@ -84,6 +84,15 @@ public interface TInsuranceDetailMapper extends BaseMapper<TInsuranceDetail> {
*/
void updatePolicyNoBatch(@Param("details") List<TInsuranceDetail> details);
/**
* 批量更新发票号
*
* @author licancan
* @param details
* @return void
*/
void updateInvoiceNoBatch(@Param("details") List<TInsuranceDetail> details);
/***********************减员办理********************************/
/**
......@@ -188,7 +197,44 @@ public interface TInsuranceDetailMapper extends BaseMapper<TInsuranceDetail> {
*/
IPage<InsuranceListByIdCardVo> getInsuranceListByIdCard(Page<TInsuranceDetail> page, @Param("idCard") String idCard, @Param("deptNo")String deptNo);
List<TInsuranceDetail> selectListByempIdcardNo(String empIdcardNo);
/**
* 查询所有在保,未出险,未过期,未失效,未减员的保单信息
*
* @author zhaji
* @param empIdcardNo
* @return {@link List< TInsuranceDetail>}
*/
List<TInsuranceDetail> selectListByEmpIdcardNo(String empIdcardNo);
/**
* 查数据是否存在权限范围内
*
* @author zhaji
* @param regionSql
* @param id
* @return {@link TInsuranceDetail}
*/
TInsuranceDetail selectByRegionSql(@Param("regionSql") String regionSql, @Param("id") String id);
/**
* 商险订单投保列表查询
*
* @author zhaji
* @param page
* @param param
* @return {@link IPage< InsuredOrderListVo>}
*/
IPage<InsuredOrderListVo> getOrderInsuredListPage(Page<InsuredOrderListVo> page,@Param("param") InsuredOrderParam param);
/**
* 商险订单减员列表查询
*
* @author zhaji
* @param page
* @param param
* @return {@link IPage< InsuredOrderListVo>}
*/
IPage<InsuredOrderListVo> getOrderRefundInsuredListPage(Page<InsuredOrderListVo> page,@Param("param") InsuredOrderParam param);
TInsuranceDetail selectByregionSQL(@Param("regionSql") String regionSQL,@Param("id") String id);
}
......@@ -3,6 +3,7 @@ package com.yifu.cloud.plus.v1.yifu.insurances.mapper.insurances;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceRefund;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* @author Administrator
......@@ -22,7 +23,7 @@ public interface TInsuranceRefundMapper extends BaseMapper<TInsuranceRefund> {
*/
TInsuranceRefund getByInsDetailId(String id);
void updateByInsDetailId(TInsuranceRefund insuranceRefund);
void updateByInsDetailId(@Param("param") TInsuranceRefund insuranceRefund);
int updateRefundMoney(TInsuranceRefund insuranceRefund);
}
......@@ -75,7 +75,7 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
* @param paramList
* @return {@link R<List<InsuranceAddParam>>}
*/
R<List<InsuranceAddParam>> addInsurance(List<InsuranceAddParam> paramList);
R<List<InsuranceAddParam>> addInsurance(List<InsuranceAddParam> paramList,String orderNo);
/**
* 商险批增
......@@ -84,7 +84,7 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
* @param paramList
* @return {@link R<List<InsuranceBatchParam>>}
*/
R<List<InsuranceBatchParam>> batchInsurance(List<InsuranceBatchParam> paramList);
R<List<InsuranceBatchParam>> batchInsurance(List<InsuranceBatchParam> paramList,String orderNo);
/**
* 商险替换
*
......@@ -92,7 +92,7 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
* @param paramList
* @return {@link R<List<InsuranceReplaceParam>>}
*/
R<List<InsuranceReplaceParam>> replaceInsurance(List<InsuranceReplaceParam> paramList);
R<List<InsuranceReplaceParam>> replaceInsurance(List<InsuranceReplaceParam> paramList,String orderNo);
/**
* 通过id删除
......@@ -187,7 +187,7 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
* @param insuranceRefundCheckList 减员表
* @return {@link R}
*/
R saveInsuranceRefund(List<InsuranceRefundCheck> insuranceRefundCheckList);
R saveInsuranceRefund(List<InsuranceRefundCheck> insuranceRefundCheckList,String orderNo);
/**
* 已投保列表分页查询
......@@ -354,4 +354,45 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
* @return {@link R}
*/
IPage<InsuranceListByIdCardVo> getInsuranceListByIdCard(Page<TInsuranceDetail> page, String idCard,String deptNo);
/**
* 新增订单商险
*
* @author zhaji
* @param paramList
* @return {@link R< List< InsuranceReplaceParam>>}
*/
R<List<InsuranceAddParam>> addOrderInsurance(InsuranceListOrderParam paramList);
/**
* 批增订单商险
*
* @author zhaji
* @param paramList
* @return {@link R< List< InsuranceBatchParam>>}
*/
R<List<InsuranceBatchParam>> batchOrderInsurance(InsuranceOrderBatchParam paramList);
/**
* 替换订单商险
*
* @author zhaji
* @param paramList
* @return {@link R< List< InsuranceReplaceParam>>}
*/
R<List<InsuranceReplaceParam>> replaceOrderInsurance(InsuranceOrderReplaceParam paramList);
R refundOrderInsurance(InsuranceOrderRefundParam paramList);
/**
* 订单商险列表查询
*
* @author zhaji
* @param page
* @param param
* @return {@link IPage< InsuredOrderListVo>}
*/
R getOrderInsuredListPage(Page<InsuredOrderListVo> page, InsuredOrderParam param);
SettleVo getInsuranceDetailSettleStatus(String detailId, String defaultSettleId);
}
......@@ -267,7 +267,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*/
@Override
@Transactional(value = "insurancesTransactionManager" ,rollbackFor = {Exception.class})
public R<List<InsuranceAddParam>> addInsurance(List<InsuranceAddParam> paramList) {
public R<List<InsuranceAddParam>> addInsurance(List<InsuranceAddParam> paramList,String orderNo) {
if (CollectionUtils.isEmpty(paramList)){
return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY);
}
......@@ -286,7 +286,10 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
TInsuranceDetail detail = new TInsuranceDetail();
BeanCopyUtils.copyProperties(success,detail);
//购买类型,默认为「新增」
detail.setOrderNo(orderNo);
detail.setBuyType(CommonConstants.ONE_INT);
detail.setCreateUserDeptId(user.getDeptId().toString());
detail.setCreateUserDeptName(user.getDeptName());
//投保状态:待投保
detail.setBuyHandleStatus(CommonConstants.ONE_INT);
detail.setPolicyStart(LocalDateUtil.parseLocalDate(success.getPolicyStart()));
......@@ -314,7 +317,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*/
@Override
@Transactional(value = "insurancesTransactionManager" ,rollbackFor = {Exception.class})
public R<List<InsuranceBatchParam>> batchInsurance(List<InsuranceBatchParam> paramList) {
public R<List<InsuranceBatchParam>> batchInsurance(List<InsuranceBatchParam> paramList,String orderNo) {
if (CollectionUtils.isEmpty(paramList)){
return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY);
}
......@@ -337,6 +340,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//投保状态:待投保
detail.setBuyHandleStatus(CommonConstants.ONE_INT);
//保费都默认是0
detail.setOrderNo(orderNo);
detail.setCreateUserDeptId(user.getDeptId().toString());
detail.setCreateUserDeptName(user.getDeptName());
detail.setActualPremium(new BigDecimal("0.00"));
detail.setEstimatePremium(new BigDecimal("0.00"));
detail.setCreateBy(user.getId());
......@@ -359,7 +365,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*/
@Override
@Transactional(value = "insurancesTransactionManager" ,rollbackFor = {Exception.class})
public R<List<InsuranceReplaceParam>> replaceInsurance(List<InsuranceReplaceParam> paramList) {
public R<List<InsuranceReplaceParam>> replaceInsurance(List<InsuranceReplaceParam> paramList,String orderNo) {
if (CollectionUtils.isEmpty(paramList)){
return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY);
}
......@@ -397,6 +403,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
this.updateById(detail);
//新数据置为待办理
newDetail.setId(null);
newDetail.setOrderNo(orderNo);
newDetail.setBuyHandleStatus(CommonConstants.ONE_INT);
newDetail.setBuyType(CommonConstants.FOUR_INT);
newDetail.setEmpName(success.getReplaceEmpName());
......@@ -410,6 +417,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
newDetail.setIsUse(null);
newDetail.setIsEffect(null);
newDetail.setReduceHandleStatus(null);
newDetail.setCreateUserDeptId(user.getDeptId().toString());
newDetail.setCreateUserDeptName(user.getDeptName());
newDetail.setSignFlag(CommonConstants.ZERO_INT);
//创建时间是新数据插入时间
newDetail.setCreateTime(LocalDateTime.now());
......@@ -417,6 +426,10 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
newDetail.setCreateName(user.getNickname());
//替换不参与结算
newDetail.setDefaultSettleId(null);
//替换不继承备注
newDetail.setRemark(null);
//替换不继承保单生效日期
newDetail.setPolicyEffect(null);
//保费都默认是0
newDetail.setActualPremium(new BigDecimal("0.00"));
newDetail.setEstimatePremium(new BigDecimal("0.00"));
......@@ -1148,6 +1161,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
detail.setIsUse(CommonConstants.ZERO_INT);
detail.setUpdateTime(LocalDateTime.now());
detail.setUpdateBy(user.getId());
//替换类型,保单生效日期:T + 1
detail.setPolicyEffect(LocalDate.now().plusDays(CommonConstants.ONE_INT));
successList.add(detail);
}else{
//根据结算类型判断是否需要计算预估保费
......@@ -1314,12 +1329,24 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
);
if (StringUtils.isNotBlank(success.getInvoiceNo())){
detail.setInvoiceNo(success.getInvoiceNo());
//如果发票号不为空,将替换类型的发票号也全部更新
List<TInsuranceReplace> list = tInsuranceReplaceService.list(Wrappers.<TInsuranceReplace>query().lambda()
.eq(TInsuranceReplace::getOriginInsuranceDetailId, detail.getId()));
if (CollectionUtils.isNotEmpty(list)){
List<String> collect = list.stream().map(TInsuranceReplace::getToInsuranceDetailId).distinct().collect(Collectors.toList());
List<TInsuranceDetail> details = this.baseMapper.selectBatchIds(collect);
if (CollectionUtils.isNotEmpty(details)){
details.stream().forEach(e -> e.setInvoiceNo(success.getInvoiceNo()));
//这里自己写sql更新发票号,防止用mybatisPlus批量更新,把updateTime更新了(updateTime不能更新)
baseMapper.updateInvoiceNoBatch(details);
}
}
}
detail.setUpdateBy(user.getId());
detail.setUpdateTime(LocalDateTime.now());
if (StringUtils.isNotBlank(success.getPolicyNo())){
detail.setPolicyNo(success.getPolicyNo());
//如果保单号不为空,将替换类型的保单号也全部更新
List<TInsuranceReplace> list = tInsuranceReplaceService.list(Wrappers.<TInsuranceReplace>query().lambda()
.eq(TInsuranceReplace::getOriginInsuranceDetailId, detail.getId()));
......@@ -1339,22 +1366,24 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
// todo 判断是否推送过ekp,没推送过调新增接口,推送过调更新接口
if (StringUtils.isNotBlank(detail.getDefaultSettleId())){
SettleVo settleVo = getInsuranceDetailSettleStatus(detail.getId(), detail.getDefaultSettleId());
TInsuranceSettle settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
if (Optional.ofNullable(settle).isPresent()){
settle.setActualPremium(new BigDecimal(success.getActualPremium()));
settle.setIsActualPush(CommonConstants.ZERO_INT);
settle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(settle);
//调EKP更新实际保费
detail.setActualPremium(new BigDecimal(success.getActualPremium()));
threadPool.execute(() ->{
String s = pushEstimate(detail,CommonConstants.FOUR_INT);
if(StringUtils.isNotBlank(s)){
settle.setActualPushTime(LocalDateTime.now());
settle.setIsActualPush(CommonConstants.ONE_INT);
tInsuranceSettleService.updateById(settle);
}
});
if(!Common.isEmpty(settleVo) && InsurancesConstants.SETTLE_ZERO.equals(settleVo.getActualStatus())){
TInsuranceSettle settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
if (Optional.ofNullable(settle).isPresent()){
settle.setActualPremium(new BigDecimal(success.getActualPremium()));
settle.setIsActualPush(CommonConstants.ZERO_INT);
settle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(settle);
//调EKP更新实际保费
detail.setActualPremium(new BigDecimal(success.getActualPremium()));
threadPool.execute(() ->{
String s = pushEstimate(detail,CommonConstants.FOUR_INT);
if(StringUtils.isNotBlank(s)){
settle.setActualPushTime(LocalDateTime.now());
settle.setIsActualPush(CommonConstants.ONE_INT);
tInsuranceSettleService.updateById(settle);
}
});
}
}
}else {
//保费存储
......@@ -2593,7 +2622,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
continue;
}else {
//查数据是否存在权限范围内
TInsuranceDetail detailByRegionSQL = this.baseMapper.selectByregionSQL(regionSQL, detail.getId());
TInsuranceDetail detailByRegionSQL = this.baseMapper.selectByRegionSql(regionSQL, detail.getId());
if (!Optional.ofNullable(detailByRegionSQL).isPresent()){
param.setErrorMessage(InsurancesConstants.NO_UPDATE_DETAIL_JURISDICTION);
listResult.add(param);
......@@ -2684,15 +2713,18 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (StringUtils.isNotBlank(detail.getDefaultSettleId())){
TInsuranceSettle settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
if (Optional.ofNullable(settle).isPresent()){
if (CommonConstants.TWO_STRING.equals(settle.getSettleHandleStatus())){
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_TWO_NOT_REGISTERED);
listResult.add(param);
continue;
}
if (CommonConstants.THREE_STRING.equals(settle.getSettleHandleStatus())){
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_THREE_NOT_REGISTERED);
listResult.add(param);
continue;
SettleVo settleVo = getInsuranceDetailSettleStatus(detail.getId(), detail.getDefaultSettleId());
if(!Common.isEmpty(settleVo)){
if (InsurancesConstants.SETTLE_ONE.equals(settleVo.getActualStatus())){
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_TWO_NOT_REGISTERED);
listResult.add(param);
continue;
}
if (InsurancesConstants.SETTLE_TWO.equals(settleVo.getActualStatus())){
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_THREE_NOT_REGISTERED);
listResult.add(param);
continue;
}
}
}
}
......@@ -2863,7 +2895,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @return {@link R}
*/
@Override
public R saveInsuranceRefund(List<InsuranceRefundCheck> insuranceRefundCheckList) {
public R saveInsuranceRefund(List<InsuranceRefundCheck> insuranceRefundCheckList,String orderNo) {
YifuUser user = SecurityUtils.getUser();
if(!Common.isNotEmpty(insuranceRefundCheckList)){
return R.failed("当前导入的减员信息为空");
......@@ -2880,6 +2912,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
insuranceRefund.setCreateBy(user.getId());
insuranceRefund.setCreateName(user.getNickname());
insuranceRefund.setCreateTime(LocalDateTime.now());
insuranceRefund.setUpdateTime(LocalDateTime.now());
insuranceRefund.setUpdateBy(user.getId());
insuranceRefund.setOrderNo(orderNo);
insuranceRefund.setCreateUserDeptId(user.getDeptId().toString());
insuranceRefund.setCreateUserDeptName(user.getDeptName());
if(StringUtils.isNotBlank(refund.getRemark())){
insuranceRefund.setRemark(refund.getRemark());
}
......@@ -3140,8 +3177,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
detailList.add(detail);
refund.setInsDetailId(record.getId());
refund.setReduceHandleStatus(CommonConstants.TWO_INT);
refund.setCreateBy(user.getId());
refund.setCreateTime(LocalDateTime.now());
refund.setUpdateBy(user.getId());
refund.setUpdateTime(LocalDateTime.now());
refundList.add(refund);
}
}
......@@ -3220,8 +3257,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
successList.add(tInsuranceDetail);
//更新减员记录
refund.setInsDetailId(tInsuranceDetail.getId());
refund.setCreateBy(user.getId());
refund.setCreateTime(LocalDateTime.now());
refund.setUpdateBy(user.getId());
refund.setUpdateTime(LocalDateTime.now());
refund.setReduceHandleStatus(refundType);
refundList.add(refund);
}else{
......@@ -3266,8 +3303,10 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
for (InsuranceHandleImportParam param : successList) {
TInsuranceOperate operate = new TInsuranceOperate();
LambdaUpdateWrapper<TInsuranceRefund> refund = new LambdaUpdateWrapper<>();
refund.eq(TInsuranceRefund :: getInsDetailId ,param.getId());
refund.set(TInsuranceRefund :: getRemark,param.getRemark());
refund.eq(TInsuranceRefund :: getInsDetailId ,param.getId())
.set(TInsuranceRefund :: getRemark,param.getRemark())
.set(TInsuranceRefund :: getUpdateTime,LocalDateTime.now())
.set(TInsuranceRefund :: getUpdateBy,user.getId());
LambdaUpdateWrapper<TInsuranceDetail> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TInsuranceDetail::getId, param.getId())
.set(TInsuranceDetail::getUpdateBy, user.getId())
......@@ -4448,21 +4487,20 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
String defaultSettleId = insuranceDetail.getDefaultSettleId();
if(StringUtils.isNotEmpty(defaultSettleId)){
//查询结算状态
LambdaQueryWrapper<TInsuranceSettle> insuranceSettleQuery = new LambdaQueryWrapper<>();
insuranceSettleQuery.eq(TInsuranceSettle :: getId,defaultSettleId);
TInsuranceSettle insuranceSettle = tInsuranceSettleService.getOne(insuranceSettleQuery);
if (!Common.isEmpty(insuranceSettle)){
//当前结算状态为结算中时,不能变更结算月
if (CommonConstants.TWO_STRING.equals(insuranceSettle.getSettleHandleStatus())){
param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_CHANGE_SETTLE_STATUS_TWO_ERROR);
errorList.add(param);
continue;
}
//当前结算状态为已结算时,不能变更结算月
if (CommonConstants.THREE_STRING.equals(insuranceSettle.getSettleHandleStatus())){
param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_CHANGE_SETTLE_STATUS_THREE_ERROR);
errorList.add(param);
continue;
TInsuranceSettle settle = tInsuranceSettleService.getById(defaultSettleId);
if (Optional.ofNullable(settle).isPresent()){
SettleVo settleVo = getInsuranceDetailSettleStatus(insuranceDetail.getId(), defaultSettleId);
if(!Common.isEmpty(settleVo)){
if (InsurancesConstants.SETTLE_ONE.equals(settleVo.getActualStatus())){
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_TWO_NOT_REGISTERED);
errorList.add(param);
continue;
}
if (InsurancesConstants.SETTLE_TWO.equals(settleVo.getActualStatus())){
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_THREE_NOT_REGISTERED);
errorList.add(param);
continue;
}
}
}
}
......@@ -4637,7 +4675,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
String detailId = insuranceDetail.getId();
//查数据是否存在权限范围内
String regionSQL = getRegionSQL(user);
TInsuranceDetail detailByRegionSQL = this.baseMapper.selectByregionSQL(regionSQL,detailId);
TInsuranceDetail detailByRegionSQL = this.baseMapper.selectByRegionSql(regionSQL,detailId);
if (!Optional.ofNullable(detailByRegionSQL).isPresent() || !user.getId().equals(detailByRegionSQL.getUpdateBy())){
param.setErrorMessage(InsurancesConstants.NO_DETAIL_JURISDICTION);
errorList.add(param);
......@@ -4956,20 +4994,21 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
String defaultSettleId = insuranceDetail.getDefaultSettleId();
if (StringUtils.isNotBlank(defaultSettleId)){
//查询结算状态
LambdaQueryWrapper<TInsuranceSettle> insuranceSettleQuery = new LambdaQueryWrapper<>();
insuranceSettleQuery.eq(TInsuranceSettle :: getId,defaultSettleId);
TInsuranceSettle insuranceSettle = tInsuranceSettleService.getOne(insuranceSettleQuery);
//当前结算状态为结算中时,不能变更结算项目
if (CommonConstants.TWO_STRING.equals(insuranceSettle.getSettleHandleStatus())){
param.setErrorMessage(InsurancesConstants.DEPT_NO_CHANGE_SETTLE_STATUS_TWO_ERROR);
errorList.add(param);
continue;
}
//当前结算状态为已结算时,不能变更结算项目
if (CommonConstants.THREE_STRING.equals(insuranceSettle.getSettleHandleStatus())){
param.setErrorMessage(InsurancesConstants.DEPT_NO_CHANGE_SETTLE_STATUS_THREE_ERROR);
errorList.add(param);
continue;
TInsuranceSettle settle = tInsuranceSettleService.getById(defaultSettleId);
if (Optional.ofNullable(settle).isPresent()){
SettleVo settleVo = getInsuranceDetailSettleStatus(insuranceDetail.getId(), defaultSettleId);
if(!Common.isEmpty(settleVo)){
if (InsurancesConstants.SETTLE_ONE.equals(settleVo.getActualStatus())){
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_TWO_NOT_REGISTERED);
errorList.add(param);
continue;
}
if (InsurancesConstants.SETTLE_TWO.equals(settleVo.getActualStatus())){
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_THREE_NOT_REGISTERED);
errorList.add(param);
continue;
}
}
}
}
//预估
......@@ -5091,7 +5130,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return R.failed("身份证格式不正确");
}
//查询所有在保,未出险,未过期,未失效,未减员的保单信息
List<TInsuranceDetail> list = this.baseMapper.selectListByempIdcardNo(empIdcardNo);
List<TInsuranceDetail> list = this.baseMapper.selectListByEmpIdcardNo(empIdcardNo);
if (CollectionUtils.isEmpty(list)){
return R.failed("无可出险的保单");
}
......@@ -5127,6 +5166,69 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
@Override
public R<List<InsuranceAddParam>> addOrderInsurance(InsuranceListOrderParam paramList) {
String orderNo = paramList.getOrderNo();
if (StringUtils.isBlank(orderNo)) {
return R.failed(InsurancesConstants.ORDER_NO_IS_EMPTY);
}
return addInsurance(paramList.getData(),paramList.getOrderNo());
}
@Override
public R<List<InsuranceBatchParam>> batchOrderInsurance(InsuranceOrderBatchParam paramList) {
String orderNo = paramList.getOrderNo();
if (StringUtils.isBlank(orderNo)) {
return R.failed(InsurancesConstants.ORDER_NO_IS_EMPTY);
}
return batchInsurance(paramList.getData(),paramList.getOrderNo());
}
@Override
public R<List<InsuranceReplaceParam>> replaceOrderInsurance(InsuranceOrderReplaceParam paramList) {
String orderNo = paramList.getOrderNo();
if (StringUtils.isBlank(orderNo)) {
return R.failed(InsurancesConstants.ORDER_NO_IS_EMPTY);
}
return replaceInsurance(paramList.getData(),paramList.getOrderNo());
}
@Override
public R refundOrderInsurance(InsuranceOrderRefundParam paramList) {
String orderNo = paramList.getOrderNo();
if (StringUtils.isBlank(orderNo)) {
return R.failed(InsurancesConstants.ORDER_NO_IS_EMPTY);
}
return saveInsuranceRefund(paramList.getData(),paramList.getOrderNo());
}
/**
* 订单商险列表查询
*
* @author zhaji
* @param page
* @param param
* @return {@link IPage< InsuredOrderListVo>}
*/
@Override
public R getOrderInsuredListPage(Page<InsuredOrderListVo> page, InsuredOrderParam param) {
YifuUser user = SecurityUtils.getUser();
List<String> deptNoList = getDeptNoList(user);
Page<InsuredOrderListVo> pageList = new Page<>();
if(CollectionUtils.isEmpty(deptNoList)){
return R.ok(pageList);
}
param.setDeptNoList(deptNoList);
String orderNo = param.getOrderNo();
if (StringUtils.isBlank(orderNo)) {
return R.failed(InsurancesConstants.ORDER_NO_IS_EMPTY);
}
//查询所有投保信息
IPage<InsuredOrderListVo> orderInsuredList = baseMapper.getOrderRefundInsuredListPage(page, param);
//查询所有的减员信息
return R.ok(orderInsuredList);
}
/**
* 获取项目权限
*
......@@ -5233,6 +5335,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
List<String> deptNoList =new ArrayList<>();
deptNoList.add(tInsuranceDetail.getDeptNo());
BeanCopyUtils.copyProperties(tInsuranceDetail,param);
param.setDetailId(tInsuranceDetail.getId());
//获取当前项目的名称,客户名称和客户编码
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(deptNoList);
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
......@@ -5291,11 +5394,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @param
* @return {@link String}
*/
@Override
public SettleVo getInsuranceDetailSettleStatus(String detailId,String settleId){
String id = detailId+CommonConstants.DOWN_LINE_STRING+settleId;
//获取ekp结算信息
SettleVo settle = ekpSettleService.getSettle(id);
return settle;
return ekpSettleService.getSettle(id);
}
/**
......
......@@ -56,12 +56,14 @@ public class TInsuranceEkpServiceImpl extends ServiceImpl<TInsuranceEkpMapper, T
List<TInsuranceEkp> ekpRefundList = this.baseMapper.getEkpRefundList();
List<TInsuranceEkp> failList = new ArrayList<>();
List<TInsuranceEkp> successLit = new ArrayList<>();
SettleVo settle = ekpSettleService.getSettle("12345");
String actualStatus = settle.getActualStatus();
log.info("settle:"+settle.toString());
log.info("actualStatus:"+actualStatus);
if (CollectionUtils.isNotEmpty(ekpRefundList)){
for (TInsuranceEkp tInsuranceEkp : ekpRefundList) {
//结算信息
SettleVo settleVo = tInsuranceDetailService.getInsuranceDetailSettleStatus(tInsuranceEkp.getDetailId(), tInsuranceEkp.getDefaultSettleId());
//实缴结算状态
String actualStatus = settleVo.getActualStatus();
//预缴结算状态
String estimateStatus = settleVo.getEstimateStatus();
Integer pushType = tInsuranceEkp.getPushType();
LambdaQueryWrapper<TInsuranceSettle> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TInsuranceSettle :: getId,tInsuranceEkp.getDefaultSettleId());
......@@ -80,10 +82,6 @@ public class TInsuranceEkpServiceImpl extends ServiceImpl<TInsuranceEkpMapper, T
}
EKPInteractiveParam ekpParam = new EKPInteractiveParam();
BeanCopyUtils.copyProperties(tInsuranceEkp,ekpParam);
String detailId = ekpParam.getDetailId();
String defaultSettleId = ekpParam.getDefaultSettleId();
//查询当前结算状态
String status = CommonConstants.ONE_STRING;
if(actualStatus.equals(InsurancesConstants.SETTLE_ZERO)){
String s = EKPUtil.sendToEKP(ekpParam);
//如果发送成功
......
......@@ -53,8 +53,10 @@
<result property="deleteFlag" column="DELETE_FLAG" jdbcType="TINYINT"/>
<result property="handledBy" column="HANDLED_BY" jdbcType="VARCHAR"/>
<result property="handledTime" column="HANDLED_TIME" jdbcType="TIMESTAMP"/>
<result property="orderNo" column="ORDER_NO" jdbcType="VARCHAR"/>
<result property="createUserDeptId" column="CREATE_USER_DEPT_ID" jdbcType="VARCHAR"/>
<result property="createUserDeptName" column="CREATE_USER_DEPT_NAME" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
ID,EMP_NAME,
EMP_IDCARD_NO,DEPT_NO,POST,INSURANCE_COMPANY_NAME,INSURANCE_TYPE_NAME,
......@@ -67,7 +69,8 @@
BUY_HANDLE_STATUS,DEFAULT_SETTLE_ID,REDUCE_HANDLE_STATUS,
IS_USE,IS_EFFECT,IS_OVERDUE,REMARK,
CREATE_BY,CREATE_NAME,CREATE_TIME,
UPDATE_BY,UPDATE_TIME,DELETE_FLAG,DEFAULT_SETTLE_ID,HANDLED_BY,HANDLED_TIME
UPDATE_BY,UPDATE_TIME,DELETE_FLAG,DEFAULT_SETTLE_ID,HANDLED_BY,HANDLED_TIME,ORDER_NO,CREATE_USER_DEPT_ID,CREATE_USER_DEPT_NAME
</sql>
<!--投保分页查询-->
<select id="getInsuranceListPage" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceListVO">
......@@ -86,12 +89,16 @@
detail.CREATE_NAME as createName,
detail.BUY_HANDLE_STATUS as buyHandleStatus,
detail.SETTLE_TYPE as settleType,
detail.CREATE_USER_DEPT_NAME as createUserDeptName,
detail.SETTLE_MONTH as settleMonth
from t_insurance_detail detail
where detail.DELETE_FLAG = 0
<if test="param.deptNo != null and param.deptNo.trim() != ''">
and detail.DEPT_NO = #{param.deptNo}
</if>
<if test="param.orderNo != null and param.orderNo.trim() != ''">
and detail.DEPT_NO = #{param.orderNo}
</if>
<if test="param.deptNo == null or param.deptNo.trim() == ''">
and detail.DEPT_NO in
<foreach collection="param.deptNoList" index="index" item="item" open="(" separator="," close=")">
......@@ -130,7 +137,6 @@
</if>
ORDER BY detail.BUY_HANDLE_STATUS,detail.CREATE_TIME DESC
</select>
<!--投保不分页查询-->
<select id="getInsuranceList" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceListVO">
select detail.id as id,
......@@ -192,7 +198,6 @@
</if>
ORDER BY detail.BUY_HANDLE_STATUS,detail.CREATE_TIME DESC
</select>
<!--投保办理分页查询-->
<select id="getInsuranceHandleListPage" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceListVO">
select detail.id as id,
......@@ -253,7 +258,6 @@
</if>
ORDER BY detail.BUY_HANDLE_STATUS,detail.CREATE_TIME DESC
</select>
<select id="getInsuranceDetailById" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceDetailVO">
select
detail.id as id,
......@@ -385,12 +389,16 @@
</if>
ORDER BY detail.CREATE_TIME DESC
</select>
<update id="updatePolicyNoBatch">
<foreach collection="details" index="index" item="item" separator=";">
update t_insurance_detail set POLICY_NO = #{item.policyNo} where ID = #{item.id}
</foreach>
</update>
<update id="updateInvoiceNoBatch">
<foreach collection="details" index="index" item="item" separator=";">
update t_insurance_detail set INVOICE_NO = #{item.invoiceNo} where ID = #{item.id}
</foreach>
</update>
<!-- ***********************减员办理******************************** -->
<!-- 已投保列表分页查询-->
......@@ -411,6 +419,7 @@
detail.IS_OVERDUE as isOverdue,
detail.INSURANCE_COMPANY_NAME as insuranceCompanyName,
detail.INSURANCE_TYPE_NAME as insuranceTypeName,
detail.CREATE_USER_DEPT_NAME as createUserDeptName,
detail.BUY_STANDARD as buyStandard
from
t_insurance_detail detail
......@@ -568,6 +577,7 @@
detail.POLICY_START as policyStart,
detail.POLICY_END as policyEnd,
detail.POLICY_NO as policyNo,
refund.CREATE_USER_DEPT_NAME as createUserDeptName,
refund.CREATE_TIME as refundCreateTime
from
t_insurance_detail detail,
......@@ -894,7 +904,7 @@
</where>
ORDER BY CREATE_TIME desc
</select>
<select id="selectListByempIdcardNo" resultType="com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail">
<select id="selectListByEmpIdcardNo" resultType="com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail">
SELECT
<include refid="Base_Column_List"/>
FROM
......@@ -910,7 +920,8 @@
</where>
ORDER BY CREATE_TIME desc
</select>
<select id="selectByregionSQL" resultType="com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail">
<!--查数据是否存在权限范围内-->
<select id="selectByRegionSql" resultType="com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail">
SELECT
<include refid="Base_Column_List"/>
FROM
......@@ -923,4 +934,130 @@
</where>
ORDER BY CREATE_TIME desc
</select>
<!--商险订单减员列表查询-->
<select id="getOrderRefundInsuredListPage" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuredOrderListVo">
(
select
detail.id as id,
detail.BUY_TYPE as buyType,
detail.EMP_NAME as empName,
detail.EMP_IDCARD_NO as empIdcardNo,
detail.INSURANCE_COMPANY_NAME as insuranceCompanyName,
detail.INSURANCE_TYPE_NAME as insuranceTypeName,
detail.BUY_STANDARD as buyStandard,
detail.MEDICAL_QUOTA as medicalQuota,
detail.DIE_DISABLE_QUOTA as dieDisableQuota,
detail.CREATE_NAME as createName,
detail.CREATE_USER_DEPT_NAME as createUserDeptName,
detail.CREATE_TIME as createTime,
detail.BUY_HANDLE_STATUS as buyHandleStatus,
detail.REDUCE_HANDLE_STATUS as reduceHandleStatus
from
t_insurance_detail detail
where
detail.DELETE_FLAG = 0
and
detail.ORDER_NO = #{param.orderNo}
<if test="param.empName != null and param.empName.trim() != ''">
and detail.EMP_NAME like concat('%',replace(replace(#{param.empName},'_','\_'),'%','\%'),'%')
</if>
<if test="param.empIdcardNo != null and param.empIdcardNo.trim() != ''">
and detail.EMP_IDCARD_NO like concat('%',replace(replace(#{param.empIdcardNo},'_','\_'),'%','\%'),'%')
</if>
<if test="param.startDate != null and param.startDate.trim() != ''">
AND detail.CREATE_TIME <![CDATA[ >= ]]> concat(#{param.startDate}, '00:00:00')
</if>
<if test="param.endDate != null and param.endDate.trim() != ''">
AND detail.CREATE_TIME <![CDATA[ <= ]]> concat(#{param.endDate}, ' 23:59:59')
</if>
<if test="param.deptNoList != null">
and detail.DEPT_NO in
<foreach collection="param.deptNoList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>)
union all(
select
detail.id as id,
detail.BUY_TYPE as buyType,
detail.EMP_NAME as empName,
detail.EMP_IDCARD_NO as empIdcardNo,
detail.INSURANCE_COMPANY_NAME as insuranceCompanyName,
detail.INSURANCE_TYPE_NAME as insuranceTypeName,
detail.BUY_STANDARD as buyStandard,
detail.MEDICAL_QUOTA as medicalQuota,
detail.DIE_DISABLE_QUOTA as dieDisableQuota,
refund.CREATE_NAME as createName,
refund.CREATE_USER_DEPT_NAME as createUserDeptName,
refund.CREATE_TIME as createTime,
detail.BUY_HANDLE_STATUS as buyHandleStatus,
refund.REDUCE_HANDLE_STATUS as reduceHandleStatus
from
t_insurance_detail detail,
t_insurance_refund refund
where
detail.DELETE_FLAG = 0
and
refund.ORDER_NO = #{param.orderNo}
<if test="param.empName != null and param.empName.trim() != ''">
and detail.EMP_NAME like concat('%',replace(replace(#{param.empName},'_','\_'),'%','\%'),'%')
</if>
<if test="param.empIdcardNo != null and param.empIdcardNo.trim() != ''">
and detail.EMP_IDCARD_NO like concat('%',replace(replace(#{param.empIdcardNo},'_','\_'),'%','\%'),'%')
</if>
<if test="param.startDate != null and param.startDate.trim() != ''">
AND refund.CREATE_TIME <![CDATA[ >= ]]> concat(#{param.startDate}, '00:00:00')
</if>
<if test="param.endDate != null and param.endDate.trim() != ''">
AND refund.CREATE_TIME <![CDATA[ <= ]]> concat(#{param.endDate}, ' 23:59:59')
</if>
<if test="param.deptNoList != null">
and detail.DEPT_NO in
<foreach collection="param.deptNoList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
)order by createTime desc
</select>
<select id="getOrderInsuredListPage" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuredOrderListVo">
select
detail.id as id,
detail.BUY_TYPE as buyType,
detail.EMP_NAME as empName,
detail.EMP_IDCARD_NO as empIdcardNo,
detail.INSURANCE_COMPANY_NAME as insuranceCompanyName,
detail.INSURANCE_TYPE_NAME as insuranceTypeName,
detail.BUY_STANDARD as buyStandard,
detail.MEDICAL_QUOTA as medicalQuota,
detail.DIE_DISABLE_QUOTA as dieDisableQuota,
detail.CREATE_NAME as createName,
detail.CREATE_USER_DEPT_NAME as createUserDeptName,
detail.CREATE_TIME as createTime,
detail.BUY_HANDLE_STATUS as buyHandleStatus
from
t_insurance_detail detail
where
detail.DELETE_FLAG = 0
and
detail.ORDER_NO = #{param.orderNo}
<if test="param.empName != null and param.empName.trim() != ''">
and detail.EMP_NAME like concat('%',replace(replace(#{param.empName},'_','\_'),'%','\%'),'%')
</if>
<if test="param.empIdcardNo != null and param.empIdcardNo.trim() != ''">
and detail.EMP_IDCARD_NO like concat('%',replace(replace(#{param.empIdcardNo},'_','\_'),'%','\%'),'%')
</if>
<if test="param.startDate != null and param.startDate.trim() != ''">
AND detail.CREATE_TIME <![CDATA[ >= ]]> concat(#{param.startDate}, '00:00:00')
</if>
<if test="param.endDate != null and param.endDate.trim() != ''">
AND detail.CREATE_TIME <![CDATA[ <= ]]> concat(#{param.endDate}, ' 23:59:59')
</if>
<if test="param.deptNoList != null">
and detail.DEPT_NO in
<foreach collection="param.deptNoList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
</mapper>
......@@ -13,26 +13,51 @@
<result property="createTime" column="CREATE_TIME" jdbcType="TIMESTAMP"/>
<result property="createBy" column="CREATE_BY" jdbcType="VARCHAR"/>
<result property="createName" column="CREATE_NAME" jdbcType="VARCHAR"/>
</resultMap>
<result property="createBy" column="CREATE_BY" jdbcType="VARCHAR"/>
<result property="orderNo" column="ORDER_NO" jdbcType="VARCHAR"/>
<result property="createUserDeptId" column="CREATE_USER_DEPT_ID" jdbcType="VARCHAR"/>
<result property="createUserDeptName" column="CREATE_USER_DEPT_NAME" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
ID,INS_DETAIL_ID,REDUCE_HANDLE_STATUS,
REFUND_MONEY,REMARK,CREATE_TIME,
CREATE_BY,CREATE_NAME
CREATE_BY,CREATE_NAME,ORDER_NO,CREATE_USER_DEPT_ID,CREATE_USER_DEPT_NAME
</sql>
<update id="updateByInsDetailId">
update
t_insurance_refund
set
REDUCE_HANDLE_STATUS = #{reduceHandleStatus},
REMARK = #{remark},
CREATE_NAME= #{createName},
CREATE_BY = #{createBy},
CREATE_TIME = #{createTime},
UPDATE_BY = #{createBy},
UPDATE_TIME = #{createTime}
<if test="param.createName != null and param.createName.trim() != ''">
CREATE_NAME= #{param.createName},
</if>
<if test="param.createBy != null and param.createBy.trim() != ''">
CREATE_BY = #{param.createBy},
</if>
<if test="param.createTime != null">
CREATE_TIME = #{param.createTime},
</if>
<if test="param.updateBy != null and param.updateBy.trim() != ''">
UPDATE_BY = #{param.updateBy},
</if>
<if test="param.updateTime != null ">
UPDATE_TIME = #{param.updateTime},
</if>
<if test="param.createUserDeptName != null and param.createUserDeptName.trim() != ''">
CREATE_USER_DEPT_NAME= #{param.createUserDeptName},
</if>
<if test="param.createUserDeptId != null and param.createUserDeptId.trim() != ''">
CREATE_USER_DEPT_ID = #{param.createUserDeptId},
</if>
<if test="param.orderNo != null and param.orderNo.trim() != ''">
ORDER_NO = #{param.orderNo},
</if>
<if test="param.remark != null and param.remark.trim() != ''">
REMARK = #{param.remark},
</if>
REDUCE_HANDLE_STATUS = #{param.reduceHandleStatus}
where
INS_DETAIL_ID = #{insDetailId}
INS_DETAIL_ID = #{param.insDetailId}
</update>
<update id="updateRefundMoney">
update
......
package com.yifu.cloud.plus.v1.yifu.order.constants;
/**
* @author licancan
* @description 订单常量
* @date 2022-08-29 11:36:21
*/
public class OrderConstants {
/**
* 状态不合法
*/
public static final String STATUS_ERROR = "状态不合法";
/**
* 数据不存在
*/
public static final String DATA_IS_EMPTY = "数据不存在";
/**
* 订单id不可为空
*/
public static final String ORDER_ID_IS_EMPTY = "订单id不可为空";
/**
* 订单已办结,不可操作
*/
public static final String ORDER_IS_HANDLED= "订单已办结,不可操作";
/**
* 操作成功
*/
public static final String OPERATE_SUCCESS = "操作成功";
}
package com.yifu.cloud.plus.v1.yifu.order.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author licancan
* @description 订单列表入参
* @date 2022-08-29 09:10:02
*/
@Data
@Schema(description = "订单列表入参")
public class OrderListParam implements Serializable {
private static final long serialVersionUID = 2575913025864285604L;
/**
* 订单编号
*/
@Schema(description = "订单编号")
private String orderNo;
/**
* 订单开始时间
*/
@Schema(description = "订单开始时间")
private String startDate;
/**
* 订单结束时间
*/
@Schema(description = "订单结束时间")
private String endDate;
/**
* 创建人姓名(下单人)
*/
@Schema(description = "创建人姓名(下单人)")
private String createName;
/**
* 客户名称
*/
@Schema(description = "客户名称")
private String customerName;
/**
* 项目名称
*/
@Schema(description = "项目名称")
private String deptName;
/**
* 项目编码
*/
@Schema(description = "项目编码")
private String deptNo;
/**
* 订单状态 0待办理 1办理中 2已办结
*/
@Schema(description = "订单状态 0待办理 1办理中 2已办结")
private Integer orderStatus;
/**
* 订单id集合
*/
@Schema(description = "订单id集合")
private List<String> idList;
}
package com.yifu.cloud.plus.v1.yifu.order.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @author licancan
* @description 订单列表VO
* @date 2022-08-29 09:16:07
*/
@Data
@Schema(description = "订单列表VO")
public class OrderListVO implements Serializable{
private static final long serialVersionUID = 4067597933537194227L;
/**
* 主键
*/
@Schema(description = "主键")
private String id;
/**
* 订单编号
*/
@Schema(description = "订单编号")
private String orderNo;
/**
* 创建时间(下单时间)
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@Schema(description = "创建时间(下单时间)")
private LocalDateTime createTime;
/**
* 创建人姓名(下单人)
*/
@Schema(description = "创建人姓名(下单人)")
private String createName;
/**
* 客户名称
*/
@Schema(description = "客户名称")
private String customerName;
/**
* 项目名称
*/
@Schema(description = "项目名称")
private String deptName;
/**
* 项目编码
*/
@Schema(description = "项目编码")
private String deptNo;
/**
* 订单状态 0待办理 1办理中 2已办结
*/
@Schema(description = "订单状态 0待办理 1办理中 2已办结")
private Integer orderStatus;
}
package com.yifu.cloud.plus.v1.yifu.order.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.order.service.TOrderService;
import com.yifu.cloud.plus.v1.yifu.order.vo.OrderListParam;
import com.yifu.cloud.plus.v1.yifu.order.vo.OrderListVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* @author licancan
* @description 订单controller
* @date 2022-08-29 09:05:23
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/order")
@Tag(name = "订单相关")
public class OrderController {
@Resource
private TOrderService tOrderService;
/**
* 订单列表分页查询
*
* @author licancan
* @param page
* @param param
* @return {@link R<IPage<OrderListVO>>}
*/
@Operation(summary = "订单列表分页查询", description = "订单列表分页查询")
@GetMapping("/getOrderPageList")
public R<IPage<OrderListVO>> getOrderPageList(Page<OrderListParam> page, OrderListParam param) {
return R.ok(tOrderService.getOrderPageList(page,param));
}
/**
* 订单列表不分页查询
*
* @author licancan
* @param param
* @return {@link R<List<OrderListVO>>}
*/
@Operation(summary = "订单列表不分页查询", description = "订单列表不分页查询")
@GetMapping("/getOrderList")
public R<List<OrderListVO>> getOrderList(OrderListParam param) {
return R.ok(tOrderService.getOrderList(param));
}
/**
* 变更订单状态
*
* @author licancan
* @param id
* @param status
* @return {@link R< String>}
*/
@GetMapping("/handleOrder")
@Operation(summary = "变更订单状态", description = "变更订单状态")
public R<String> handleOrder(@RequestParam String id,@RequestParam Integer status) {
return tOrderService.handleOrder(id,status);
}
}
......@@ -2,8 +2,15 @@ package com.yifu.cloud.plus.v1.yifu.order.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.order.entity.TOrder;
import com.yifu.cloud.plus.v1.yifu.order.vo.OrderListParam;
import com.yifu.cloud.plus.v1.yifu.order.vo.OrderListVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author licancan
......@@ -13,5 +20,31 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TOrderMapper extends BaseMapper<TOrder> {
/**
* 订单列表分页查询
*
* @author licancan
* @param page
* @param param
* @return {@link IPage<OrderListVO>}
*/
IPage<OrderListVO> getOrderPageList(Page<OrderListParam> page,@Param("param") OrderListParam param);
/**
* 导出勾选查询结果
*
* @author licancan
* @param idList
* @return {@link List<OrderListVO>}
*/
List<OrderListVO> getOrderListBySelect(@Param("idList") List<String> idList);
/**
* 导出非勾选查询结果
*
* @author licancan
* @param param
* @return {@link List< OrderListVO>}
*/
List<OrderListVO> getOrderList(@Param("param") OrderListParam param);
}
package com.yifu.cloud.plus.v1.yifu.order.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.order.entity.TOrder;
import com.yifu.cloud.plus.v1.yifu.order.vo.OrderListParam;
import com.yifu.cloud.plus.v1.yifu.order.vo.OrderListVO;
import java.util.List;
/**
* @author licancan
......@@ -11,4 +18,32 @@ import com.yifu.cloud.plus.v1.yifu.order.entity.TOrder;
*/
public interface TOrderService extends IService<TOrder> {
/**
* 订单列表分页查询
*
* @author licancan
* @param page
* @param param
* @return {@link IPage<OrderListVO>}
*/
IPage<OrderListVO> getOrderPageList(Page<OrderListParam> page, OrderListParam param);
/**
* 订单列表不分页查询
*
* @author licancan
* @param param
* @return {@link List<OrderListVO>}
*/
List<OrderListVO> getOrderList(OrderListParam param);
/**
* 变更订单状态
*
* @author licancan
* @param id
* @param status
* @return {@link R<String>}
*/
R<String> handleOrder(String id, Integer status);
}
package com.yifu.cloud.plus.v1.yifu.order.service.impl;
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.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.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.order.constants.OrderConstants;
import com.yifu.cloud.plus.v1.yifu.order.entity.TOrder;
import com.yifu.cloud.plus.v1.yifu.order.mapper.TOrderMapper;
import com.yifu.cloud.plus.v1.yifu.order.service.TOrderService;
import com.yifu.cloud.plus.v1.yifu.order.vo.OrderListParam;
import com.yifu.cloud.plus.v1.yifu.order.vo.OrderListVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
/**
* @author licancan
* @description 针对表【t_order(订单表)】的数据库操作Service实现
......@@ -16,4 +32,68 @@ import org.springframework.stereotype.Service;
@Service
public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> implements TOrderService {
/**
* 订单列表分页查询
*
* @param page
* @param param
* @return {@link IPage <OrderListVO>}
* @author licancan
*/
@Override
public IPage<OrderListVO> getOrderPageList(Page<OrderListParam> page, OrderListParam param) {
IPage<OrderListVO> orderList = baseMapper.getOrderPageList(page,param);
return orderList;
}
/**
* 订单列表不分页查询
*
* @param param
* @return {@link List<OrderListVO>}
* @author licancan
*/
@Override
public List<OrderListVO> getOrderList(OrderListParam param) {
List<OrderListVO> list;
if (CollectionUtils.isNotEmpty(param.getIdList())){
list = baseMapper.getOrderListBySelect(param.getIdList());
}else {
list = baseMapper.getOrderList(param);
}
return list;
}
/**
* 变更订单状态
*
* @param id
* @param status
* @return {@link R <String>}
* @author licancan
*/
@Override
public R<String> handleOrder(String id, Integer status) {
if (StringUtils.isEmpty(id)){
return R.failed(OrderConstants.ORDER_ID_IS_EMPTY);
}
if (CommonConstants.TWO_INT != status && CommonConstants.THREE_INT != status){
return R.failed(OrderConstants.STATUS_ERROR);
}
YifuUser user = SecurityUtils.getUser();
TOrder byId = this.getById(id);
if (!Optional.ofNullable(byId).isPresent()){
return R.failed(OrderConstants.DATA_IS_EMPTY);
}
if (CommonConstants.THREE_INT == byId.getOrderStatus()){
return R.failed(OrderConstants.ORDER_IS_HANDLED);
}
byId.setOrderStatus(status);
byId.setUpdateBy(user.getId());
byId.setUpdateName(user.getNickname());
byId.setUpdateTime(LocalDateTime.now());
this.updateById(byId);
return R.ok(OrderConstants.OPERATE_SUCCESS);
}
}
......@@ -27,4 +27,92 @@
UPDATE_BY,UPDATE_NAME,UPDATE_TIME,
DELETE_FLAG
</sql>
<select id="getOrderPageList" resultType="com.yifu.cloud.plus.v1.yifu.order.vo.OrderListVO">
select t.id as id,
t.ORDER_NO as orderNo,
t.CREATE_TIME as createTime,
t.CREATE_NAME as createName,
t.CUSTOMER_NAME as customerName,
t.DEPT_NAME as deptName,
t.DEPT_NO as deptNo,
t.ORDER_STATUS as orderStatus
from t_order t
where t.DELETE_FLAG = 0
<if test="param.orderNo != null and param.orderNo.trim() != ''">
and t.ORDER_NO = #{param.orderNo}
</if>
<if test="param.startDate != null and param.startDate.trim() != '' and param.endDate != null and param.endDate.trim() != ''">
and t.CREATE_TIME <![CDATA[ >= ]]> concat(#{param.startDate}, ' 00:00:00') and t.CREATE_TIME <![CDATA[ <= ]]> concat(#{param.endDate}, ' 23:59:59')
</if>
<if test="param.createName != null and param.createName.trim() != ''">
and t.CREATE_NAME like concat('%',replace(replace(#{param.createName},'_','\_'),'%','\%'),'%')
</if>
<if test="param.customerName != null and param.customerName.trim() != ''">
and t.CUSTOMER_NAME = #{param.customerName}
</if>
<if test="param.deptName != null and param.deptName.trim() != ''">
and t.DEPT_NAME = #{param.deptName}
</if>
<if test="param.deptNo != null and param.deptNo.trim() != ''">
and t.DEPT_NO like concat('%',replace(replace(#{param.deptNo},'_','\_'),'%','\%'),'%')
</if>
<if test="param.orderStatus != null">
and t.ORDER_STATUS = #{param.orderStatus}
</if>
ORDER BY t.ORDER_STATUS,t.CREATE_TIME DESC
</select>
<select id="getOrderListBySelect" resultType="com.yifu.cloud.plus.v1.yifu.order.vo.OrderListVO">
select t.id as id,
t.ORDER_NO as orderNo,
t.CREATE_TIME as createTime,
t.CREATE_NAME as createName,
t.CUSTOMER_NAME as customerName,
t.DEPT_NAME as deptName,
t.DEPT_NO as deptNo,
t.ORDER_STATUS as orderStatus
from t_order t
where t.DELETE_FLAG = 0 and t.id in
<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
ORDER BY t.ORDER_STATUS,t.CREATE_TIME DESC
</select>
<select id="getOrderList" resultType="com.yifu.cloud.plus.v1.yifu.order.vo.OrderListVO">
select t.id as id,
t.ORDER_NO as orderNo,
t.CREATE_TIME as createTime,
t.CREATE_NAME as createName,
t.CUSTOMER_NAME as customerName,
t.DEPT_NAME as deptName,
t.DEPT_NO as deptNo,
t.ORDER_STATUS as orderStatus
from t_order t
where t.DELETE_FLAG = 0
<if test="param.orderNo != null and param.orderNo.trim() != ''">
and t.ORDER_NO = #{param.orderNo}
</if>
<if test="param.startDate != null and param.startDate.trim() != '' and param.endDate != null and param.endDate.trim() != ''">
and t.CREATE_TIME <![CDATA[ >= ]]> concat(#{param.startDate}, ' 00:00:00') and t.CREATE_TIME <![CDATA[ <= ]]> concat(#{param.endDate}, ' 23:59:59')
</if>
<if test="param.createName != null and param.createName.trim() != ''">
and t.CREATE_NAME like concat('%',replace(replace(#{param.createName},'_','\_'),'%','\%'),'%')
</if>
<if test="param.customerName != null and param.customerName.trim() != ''">
and t.CUSTOMER_NAME = #{param.customerName}
</if>
<if test="param.deptName != null and param.deptName.trim() != ''">
and t.DEPT_NAME = #{param.deptName}
</if>
<if test="param.deptNo != null and param.deptNo.trim() != ''">
and t.DEPT_NO like concat('%',replace(replace(#{param.deptNo},'_','\_'),'%','\%'),'%')
</if>
<if test="param.orderStatus != null">
and t.ORDER_STATUS = #{param.orderStatus}
</if>
ORDER BY t.ORDER_STATUS,t.CREATE_TIME DESC
</select>
</mapper>
......@@ -32,6 +32,7 @@ import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
......@@ -358,6 +359,30 @@ public class TSalaryAccount extends BaseEntity {
@ExcelProperty("个税-单位承担")
private BigDecimal salaryTaxUnit;
@ExcelAttribute(name = "发送状态:0未发送,1已发送")
@ExcelProperty("发送状态:0未发送,1已发送")
private String sendStatus;
@ExcelAttribute(name = "发送月份")
@ExcelProperty("发送月份")
private String sendMonth;
@ExcelAttribute(name = "发送时间")
@ExcelProperty("发送时间")
private Date sendTime;
@ExcelAttribute(name = "发送人id")
@ExcelProperty("发送人id")
private String sendUser;
@ExcelAttribute(name = "发送人姓名")
@ExcelProperty("发送人姓名")
private String sendUserName;
@ExcelAttribute(name = "发送返回的EKPID")
@ExcelProperty("发送返回的EKPID")
private String ekpId;
@TableField(exist = false)
private List<TSalaryAccountItem> saiList = new ArrayList<>(); //工资组成部分明细
......
......@@ -22,6 +22,11 @@
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-common-seata</artifactId>
</dependency>
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-common-ekp</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-salary-api</artifactId>
......
......@@ -207,4 +207,17 @@ public class TSalaryStandardController {
return R.failed("请传参!");
}
}
/**
* @param id 主键
* @Description: 发送至EKP
* @Author: hgw
* @Date: 2022/8/26 11:40
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R
**/
@Operation(description = "发送至EKP")
@PostMapping("/doSend")
public R<String> doSend(@RequestParam String id) {
return tSalaryStandardService.doSend(id);
}
}
......@@ -20,6 +20,7 @@ package com.yifu.cloud.plus.v1.yifu.salary.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.ekp.vo.EkpSalaryParam;
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;
......@@ -89,6 +90,15 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> {
**/
List<String> getAccountYearCheckList();
/**
* @param salaryId
* @Description: 获取薪资明细
* @Author: hgw
* @Date: 2022/8/29 16:52
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParam>
**/
List<EkpSalaryParam> getEkpSalaryParamList(@Param("salaryId") String salaryId);
List<TSalaryAccount> noPageDiy(@Param("searchVo") TSalaryAccountSearchVo searchVo,
@Param("idList")List<String> idList);
......
......@@ -20,6 +20,7 @@ package com.yifu.cloud.plus.v1.yifu.salary.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParam;
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.TSalaryAccountSearchVo;
......@@ -86,4 +87,13 @@ public interface TSalaryAccountService extends IService<TSalaryAccount> {
* @return:
**/
List<String> getAccountYearCheckMap();
/**
* @param salaryId
* @Description: 获取薪资数据
* @Author: hgw
* @Date: 2022/8/29 16:54
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParam>
**/
List<EkpSalaryParam> getEkpSalaryParamList(String salaryId);
}
......@@ -74,5 +74,14 @@ public interface TSalaryStandardService extends IService<TSalaryStandard> {
**/
R<String> deleteSalaryById(String id);
/**
* @param id
* @Description: 推送至ekp
* @Author: hgw
* @Date: 2022/8/26 11:56
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<String> doSend(String id);
IPage<TSalaryStandard> getTSalaryStandardPageApply(Page<TSalaryStandard> page, TSalaryStandardSearchVo tSalaryStandard);
}
......@@ -13,18 +13,17 @@ import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprArchivesProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprSocialProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.salary.constants.SalaryConstants;
import com.yifu.cloud.plus.v1.yifu.salary.entity.*;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryStandardMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.*;
import com.yifu.cloud.plus.v1.yifu.salary.util.SalaryAccountUtil;
import com.yifu.cloud.plus.v1.yifu.salary.util.SalaryConstants;
import com.yifu.cloud.plus.v1.yifu.salary.vo.*;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;
import java.math.BigDecimal;
import java.net.URLDecoder;
......
......@@ -28,6 +28,7 @@ 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.ExcelUtil;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParam;
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.mapper.TSalaryAccountMapper;
......@@ -200,4 +201,10 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
public List<String> getAccountYearCheckMap() {
return baseMapper.getAccountYearCheckList();
}
@Override
public List<EkpSalaryParam> getEkpSalaryParamList(String salaryId) {
return baseMapper.getEkpSalaryParamList(salaryId);
}
}
......@@ -36,7 +36,8 @@ import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprSocialProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.salary.constants.SalaryConstants;
import com.yifu.cloud.plus.v1.yifu.ekp.util.EkpSalaryUtil;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParam;
import com.yifu.cloud.plus.v1.yifu.salary.entity.MSalaryEstimate;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TApprovalRecord;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount;
......@@ -46,6 +47,7 @@ import com.yifu.cloud.plus.v1.yifu.salary.service.MSalaryEstimateService;
import com.yifu.cloud.plus.v1.yifu.salary.service.TApprovalRecordService;
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.util.SalaryConstants;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardExportVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardSearchVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardVo;
......@@ -60,6 +62,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
......@@ -85,6 +88,9 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
@Autowired
private DaprSocialProperties socialProperties;
@Autowired
private EkpSalaryUtil ekpSalaryUtil;
/**
* 标准薪酬工资表简单分页查询
*
......@@ -402,4 +408,58 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
return R.failed("id 不可为空");
}
@Override
public R<String> doSend(String id) {
TSalaryStandard s = this.getById(id);
if (s == null) {
return R.failed("未找到工资表");
} else if (s.getStatus() == SalaryConstants.STATUS[2] || s.getStatus() == SalaryConstants.STATUS[10]) {
//报账表
List<EkpSalaryParam> salaryAccountList = salaryAccountService.getEkpSalaryParamList(id);
YifuUser user = SecurityUtils.getUser();
if (user != null && salaryAccountList != null && !salaryAccountList.isEmpty()) {
boolean sendStatus = true;
String sendBack;
List<TSalaryAccount> accountList = new ArrayList<>();
TSalaryAccount account;
Date sendTime = new Date();
String nowMonth = DateUtil.addMonth(0);
for (EkpSalaryParam sendParam : salaryAccountList) {
// 转化报账表的参数
account = new TSalaryAccount();
account.setId(sendParam.getFd_id());
sendParam.setFd_id(null);
sendBack = ekpSalaryUtil.sendToEKP(sendParam);
account.setSendTime(sendTime);
account.setSendUser(user.getId());
account.setSendUserName(user.getNickname());
if (Common.isNotNull(sendBack)) {
account.setSendStatus(CommonConstants.ONE_STRING);
account.setSendMonth(nowMonth);
account.setEkpId(sendBack);
} else {
sendStatus = false;
}
accountList.add(account);
}
salaryAccountService.updateBatchById(accountList);
if (sendStatus) {
s.setSendTime(new Date());
s.setSendMonth(DateUtil.addMonth(0));
s.setStatus(SalaryConstants.STATUS[3]);
this.updateById(s);
return R.ok("发送成功!");
} else {
s.setStatus(SalaryConstants.STATUS[10]);
this.updateById(s);
return R.ok("发送失败!");
}
} else {
return R.failed("请登录!");
}
} else {
return R.failed("请刷新后检查薪资表状态!");
}
}
}
......@@ -269,13 +269,17 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
}
sumDeductSalary = BigDecimalUtils.safeAdd(sdSum,isTax,costReduction);
//年终奖单独扣税
finalSalaryNoSalary = calculationSalary(annousTax,infoVo.getAnnualBonus());
//年终奖合并扣税
if (isSend) {
//年终奖单独扣税
finalSalaryNoSalary = calculationSalary(annousTax,infoVo.getAnnualBonus());
wSalary = infoVo.getAnnualBonus();
finalSalaryWithSalary = finalSalaryNoSalary;
} else {
//年终奖单独扣税
finalSalaryNoSalary = calculationSalary(annousTax,infoVo.getAnnualBonus());
BigDecimal annualTSalary = calculationSalaryT(personTax,infoVo.getAnnualTSalary(),sumTax);
finalSalaryNoSalary = BigDecimalUtils.safeAdd(finalSalaryNoSalary,annualTSalary);
wSalary = BigDecimalUtils.safeAdd(infoVo.getAnnualBonus(), infoVo.getAnnualTSalary());
finalSalaryWithSalary = calculationSalary(annousTax, wSalary);
}
......@@ -394,8 +398,13 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
infoVo.setBestPlanTSalary(map.get(res.toString()));
infoVo.setBestPlanBonus(BigDecimalUtils.safeSubtract(wSalary,map.get(res.toString())));
}
if (Common.isNotNull(list)) {
WriteSheet writeSheet = EasyExcel.writerSheet("全年一次性奖金测算").build();
excelWriter.write(list, writeSheet);
}
}else {
WriteSheet writeSheet = EasyExcel.writerSheet("全年一次性奖金测算"+index).build();
WriteSheet writeSheet = EasyExcel.writerSheet("全年一次性奖金测算").build();
excelWriter.write(list,writeSheet);
}
if (Common.isNotNull(list)){
......@@ -435,7 +444,7 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
BigDecimal anRes;
List<BigDecimal> zySalary = new ArrayList<>();
Map<String,BigDecimal> map = new HashMap<>();
for (BigDecimal i = minSalary; i.compareTo(maxAnualSalary) <= 0; BigDecimalUtils.safeAdd(i,new BigDecimal(100)) ) {
for (BigDecimal i = minSalary; i.compareTo(maxAnualSalary) <= 0; i = BigDecimalUtils.safeAdd(i,new BigDecimal(100)) ) {
//本次薪资纳税额
BigDecimal res = BigDecimal.ZERO;
//本次年终奖纳税额
......@@ -511,6 +520,32 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
return anRes;
}
/**
* @param personTax 薪资扣税阶梯表list
* @param annualSalary 年终奖
* @Description: 计算薪资扣税-个税
* @Author: huyc
* @Date: 2022/8/23
* @return: java.math.BigDecimal
**/
private static BigDecimal calculationSalaryT(List<TSalaryTaxConfig> personTax, BigDecimal annualSalary, BigDecimal sumTax) {
//本次年终奖纳税额
BigDecimal res = BigDecimal.ZERO;
//计算年终奖税
//计算个税
for (TSalaryTaxConfig sub : personTax) {
if (annualSalary.compareTo(sub.getMinIncome()) == SalaryConstants.MORE_THAN
&& annualSalary.compareTo(sub.getMaxIncome()) != SalaryConstants.MORE_THAN) {
//annualSalary = realDeduSalary * ((double) ((annualSalary.getTaxRate() * 1.0) / 100)) - sumTax - sub.getQuick();
res = annualSalary.multiply(new BigDecimal(sub.getWithholdingRate()).divide(
SalaryConstants.B_ONEHUNDRED, SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP))
.subtract(sumTax).subtract(sub.getQuickDeducation());// 应纳税额
break;
}
}
return res;
}
@Override
public List<TStatisticsBonus> noPageDiy(TStatisticsBonusSearchVo searchVo) {
LambdaQueryWrapper<TStatisticsBonus> wrapper = buildQueryWrapper(searchVo);
......
......@@ -158,7 +158,7 @@ public class TStatisticsDeclarerServiceImpl extends ServiceImpl<TStatisticsDecla
baseMapper.updateById(tStatisticsDeclarer);
return R.ok();
}
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
}
@Override
......@@ -274,16 +274,18 @@ public class TStatisticsDeclarerServiceImpl extends ServiceImpl<TStatisticsDecla
}
//根据身份证号和申报月份查找申报人员
TStatisticsDeclarer tStatisticsDeclarer = baseMapper.selectOne(Wrappers.<TStatisticsDeclarer>query().lambda()
List<TStatisticsDeclarer> declarerList = baseMapper.selectList(Wrappers.<TStatisticsDeclarer>query().lambda()
.eq(TStatisticsDeclarer::getEmpIdcard, excel.getEmpIdcard())
.eq(TStatisticsDeclarer::getDeclareMonth, excel.getDeclareMonth())
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(tStatisticsDeclarer)) {
tStatisticsDeclarer.setIsDeclare(excel.getIsDeclare());
if (Common.isNotNull(excel.getUndeclareReason())) {
tStatisticsDeclarer.setUndeclareReason(excel.getUndeclareReason());
.eq(TStatisticsDeclarer::getEmpName, excel.getEmpName()));
if (Common.isNotNull(declarerList)) {
for (TStatisticsDeclarer tStatisticsDeclarer: declarerList) {
tStatisticsDeclarer.setIsDeclare(excel.getIsDeclare());
if (Common.isNotNull(excel.getUndeclareReason())) {
tStatisticsDeclarer.setUndeclareReason(excel.getUndeclareReason());
}
baseMapper.updateById(tStatisticsDeclarer);
}
baseMapper.updateById(tStatisticsDeclarer);
}else {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "未找到身份证和申报月份对应的申报人员信息"));
continue;
......
......@@ -33,7 +33,7 @@ public class SalaryConstants {
* @return:
**/
public static final Integer[] AUDIT_STATUS = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
public static final int[] STATUS = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
public static final int[] STATUS = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
public static final String[] AUDIT_STATUS_STRING = {"待提交", "待审核", "-", "待发放", "已发放", "审核不通过", "确认不通过", "财务退回", "结算单调整待审核", "结算单调整待打印"};
//发放失败-认领状态 0待认领1待出账2已发放3再次失败待认领
public static final Integer[] LOST_STATUS = {0, 1, 2, 3};
......
......@@ -72,7 +72,43 @@
<result property="createTime" column="CREATE_TIME"/>
<result property="updateBy" column="UPDATE_BY"/>
<result property="updateTime" column="UPDATE_TIME"/>
<result property="sendStatus" column="SEND_STATUS"/>
<result property="sendTime" column="SEND_TIME"/>
<result property="sendUser" column="SEND_USER"/>
<result property="sendUserName" column="SEND_USER_NAME"/>
<result property="sendMonth" column="SEND_MONTH"/>
</resultMap>
<!-- 对接EKP的参数 -->
<resultMap id="ekpSalaryParamMap" type="com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParam">
<id property="fd_id" column="fd_id"/>
<result property="fd_3adfedf98ccba2" column="fd_3adfedf98ccba2"/>
<result property="fd_3adfedf9d2bf1c" column="fd_3adfedf9d2bf1c"/>
<result property="fd_3adfedfacd65d6" column="fd_3adfedfacd65d6"/>
<result property="fd_3adfedfb174068" column="fd_3adfedfb174068"/>
<result property="fd_3adfedfb5a68a2" column="fd_3adfedfb5a68a2"/>
<result property="fd_3adfedfb8f76d4" column="fd_3adfedfb8f76d4"/>
<result property="fd_3adfedfbd23ab8" column="fd_3adfedfbd23ab8"/>
<result property="fd_3adfedfcb17f1e" column="fd_3adfedfcb17f1e"/>
<result property="fd_3adfedfc453cc4" column="fd_3adfedfc453cc4"/>
<result property="fd_3adfee063acff0" column="fd_3adfee063acff0"/>
<result property="fd_3adfee0690737c" column="fd_3adfee0690737c"/>
<result property="fd_3adfee01668666" column="fd_3adfee01668666"/>
<result property="fd_3adfedfed8bb28" column="fd_3adfedfed8bb28"/>
<result property="fd_3adfedff3a7430" column="fd_3adfedff3a7430"/>
<result property="fd_3adfee0009d070" column="fd_3adfee0009d070"/>
<result property="fd_3adfee01dea2fa" column="fd_3adfee01dea2fa"/>
<result property="fd_3adfee12cb8840" column="fd_3adfee12cb8840"/>
<result property="fd_3adfee1374ed7a" column="fd_3adfee1374ed7a"/>
<result property="fd_3adfee1e2b2f78" column="fd_3adfee1e2b2f78"/>
<result property="fd_3adfee1e88723e" column="fd_3adfee1e88723e"/>
<result property="fd_3adfee1ee24680" column="fd_3adfee1ee24680"/>
<result property="fd_3adfee1f32fa24" column="fd_3adfee1f32fa24"/>
<result property="fd_3adfee1f901c46" column="fd_3adfee1f901c46"/>
<result property="fd_3adfee20fe5ba4" column="fd_3adfee20fe5ba4"/>
<result property="fd_3af9d49d165e90" column="fd_3af9d49d165e90"/>
<result property="fd_3afab1895feea2" column="fd_3afab1895feea2"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
a.INVOICE_TITLE,
......@@ -121,7 +157,12 @@
a.CREATE_NAME,
a.CREATE_TIME,
a.UPDATE_BY,
a.UPDATE_TIME
a.UPDATE_TIME,
a.SEND_STATUS,
a.SEND_TIME,
a.SEND_USER,
a.SEND_USER_NAME,
a.SEND_MONTH
</sql>
<sql id="tSalaryAccount_where">
<if test="tSalaryAccount != null">
......@@ -247,6 +288,9 @@
</if>
<if test="tSalaryAccount.salaryTaxUnit != null">
AND a.SALARY_TAX_UNIT = #{tSalaryAccount.salaryTaxUnit}
</if>
<if test="tSalaryAccount.sendStatus != null">
AND a.SEND_STATUS = #{tSalaryAccount.sendStatus}
</if>
</if>
</sql>
......@@ -354,6 +398,52 @@
where a.DELETE_FLAG = 0 and a.FORM_TYPE = '0' and a.SALARY_MONTH like concat(DATE_FORMAT(NOW(), '%Y'), '%')
</select>
<!-- 获取薪资明细 -->
<select id="getEkpSalaryParamList" resultMap="ekpSalaryParamMap">
select
a.id fd_id
,a.DEPT_NO fd_3adfedf98ccba2
,a.DEPT_NAME fd_3adfedf9d2bf1c
,s.UNIT_NO fd_3adfedfacd65d6
,s.UNIT_NAME fd_3adfedfb174068
,a.EMP_NAME fd_3adfedfb5a68a2
,a.EMP_IDCARD fd_3adfedfb8f76d4
,a.EMP_PHONE fd_3adfedfbd23ab8
,a.BANK_NO fd_3adfedfcb17f1e
,a.BANK_NAME fd_3adfedfc453cc4
,a.SALARY_MONTH fd_3adfee063acff0
,a.SETTLEMENT_MONTH fd_3adfee0690737c
,'1' fd_3adfee01668666
,a.SOCIAL_PRIORITY fd_3adfedfed8bb28
,a.FUND_PRIORITY fd_3adfedff3a7430
,a.OWN_FLAG fd_3adfee0009d070
,a.ANNUAL_BONUS_TYPE fd_3adfee01dea2fa
,a.RELAY_SALARY fd_3adfee12cb8840
,pdeduction.SALARY_MONEY fd_3adfee1374ed7a
,ifnull(withholidingUnitSocial.SALARY_MONEY,unitSocial.SALARY_MONEY) fd_3adfee1e2b2f78
,ifnull(withholidingPersonSocial.SALARY_MONEY,personalSocial.SALARY_MONEY) fd_3adfee1e88723e
,ifnull(withholidingUnitFund.SALARY_MONEY,unitFund.SALARY_MONEY) fd_3adfee1ee24680
,ifnull(withholidingPersonFund.SALARY_MONEY,personalFund.SALARY_MONEY) fd_3adfee1f32fa24
,a.SALARY_TAX fd_3adfee1f901c46
,a.ACTUAL_SALARY fd_3adfee20fe5ba4
,a.SALARY_GIVE_TIME fd_3af9d49d165e90
,a.INVOICE_TITLE fd_3afab1895feea2
from t_salary_account a
LEFT JOIN t_salary_standard s on a.SALARY_FORM_ID=s.ID
left join t_salary_account_item withholidingPersonSocial on withholidingPersonSocial.SALARY_ACCOUNT_ID = a.id and withholidingPersonSocial.JAVA_FIED_NAME='withholidingPersonSocial'
left join t_salary_account_item withholidingPersonFund on withholidingPersonFund.SALARY_ACCOUNT_ID = a.id and withholidingPersonFund.JAVA_FIED_NAME='withholidingPersonFund'
left join t_salary_account_item personalSocial on personalSocial.SALARY_ACCOUNT_ID = a.id and personalSocial.JAVA_FIED_NAME='personalSocial'
left join t_salary_account_item personalFund on personalFund.SALARY_ACCOUNT_ID = a.id and personalFund.JAVA_FIED_NAME='personalFund'
left join t_salary_account_item exemptionPersionTax on exemptionPersionTax.SALARY_ACCOUNT_ID = a.id and exemptionPersionTax.JAVA_FIED_NAME='exemptionPersionTax'
left join t_salary_account_item unitSocial on unitSocial.SALARY_ACCOUNT_ID = a.id and unitSocial.JAVA_FIED_NAME='unitSocial'
left join t_salary_account_item unitFund on unitFund.SALARY_ACCOUNT_ID = a.id and unitFund.JAVA_FIED_NAME='unitFund'
left join t_salary_account_item withholidingUnitSocial on withholidingUnitSocial.SALARY_ACCOUNT_ID = a.id and withholidingUnitSocial.JAVA_FIED_NAME='withholidingUnitSocial'
left join t_salary_account_item withholidingUnitFund on withholidingUnitFund.SALARY_ACCOUNT_ID = a.id and withholidingUnitFund.JAVA_FIED_NAME='withholidingUnitFund'
left join t_salary_account_item pdeduction on pdeduction.SALARY_ACCOUNT_ID = a.id and pdeduction.JAVA_FIED_NAME='pdeduction'
where a.DELETE_FLAG = 0 and a.SALARY_FORM_ID = #{salaryId} and a.SEND_STATUS = '0'
</select>
<select id="noPageDiy" resultMap="tSalaryAccountMap" parameterType="com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount">
SELECT
<include refid="Base_Column_List"/>
......
......@@ -99,11 +99,12 @@
#{nowMonth} DECLARE_MONTH,c.EMP_NAME,c.EMP_IDCARD,c.EMP_PHONE,c.INVOICE_TITLE DECLARE_UNIT,
if(c.FORM_TYPE=0,'0',if(c.FORM_TYPE=3 or c.FORM_TYPE=4,'1','-')) OCCUPATION_TYPE FROM
(SELECT s.* FROM t_salary_account s,
(SELECT a.EMP_NAME,a.EMP_IDCARD,a.EMP_PHONE,a.INVOICE_TITLE,a.FORM_TYPE,MAX(CREATE_TIME) max_day,a.SETTLEMENT_MONTH
FROM t_salary_account a WHERE a.DELETE_FLAG = '0' AND a.SETTLEMENT_MONTH = #{lastYear}
GROUP BY a.EMP_IDCARD,a.INVOICE_TITLE,a.FORM_TYPE,a.SETTLEMENT_MONTH) b
(SELECT a.EMP_NAME,a.EMP_IDCARD,a.EMP_PHONE,a.INVOICE_TITLE,a.FORM_TYPE,MAX(CREATE_TIME) max_day,a.SETTLEMENT_MONTH,
if(a.FORM_TYPE=0,'0',if(a.FORM_TYPE=3 or a.FORM_TYPE=4,'1','-')) CUPATION_TYPE
FROM t_salary_account a WHERE a.DELETE_FLAG = '0' AND a.SETTLEMENT_MONTH = #{lastMonth}
GROUP BY a.EMP_IDCARD,a.INVOICE_TITLE,CUPATION_TYPE,a.SETTLEMENT_MONTH) b
WHERE s.DELETE_FLAG = '0' AND b.max_day = s.CREATE_TIME
AND s.EMP_IDCARD = b.EMP_IDCARD AND s.INVOICE_TITLE = b.INVOICE_TITLE
AND s.SETTLEMENT_MONTH = b.SETTLEMENT_MONTH AND s.FORM_TYPE = b.FORM_TYPE ) c
AND s.SETTLEMENT_MONTH = b.SETTLEMENT_MONTH) c
</select>
</mapper>
......@@ -88,6 +88,14 @@ public interface TPaymentInfoMapper extends BaseMapper<TPaymentInfo> {
* */
List<TPaymentInfo> selectListForPaymentImport(@Param("months")List<String> months, @Param("idcards")List<String> idcards);
/*
* 已存在公积金缴费库数据 非删除状态
* @param months
* @param idcards
* @return
* */
List<TPaymentInfo> selectListForPaymentImport1(@Param("months")List<String> months, @Param("idcards")List<String> idcards);
/**
* 薪资获取缴费库
* @Author hgw
......
......@@ -262,7 +262,9 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
for (TPaymentInfo paymentInfo : list) {
if ((!user.getId().equals(paymentInfo.getCreateBy()) &&
!CommonConstants.ONE_STRING.equals(user.getId())) ||
CommonConstants.ZERO_STRING.equals(paymentInfo.getPushStatus())) {
CommonConstants.ZERO_STRING.equals(paymentInfo.getPushStatus()) ||
CommonConstants.ONE_STRING.equals(paymentInfo.getSalaryFundFlag()) ||
CommonConstants.ONE_STRING.equals(paymentInfo.getSalarySocialFlag())) {
delFlag = true;
} else {
idList.add(paymentInfo.getId());
......@@ -1256,7 +1258,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
List<String> monthList = list.stream().map(TPaymentInfoVo::getProvidentPayMonth).collect(Collectors.toList());
//已存在社保缴费库数据 非删除状态
List<TPaymentInfo> paymentInfos = baseMapper.selectListForPaymentImport(monthList, idcards);
List<TPaymentInfo> paymentInfos = baseMapper.selectListForPaymentImport1(monthList, idcards);
//公积金唯一性检验条件:身份证编码+公积金缴纳月份
HashMap<String, Object> paymentInfoMap = new HashMap<>();
if (Common.isNotNull(paymentInfos)) {
......@@ -1348,9 +1350,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
+ Math.round(BigDecimalUtils.safeAdd(infoVo.getProvidentSum()).doubleValue() * 100) / 100.0);
}
//存在公积金缴费数据
if (null != paymentInfo && ((BigDecimalUtils.isNullToZero(paymentInfo.getProvidentSum()).compareTo(BigDecimal.ZERO) != 0)
|| ((BigDecimalUtils.isNullToZero(paymentInfo.getSocialSum()).compareTo(BigDecimal.ZERO) == 0)
&& BigDecimalUtils.isNullToZero(paymentInfo.getProvidentSum()).compareTo(BigDecimal.ZERO) == 0))) {
if (null != paymentInfo && BigDecimalUtils.isNullToZero(paymentInfo.getProvidentSum()).compareTo(BigDecimal.ZERO) != 0) {
//允许覆盖,但已核准表或工资结算或已锁定不允许覆盖
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "已存在对应员工身份证" +
......@@ -1415,7 +1415,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
paymentInfo.setProvidentNo(infoVo.getProvidentNo());
paymentInfo.setPersonalProvidentSum(null == infoVo.getUnitProvidentSum() ? BigDecimal.ZERO : infoVo.getUnitProvidentSum());
paymentInfo.setUnitProvidentSum(null == infoVo.getUnitProvidentSum() ? BigDecimal.ZERO : infoVo.getUnitProvidentSum());
paymentInfo.setProvidentSum(BigDecimalUtils.safeAdd(paymentInfo.getUnitProvidentSum(), paymentInfo.getPersonalProvidentSum()));
paymentInfo.setProvidentSum(null == infoVo.getProvidentSum() ? BigDecimal.ZERO : infoVo.getProvidentSum());
paymentInfo.setSumAll(paymentInfo.getProvidentSum());
if (null != paymentInfo && Common.isEmpty(paymentInfo.getFundId())) {
paymentInfo.setFundId(UUID.randomUUID().toString());
......
......@@ -955,6 +955,25 @@
</if>
</select>
<select id="selectListForPaymentImport1" resultMap="tPaymentInfoMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_payment_info a
where 1=1
<if test="months != null and months.size > 0">
AND a.PROVIDENT_PAY_MONTH in
<foreach item="item" index="index" collection="months" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="idcards != null and idcards.size > 0">
AND a.EMP_IDCARD IN
<foreach item="item" index="index" collection="idcards" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<!--tPaymentInfo 查询缴费库要删除的数据-->
<select id="selectListForDelete" resultType="com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfo">
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