目录
需求文档
公积金销户类
controller层
service层
service层实现类
1.验证 (个人账户)
2.提交(添加)
controller层
service层
service层实现类
3.分页查询
controller层
service层
service层实现类
4. 详情查询
controller层
service层
service层实现类
需求文档
公积金销户流水表提交(添加)、分页、查看(详情查询)、验证(个人账户)
在离职、退休、提前退休的情况下,会将公积金账户注销并取出里面资金
公积金销户类
controller层
@Tag(name = "管理后台-销户-公积金销户")
@RestController
@RequestMapping("/business/tq-gjjxh")
@Validated
public class TqGjjxhlsbController {@Resourceprivate TqGjjxhlsbService tqGjjxhlsbService;...(类中功能方法)}
service层
/*** 个人网上营业厅-公积金销户流水 Service 接口** @author 芋道源码*/
public interface TqGjjxhlsbService {...
}
service层实现类
/*** 个人网上营业厅-公积金销户流水 Service 实现类** @author 芋道源码*/
@Service
@Validated
public class TqGjjxhlsbServiceImpl implements TqGjjxhlsbService {@Resourceprivate TqGjjxhlsbMapper tqGjjxhlsbMapper;...
}
1.验证 (个人账户)
/*** 根据vo中的定义验证参数合法后,验证请求数据合法性* @param createReqVO (暂存、直接保存)请求参数* @return SaveGeneralReturn*/private CommonResult<SaveGeneralReturn> validateData(TqGjjxhlsbCreateReqVO createReqVO){SaveGeneralReturn saveGeneralReturn=new SaveGeneralReturn();List<ErrorCode> errorCodeList=new ArrayList<>();//传入参数不合法/*******判断网厅是否存在未审批记录*************/LambdaQueryWrapper<TqGjjxhlsbDO> queryWrapper = new LambdaQueryWrapper();queryWrapper.eq(TqGjjxhlsbDO::getGrzh,createReqVO.getGrzh());queryWrapper.ne(TqGjjxhlsbDO::getYwzt,"100");List<TqGjjxhlsbDO> tqGjjxhlsbDOList = tqGjjxhlsbService.getSelectList(queryWrapper);if (tqGjjxhlsbDOList != null && tqGjjxhlsbDOList.size() > 0) {errorCodeList.add(GJJXHLSB_WSP);}saveGeneralReturn.setValidate(errorCodeList.size() == 0);saveGeneralReturn.setErrorCount(errorCodeList.size());saveGeneralReturn.setErrorCodes(errorCodeList);//特殊判断return success(saveGeneralReturn);}
通过查询数据库表TqGjjxhlsbDO来判断,具体查询条件是根据createReqVO中的"grzh"属性等于表中的"grzh"并且"ywzt"属性不等于"100"。如果查询结果不为空且数量大于0,将给予错误码GJJXHLSB_WSP(公积金提取流水表未审批)提示。个人账户具有唯一性,相同的个人账户,不予添加。
2.提交(添加)
controller层
/***提交 保存数据 注意业务状态* */@PostMapping("/create")@Operation(summary = "公积金销户_保存")public CommonResult<SaveGeneralReturn> createTqGjjxhlsb(@Valid @RequestBody TqGjjxhlsbCreateReqVO createReqVO){CommonResult<SaveGeneralReturn> validatedReturn=validateData(createReqVO);SaveGeneralReturn validated=validatedReturn.getData();if(validated.getValidate()){createReqVO.setYwzt("0");BigDecimal id = tqGjjxhlsbService.createTqGjjxhlsb(createReqVO);validated.setId(id);validated.setSuccessMsg("暂存成功");return success(validated);}return error(validatedReturn);}
通过判断
validated
对象的validate
属性是否为true来确定是否通过了数据验证。如果通过验证,即为库中不存在相同账户的额数据,将createReqVO
的ywzt
属性设置为"0",调用
tqGjjxhlsbService.createTqGjjxhlsb(createReqVO)
方法保存数据,并将返回的id赋值给validated
对象的id
属性。随后,设置validated
对象的successMsg
属性为"暂存成功",并返回success(validated)
。
service层
/*** 创建个人网上营业厅-公积金销户流水** @param createReqVO 创建信息* @return 编号*/BigDecimal createTqGjjxhlsb(@Valid TqGjjxhlsbCreateReqVO createReqVO);
service层实现类
@Overridepublic BigDecimal createTqGjjxhlsb(TqGjjxhlsbCreateReqVO createReqVO) {// 插入TqGjjxhlsbDO tqGjjxhlsb = TqGjjxhlsbConvert.INSTANCE.convert(createReqVO);tqGjjxhlsbMapper.insert(tqGjjxhlsb);// 返回return tqGjjxhlsb.getId();}
3.分页查询
controller层
/*** @param pageVO 请求参数(包括分页参数)* @return PageResult<TqGjjxhlsbRespVO>*/@GetMapping("/page")@Operation(summary = "公积金销户_分页查询")public CommonResult<PageResult<TqGjjxhlsbRespVO>> getTqGjjxhlsbPage(@Valid TqGjjxhlsbPageReqVO pageVO){PageResult<TqGjjxhlsbDO> pageResult = tqGjjxhlsbService.getTqGjjxhlsbPage(pageVO);return success(TqGjjxhlsbConvert.INSTANCE.convertPage(pageResult));}
service层
/*** 获得个人网上营业厅-公积金销户流水分页** @param pageReqVO 分页查询* @return 个人网上营业厅-公积金销户流水分页*/PageResult<TqGjjxhlsbDO> getTqGjjxhlsbPage(TqGjjxhlsbPageReqVO pageReqVO);
service层实现类
@Overridepublic PageResult<TqGjjxhlsbDO> getTqGjjxhlsbPage(TqGjjxhlsbPageReqVO pageReqVO) {return tqGjjxhlsbMapper.selectPage(pageReqVO);}
4. 详情查询
controller层
/*** 详情* @param id 查询参数* @result TqGjjxhlsbRespVO*/@GetMapping("/get")@Operation(summary = "公积金销户_查看详情")@Parameter(name = "id", description = "编号", required = true, example = "1024")public CommonResult<TqGjjxhlsbRespVO> getTqGjjxhlsb(@RequestParam("id") BigDecimal id){TqGjjxhlsbDO tqGjjxhlsb = tqGjjxhlsbService.getTqGjjxhlsb(id);return success(TqGjjxhlsbConvert.INSTANCE.convert(tqGjjxhlsb));}
service层
/*** 获得个人网上营业厅-公积金销户流水** @param id 编号* @return 个人网上营业厅-公积金销户流水*/TqGjjxhlsbDO getTqGjjxhlsb(BigDecimal id);
service层实现类
@Overridepublic TqGjjxhlsbDO getTqGjjxhlsb(BigDecimal id) {return tqGjjxhlsbMapper.selectById(id);}