新增按发票登记相关接口

dev
anthonywj 2 years ago
parent 654d32def0
commit dce2904b65

@ -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;

@ -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;

@ -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<IoOrderInvoiceResponse> orderInvoiceEntities = ioOrderInvoiceService.filterGroupBy(orderInvoiceRequest);
PageInfo<IoOrderInvoiceResponse> 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<IoOrderInvoiceResponse> orderInvoiceEntities = ioOrderInvoiceService.filterGroupBy(orderInvoiceRequest);
PageInfo<IoOrderInvoiceResponse> pageInfo = new PageInfo<>(orderInvoiceEntities);
return ResultVOUtils.page(pageInfo);
}
//发票对应所有单据
@AuthRuleAnnotation("")
@GetMapping("/udiwms/inout/invoice/order/detail")
public BaseResponse orderDetail(IoOrderInvoiceRequest orderInvoiceRequest) {
List<IoOrderResponse> orderInvoiceEntities = ioOrderInvoiceService.filterByInvoiceCode(orderInvoiceRequest);
PageInfo<IoOrderResponse> 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<IoOrderInvoiceEntity>().eq("invoiceEncode", deleteRequest.getInvoiceEncode()));
if (b)
return ResultVOUtils.success("删除成功!");
else
return ResultVOUtils.error(500, "删除失败!");
}
}

@ -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<IoOrderInvoiceMappe
List<IoOrderInvoiceEntity> selectOrderInvoice(IoOrderInvoiceRequest ioOrderInvoiceEntity);
List<IoOrderInvoiceResponse> filterGroupBy(IoOrderInvoiceRequest orderInvoiceRequest);
List<IoOrderResponse> filterByInvoiceCode(IoOrderInvoiceRequest orderInvoiceRequest);
}

@ -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;

@ -11,4 +11,5 @@ public class DeleteRequest {
List<String> ids;
String billNo;
List<String> billNos;
String invoiceEncode;
}

@ -9,7 +9,6 @@ import lombok.Data;
import java.util.Date;
@Data
@TableName(value = "io_order_invoice")
public class IoOrderInvoiceResponse {
private Long id;

@ -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;

@ -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;

@ -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<IoOrderInvoiceEntity> {
List<IoOrderInvoiceEntity> findByBillNo(String billNo);
boolean deleteByInvId(String id);
boolean updateByInvId(IoOrderInvoiceRequest ioOrderInvoiceRequest);
boolean insertInvoice(IoOrderInvoiceEntity ioOrderInvoiceEntity);
List<IoOrderInvoiceEntity> selectOrderInvoice(IoOrderInvoiceRequest ioOrderInvoiceRequest);
// 更新发票状态
boolean updateRegStatus(IoOrderDetailCodeEntity orderDetailCodeEntity);
IoOrderResponse findRegStausByBillNo(IoOrderResponse orderResponse);
boolean findRegStausByProduct(String billNo);
}

@ -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<IoOrderInvoiceMapper, IoOrderInvoiceEntity> implements IoOrderInvoiceService {
public class IoOrderInvoiceService extends ServiceImpl<IoOrderInvoiceMapper, IoOrderInvoiceEntity> {
@Resource
IoOrderInvoiceMapper ioOrderInvoiceMapper;
@Resource
IoOrderDetailCodeDao orderDetailCodeDao;
@Override
public List<IoOrderInvoiceEntity> findByBillNo(String orderIdFk) {
return ioOrderInvoiceMapper.selectList(new QueryWrapper<IoOrderInvoiceEntity>().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<IoOrderInvoiceMapper,
return this.ioOrderInvoiceMapper.updateById(ioOrderInvoiceEntity) > 0;
}
@Override
public boolean insertInvoice(IoOrderInvoiceEntity ioOrderInvoiceEntity) {
return ioOrderInvoiceMapper.insert(ioOrderInvoiceEntity) > 0;
}
@Override
public List<IoOrderInvoiceEntity> 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<IoOrderInvoiceEntity> 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<IoOrderInvoiceMapper,
return true;
}
@Override
public IoOrderResponse findRegStausByBillNo(IoOrderResponse orderResponse) {
List<IoOrderInvoiceEntity> orderInvoiceEntities = ioOrderInvoiceMapper.selectList(new QueryWrapper<IoOrderInvoiceEntity>().eq("orderIdFk", orderResponse.getBillNo()));
List<IoOrderDetailCodeEntity> orderDetailCodeEntities = orderDetailCodeDao.selectList(new QueryWrapper<IoOrderDetailCodeEntity>().eq("orderIdFk", orderResponse.getBillNo()));
@ -113,15 +98,33 @@ public class IoOrderInvoiceServiceImpl extends ServiceImpl<IoOrderInvoiceMapper,
}
if (orderDetailCodeEntities.size() == isAll)
orderResponse.setInvoiceStatus(2);//已全部登记
else if(isAll >0){
else if (isAll > 0) {
orderResponse.setInvoiceStatus(1);//未全部登记
}
return orderResponse;
}
@Override
public boolean findRegStausByProduct(String billNo) {
return false;
}
public List<IoOrderInvoiceResponse> 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<IoOrderResponse> filterByInvoiceCode(IoOrderInvoiceRequest orderInvoiceRequest) {
if (orderInvoiceRequest.getPage() != null) {
int offset = (orderInvoiceRequest.getPage() - 1) * orderInvoiceRequest.getLimit();
PageHelper.offsetPage(offset, orderInvoiceRequest.getLimit());
}
return ioOrderInvoiceMapper.filterByInvoiceCode(orderInvoiceRequest);
}
}

@ -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;

@ -12,11 +12,11 @@
<select id="selectOrderInvoice" parameterType="com.glxp.api.req.inout.IoOrderInvoiceRequest"
resultType="com.glxp.api.entity.inout.IoOrderInvoiceEntity">
SELECT ic.*,bp.cpmctymc,bp.ggxh
SELECT ic.*, bp.cpmctymc, bp.ggxh
FROM io_order_invoice ic
LEFT JOIN basic_udirel bu ON bu.id = ic.bindRlFk
LEFT JOIN basic_products bp ON bu.uuid = bp.uuid
and bp.id >1
LEFT JOIN basic_udirel bu ON bu.id = ic.bindRlFk
LEFT JOIN basic_products bp ON bu.uuid = bp.uuid
and bp.id > 1
<where>
<if test="orderIdFk != null and orderIdFk != ''">
AND ic.orderIdFk = #{orderIdFk}
@ -33,4 +33,55 @@
</where>
GROUP BY ic.id
</select>
<select id="filterGroupBy" parameterType="com.glxp.api.req.inout.IoOrderInvoiceRequest"
resultType="com.glxp.api.res.inout.IoOrderInvoiceResponse">
SELECT ic.*
FROM io_order_invoice ic
inner join io_order io on ic.orderIdFk = io.billNo
LEFT JOIN basic_udirel bu
ON bu.id = ic.bindRlFk
LEFT JOIN basic_products bp ON bu.uuid = bp.uuid
<where>
<if test="orderIdFk != null and orderIdFk != ''">
AND ic.orderIdFk = #{orderIdFk}
</if>
<if test="bindRlFk != null">
AND ic.bindRlFk = #{bindRlFk}
</if>
<if test="batchNo != null and batchNo != ''">
AND ic.batchNo = #{batchNo}
</if>
</where>
GROUP BY ic.invoiceEncode
</select>
<select id="filterByInvoiceCode" parameterType="com.glxp.api.req.inout.IoOrderInvoiceRequest"
resultType="com.glxp.api.res.inout.IoOrderResponse">
select io.*,
(select name from basic_bussiness_type bus where bus.action = io.action) billTypeName,
(select name from auth_dept ad where ad.code = io.deptCode) deptName,
(select name from auth_warehouse aw where aw.code = io.invCode) invName,
(select employeeName from auth_user au where au.id = io.createUser) createUserName,
(select employeeName from auth_user au2 where au2.id = io.updateUser) updateUserName,
(select employeeName from auth_user au3 where au3.id = io.reviewUser) reviewUserName,
(select employeeName from auth_user au4 where au4.id = io.checkUser) checkUserName,
(select name from auth_dept ad2 where ad2.code = io.fromDeptCode) fromDeptName,
(select name from auth_warehouse aw2 where aw2.code = io.fromInvCode) fromInvName,
(select name from basic_corp bc where bc.erpId = io.fromCorp) fromCorpName,
(select name from basic_corp bc where bc.erpId = io.customerId) customerName
from io_order as io
inner join io_order_invoice ioi on io.billNo = ioi.orderIdFk
<where>
<if test="invoiceEncode != null">
AND ioi.invoiceEncode = #{invoiceEncode}
</if>
</where>
group by io.billNo;
</select>
</mapper>

Loading…
Cancel
Save