diff --git a/src/main/java/com/glxp/api/controller/inout/IoOrderController.java b/src/main/java/com/glxp/api/controller/inout/IoOrderController.java index d4acef7f..40251efc 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoOrderController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoOrderController.java @@ -35,6 +35,7 @@ import com.glxp.api.service.auth.InvWarehouseService; import com.glxp.api.service.basic.EntrustReceService; import com.glxp.api.service.basic.IBasicBussinessTypeService; import com.glxp.api.service.inout.*; +import com.glxp.api.service.inout.impl.IoOrderInvoiceService; import com.glxp.api.util.CustomUtil; import com.glxp.api.util.GennerOrderUtils; import com.glxp.api.util.OrderNoTypeBean; diff --git a/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java b/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java index e0af8906..f836dc91 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java @@ -41,6 +41,7 @@ import com.glxp.api.res.inout.IoOrderInvoiceResponse; import com.glxp.api.service.auth.InvWarehouseService; import com.glxp.api.service.basic.*; import com.glxp.api.service.inout.*; +import com.glxp.api.service.inout.impl.IoOrderInvoiceService; import com.glxp.api.service.purchase.PurOrderDetailService; import com.glxp.api.service.purchase.PurOrderService; import com.glxp.api.service.purchase.SupCertService; diff --git a/src/main/java/com/glxp/api/controller/inout/IoOrderInvoiceController.java b/src/main/java/com/glxp/api/controller/inout/IoOrderInvoiceController.java index 18b9ef0d..1d2417ac 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoOrderInvoiceController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoOrderInvoiceController.java @@ -1,19 +1,27 @@ package com.glxp.api.controller.inout; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.github.pagehelper.PageInfo; import com.glxp.api.annotation.AuthRuleAnnotation; import com.glxp.api.annotation.Log; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.constant.BusinessType; import com.glxp.api.entity.inout.IoOrderDetailCodeEntity; +import com.glxp.api.entity.inout.IoOrderEntity; import com.glxp.api.entity.inout.IoOrderInvoiceEntity; import com.glxp.api.req.inout.IoOrderInvoiceRequest; import com.glxp.api.req.inout.RefreshInoiceRequest; +import com.glxp.api.req.system.DeleteRequest; +import com.glxp.api.res.inout.IoOrderInvoiceResponse; +import com.glxp.api.res.inout.IoOrderResponse; import com.glxp.api.res.inout.RefreshInoiceResponse; import com.glxp.api.service.inout.IoOrderDetailCodeService; -import com.glxp.api.service.inout.IoOrderInvoiceService; +import com.glxp.api.service.inout.impl.IoOrderInvoiceService; import org.springframework.beans.BeanUtils; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; @@ -46,4 +54,49 @@ public class IoOrderInvoiceController { return ResultVOUtils.error(500, "查无发票信息!"); return ResultVOUtils.success(response); } + + //分组查询发票列表 + @AuthRuleAnnotation("") + @GetMapping("/udiwms/inout/order/group/invoice") + public BaseResponse filterGroup(IoOrderInvoiceRequest orderInvoiceRequest) { + List orderInvoiceEntities = ioOrderInvoiceService.filterGroupBy(orderInvoiceRequest); + PageInfo pageInfo = new PageInfo<>(orderInvoiceEntities); + return ResultVOUtils.page(pageInfo); + } + + //发票对应产品信息汇总 + @AuthRuleAnnotation("") + @GetMapping("/udiwms/inout/invoice/product/detail") + public BaseResponse productDetail(IoOrderInvoiceRequest orderInvoiceRequest) { + if (StrUtil.isEmpty(orderInvoiceRequest.getInvoiceEncode())) + return ResultVOUtils.error(500, "发票编码不能为空!"); + List orderInvoiceEntities = ioOrderInvoiceService.filterGroupBy(orderInvoiceRequest); + PageInfo pageInfo = new PageInfo<>(orderInvoiceEntities); + return ResultVOUtils.page(pageInfo); + } + + //发票对应所有单据 + @AuthRuleAnnotation("") + @GetMapping("/udiwms/inout/invoice/order/detail") + public BaseResponse orderDetail(IoOrderInvoiceRequest orderInvoiceRequest) { + List orderInvoiceEntities = ioOrderInvoiceService.filterByInvoiceCode(orderInvoiceRequest); + PageInfo pageInfo = new PageInfo<>(orderInvoiceEntities); + return ResultVOUtils.page(pageInfo); + } + + @AuthRuleAnnotation("") + @PostMapping("/udiwms/inout/invoice/delete") + @Log(title = "发票删除", businessType = BusinessType.DELETE) + public BaseResponse deleteInvoice(@RequestBody DeleteRequest deleteRequest) { + if (StrUtil.isEmpty(deleteRequest.getInvoiceEncode())) + return ResultVOUtils.error(500, "发票编码不能为空"); + + boolean b = ioOrderInvoiceService.remove(new QueryWrapper().eq("invoiceEncode", deleteRequest.getInvoiceEncode())); + if (b) + return ResultVOUtils.success("删除成功!"); + else + return ResultVOUtils.error(500, "删除失败!"); + } + + } diff --git a/src/main/java/com/glxp/api/dao/inout/IoOrderInvoiceMapper.java b/src/main/java/com/glxp/api/dao/inout/IoOrderInvoiceMapper.java index 7f031495..bcda280a 100644 --- a/src/main/java/com/glxp/api/dao/inout/IoOrderInvoiceMapper.java +++ b/src/main/java/com/glxp/api/dao/inout/IoOrderInvoiceMapper.java @@ -4,6 +4,8 @@ package com.glxp.api.dao.inout; import com.glxp.api.dao.BaseMapperPlus; import com.glxp.api.entity.inout.IoOrderInvoiceEntity; import com.glxp.api.req.inout.IoOrderInvoiceRequest; +import com.glxp.api.res.inout.IoOrderInvoiceResponse; +import com.glxp.api.res.inout.IoOrderResponse; import org.apache.ibatis.annotations.Mapper; import java.util.List; @@ -15,4 +17,8 @@ public interface IoOrderInvoiceMapper extends BaseMapperPlus selectOrderInvoice(IoOrderInvoiceRequest ioOrderInvoiceEntity); + List filterGroupBy(IoOrderInvoiceRequest orderInvoiceRequest); + + + List filterByInvoiceCode(IoOrderInvoiceRequest orderInvoiceRequest); } diff --git a/src/main/java/com/glxp/api/req/inout/IoOrderInvoiceRequest.java b/src/main/java/com/glxp/api/req/inout/IoOrderInvoiceRequest.java index 07ee07cc..35c617fc 100644 --- a/src/main/java/com/glxp/api/req/inout/IoOrderInvoiceRequest.java +++ b/src/main/java/com/glxp/api/req/inout/IoOrderInvoiceRequest.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.glxp.api.entity.inout.IoOrderDetailResultEntity; import com.glxp.api.entity.inout.IoOrderInvoiceEntity; import com.glxp.api.entity.purchase.SupCertSetEntity; +import com.glxp.api.util.page.ListPageRequest; import lombok.Data; import java.util.Date; @@ -17,7 +18,7 @@ import java.util.List; * @modyified By : */ @Data -public class IoOrderInvoiceRequest { +public class IoOrderInvoiceRequest extends ListPageRequest { private Long id; diff --git a/src/main/java/com/glxp/api/req/system/DeleteRequest.java b/src/main/java/com/glxp/api/req/system/DeleteRequest.java index 005102ef..dc14f613 100644 --- a/src/main/java/com/glxp/api/req/system/DeleteRequest.java +++ b/src/main/java/com/glxp/api/req/system/DeleteRequest.java @@ -11,4 +11,5 @@ public class DeleteRequest { List ids; String billNo; List billNos; + String invoiceEncode; } diff --git a/src/main/java/com/glxp/api/res/inout/IoOrderInvoiceResponse.java b/src/main/java/com/glxp/api/res/inout/IoOrderInvoiceResponse.java index c9eab274..ca0a1670 100644 --- a/src/main/java/com/glxp/api/res/inout/IoOrderInvoiceResponse.java +++ b/src/main/java/com/glxp/api/res/inout/IoOrderInvoiceResponse.java @@ -9,7 +9,6 @@ import lombok.Data; import java.util.Date; @Data -@TableName(value = "io_order_invoice") public class IoOrderInvoiceResponse { private Long id; diff --git a/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java b/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java index b9b4c649..4976dac1 100644 --- a/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java +++ b/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java @@ -16,6 +16,7 @@ import com.glxp.api.entity.system.SystemParamConfigEntity; import com.glxp.api.service.auth.InvWarehouseService; import com.glxp.api.service.basic.IBasicBusTypePreService; import com.glxp.api.service.basic.IBasicBussinessTypeService; +import com.glxp.api.service.inout.impl.IoOrderInvoiceService; import com.glxp.api.service.inv.InvProductDetailService; import com.glxp.api.service.inv.InvProductService; import com.glxp.api.service.system.SystemParamConfigService; diff --git a/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java b/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java index 80c3f8f0..b83a8a5b 100644 --- a/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java +++ b/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java @@ -22,6 +22,7 @@ import com.glxp.api.res.inout.IoOrderDetailBizResponse; import com.glxp.api.res.inout.IoOrderDetailCodeResponse; import com.glxp.api.service.auth.InvWarehouseService; import com.glxp.api.service.basic.IBasicBussinessTypeService; +import com.glxp.api.service.inout.impl.IoOrderInvoiceService; import com.glxp.api.service.inv.InvPreinDetailService; import com.glxp.api.service.inv.InvPreinOrderService; import com.glxp.api.service.inv.InvPreinProductDetailService; diff --git a/src/main/java/com/glxp/api/service/inout/IoOrderInvoiceService.java b/src/main/java/com/glxp/api/service/inout/IoOrderInvoiceService.java deleted file mode 100644 index 836e73f4..00000000 --- a/src/main/java/com/glxp/api/service/inout/IoOrderInvoiceService.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.glxp.api.service.inout; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.glxp.api.entity.inout.IoCodeRelEntity; -import com.glxp.api.entity.inout.IoOrderDetailCodeEntity; -import com.glxp.api.entity.inout.IoOrderInvoiceEntity; -import com.glxp.api.req.inout.IoOrderInvoiceRequest; -import com.glxp.api.res.inout.IoOrderResponse; - -import java.util.List; - -public interface IoOrderInvoiceService extends IService { - - - List findByBillNo(String billNo); - - boolean deleteByInvId(String id); - - boolean updateByInvId(IoOrderInvoiceRequest ioOrderInvoiceRequest); - - boolean insertInvoice(IoOrderInvoiceEntity ioOrderInvoiceEntity); - - List selectOrderInvoice(IoOrderInvoiceRequest ioOrderInvoiceRequest); - - // 更新发票状态 - boolean updateRegStatus(IoOrderDetailCodeEntity orderDetailCodeEntity); - - IoOrderResponse findRegStausByBillNo(IoOrderResponse orderResponse); - - boolean findRegStausByProduct(String billNo); -} diff --git a/src/main/java/com/glxp/api/service/inout/impl/IoOrderInvoiceServiceImpl.java b/src/main/java/com/glxp/api/service/inout/impl/IoOrderInvoiceService.java similarity index 81% rename from src/main/java/com/glxp/api/service/inout/impl/IoOrderInvoiceServiceImpl.java rename to src/main/java/com/glxp/api/service/inout/impl/IoOrderInvoiceService.java index 2e3f1115..0f4d9b7c 100644 --- a/src/main/java/com/glxp/api/service/inout/impl/IoOrderInvoiceServiceImpl.java +++ b/src/main/java/com/glxp/api/service/inout/impl/IoOrderInvoiceService.java @@ -4,18 +4,18 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.glxp.api.dao.inout.IoCodeRelMapper; +import com.github.pagehelper.PageHelper; import com.glxp.api.dao.inout.IoOrderDetailCodeDao; import com.glxp.api.dao.inout.IoOrderInvoiceMapper; -import com.glxp.api.entity.inout.IoCodeRelEntity; import com.glxp.api.entity.inout.IoOrderDetailCodeEntity; import com.glxp.api.entity.inout.IoOrderInvoiceEntity; import com.glxp.api.req.inout.IoOrderInvoiceRequest; +import com.glxp.api.res.inout.IoOrderInvoiceResponse; import com.glxp.api.res.inout.IoOrderResponse; +import org.apache.regexp.RE; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; -import com.glxp.api.service.inout.IoOrderInvoiceService; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; @@ -25,24 +25,22 @@ import java.util.List; @Service @Transactional(rollbackFor = Exception.class) -public class IoOrderInvoiceServiceImpl extends ServiceImpl implements IoOrderInvoiceService { +public class IoOrderInvoiceService extends ServiceImpl { @Resource IoOrderInvoiceMapper ioOrderInvoiceMapper; @Resource IoOrderDetailCodeDao orderDetailCodeDao; - @Override + public List findByBillNo(String orderIdFk) { return ioOrderInvoiceMapper.selectList(new QueryWrapper().eq("orderIdFk", orderIdFk)); } - @Override public boolean deleteByInvId(String id) { return this.ioOrderInvoiceMapper.deleteById(id) > 0; } - @Override public boolean updateByInvId(IoOrderInvoiceRequest ioOrderInvoiceRequest) { IoOrderInvoiceEntity ioOrderInvoiceEntity = new IoOrderInvoiceEntity(); BeanUtils.copyProperties(ioOrderInvoiceRequest, ioOrderInvoiceEntity); @@ -50,32 +48,20 @@ public class IoOrderInvoiceServiceImpl extends ServiceImpl 0; } - @Override public boolean insertInvoice(IoOrderInvoiceEntity ioOrderInvoiceEntity) { return ioOrderInvoiceMapper.insert(ioOrderInvoiceEntity) > 0; } - @Override public List selectOrderInvoice(IoOrderInvoiceRequest ioOrderInvoiceRequest) { return ioOrderInvoiceMapper.selectOrderInvoice(ioOrderInvoiceRequest); } - @Override public boolean updateRegStatus(IoOrderDetailCodeEntity orderDetailCodeEntity) { IoOrderInvoiceRequest orderInvoiceRequest = new IoOrderInvoiceRequest(); orderInvoiceRequest.setBatchNo(orderDetailCodeEntity.getBatchNo()); orderInvoiceRequest.setBindRlFk(orderDetailCodeEntity.getBindRlFk() + ""); List orderInvoiceEntities = selectOrderInvoice(orderInvoiceRequest); if (CollUtil.isNotEmpty(orderInvoiceEntities)) { -// BigDecimal amount = new BigDecimal(0.00); -// for (IoOrderInvoiceEntity orderInvoiceEntity : orderInvoiceEntities) { -// amount = amount.add(new BigDecimal(orderInvoiceEntity.getPrice())); -// } -// if (amount.compareTo(orderDetailCodeEntity.getPrice()) == 0) { -// orderDetailCodeEntity.setRegStatus(true); -// } else { -// orderDetailCodeEntity.setRegStatus(false); -// } orderDetailCodeEntity.setRegStatus(true); } else { orderDetailCodeEntity.setRegStatus(false); @@ -84,7 +70,6 @@ public class IoOrderInvoiceServiceImpl extends ServiceImpl orderInvoiceEntities = ioOrderInvoiceMapper.selectList(new QueryWrapper().eq("orderIdFk", orderResponse.getBillNo())); List orderDetailCodeEntities = orderDetailCodeDao.selectList(new QueryWrapper().eq("orderIdFk", orderResponse.getBillNo())); @@ -113,15 +98,33 @@ public class IoOrderInvoiceServiceImpl extends ServiceImpl0){ + else if (isAll > 0) { orderResponse.setInvoiceStatus(1);//未全部登记 } return orderResponse; } - @Override public boolean findRegStausByProduct(String billNo) { return false; } + + public List filterGroupBy(IoOrderInvoiceRequest orderInvoiceRequest) { + if (orderInvoiceRequest.getPage() != null) { + int offset = (orderInvoiceRequest.getPage() - 1) * orderInvoiceRequest.getLimit(); + PageHelper.offsetPage(offset, orderInvoiceRequest.getLimit()); + } + return ioOrderInvoiceMapper.filterGroupBy(orderInvoiceRequest); + } + + + public List filterByInvoiceCode(IoOrderInvoiceRequest orderInvoiceRequest) { + if (orderInvoiceRequest.getPage() != null) { + int offset = (orderInvoiceRequest.getPage() - 1) * orderInvoiceRequest.getLimit(); + PageHelper.offsetPage(offset, orderInvoiceRequest.getLimit()); + } + return ioOrderInvoiceMapper.filterByInvoiceCode(orderInvoiceRequest); + } + + } diff --git a/src/main/java/com/glxp/api/service/sync/SpsSyncDownloadService.java b/src/main/java/com/glxp/api/service/sync/SpsSyncDownloadService.java index fb6a2e68..1beeda9c 100644 --- a/src/main/java/com/glxp/api/service/sync/SpsSyncDownloadService.java +++ b/src/main/java/com/glxp/api/service/sync/SpsSyncDownloadService.java @@ -26,6 +26,7 @@ import com.glxp.api.res.sync.SpsSyncOrderResponse; import com.glxp.api.res.system.SyncDataSetResponse; import com.glxp.api.service.basic.*; import com.glxp.api.service.inout.*; +import com.glxp.api.service.inout.impl.IoOrderInvoiceService; import com.glxp.api.service.purchase.*; import com.glxp.api.service.thrsys.IThrBusTypeOriginService; import com.glxp.api.util.CustomUtil; diff --git a/src/main/resources/mybatis/mapper/inout/IoOrderInvoiceMapper.xml b/src/main/resources/mybatis/mapper/inout/IoOrderInvoiceMapper.xml index 3cc52948..c2e92f89 100644 --- a/src/main/resources/mybatis/mapper/inout/IoOrderInvoiceMapper.xml +++ b/src/main/resources/mybatis/mapper/inout/IoOrderInvoiceMapper.xml @@ -12,11 +12,11 @@ + + + + + + + + +