diff --git a/jianshui-admin/src/main/java/com/jianshui/web/controller/platform/InvoiceAddController.java b/jianshui-admin/src/main/java/com/jianshui/web/controller/platform/InvoiceAddController.java index fa08900..bfaa6b7 100644 --- a/jianshui-admin/src/main/java/com/jianshui/web/controller/platform/InvoiceAddController.java +++ b/jianshui-admin/src/main/java/com/jianshui/web/controller/platform/InvoiceAddController.java @@ -3,9 +3,13 @@ package com.jianshui.web.controller.platform; import cn.hutool.json.JSON; import com.jianshui.common.core.controller.BaseController; import com.jianshui.common.core.domain.AjaxResult; +import com.jianshui.common.utils.ValidateUtils; +import com.jianshui.invoice.mapper.BillInfoMapper; import com.jianshui.platform.domain.dto.BillInfoPDTO; import com.jianshui.platform.domain.vo.BillInfoPVO; +import com.jianshui.platform.service.InvoiceAddService; import io.swagger.annotations.*; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -18,14 +22,13 @@ import org.springframework.web.bind.annotation.*; @RequestMapping("/platForm/documentEntry/") public class InvoiceAddController extends BaseController { + @Autowired + private static InvoiceAddService addService; @ApiOperation(value = "单据保存",notes = "单据保存请求") - @PostMapping( "save") - public BillInfoPVO invoiceStatistics(@RequestBody BillInfoPDTO billInfoPDTO) throws Exception { - // TODO: 全电-? - - return new BillInfoPVO(); - + @PostMapping( "invoiceSave") + public AjaxResult invoiceSave(@RequestBody BillInfoPDTO billInfoPDTO) throws Exception { + return toAjax(addService.invoiceSave(billInfoPDTO)); } diff --git a/jianshui-platform/src/main/java/com/jianshui/platform/service/InvoiceAddService.java b/jianshui-platform/src/main/java/com/jianshui/platform/service/InvoiceAddService.java new file mode 100644 index 0000000..0ee5e7a --- /dev/null +++ b/jianshui-platform/src/main/java/com/jianshui/platform/service/InvoiceAddService.java @@ -0,0 +1,31 @@ +package com.jianshui.platform.service; + +import com.jianshui.common.core.controller.BaseController; +import com.jianshui.platform.domain.dto.BillInfoPDTO; +import com.jianshui.platform.domain.vo.BillInfoPVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + + +/** + * 发票录入 + * + */ + +public interface InvoiceAddService { + + + /** + * @Author: kk + * @Description: 单据录入 + * @DateTime: 2023/6/5 17:14 + * @Params: + * @Return + */ + + int invoiceSave(BillInfoPDTO billInfoPDTO); +} diff --git a/jianshui-platform/src/main/java/com/jianshui/platform/service/impl/InvoiceAddServiceImpl.java b/jianshui-platform/src/main/java/com/jianshui/platform/service/impl/InvoiceAddServiceImpl.java new file mode 100644 index 0000000..641e3d0 --- /dev/null +++ b/jianshui-platform/src/main/java/com/jianshui/platform/service/impl/InvoiceAddServiceImpl.java @@ -0,0 +1,81 @@ +package com.jianshui.platform.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import com.jianshui.common.core.controller.BaseController; +import com.jianshui.common.utils.ValidateUtils; +import com.jianshui.invoice.domain.BillInfo; +import com.jianshui.invoice.mapper.BillInfoMapper; +import com.jianshui.platform.domain.dto.BillInfoPDTO; +import com.jianshui.platform.domain.vo.BillInfoPVO; +import com.jianshui.platform.service.InvoiceAddService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + + +/** + * 发票录入 + * + */ +@Service +public class InvoiceAddServiceImpl implements InvoiceAddService { + + @Autowired + private static BillInfoMapper billInfoMapper; + + @Override + public int invoiceSave(BillInfoPDTO billInfoPDTO) { + ValidateUtils.validate(billInfoPDTO); + + BillInfo billInfo = BeanUtil.copyProperties(billInfoPDTO, BillInfo.class); + // 手工录入 + billInfo.setSource("3"); + return billInfoMapper.insertBillInfo(billInfo); + + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +}