mirror of https://github.com/jeecgboot/jeecg-boot
feature : (WIP) Expenses overview + transactions VIEW
parent
fd35ea1c3e
commit
cff04fe906
|
@ -318,7 +318,7 @@ public class InvoiceController {
|
|||
((LoginUser) SecurityUtils.getSubject().getPrincipal()).getUsername(),
|
||||
shopIds);
|
||||
List<String> shopIdList = Arrays.asList(shopIds.split(","));
|
||||
List<PlatformOrder> orders = platformOrderService.findUninvoicedOrdersByShopForClient(shopIdList);
|
||||
List<PlatformOrder> orders = platformOrderService.findUninvoicedOrdersByShopForClient(shopIdList, Collections.singletonList(1));
|
||||
IPage<PlatformOrder> page = new Page<>();
|
||||
page.setRecords(orders);
|
||||
page.setTotal(orders.size());
|
||||
|
@ -559,12 +559,12 @@ public class InvoiceController {
|
|||
}
|
||||
|
||||
@GetMapping(value = "/checkInvoiceValidity")
|
||||
public Result<?> checkInvoiceValidity(@RequestParam("invoiceID") String invoiceID, @RequestParam("email") String email, @RequestParam("orgCode") String orgCode) {
|
||||
String invoiceNumber;
|
||||
public Result<?> checkInvoiceValidity(@RequestParam("invoiceNumber") String invoiceNumber, @RequestParam("email") String email, @RequestParam("orgCode") String orgCode) {
|
||||
String invoiceID;
|
||||
String customerFullName;
|
||||
invoiceNumber = iShippingInvoiceService.getShippingInvoiceNumber(invoiceID);
|
||||
invoiceID = iShippingInvoiceService.getShippingInvoiceId(invoiceNumber);
|
||||
// if invoice exists
|
||||
if (invoiceNumber == null) {
|
||||
if (invoiceID == null) {
|
||||
return Result.error("Error 404 page not found.");
|
||||
}
|
||||
// if user is a customer, we check if he's the owner of the shops
|
||||
|
|
|
@ -450,7 +450,6 @@ public class ShippingInvoiceController {
|
|||
|
||||
@GetMapping(value = "/sendDetailsByEmail")
|
||||
public Result<?> sendDetailsByEmail(@RequestParam("invoiceNumber") String invoiceNumber,
|
||||
@RequestParam("invoiceID") String invoiceID,
|
||||
@RequestParam("email") String email,
|
||||
@RequestParam("invoiceEntity") String invoiceEntity) throws Exception {
|
||||
String filePath = getInvoiceList(invoiceNumber, "detail");
|
||||
|
@ -460,7 +459,6 @@ public class ShippingInvoiceController {
|
|||
Map <String, Object> templateModel = new HashMap<>();
|
||||
templateModel.put("fileType", fileType);
|
||||
templateModel.put("invoiceEntity", invoiceEntity);
|
||||
templateModel.put("invoiceID", invoiceID);
|
||||
templateModel.put("invoiceNumber", invoiceNumber);
|
||||
|
||||
Session session = Session.getInstance(prop, new Authenticator() {
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
package org.jeecg.modules.business.controller.client;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.business.domain.shippingInvoice.ShippingInvoiceFactory;
|
||||
import org.jeecg.modules.business.entity.PlatformOrder;
|
||||
import org.jeecg.modules.business.mapper.*;
|
||||
import org.jeecg.modules.business.service.*;
|
||||
import org.jeecg.modules.business.vo.ShippingFeesEstimation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Api(tags = "Transaction")
|
||||
@RestController
|
||||
@RequestMapping("/transaction")
|
||||
@Slf4j
|
||||
public class TransactionController {
|
||||
@Autowired
|
||||
private TransactionMapper transactionMapper;
|
||||
@Autowired
|
||||
private IPlatformOrderService platformOrderService;
|
||||
@Autowired
|
||||
private IShopService shopService;
|
||||
@Autowired
|
||||
ShippingInvoiceMapper shippingInvoiceMapper;
|
||||
@Autowired
|
||||
PlatformOrderMapper platformOrderMapper;
|
||||
@Autowired
|
||||
ClientMapper clientMapper;
|
||||
@Autowired
|
||||
ShopMapper shopMapper;
|
||||
@Autowired
|
||||
LogisticChannelPriceMapper logisticChannelPriceMapper;
|
||||
@Autowired
|
||||
LogisticChannelMapper logisticChannelMapper;
|
||||
@Autowired
|
||||
IPlatformOrderContentService platformOrderContentService;
|
||||
@Autowired
|
||||
ISkuDeclaredValueService skuDeclaredValueService;
|
||||
@Autowired
|
||||
FactureDetailMapper factureDetailMapper;
|
||||
@Autowired
|
||||
CountryService countryService;
|
||||
@Autowired
|
||||
IPurchaseOrderService purchaseOrderService;
|
||||
@Autowired
|
||||
PurchaseOrderContentMapper purchaseOrderContentMapper;
|
||||
@Autowired
|
||||
SkuPromotionHistoryMapper skuPromotionHistoryMapper;
|
||||
@Autowired
|
||||
ExchangeRatesMapper exchangeRatesMapper;
|
||||
@Autowired
|
||||
ISavRefundWithDetailService savRefundWithDetailService;
|
||||
@Autowired
|
||||
ISavRefundService savRefundService;
|
||||
@GetMapping(value="/list")
|
||||
public Result<?> list() {
|
||||
return Result.ok(transactionMapper.list());
|
||||
}
|
||||
@GetMapping(value="/listByClient")
|
||||
public Result<?> listByClientId(@RequestParam("clientId") String clientId) {
|
||||
return Result.ok(transactionMapper.listByClientId(clientId));
|
||||
}
|
||||
@GetMapping(value="/debit")
|
||||
public Result<?> debit(@RequestParam("clientId") String clientId) {
|
||||
List<String> errorMessages = new ArrayList<>();
|
||||
List<String> shopIds = shopService.listIdByClient(clientId);
|
||||
List<PlatformOrder> orders = platformOrderService.findUninvoicedOrdersByShopForClient(shopIds, Arrays.asList(1,2,3));
|
||||
List<String> orderIds = orders.stream().map(PlatformOrder::getId).collect(Collectors.toList());
|
||||
System.out.println("Orders size : " + orderIds.size());
|
||||
System.out.println("Orders : " + orderIds);
|
||||
ShippingInvoiceFactory factory = new ShippingInvoiceFactory(
|
||||
platformOrderService, clientMapper, shopMapper, logisticChannelMapper, logisticChannelPriceMapper,
|
||||
platformOrderContentService, skuDeclaredValueService, countryService, exchangeRatesMapper,
|
||||
purchaseOrderService, purchaseOrderContentMapper, skuPromotionHistoryMapper, savRefundService, savRefundWithDetailService);
|
||||
List<ShippingFeesEstimation> estimations = factory.getEstimations(clientId, orderIds, errorMessages);
|
||||
System.out.println("Estimation size : " + estimations.size());
|
||||
for(ShippingFeesEstimation estimation: estimations) {
|
||||
System.out.println("estimation : " + estimation.getDueForProcessedOrders());
|
||||
}
|
||||
return Result.ok(estimations);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
package org.jeecg.modules.business.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: transaction
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-09-08
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("transaction")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="transaction对象", description="transaction")
|
||||
public class Transaction implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private java.lang.String id;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**type*/
|
||||
@Excel(name = "type", width = 15)
|
||||
@ApiModelProperty(value = "type")
|
||||
private java.lang.String type;
|
||||
/**client code*/
|
||||
@Excel(name = "client code", width = 15)
|
||||
@ApiModelProperty(value = "client ID")
|
||||
private java.lang.String clientId;
|
||||
/**proof*/
|
||||
@Excel(name = "proof", width = 15)
|
||||
private transient java.lang.String paymentProofString;
|
||||
|
||||
private byte[] paymentProof;
|
||||
|
||||
public byte[] getPaymentProof(){
|
||||
if(paymentProofString==null){
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return paymentProofString.getBytes("UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getPaymentProofString(){
|
||||
if(paymentProof==null || paymentProof.length==0){
|
||||
return "";
|
||||
}
|
||||
try {
|
||||
return new String(paymentProof,"UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
/**invoice number*/
|
||||
@Excel(name = "invoice number", width = 15)
|
||||
@ApiModelProperty(value = "invoice number")
|
||||
private java.lang.String invoiceNumber;
|
||||
/**amount*/
|
||||
@Excel(name = "amount", width = 15)
|
||||
@ApiModelProperty(value = "amount")
|
||||
private java.math.BigDecimal amount;
|
||||
/**currency*/
|
||||
@Excel(name = "currency", width = 15)
|
||||
@ApiModelProperty(value = "currency")
|
||||
private java.lang.String currency;
|
||||
}
|
|
@ -187,5 +187,5 @@ public interface PlatformOrderMapper extends BaseMapper<PlatformOrder> {
|
|||
void cancelInvoice(@Param("invoiceNumber") String invoiceNumber);
|
||||
void cancelBatchInvoice(@Param("invoiceNumbers") List<String> invoiceNumbers);
|
||||
|
||||
List<PlatformOrder> findUninvoicedOrdersByShopForClient(@Param("shopIds") List<String> shopIds);
|
||||
List<PlatformOrder> findUninvoicedOrdersByShopForClient(@Param("shopIds") List<String> shopIds, @Param("erpStatuses") List<Integer> erpStatuses);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import java.util.List;
|
|||
*/
|
||||
@Repository
|
||||
public interface ShippingInvoiceMapper extends BaseMapper<ShippingInvoice> {
|
||||
String fetchShippingInvoiceNumber(@Param("invoiceID") String invoiceID);
|
||||
String fetchShippingInvoiceId(@Param("invoiceNumber") String invoiceNumber);
|
||||
ShippingInvoice fetchShippingInvoice(@Param("invoiceNumber") String invoiceNumber);
|
||||
List<PlatformOrder> fetchPlatformOrder(@Param("invoiceNumber") String invoiceNumber);
|
||||
List<PlatformOrderContent> fetchPlatformOrderContent(@Param("platformOrderId") String platformOrderId);
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package org.jeecg.modules.business.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.business.entity.Transaction;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface TransactionMapper extends BaseMapper<Transaction> {
|
||||
List<Transaction> list();
|
||||
|
||||
List<Transaction> listByClientId(@Param("clientId") String clientId);
|
||||
}
|
|
@ -543,7 +543,17 @@
|
|||
<select id="findUninvoicedOrdersByShopForClient" resultType="org.jeecg.modules.business.entity.PlatformOrder">
|
||||
SELECT *
|
||||
FROM platform_order
|
||||
WHERE erp_status = 1
|
||||
WHERE erp_status IN
|
||||
<foreach
|
||||
collection="erpStatuses"
|
||||
separator=","
|
||||
open="("
|
||||
close=")"
|
||||
index="index"
|
||||
item="erpStatus"
|
||||
>
|
||||
#{erpStatus}
|
||||
</foreach>
|
||||
AND shipping_invoice_number IS NULL
|
||||
AND shop_id IN
|
||||
<foreach
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
JOIN platform_order po on s.id = po.shop_id
|
||||
WHERE po.shipping_invoice_number = #{invoiceNumber}
|
||||
</select>
|
||||
<select id="fetchShippingInvoiceNumber" resultType="java.lang.String">
|
||||
SELECT invoice_number
|
||||
FROM shipping_invoice s
|
||||
WHERE s.id = #{invoiceID}
|
||||
<select id="fetchShippingInvoiceId" resultType="java.lang.String">
|
||||
SELECT id
|
||||
FROM shipping_invoice
|
||||
WHERE invoice_number = #{invoiceNumber}
|
||||
</select>
|
||||
<select id="fetchShippingInvoice" resultType="org.jeecg.modules.business.entity.ShippingInvoice">
|
||||
SELECT total_amount, discount_amount, final_amount, paid_amount
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.business.mapper.TransactionMapper">
|
||||
<select id="list" resultType="org.jeecg.modules.business.entity.Transaction">
|
||||
SELECT * FROM transaction;
|
||||
</select>
|
||||
<select id="listByClientId" resultType="org.jeecg.modules.business.entity.Transaction">
|
||||
SELECT *
|
||||
FROM transaction
|
||||
WHERE client_id = #{clientId}
|
||||
ORDER BY create_time;
|
||||
</select>
|
||||
</mapper>
|
|
@ -183,5 +183,5 @@ public interface IPlatformOrderService extends IService<PlatformOrder> {
|
|||
* @param shopIds list of shop id
|
||||
* @return list of orders
|
||||
*/
|
||||
List<PlatformOrder> findUninvoicedOrdersByShopForClient(List<String> shopIds);
|
||||
List<PlatformOrder> findUninvoicedOrdersByShopForClient(List<String> shopIds, List<Integer> erpStatuses);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public interface IShippingInvoiceService extends IService<ShippingInvoice> {
|
|||
* 批量删除一对多
|
||||
*/
|
||||
public void delBatchMain(Collection<? extends Serializable> idList);
|
||||
public String getShippingInvoiceNumber(String invoiceID);
|
||||
public String getShippingInvoiceId(String invoiceNumber);
|
||||
public ShippingInvoice getShippingInvoice(String invoiceNumber);
|
||||
public List<PlatformOrder> getPlatformOrder(String invoiceNumber);
|
||||
public List<PlatformOrderContent> getPlatformOrderContent(String platformOrderId);
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package org.jeecg.modules.business.service;
|
||||
|
||||
import org.jeecg.modules.business.entity.Transaction;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: transaction
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-09-08
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Repository
|
||||
public interface ITransactionService extends IService<Transaction> {
|
||||
List<Transaction> list();
|
||||
}
|
|
@ -395,7 +395,7 @@ public class PlatformOrderServiceImpl extends ServiceImpl<PlatformOrderMapper, P
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<PlatformOrder> findUninvoicedOrdersByShopForClient(List<String> shopIds) {
|
||||
return platformOrderMap.findUninvoicedOrdersByShopForClient(shopIds);
|
||||
public List<PlatformOrder> findUninvoicedOrdersByShopForClient(List<String> shopIds, List<Integer> erpStatuses) {
|
||||
return platformOrderMap.findUninvoicedOrdersByShopForClient(shopIds, erpStatuses);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,8 +72,8 @@ public class ShippingInvoiceServiceImpl extends ServiceImpl<ShippingInvoiceMappe
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
public String getShippingInvoiceNumber(String invoiceID) {
|
||||
return shippingInvoiceMapper.fetchShippingInvoiceNumber(invoiceID);
|
||||
public String getShippingInvoiceId(String invoiceNumber) {
|
||||
return shippingInvoiceMapper.fetchShippingInvoiceId(invoiceNumber);
|
||||
}
|
||||
@Override
|
||||
@Transactional
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package org.jeecg.modules.business.service.impl;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.modules.business.entity.Transaction;
|
||||
import org.jeecg.modules.business.mapper.TransactionMapper;
|
||||
import org.jeecg.modules.business.service.ITransactionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: transaction
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-09-08
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class TransactionServiceImpl extends ServiceImpl<TransactionMapper, Transaction> implements ITransactionService {
|
||||
|
||||
@Autowired
|
||||
private TransactionMapper transactionMapper;
|
||||
@Override
|
||||
public List<Transaction> list() {
|
||||
return transactionMapper.list();
|
||||
}
|
||||
}
|
|
@ -30,7 +30,7 @@
|
|||
<td style="padding:10px 0;"><b>Client :</b> ${invoiceEntity}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:10px 0;"><b>Numéro de facture :</b> <a href="http://app.wia-sourcing.com/business/admin/shippingInvoice/Invoice?invoiceID=${invoiceID}"> ${invoiceNumber} </a></td>
|
||||
<td style="padding:10px 0;"><b>Numéro de facture :</b> <a href="http://app.wia-sourcing.com/business/admin/shippingInvoice/Invoice?invoice=${invoiceNumber}"> ${invoiceNumber} </a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:35px 0 5px 0;">Merci d’utiliser nos services.</td>
|
||||
|
|
Loading…
Reference in New Issue