|
@@ -1,290 +0,0 @@
|
|
|
-package com.ydtech.modules.inv.controller;
|
|
|
|
|
-
|
|
|
|
|
-import cn.dev33.satoken.stp.StpUtil;
|
|
|
|
|
-import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
-import cn.hutool.core.bean.copier.CopyOptions;
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
-import com.ydtech.constants.enums.dict.finance.CheckingStatusEnum;
|
|
|
|
|
-import com.ydtech.core.page.HttpResult;
|
|
|
|
|
-import com.ydtech.core.page.PageResult;
|
|
|
|
|
-import com.ydtech.modules.admin.model.SysUser;
|
|
|
|
|
-import com.ydtech.modules.base.controller.BaseController;
|
|
|
|
|
-import com.ydtech.modules.base.model.dto.PageDto;
|
|
|
|
|
-import com.ydtech.modules.base.model.vo.PageVo;
|
|
|
|
|
-import com.ydtech.modules.inv.model.InvChannelsExternalBillsDetails;
|
|
|
|
|
-import com.ydtech.modules.inv.model.InvChannelsExternalBillsDetailsHistory;
|
|
|
|
|
-import com.ydtech.modules.inv.model.InvInsExternalBillsDetails;
|
|
|
|
|
-import com.ydtech.modules.inv.model.dto.InvInsCompanyDto;
|
|
|
|
|
-import com.ydtech.modules.inv.service.InvChannelsExternalBillsDetailsHistoryService;
|
|
|
|
|
-import com.ydtech.modules.inv.service.InvChannelsExternalBillsDetailsService;
|
|
|
|
|
-import com.ydtech.modules.inv.service.InvInsExternalBillsDetailsService;
|
|
|
|
|
-import com.ydtech.utils.StringUtils;
|
|
|
|
|
-import io.swagger.annotations.Api;
|
|
|
|
|
-import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
|
-import io.swagger.annotations.ApiImplicitParams;
|
|
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
|
|
-import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
-
|
|
|
|
|
-import javax.annotation.Resource;
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
|
-import java.util.Date;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-import java.util.function.Function;
|
|
|
|
|
-
|
|
|
|
|
-/**
|
|
|
|
|
- * 财务 - 渠道 - 外部票据控制层 详情
|
|
|
|
|
- *
|
|
|
|
|
- * @author: lig
|
|
|
|
|
- * @date: 2023-05-31
|
|
|
|
|
- */
|
|
|
|
|
-@Api(tags = "财务 - 渠道 - 外部票据 详情 控制层")
|
|
|
|
|
-@RestController
|
|
|
|
|
-@RequestMapping("api/inv/channelsExternalBillsDetails")
|
|
|
|
|
-@Slf4j
|
|
|
|
|
-public class InvChannelsExternalBillsDetailsController extends BaseController {
|
|
|
|
|
-
|
|
|
|
|
- //渠道
|
|
|
|
|
- @Resource
|
|
|
|
|
- private InvChannelsExternalBillsDetailsService icebdService;
|
|
|
|
|
-
|
|
|
|
|
- //渠道 历史
|
|
|
|
|
- @Resource
|
|
|
|
|
- private InvChannelsExternalBillsDetailsHistoryService icebdhService;
|
|
|
|
|
-
|
|
|
|
|
- //保险公司
|
|
|
|
|
- @Resource
|
|
|
|
|
- private InvInsExternalBillsDetailsService InvInsExternalBillsDetailsService;
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 分页查询
|
|
|
|
|
- *
|
|
|
|
|
- * @param pageDto
|
|
|
|
|
- * @return
|
|
|
|
|
- */
|
|
|
|
|
- @ApiOperation(value = "分页查询")
|
|
|
|
|
- @PostMapping(value = "/queryPage")
|
|
|
|
|
- public HttpResult<PageResult<InvChannelsExternalBillsDetails>> queryPage(@RequestBody PageDto<InvInsCompanyDto> pageDto) {
|
|
|
|
|
-// public HttpResult<PageResult<InvChannelsExternalBillsDetails>> queryPage(@RequestBody InvInsExternalBillsDetailsReqVO reqVo) {
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- LambdaQueryWrapper<InvChannelsExternalBillsDetails> lqw = new LambdaQueryWrapper();
|
|
|
|
|
- if(null != pageDto.getDto()){
|
|
|
|
|
- lqw.in(null != pageDto.getDto().getInsCompanyIds() && pageDto.getDto().getInsCompanyIds().size() > 0, InvChannelsExternalBillsDetails::getInsCompanyId, pageDto.getDto().getInsCompanyIds());
|
|
|
|
|
- lqw.eq(null != pageDto.getDto().getPayDate(),InvChannelsExternalBillsDetails::getPayDate,pageDto.getDto().getPayDate());
|
|
|
|
|
- lqw.eq(StringUtils.isNotEmpty(pageDto.getDto().getPlateNum()), InvChannelsExternalBillsDetails::getPlateNum, pageDto.getDto().getPlateNum());
|
|
|
|
|
- lqw.eq(StringUtils.isNotEmpty(pageDto.getDto().getOutChannel()), InvChannelsExternalBillsDetails::getOutChannel, pageDto.getDto().getOutChannel());
|
|
|
|
|
- lqw.eq(StringUtils.isNotEmpty(pageDto.getDto().getChannel()), InvChannelsExternalBillsDetails::getChannel, pageDto.getDto().getChannel());
|
|
|
|
|
- lqw.eq(StringUtils.isNotEmpty(pageDto.getDto().getStatus()), InvChannelsExternalBillsDetails::getStatus, pageDto.getDto().getStatus());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- Page p = PageVo.buildPageRequest(pageDto);
|
|
|
|
|
- IPage<InvChannelsExternalBillsDetails> pResult = icebdService.page(p, lqw);
|
|
|
|
|
- //传入查询条件
|
|
|
|
|
- PageResult pageResult = PageResult.buildPageResult(pResult);
|
|
|
|
|
- return HttpResult.ok(pageResult);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- @GetMapping("/detailsById")
|
|
|
|
|
- @ApiOperation(value = "详情")
|
|
|
|
|
- public HttpResult detailsById(String id) {
|
|
|
|
|
- return HttpResult.ok(icebdService.getById(id));
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- @ApiOperation(value = "修改")
|
|
|
|
|
- @PostMapping(value = "/edit")
|
|
|
|
|
- @Transactional
|
|
|
|
|
- public HttpResult edit(@RequestBody InvChannelsExternalBillsDetails icebd) {
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- List<InvChannelsExternalBillsDetailsHistory> list = icebdhService.gainListByEditId(icebd.getId());
|
|
|
|
|
-
|
|
|
|
|
- List<InvChannelsExternalBillsDetailsHistory> icebdhList = new ArrayList<>();
|
|
|
|
|
- InvChannelsExternalBillsDetails icebdOld = icebdService.getById(icebd.getId());
|
|
|
|
|
- if (null == list || list.size() < 1) {
|
|
|
|
|
- //初始历史数据
|
|
|
|
|
- InvChannelsExternalBillsDetailsHistory icebdh = new InvChannelsExternalBillsDetailsHistory();
|
|
|
|
|
-// BeanUtils.copyProperties(icebdOld, icebdh,"id");
|
|
|
|
|
- BeanUtil.copyProperties(icebdOld, icebdh, CopyOptions.create(null, true, "id"));
|
|
|
|
|
- icebdh.setEditId(icebd.getId());
|
|
|
|
|
- icebdhList.add(icebdh);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- InvChannelsExternalBillsDetailsHistory icebdh = new InvChannelsExternalBillsDetailsHistory();
|
|
|
|
|
-
|
|
|
|
|
- //构造更新数据
|
|
|
|
|
- BeanUtil.copyProperties(icebd, icebdOld, CopyOptions.create(null, true));
|
|
|
|
|
-
|
|
|
|
|
- //构造历史数据
|
|
|
|
|
- BeanUtil.copyProperties(icebdOld, icebdh, CopyOptions.create(null, true, "id"));
|
|
|
|
|
-
|
|
|
|
|
-// //构造更新数据
|
|
|
|
|
-// BeanUtils.copyProperties(icebdOld , icebd);
|
|
|
|
|
-// //构造历史数据
|
|
|
|
|
-// BeanUtils.copyProperties(icebd, icebdh,"id");
|
|
|
|
|
- icebdh.setEditId(icebdOld.getId());
|
|
|
|
|
- icebdh.setEditTime(new Date());
|
|
|
|
|
- icebdh.setEditBy(StpUtil.getLoginId().toString());
|
|
|
|
|
- icebdhList.add(icebdh);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-// icebdhService.saveBatch(icebdhList);
|
|
|
|
|
-
|
|
|
|
|
- icebdService.updateById(icebdOld);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- return HttpResult.ok(icebdhService.saveBatch(icebdhList));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- @PostMapping(value = "/batchReceive")
|
|
|
|
|
- @ApiOperation(value = "批量领取")
|
|
|
|
|
- @ApiImplicitParams({
|
|
|
|
|
- @ApiImplicitParam(name = "ids", value = "渠道ID数组", dataType = "String", paramType = "body", allowMultiple = true, required = true)
|
|
|
|
|
- })
|
|
|
|
|
- public HttpResult batchReceive(@RequestBody List<String> ids) {
|
|
|
|
|
- LambdaQueryWrapper<InvChannelsExternalBillsDetails> lqw = new LambdaQueryWrapper<>();
|
|
|
|
|
- lqw.select(InvChannelsExternalBillsDetails::getPlateNum);
|
|
|
|
|
- lqw.in(InvChannelsExternalBillsDetails::getId,ids);
|
|
|
|
|
- //车牌号
|
|
|
|
|
- List<String> plateNums = icebdService.listObjs(lqw, new Function<Object, String>() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public String apply(Object id) {
|
|
|
|
|
- return id.toString();
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- //保险公司 更新状态
|
|
|
|
|
- LambdaUpdateWrapper<InvInsExternalBillsDetails> insLuw = new LambdaUpdateWrapper<>();
|
|
|
|
|
- insLuw.set(InvInsExternalBillsDetails::getStatus,CheckingStatusEnum.AS1.getCode());
|
|
|
|
|
- insLuw.in(InvInsExternalBillsDetails::getPlateNum,plateNums);
|
|
|
|
|
- insLuw.eq(InvInsExternalBillsDetails::getStatus,CheckingStatusEnum.AS0.getCode());
|
|
|
|
|
- InvInsExternalBillsDetailsService.update(insLuw);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- //渠道 更新批次号状态
|
|
|
|
|
- LambdaUpdateWrapper<InvChannelsExternalBillsDetails> luw = new LambdaUpdateWrapper<>();
|
|
|
|
|
- luw.set(InvChannelsExternalBillsDetails::getStatus, CheckingStatusEnum.AS1.getCode());
|
|
|
|
|
- luw.in(InvChannelsExternalBillsDetails::getId,ids);
|
|
|
|
|
- icebdService.update(luw);
|
|
|
|
|
-
|
|
|
|
|
- return HttpResult.ok("领取成功");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-// @GetMapping(value = "/receive/{batchNum}")
|
|
|
|
|
-// @ApiOperation(value = "确认领取")
|
|
|
|
|
-// @ApiImplicitParams({
|
|
|
|
|
-// @ApiImplicitParam(name = "batchNum", value = "批次号", required = true, dataType = "String")
|
|
|
|
|
-// })
|
|
|
|
|
-// @Transactional
|
|
|
|
|
-// public HttpResult receive(@PathVariable String batchNum) {
|
|
|
|
|
-//
|
|
|
|
|
-// LambdaQueryWrapper<InvChannelsExternalBillsDetails> lqw = new LambdaQueryWrapper<>();
|
|
|
|
|
-// lqw.select(InvChannelsExternalBillsDetails::getPlateNum);
|
|
|
|
|
-// lqw.eq(InvChannelsExternalBillsDetails::getBatchNum,batchNum);
|
|
|
|
|
-//// List<InvChannelsExternalBillsDetails> iebdList = icebdService.list(lqw);
|
|
|
|
|
-// //车牌号
|
|
|
|
|
-// List<String> plateNums = icebdService.listObjs(lqw, new Function<Object, String>() {
|
|
|
|
|
-// @Override
|
|
|
|
|
-// public String apply(Object id) {
|
|
|
|
|
-// return id.toString();
|
|
|
|
|
-// }
|
|
|
|
|
-// });
|
|
|
|
|
-//
|
|
|
|
|
-// //保险公司 更新状态
|
|
|
|
|
-// LambdaUpdateWrapper<InvInsExternalBillsDetails> insLuw = new LambdaUpdateWrapper<>();
|
|
|
|
|
-// insLuw.set(InvInsExternalBillsDetails::getStatus,"1");
|
|
|
|
|
-// insLuw.in(InvInsExternalBillsDetails::getPlateNum,plateNums);
|
|
|
|
|
-// InvInsExternalBillsDetailsService.update(insLuw);
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-// //渠道 更新批次号状态
|
|
|
|
|
-// LambdaUpdateWrapper<InvChannelsExternalBillsDetails> luw = new LambdaUpdateWrapper<>();
|
|
|
|
|
-// luw.set(InvChannelsExternalBillsDetails::getStatus,"1");
|
|
|
|
|
-// luw.eq(InvChannelsExternalBillsDetails::getBatchNum,batchNum);
|
|
|
|
|
-// icebdService.update(luw);
|
|
|
|
|
-//
|
|
|
|
|
-// return HttpResult.ok("领取成功");
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- @PostMapping(value = "/batchPay")
|
|
|
|
|
- @ApiOperation(value = "批量支付")
|
|
|
|
|
- @ApiImplicitParams({
|
|
|
|
|
- @ApiImplicitParam(name = "ids", value = "渠道数据ID数组", dataType = "String", paramType = "body", allowMultiple = true, required = true)
|
|
|
|
|
- })
|
|
|
|
|
- public HttpResult pay(@RequestBody List<String> ids) {
|
|
|
|
|
- SysUser user = getUser();
|
|
|
|
|
- icebdService.pay(ids,user);
|
|
|
|
|
-
|
|
|
|
|
- return HttpResult.ok("支付成功");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- @PostMapping(value = "/pay/{id}")
|
|
|
|
|
- @ApiOperation(value = "支付")
|
|
|
|
|
- @ApiImplicitParams({
|
|
|
|
|
- @ApiImplicitParam(name = "id", value = "渠道数据ID", dataType = "String", paramType = "path", required = true)
|
|
|
|
|
- })
|
|
|
|
|
- public HttpResult pay(@PathVariable String id) {
|
|
|
|
|
- SysUser user = getUser();
|
|
|
|
|
- List<String> ids = new ArrayList<>();
|
|
|
|
|
- ids.add(id);
|
|
|
|
|
-
|
|
|
|
|
- icebdService.pay(ids,user);
|
|
|
|
|
-
|
|
|
|
|
- return HttpResult.ok("支付成功");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- @PostMapping("/importData")
|
|
|
|
|
- @ApiOperation(value = "渠道数据导入(excel)")
|
|
|
|
|
- @ApiImplicitParams({
|
|
|
|
|
- @ApiImplicitParam(name = "file", value = "excel文件", required = true, dataType = "__file")
|
|
|
|
|
- })
|
|
|
|
|
- public HttpResult importData(@RequestPart MultipartFile file) {
|
|
|
|
|
-
|
|
|
|
|
- icebdService.importData(file);
|
|
|
|
|
-
|
|
|
|
|
- return HttpResult.ok("导入成功");
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @PostMapping(value = "/findEditHistory")
|
|
|
|
|
- @ApiOperation(value = "获取渠道修改历史")
|
|
|
|
|
- public HttpResult<PageResult<InvChannelsExternalBillsDetailsHistory>> findEditHistory(@RequestBody PageDto<InvInsCompanyDto> pageDto) {
|
|
|
|
|
-
|
|
|
|
|
- LambdaQueryWrapper<InvChannelsExternalBillsDetailsHistory> lqw = new LambdaQueryWrapper<>();
|
|
|
|
|
- if(null != pageDto.getDto()){
|
|
|
|
|
- lqw.eq(StringUtils.isNotEmpty(pageDto.getDto().getPlateNum()),InvChannelsExternalBillsDetailsHistory::getPlateNum,pageDto.getDto().getPlateNum());
|
|
|
|
|
- }
|
|
|
|
|
- lqw.orderByAsc(InvChannelsExternalBillsDetailsHistory::getPlateNum,InvChannelsExternalBillsDetailsHistory::getEditTime);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- Page p = PageVo.buildPageRequest(pageDto);
|
|
|
|
|
- IPage<InvChannelsExternalBillsDetailsHistory> pResult = icebdhService.page(p,lqw);
|
|
|
|
|
- //传入查询条件
|
|
|
|
|
- PageResult pageResult = PageResult.buildPageResult(pResult);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- return HttpResult.ok(pageResult);
|
|
|
|
|
-// return HttpResult.ok(sysUserService.gainUserPage(pageDto));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|