Commit 3b32a37b authored by 李灿灿's avatar 李灿灿

Merge branch 'feature-licancan' into 'feature/insurance-1.1.0'

Feature licancan

See merge request !277
parents fb20b37d 78285fac
package com.yifu.cloud.plus.v1.yifu.insurances.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* @author licancan
* @description 业务操作记录表 t_business_operate
* @date 2022-12-08 10:20:16
*/
@TableName(value ="t_business_operate")
@Data
@Schema(description = "业务操作记录表")
public class TBusinessOperate extends BaseEntity {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private String id;
/**
* 业务表id
*/
@Schema(description = "业务表id")
private String businessId;
/**
* 原来的信息
*/
@Schema(description = "原来的信息")
private String oldInfo;
/**
* 新的信息
*/
@Schema(description = "新的信息")
private String newInfo;
/**
* 操作描述
*/
@Schema(description = "操作描述:差异的信息(属性名称,逗号隔开)")
private String differenceInfo;
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yifu.cloud.plus.v1.yifu.insurances.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDate;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* @author licancan
* @description 保单号对应起止时间表 t_insurance_policy
* @date 2022-12-07 16:40:16
*/
@Schema(description = "保单号对应起止时间表")
@Data
public class TInsurancePolicy extends BaseEntity {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private String id;
/**
* 保单编号
*/
@Schema(description = "保单编号")
private String policyNo;
/**
* 保单开始时间
*/
@Schema(description = "保单开始时间")
private LocalDate policyStart;
/**
* 保单结束时间
*/
@Schema(description = "保单结束时间")
private LocalDate policyEnd;
/**
* 保险公司名称
*/
@Schema(description = "保险公司名称")
private String insuranceCompanyName;
/**
* 险种名称
*/
@Schema(description = "险种名称")
private String insuranceTypeName;
/**
* 是否启用标识 0启用 1未启用
*/
@Schema(description = "是否启用标识 0启用 1未启用")
private Integer enableFlag;
/**
* 是否删除 0未删除 1删除
*/
@Schema(description = "是否删除 0未删除 1删除")
private Integer deleteFlag;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.checkerframework.common.value.qual.IntVal;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDate;
/**
* @author licancan
* @description 保单对应起止保时间编辑入参
* @date 2022-12-07 17:39:45
*/
@Data
@Schema(description = "保单对应起止保时间编辑入参")
public class InsurancePolicyListEditParam implements Serializable {
private static final long serialVersionUID = 9200033608149413253L;
/**
* 主键
*/
@Schema(description = "主键")
@NotBlank(message = "主键不能为空")
private String id;
/**
* 保单编号
*/
@Schema(description = "保单编号")
@NotBlank(message = "保单编号不能为空")
private String policyNo;
/**
* 保单开始时间
*/
@Schema(description = "保单开始时间")
@NotNull(message = "保单开始时间不能为空")
private LocalDate policyStart;
/**
* 保单结束时间
*/
@Schema(description = "保单结束时间")
@NotNull(message = "保单结束时间不能为空")
private LocalDate policyEnd;
/**
* 保险公司名称
*/
@Schema(description = "保险公司名称")
@NotBlank(message = "保险公司名称不能为空")
private String insuranceCompanyName;
/**
* 险种名称
*/
@Schema(description = "险种名称")
@NotBlank(message = "险种名称不能为空")
private String insuranceTypeName;
/**
* 是否启用标识 0启用 1未启用
*/
@Schema(description = "是否启用标识 0启用 1未启用")
@NotNull(message = "启用标识不能为空")
@IntVal({0,1})
private Integer enableFlag;
}
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
/**
* @author licancan
* @description 保单对应起止保时间列表入参
* @date 2022-12-07 17:12:27
*/
@Data
@Schema(description = "保单对应起止保时间列表入参")
public class InsurancePolicyListParam implements Serializable {
private static final long serialVersionUID = 1442112261102562729L;
/**
* 保单编号
*/
@Schema(description = "保单编号")
private String policyNo;
/**
* 保单开始时间
*/
@Schema(description = "保单开始时间")
private String policyStart;
/**
* 保单结束时间
*/
@Schema(description = "保单结束时间")
private String policyEnd;
/**
* 保险公司名称
*/
@Schema(description = "保险公司名称")
private String insuranceCompanyName;
/**
* 险种名称
*/
@Schema(description = "险种名称")
private String insuranceTypeName;
/**
* 是否启用标识 0启用 1未启用
*/
@Schema(description = "是否启用标识 0启用 1未启用")
private Integer enableFlag;
}
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TBusinessOperate;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsurancePolicy;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
/**
* @author licancan
* @description 保单号对应起止时间详情vo
* @date 2022-12-08 11:11:35
*/
@Data
@Schema(description = "保单号对应起止时间详情vo")
public class TInsurancePolicyDetailVO extends TInsurancePolicy {
/**
* 操作记录列表
*/
@Schema(description = "操作记录列表")
List<TBusinessOperate> operateList;
}
package com.yifu.cloud.plus.v1.yifu.insurances.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.insurances.entity.TInsurancePolicy;
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsurancePolicyService;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsurancePolicyListEditParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsurancePolicyListParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.TInsurancePolicyDetailVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
/**
* @author licancan
* @description 保单维护 controller
* @date 2022-12-07 16:56:53
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/insurancePolicy")
@Tag(name = "保单维护相关")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class TInsurancePolicyController {
@Resource
private TInsurancePolicyService tInsurancePolicyService;
/**
* 保单号对应起止保时间分页查询
*
* @author licancan
* @param page 分页对象
* @param param 查询参数
* @return {@link R<IPage<TInsurancePolicy>>}
*/
@Operation(summary = "保单号对应起止保时间分页查询", description = "保单号对应起止保时间分页查询")
@GetMapping("/page" )
public R<IPage<TInsurancePolicy>> getInsurancePolicyPage(Page page, InsurancePolicyListParam param) {
return R.ok(tInsurancePolicyService.pageDiy(page, param));
}
/**
* 保单号对应起止保时间列表(不分页)
*
* @author licancan
* @param param
* @return {@link R<List<TInsurancePolicy>>}
*/
@Operation(summary = "保单号对应起止保时间列表(不分页)", description = "保单号对应起止保时间(不分页)")
@GetMapping("/list")
public R<List<TInsurancePolicy>> getInsurancePolicyList(InsurancePolicyListParam param) {
return R.ok(tInsurancePolicyService.getInsurancePolicyList(param));
}
/**
* 通过id查询详情
*
* @author licancan
* @param id
* @return {@link R<TInsurancePolicyDetailVO>}
*/
@GetMapping("/{id}")
@Operation(summary = "通过id查询详情", description = "通过id查询详情")
public R<TInsurancePolicyDetailVO> getDetailById(@PathVariable("id" ) String id) {
return tInsurancePolicyService.getDetailById(id);
}
/**
* 修改保单号对应起止保时间
*
* @author licancan
* @param param 修改参数
* @return {@link R}
*/
@Operation(summary = "修改保单号对应起止保时间", description = "修改保单号对应起止保时间)")
@PostMapping("/update")
public R update(@RequestBody @Valid InsurancePolicyListEditParam param) {
return tInsurancePolicyService.updateInsurancePolicy(param);
}
/**
* 删除保单号对应起止保时间
*
* @author licancan
* @param id 主键
* @return {@link R}
*/
@Operation(summary = "删除保单号对应起止保时间", description = "删除保单号对应起止保时间")
@DeleteMapping("/{id}" )
public R deleteById(@PathVariable("id") String id) {
return tInsurancePolicyService.deleteInsurancePolicy(id);
}
}
package com.yifu.cloud.plus.v1.yifu.insurances.mapper.insurances;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TBusinessOperate;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @author licancan
* @description 针对表【t_business_operate(业务操作记录表)】的数据库操作Mapper
* @date 2022-12-08 10:20:16
*/
@Mapper
public interface TBusinessOperateMapper extends BaseMapper<TBusinessOperate> {
}
package com.yifu.cloud.plus.v1.yifu.insurances.mapper.insurances;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsurancePolicy;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsurancePolicyListParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author licancan
* @description 针对表【t_insurance_policy(保单号对应起止时间表)】的数据库操作Mapper
* @date 2022-12-07 16:40:16
*/
@Mapper
public interface TInsurancePolicyMapper extends BaseMapper<TInsurancePolicy> {
/**
* 保单号对应起止保时间分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return {@link IPage <TInsurancePolicy>}
* @author licancan
*/
IPage<TInsurancePolicy> getInsurancePolicyListPage(Page page,@Param("param") InsurancePolicyListParam param);
/**
* 保单号对应起止保时间列表(不分页)
*
* @author licancan
* @param param
* @return {@link List< TInsurancePolicy>}
*/
List<TInsurancePolicy> getInsurancePolicyList(@Param("param") InsurancePolicyListParam param);
}
package com.yifu.cloud.plus.v1.yifu.insurances.service.insurance;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TBusinessOperate;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* @author licancan
* @description 针对表【t_business_operate(业务操作记录表)】的数据库操作Service
* @date 2022-12-08 10:20:16
*/
public interface TBusinessOperateService extends IService<TBusinessOperate> {
/**
* 保存修改记录
*
* @author licancan
* @param businessId 业务表主键
* @param oldInfo 老的实体类
* @param newInfo 新的实体类
* @param remark 备注
* @return {@link TBusinessOperate}
*/
<T> TBusinessOperate saveModificationRecord(String businessId, T oldInfo, T newInfo, String remark);
/**
* 根据业务主键获取操作记录
*
* @author licancan
* @param businessId
* @return {@link List<TBusinessOperate>}
*/
List<TBusinessOperate> getOperateListByBusinessId(String businessId);
}
package com.yifu.cloud.plus.v1.yifu.insurances.service.insurance;
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.insurances.entity.TInsurancePolicy;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsurancePolicyListEditParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsurancePolicyListParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.TInsurancePolicyDetailVO;
import java.util.List;
/**
* @author licancan
* @description 针对表【t_insurance_policy(保单号对应起止时间表)】的数据库操作Service
* @date 2022-12-07 16:40:16
*/
public interface TInsurancePolicyService extends IService<TInsurancePolicy> {
/**
* 保单号对应起止保时间分页查询
*
* @author licancan
* @param page 分页对象
* @param param 查询参数
* @return {@link IPage<TInsurancePolicy>}
*/
IPage<TInsurancePolicy> pageDiy(Page page, InsurancePolicyListParam param);
/**
* 保单号对应起止保时间列表(不分页)
*
* @author licancan
* @param param
* @return {@link List<TInsurancePolicy>}
*/
List<TInsurancePolicy> getInsurancePolicyList(InsurancePolicyListParam param);
/**
* 通过id查询详情
*
* @author licancan
* @param id
* @return {@link R<TInsurancePolicyDetailVO>}
*/
R<TInsurancePolicyDetailVO> getDetailById(String id);
/**
* 新增
*
* @author licancan
* @param policy
* @return {@link R}
*/
R saveTInsurancePolicy(TInsurancePolicy policy);
/**
* 修改保单号对应起止保时间
*
* @author licancan
* @param param
* @return {@link R}
*/
R updateInsurancePolicy(InsurancePolicyListEditParam param);
/**
* 删除保单号对应起止保时间
*
* @author licancan
* @param id 主键
* @return {@link R}
*/
R deleteInsurancePolicy(String id);
}
package com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.equator.HrEquator;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TBusinessOperate;
import com.yifu.cloud.plus.v1.yifu.insurances.mapper.insurances.TBusinessOperateMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TBusinessOperateService;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.List;
import static com.alibaba.fastjson.serializer.SerializerFeature.*;
/**
* @author licancan
* @description 针对表【t_business_operate(业务操作记录表)】的数据库操作Service实现
* @date 2022-12-08 10:20:16
*/
@Service
public class TBusinessOperateServiceImpl extends ServiceImpl<TBusinessOperateMapper, TBusinessOperate> implements TBusinessOperateService {
/**
* 保存修改记录
*
* @param businessId 业务表主键
* @param oldInfo 老的实体类
* @param newInfo 新的实体类
* @param remark 备注
* @return {@link TBusinessOperate}
* @author licancan
*/
@Override
public <T> TBusinessOperate saveModificationRecord(String businessId, T oldInfo, T newInfo, String remark) {
try{
//比较记录不影响业务逻辑,用try套住
//比较差异
String differenceKey = HrEquator.comparisonValue(oldInfo, newInfo);
//如果有差异保存差异
if(!Common.isEmpty(differenceKey)){
TBusinessOperate operate = new TBusinessOperate();
operate.setBusinessId(businessId);
operate.setCreateTime(LocalDateTime.now());
operate.setOldInfo(JSON.toJSONString(oldInfo,features));
operate.setNewInfo(JSON.toJSONString(newInfo,features));
operate.setDifferenceInfo(differenceKey);
operate.setRemark(remark);
baseMapper.insert(operate);
return operate;
}
}catch (Exception e){
log.error(JSON.toJSON(oldInfo)+"插入修改记录报错>>>",e);
}
return null;
}
/**
* 根据业务主键获取操作记录
*
* @param businessId
* @return {@link List <TBusinessOperate>}
* @author licancan
*/
@Override
public List<TBusinessOperate> getOperateListByBusinessId(String businessId) {
List<TBusinessOperate> list = this.baseMapper.selectList(Wrappers.<TBusinessOperate>query().lambda()
.eq(TBusinessOperate::getBusinessId,businessId));
return list;
}
private SerializerFeature[] features = new SerializerFeature[] {
WriteMapNullValue, WriteNullNumberAsZero, WriteNullListAsEmpty,
WriteNullStringAsEmpty,WriteDateUseDateFormat
};
}
......@@ -1744,6 +1744,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.eq(TInsuranceDetail::getPolicyStart, LocalDateUtil.parseLocalDate(success.getPolicyStart()))
.eq(TInsuranceDetail::getPolicyEnd, LocalDateUtil.parseLocalDate(success.getPolicyEnd()))
.eq(TInsuranceDetail::getBuyStandard, success.getBuyStandard())
//排除替换类型,解决保单保费挂靠问题
.ne(TInsuranceDetail::getBuyType,CommonConstants.FOUR_INT)
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceDetail::getUpdateTime)
.last(CommonConstants.LAST_ONE_SQL)
......@@ -3103,6 +3105,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.eq(TInsuranceDetail::getPolicyStart, LocalDateUtil.parseLocalDate(param.getPolicyStart()))
.eq(TInsuranceDetail::getPolicyEnd, LocalDateUtil.parseLocalDate(param.getPolicyEnd()))
.eq(TInsuranceDetail::getBuyStandard,param.getBuyStandard())
//排除替换类型,解决保单保费挂靠问题
.ne(TInsuranceDetail::getBuyType,CommonConstants.FOUR_INT)
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceDetail::getUpdateTime)
.last(CommonConstants.LAST_ONE_SQL)
......
package com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.impl;
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.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TBusinessOperate;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsurancePolicy;
import com.yifu.cloud.plus.v1.yifu.insurances.mapper.insurances.TInsurancePolicyMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TBusinessOperateService;
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsuranceDetailService;
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsurancePolicyService;
import com.yifu.cloud.plus.v1.yifu.insurances.util.BeanCopyUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsurancePolicyListEditParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsurancePolicyListParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.TInsurancePolicyDetailVO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
import java.util.Optional;
/**
* @author licancan
* @description 针对表【t_insurance_policy(保单号对应起止时间表)】的数据库操作Service实现
* @date 2022-12-07 16:40:16
*/
@Service
public class TInsurancePolicyServiceImpl extends ServiceImpl<TInsurancePolicyMapper, TInsurancePolicy> implements TInsurancePolicyService {
@Resource
private TBusinessOperateService tBusinessOperateService;
@Resource
private TInsuranceDetailService tInsuranceDetailService;
/**
* 保单号对应起止保时间分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return {@link IPage <TInsurancePolicy>}
* @author licancan
*/
@Override
public IPage<TInsurancePolicy> pageDiy(Page page, InsurancePolicyListParam param) {
IPage<TInsurancePolicy> list = this.baseMapper.getInsurancePolicyListPage(page, param);
return list;
}
/**
* 保单号对应起止保时间列表(不分页)
*
* @param param
* @return {@link List<TInsurancePolicy>}
* @author licancan
*/
@Override
public List<TInsurancePolicy> getInsurancePolicyList(InsurancePolicyListParam param) {
List<TInsurancePolicy> list = this.baseMapper.getInsurancePolicyList(param);
return list;
}
/**
* 通过id查询详情
*
* @param id
* @return {@link R<TInsurancePolicyDetailVO>}
* @author licancan
*/
@Override
public R<TInsurancePolicyDetailVO> getDetailById(String id) {
if(Common.isEmpty(id)){
return R.failed("id不能为空");
}
TInsurancePolicy byId = getById(id);
if (!Optional.ofNullable(byId).isPresent()){
return R.failed("数据不存在");
}
TInsurancePolicyDetailVO vo = new TInsurancePolicyDetailVO();
BeanCopyUtils.copyProperties(byId,vo);
List<TBusinessOperate> list = tBusinessOperateService.getOperateListByBusinessId(id);
if (CollectionUtils.isNotEmpty(list)){
vo.setOperateList(list);
}
return R.ok(vo);
}
/**
* 新增,内部调用的,保证调用方把该传的字段都传了(保单号、起止保时间、保险公司、险种)
*
* @param policy
* @return {@link R}
* @author licancan
*/
@Override
public R saveTInsurancePolicy(TInsurancePolicy policy) {
if (StringUtils.isNotEmpty(policy.getPolicyNo())){
TInsurancePolicy one = this.getOne(Wrappers.<TInsurancePolicy>query().lambda()
.eq(TInsurancePolicy::getPolicyNo, policy.getPolicyNo())
.eq(TInsurancePolicy::getDeleteFlag,CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL));
if (!Optional.ofNullable(one).isPresent()){
this.save(policy);
}
}
return R.ok();
}
/**
* 修改保单号对应起止保时间
*
* @param param
* @return {@link R}
* @author licancan
*/
@Override
@Transactional(value = "insurancesTransactionManager" ,rollbackFor = {Exception.class})
public R updateInsurancePolicy(InsurancePolicyListEditParam param) {
TInsurancePolicy tInsurancePolicy = this.baseMapper.selectById(param.getId());
if (!Optional.ofNullable(tInsurancePolicy).isPresent()){
return R.failed("数据不存在");
}
//操作日志
tBusinessOperateService.saveModificationRecord(param.getId(),tInsurancePolicy,param,null);
BeanCopyUtils.copyProperties(param,tInsurancePolicy);
updateById(tInsurancePolicy);
return R.ok();
}
/**
* 删除保单号对应起止保时间
*
* @param id 主键
* @return {@link R}
* @author licancan
*/
@Override
public R deleteInsurancePolicy(String id) {
if(Common.isEmpty(id)){
return R.failed("id不能为空");
}
TInsurancePolicy byId = getById(id);
if (!Optional.ofNullable(byId).isPresent()){
return R.failed("数据不存在");
}
//检验保单号是否被使用,被使用不能删除
TInsuranceDetail one = tInsuranceDetailService.getOne(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getPolicyNo, byId.getPolicyNo())
.eq(TInsuranceDetail::getDeleteFlag,CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL));
if (Optional.ofNullable(one).isPresent()){
return R.failed("存在正常关联的承保信息,禁止删除!");
}
LambdaUpdateWrapper<TInsurancePolicy> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TInsurancePolicy::getId,id)
.set(TInsurancePolicy::getDeleteFlag, CommonConstants.ONE_INT);
update(updateWrapper);
return R.ok();
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.yifu.insurances.mapper.insurances.TBusinessOperateMapper">
<resultMap id="BaseResultMap" type="com.yifu.cloud.plus.v1.yifu.insurances.entity.TBusinessOperate">
<id property="id" column="ID" jdbcType="VARCHAR"/>
<result property="businessId" column="BUSINESS_ID" jdbcType="VARCHAR"/>
<result property="oldInfo" column="OLD_INFO" jdbcType="VARCHAR"/>
<result property="newInfo" column="NEW_INFO" jdbcType="VARCHAR"/>
<result property="differenceInfo" column="DIFFERENCE_INFO" jdbcType="VARCHAR"/>
<result property="remark" column="REMARK" jdbcType="VARCHAR"/>
<result property="createBy" column="CREATE_BY" jdbcType="VARCHAR"/>
<result property="createName" column="CREATE_NAME" jdbcType="VARCHAR"/>
<result property="createTime" column="CREATE_TIME" jdbcType="TIMESTAMP"/>
<result property="updateBy" column="UPDATE_BY" jdbcType="VARCHAR"/>
<result property="updateTime" column="UPDATE_TIME" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
ID,BUSINESS_ID,OPERATE_DESC,
REMARK,CREATE_BY,CREATE_NAME,
CREATE_TIME,UPDATE_BY,
UPDATE_TIME
</sql>
</mapper>
......@@ -854,7 +854,7 @@
a.BUY_STANDARD as buyStandard,
a.MEDICAL_QUOTA as medicalQuota,
a.DIE_DISABLE_QUOTA as dieDisableQuota,
a.CREATE_TIME as createTime,
refund.CREATE_TIME as createTime,
refund.CREATE_NAME as createName,
a.REDUCE_HANDLE_STATUS as reduceHandleStatus
from
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.yifu.insurances.mapper.insurances.TInsurancePolicyMapper">
<resultMap id="BaseResultMap" type="com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsurancePolicy">
<id property="id" column="ID" jdbcType="VARCHAR"/>
<result property="policyNo" column="POLICY_NO" jdbcType="VARCHAR"/>
<result property="policyStart" column="POLICY_START" jdbcType="DATE"/>
<result property="policyEnd" column="POLICY_END" jdbcType="DATE"/>
<result property="insuranceCompanyName" column="INSURANCE_COMPANY_NAME" jdbcType="VARCHAR"/>
<result property="insuranceTypeName" column="INSURANCE_TYPE_NAME" jdbcType="VARCHAR"/>
<result property="enableFlag" column="ENABLE_FLAG" jdbcType="TINYINT"/>
<result property="deleteFlag" column="DELETE_FLAG" jdbcType="TINYINT"/>
<result property="createBy" column="CREATE_BY" jdbcType="VARCHAR"/>
<result property="createName" column="CREATE_NAME" jdbcType="VARCHAR"/>
<result property="createTime" column="CREATE_TIME" jdbcType="TIMESTAMP"/>
<result property="updateBy" column="UPDATE_BY" jdbcType="VARCHAR"/>
<result property="updateTime" column="UPDATE_TIME" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
ID,POLICY_NO,POLICY_START,
POLICY_END,INSURANCE_COMPANY_NAME,INSURANCE_TYPE_NAME,
ENABLE_FLAG,DELETE_FLAG,CREATE_BY,
CREATE_NAME,CREATE_TIME,UPDATE_BY,
UPDATE_TIME
</sql>
<select id="getInsurancePolicyListPage" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"></include>
FROM t_insurance_policy
where DELETE_FLAG = 0
<if test="param.policyNo != null and param.policyNo.trim() != ''">
and POLICY_NO like concat('%',replace(replace(#{param.policyNo},'_','\_'),'%','\%'),'%')
</if>
<if test="param.policyStart != null and param.policyStart.trim() != '' and param.policyEnd == null and param.policyEnd.trim() == ''">
AND POLICY_END <![CDATA[ >= ]]> #{param.policyStart}
</if>
<if test="param.policyEnd != null and param.policyEnd.trim() != '' and param.policyStart == null and param.policyStart.trim() == ''">
AND POLICY_START <![CDATA[ <= ]]> #{param.policyEnd}
</if>
<if test="param.insuranceCompanyName != null and param.insuranceCompanyName.trim() != ''">
and INSURANCE_COMPANY_NAME like concat('%',replace(replace(#{param.insuranceCompanyName},'_','\_'),'%','\%'),'%')
</if>
<if test="param.insuranceTypeName != null and param.insuranceTypeName.trim() != ''">
and INSURANCE_TYPE_NAME like concat('%',replace(replace(#{param.insuranceTypeName},'_','\_'),'%','\%'),'%')
</if>
<if test="param.enableFlag != null">
and ENABLE_FLAG = #{enableFlag}
</if>
ORDER BY CREATE_TIME DESC
</select>
<select id="getInsurancePolicyList" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"></include>
FROM t_insurance_policy
where DELETE_FLAG = 0
<if test="param.policyNo != null and param.policyNo.trim() != ''">
and POLICY_NO like concat('%',replace(replace(#{param.policyNo},'_','\_'),'%','\%'),'%')
</if>
<if test="param.policyStart != null and param.policyStart.trim() != '' and param.policyEnd == null and param.policyEnd.trim() == ''">
AND POLICY_END <![CDATA[ >= ]]> #{param.policyStart}
</if>
<if test="param.policyEnd != null and param.policyEnd.trim() != '' and param.policyStart == null and param.policyStart.trim() == ''">
AND POLICY_START <![CDATA[ <= ]]> #{param.policyEnd}
</if>
<if test="param.insuranceCompanyName != null and param.insuranceCompanyName.trim() != ''">
and INSURANCE_COMPANY_NAME like concat('%',replace(replace(#{param.insuranceCompanyName},'_','\_'),'%','\%'),'%')
</if>
<if test="param.insuranceTypeName != null and param.insuranceTypeName.trim() != ''">
and INSURANCE_TYPE_NAME like concat('%',replace(replace(#{param.insuranceTypeName},'_','\_'),'%','\%'),'%')
</if>
<if test="param.enableFlag != null">
and ENABLE_FLAG = #{enableFlag}
</if>
ORDER BY CREATE_TIME DESC
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment