bms2发票相关;

This commit is contained in:
王奎兴
2026-02-26 15:59:39 +08:00
parent 442f95cbc6
commit 7fb245b8c2
28 changed files with 3518 additions and 1 deletions
@@ -0,0 +1,200 @@
package com.mhd.bms.interfaces.facadeApi;
import com.aliyun.oss.ServiceException;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mhd.bms.domain.bmsInvoiceInfo.entity.BmsInvoiceInfo;
import com.mhd.bms.domain.bmsInvoiceInfo.repository.facade.IBmsInvoiceInfoService;
import com.mhd.bms.domain.bmsInvoiceInfo.repository.todo.BmsInvoiceInfoAddDTO;
import com.mhd.bms.domain.bmsInvoiceInfo.repository.todo.BmsInvoiceInfoDTO;
import com.mhd.bms.domain.bmsInvoiceInfo.repository.vo.BmsInvoiceInfoVO;
import com.mhd.bms.domain.bmsInvoiceInfo.repository.vo.QueryInvoiceInfoVO;
import com.mhd.common.core.utils.sms.CommonConstant;
import com.mhd.common.core.utils.sms.Result;
import com.mhd.common.core.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.List;
/**
* @Description: 发票信息表
* @Author: Alex
* @Date: 2020-02-19 08:50:59
* @Version: V1.0
*/
@Api(tags = "发票信息表")
@RestController
@RequestMapping("/bmsInvoiceInfoApi")
@Slf4j
public class BmsInvoiceInfoApi extends BaseController {
@Autowired
private IBmsInvoiceInfoService bmsInvoiceInfoService;
/**
* 分页列表查询
*
* @param bmsInvoiceInfoDTO
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@ApiOperation(value = "发票信息表-分页列表查询", notes = "发票信息表-分页列表查询")
@GetMapping(value = "/queryList")
public Result<IPage<BmsInvoiceInfoVO>> queryList(BmsInvoiceInfoDTO bmsInvoiceInfoDTO,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<BmsInvoiceInfoVO>> result = new Result<IPage<BmsInvoiceInfoVO>>();
Page<BmsInvoiceInfoVO> pageList = new Page<BmsInvoiceInfoVO>(pageNo, pageSize);
pageList = bmsInvoiceInfoService.queryList(pageList, bmsInvoiceInfoDTO);
result.setResult(pageList);
result.setSuccess(true);
result.setCode(CommonConstant.SC_OK_200);
return result;
}
/**
* 发票信息管理查询
*
* @return
*/
@ApiOperation(value = "发票信息表-发票信息管理查询", notes = "发票信息表-发票信息管理查询")
@GetMapping(value = "/queryInvoiceInfo")
public Result<QueryInvoiceInfoVO> queryInvoiceInfo(
@RequestParam(name = "shipperId", required = false) String shipperId) {
Result<QueryInvoiceInfoVO> result = new Result<QueryInvoiceInfoVO>();
QueryInvoiceInfoVO queryInvoiceInfoVO = bmsInvoiceInfoService.queryInvoiceInfo(shipperId);
if (queryInvoiceInfoVO == null) {
queryInvoiceInfoVO = new QueryInvoiceInfoVO();
}
result.setResult(queryInvoiceInfoVO);
return result;
}
/**
* 添加
*
* @param bmsInvoiceInfoAddDTO
* @return
*/
@ApiOperation(value = "发票信息表-新增", notes = "发票信息表-新增")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody BmsInvoiceInfoAddDTO bmsInvoiceInfoAddDTO) {
Result<?> result = new Result<BmsInvoiceInfo>();
try {
bmsInvoiceInfoService.save(bmsInvoiceInfoAddDTO);
result.success("发票信息保存成功!");
} catch (ServiceException e) {
log.error(e.getErrorMessage(), e);
result.error500(e.getErrorMessage());
} catch (Exception e) {
log.error(e.getMessage(), e);
result.error500("操作失败");
}
return result;
}
/**
* 编辑
*
* @param bmsInvoiceInfoDTO
* @return
*/
@ApiOperation(value = "发票信息表-编辑", notes = "发票信息表-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody BmsInvoiceInfoDTO bmsInvoiceInfoDTO) {
Result<?> result = new Result<BmsInvoiceInfo>();
try {
bmsInvoiceInfoService.update(bmsInvoiceInfoDTO);
result.success("发票信息保存成功!");
} catch (ServiceException e) {
log.error(e.getErrorMessage(), e);
result.error500(e.getErrorMessage());
} catch (Exception e) {
log.error(e.getMessage(), e);
result.error500("操作失败" + e.getMessage());
}
return result;
}
/**
* 通过id删除
*
* @param id
* @return
*/
@ApiOperation(value = "发票信息表-删除", notes = "发票信息表-删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
Result<?> result = new Result<BmsInvoiceInfo>();
try {
bmsInvoiceInfoService.delete(Arrays.asList(id.split(",")));
result.success("删除成功!");
} catch (ServiceException e) {
log.error(e.getMessage(), e);
result.error500("操作失败" + e.getMessage());
} catch (Exception e) {
log.error(e.getMessage(), e);
result.error500("操作失败" + e.getMessage());
}
return result;
}
/**
* 批量删除
*
* @param ids
* @return
*/
@ApiOperation(value = "发票信息表-批量删除", notes = "发票信息表-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
Result<?> result = new Result<BmsInvoiceInfo>();
try {
this.bmsInvoiceInfoService.delete(Arrays.asList(ids.split(",")));
result.success("删除成功!");
} catch (ServiceException e) {
log.error(e.getMessage(), e);
result.error500("操作失败" + e.getMessage());
} catch (Exception e) {
log.error(e.getMessage(), e);
result.error500("操作失败" + e.getMessage());
}
return result;
}
/**
* 通过id查询
*
* @param id
* @return
*/
@ApiOperation(value = "发票信息表-通过id查询", notes = "发票信息表-通过id查询")
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
BmsInvoiceInfo bmsInvoiceInfo = bmsInvoiceInfoService.getById(id);
if (bmsInvoiceInfo == null) {
return Result.error("未找到对应数据");
}
return Result.ok(bmsInvoiceInfo);
}
@ApiOperation(value = "发票信息表-货主Id查询", notes = "发票信息表-货主Id查询")
@GetMapping(value = "/queryByShipperId")
public Result<?> queryByShipperId(@RequestParam(name = "shipperId") String shipperId) {
List<BmsInvoiceInfo> info = bmsInvoiceInfoService.list(
Wrappers.<BmsInvoiceInfo>lambdaQuery().eq(BmsInvoiceInfo :: getShipperId, shipperId));
return Result.ok(info);
}
}
@@ -0,0 +1,427 @@
package com.mhd.bms.interfaces.facadeApi;
import com.aliyun.oss.ServiceException;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mhd.bms.domain.bmsInvoiceList.entity.BmsInvoiceList;
import com.mhd.bms.domain.bmsInvoiceList.entity.BmsSettlementPartyInvoice;
import com.mhd.bms.domain.bmsInvoiceList.repository.facade.IBmsInvoiceListService;
import com.mhd.bms.domain.bmsInvoiceList.repository.todo.*;
import com.mhd.bms.domain.bmsInvoiceList.repository.vo.BmsInvoiceListDetailsVO;
import com.mhd.bms.domain.bmsInvoiceList.repository.vo.BmsInvoiceListVO;
import com.mhd.common.core.utils.sms.CommonConstant;
import com.mhd.common.core.utils.sms.Result;
import com.mhd.common.core.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.Map;
/**
* @Description: 销项发票表
* @Author: Alex
* @Date: 2020-02-19 08:50:47
* @Version: V1.0
*/
@Api(tags = "销项发票表")
@RestController
@RequestMapping("/bmsInvoiceListApi")
@Slf4j
public class BmsInvoiceListApi extends BaseController {
@Autowired
private IBmsInvoiceListService bmsInvoiceListService;
/**
* 分页列表查询
*
* @param bmsInvoiceListQueryDTO
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@ApiOperation(value = "销项发票表-分页列表查询", notes = "销项发票表-分页列表查询")
@RequestMapping(value = "/queryList")
public Result<IPage<BmsInvoiceListVO>> queryList(BmsInvoiceListQueryDTO bmsInvoiceListQueryDTO,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<BmsInvoiceListVO>> result = new Result<IPage<BmsInvoiceListVO>>();
Page<BmsInvoiceListVO> pageList = new Page<BmsInvoiceListVO>(pageNo,pageSize);
pageList = bmsInvoiceListService.queryList(pageList, bmsInvoiceListQueryDTO);
result.setResult(pageList);
result.setSuccess(true);
result.setCode(CommonConstant.SC_OK_200);
return result;
}
/**
* 添加
*
* @param bmsInvoiceListAddDTO
* @return
*/
@ApiOperation(value = "销项发票表-新增", notes = "销项发票表-新增")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody BmsInvoiceListAddDTO bmsInvoiceListAddDTO) {
Result<?> result = new Result<BmsInvoiceList>();
try {
bmsInvoiceListService.save(bmsInvoiceListAddDTO);
result.success("添加成功!");
} catch (ServiceException e) {
log.error(e.getErrorMessage(),e);
result.error500(e.getErrorMessage());
} catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("操作失败:"+e.getMessage());
}
return result;
}
/**
* 应收账单申请发票
*
* @param bmsInvoiceListAddDTO
* @return
*/
@ApiOperation(value = "销项发票表-应收账单申请发票", notes = "销项发票表-应收账单申请发票")
@PostMapping(value = "/addReceivableBill")
public Result<?> addReceivableBill(@RequestBody BmsInvoiceListAddDTO bmsInvoiceListAddDTO) {
Result<?> result = new Result<BmsInvoiceList>();
try {
bmsInvoiceListService.addReceivableBill(bmsInvoiceListAddDTO);
result.success("添加成功!");
} catch (ServiceException e) {
log.error(e.getErrorMessage(),e);
result.error500(e.getErrorMessage());
} catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("操作失败:"+e.getMessage());
}
return result;
}
/**
* 发票详情
*
* @param id
* @return
*/
@ApiOperation(value = "销项发票表-发票详情", notes = "销项发票表-发票详情")
@GetMapping(value = "/details")
public Result<BmsInvoiceListDetailsVO> details(@RequestParam(name="id",required=true) String id) {
Result<BmsInvoiceListDetailsVO> result = new Result<BmsInvoiceListDetailsVO>();
try {
BmsInvoiceListDetailsVO bmsInvoiceListDetailsVO = bmsInvoiceListService.details(id);
result.setResult(bmsInvoiceListDetailsVO);
result.setSuccess(true);
result.setCode(CommonConstant.SC_OK_200);
} catch (ServiceException e) {
log.error(e.getErrorMessage());
result.error500(e.getErrorMessage());
} catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("操作失败");
}
return result;
}
/**
* 编辑
*
* @param bmsInvoiceListDTO
* @return
*/
@ApiOperation(value = "销项发票表-编辑", notes = "销项发票表-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody BmsInvoiceListDTO bmsInvoiceListDTO) {
Result<?> result = new Result<>();
try {
bmsInvoiceListService.update(bmsInvoiceListDTO);
result.success("编辑成功!");
} catch (ServiceException e) {
log.error(e.getMessage());
result.error500(e.getErrorMessage());
} catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("操作失败"+e.getMessage());
}
return result;
}
/**
* 开票
*zyp 2020 02-22 14:17:17
* @param bmsInvoiceListInvoiceStateDTO
* @return
*/
@ApiOperation(value = "销项发票表-开票 ", notes = "销项发票表-开票")
@PutMapping(value = "/invoice")
public Result<?> invoice(@RequestBody BmsInvoiceListInvoiceStateDTO bmsInvoiceListInvoiceStateDTO) {
Result<?> result = new Result<BmsInvoiceList>();
try {
bmsInvoiceListService.invoice(bmsInvoiceListInvoiceStateDTO);
result.success("开具发票成功!");
} catch (ServiceException e) {
log.error(e.getErrorMessage());
result.error500(e.getErrorMessage());
} catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("操作失败"+e.getMessage());
}
return result;
}
/**
* 驳回 - 取消申请
*zyp 2020 02-22 14:17:17
* @param bmsInvoiceListInvoiceStateDTO
* @return
*/
@ApiOperation(value = "销项发票表-驳回 取消申请 ", notes = "销项发票表-驳回 - 取消申请")
@PutMapping(value = "/reject")
public Result<?> reject(@RequestBody BmsInvoiceListInvoiceStateDTO bmsInvoiceListInvoiceStateDTO) {
Result<?> result = new Result<BmsInvoiceList>();
try {
Integer integer = bmsInvoiceListService.reject(bmsInvoiceListInvoiceStateDTO);
if (integer == 1){
result.success("已取消申请!");
} else if (integer == 3){
result.success("已成功驳回!");
}
} catch (ServiceException e) {
log.error(e.getErrorMessage());
result.error500(e.getErrorMessage());
} catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("操作失败"+e.getMessage());
}
return result;
}
/**
* 寄出
*zyp 2020 02-22 14:22:17
* @param bmsInvoiceListInvoiceStateDTO
* @return
*/
@ApiOperation(value = "销项发票表-寄出", notes = "销项发票表-寄出")
@PutMapping(value = "/mail")
public Result<?> mail(@RequestBody BmsInvoiceListInvoiceStateDTO bmsInvoiceListInvoiceStateDTO) {
Result<?> result = new Result<BmsInvoiceList>();
try {
bmsInvoiceListService.mail(bmsInvoiceListInvoiceStateDTO);
result.success("已成功寄出!");
} catch (ServiceException e) {
log.error(e.getErrorMessage());
result.error500(e.getErrorMessage());
} catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("操作失败"+e.getMessage());
}
return result;
}
/**
* 通过id删除
*
* @param id
* @return
*/
@ApiOperation(value = "销项发票表-删除", notes = "销项发票表-删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
Result<?> result = new Result<BmsInvoiceList>();
try {
bmsInvoiceListService.delete(Arrays.asList(id.split(",")));
result.success("删除成功!");
} catch (ServiceException e) {
log.error(e.getMessage());
result.error500(e.getErrorMessage());
} catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("操作失败"+e.getMessage());
}
return result;
}
/**
* 批量删除
*
* @param ids
* @return
*/
@ApiOperation(value = "销项发票表-批量删除", notes = "销项发票表-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
Result<?> result = new Result<BmsInvoiceList>();
try {
this.bmsInvoiceListService.delete(Arrays.asList(ids.split(",")));
result.success("删除成功!");
} catch (ServiceException e) {
log.error(e.getMessage(),e);
result.error500("操作失败"+e.getMessage());
} catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("操作失败"+e.getMessage());
}
return result;
}
/**
* 通过id查询
*
* @param id
* @return
*/
@ApiOperation(value = "销项发票表-通过id查询", notes = "销项发票表-通过id查询")
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id") String id) {
BmsInvoiceList bmsInvoiceList = bmsInvoiceListService.getById(id);
if(bmsInvoiceList==null) {
return Result.error("未找到对应数据");
}
return Result.ok(bmsInvoiceList);
}
/**
* 导出excel
*
* @param request
*/
/*@AutoLog(value = "销项发票表-导出excel")
@ApiOperation(value = "销项发票表-导出excel", notes = "销项发票表-导出excel")
@GetMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request,BmsInvoiceListQueryDTO bmsInvoiceListQueryDTO,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
try {
//当前登录人
WlhyLoginUser sysUser = SecurityUtils.getLoginUser().getWlhyLoginUser();
String title = "货主发票导出";
Page<BmsInvoiceListVO> pageList = new Page<BmsInvoiceListVO>(pageNo, pageSize);
pageList = bmsInvoiceListService.queryList(pageList, bmsInvoiceListQueryDTO);
mv.addObject(NormalExcelConstants.FILE_NAME, title); //此处设置的filename无效 ,前端会重更新设置一下
mv.addObject(NormalExcelConstants.CLASS, BmsInvoiceListVO.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams(title + "报表","导出人:" + sysUser.getRealname(), title));
mv.addObject(NormalExcelConstants.DATA_LIST, pageList.getRecords());
return mv;
}catch (Exception e){
log.error(e.getMessage(),e);
return mv;
}
}*/
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@ApiOperation(value = "司机表-通过excel导入数据", notes = "司机表-通过excel导入数据")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
Result result = new Result<>();
response.setContentType("text/plain");
response.setHeader("Cache-Control", "no-cache");
response.setCharacterEncoding("UTF-8");
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
try{
bmsInvoiceListService.importExcel(fileMap);
result.success("导入成功");
}catch (ServiceException e1){
result.error500(e1.getErrorMessage());
e1.printStackTrace();
}catch (Exception e){
result.error500("系统出现异常,请联系平台客服处理。");
e.printStackTrace();
}
return result;
}
@ApiOperation(value = "销项发票表-修改开票信息 ", notes = "销项发票表-修改开票信息")
@PutMapping(value = "/changeOutInvoice")
public Result<?> changeOutInvoice(@RequestBody BmsOutInvoiceChangeDTO bmsOutInvoiceChangeDTO) {
Result<?> result = new Result<BmsInvoiceList>();
try {
bmsInvoiceListService.changeOutInvoice(bmsOutInvoiceChangeDTO);
result.success("修改发票成功!");
} catch (ServiceException e) {
log.error(e.getErrorMessage());
result.error500(e.getErrorMessage());
} catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("操作失败"+e.getMessage());
}
return result;
}
@ApiOperation(value = "销项发票表-校验选中发票信息是否可以批量开票 ", notes = "销项发票表-校验选中发票信息是否可以批量开票")
@PutMapping(value = "/queryBulkMailStatus")
public Result<?> queryBulkMailStatus(@RequestBody BmsOutInvoiceChangeDTO bmsOutInvoiceChangeDTO) {
Result<?> result = new Result<BmsInvoiceList>();
try {
bmsInvoiceListService.queryBulkMailStatus(bmsOutInvoiceChangeDTO);
result.success("查询成功!");
} catch (ServiceException e) {
log.error(e.getErrorMessage());
result.error500(e.getErrorMessage());
} catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("操作失败"+e.getMessage());
}
return result;
}
@ApiOperation(value = "销项发票表-批量寄出", notes = "销项发票表-批量寄出")
@PutMapping(value = "/bulkMail")
public Result<?> bulkMail(@RequestBody BmsInvoiceListInvoiceStateDTO bmsInvoiceListInvoiceStateDTO) {
Result<?> result = new Result<BmsInvoiceList>();
try {
bmsInvoiceListService.bulkMail(bmsInvoiceListInvoiceStateDTO);
result.success("已成功寄出!");
} catch (ServiceException e) {
log.error(e.getErrorMessage());
result.error500(e.getErrorMessage());
} catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("操作失败"+e.getMessage());
}
return result;
}
@ApiOperation(value = "根据结算方姓名查询发票信息", notes = "根据结算方姓名查询发票信息")
@GetMapping(value = "/selectSettlementPartyInfoByName")
public Result<BmsSettlementPartyInvoice> selectSettlementPartyInfoByName(@RequestParam(name="settlementPartyName",required=true) String settlementPartyName) {
Result<BmsSettlementPartyInvoice> result = new Result<BmsSettlementPartyInvoice>();
try {
BmsSettlementPartyInvoice bmsSettlementPartyInvoice = bmsInvoiceListService.selectSettlementPartyInfoByName(settlementPartyName);
result.setResult(bmsSettlementPartyInvoice);
result.setSuccess(true);
result.setCode(CommonConstant.SC_OK_200);
} catch (ServiceException e) {
log.error(e.getErrorMessage());
result.error500(e.getErrorMessage());
} catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("操作失败");
}
return result;
}
}