From cd924ce2d10aac9e9983fc6ec7bdd77bae4109b5 Mon Sep 17 00:00:00 2001 From: Gauthier LO Date: Fri, 13 Oct 2023 14:38:36 +0200 Subject: [PATCH] =?UTF-8?q?feature=20:=20(W=C3=8FP)=20credit=20Page=20+=20?= =?UTF-8?q?balance=20+=20invoicing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/admin/BalanceController.java | 175 ++++++++++++++++++ .../admin/UserClientController.java | 2 +- .../client/TransactionController.java | 14 +- .../domain/job/LogisticChannelChoiceJob.java | 28 ++- .../ShippingInvoiceFactory.java | 10 + .../modules/business/entity/Balance.java | 70 +++++++ .../business/mapper/BalanceMapper.java | 21 +++ .../business/mapper/xml/BalanceMapper.xml | 14 ++ .../business/mapper/xml/CountryMapper.xml | 14 +- .../mapper/xml/PlatformOrderMapper.xml | 2 +- .../mapper/xml/SensitiveAttributeMapper.xml | 2 +- .../business/mapper/xml/TransactionMapper.xml | 2 +- .../business/service/IBalanceService.java | 17 ++ .../service/impl/BalanceServiceImpl.java | 27 +++ .../impl/PlatformOrderServiceImpl.java | 1 + .../jeecg/modules/business/vo/Estimation.java | 14 +- .../vo/LogisticChannelChoiceError.java | 18 ++ .../templates/logisticChannelChoiceError.ftl | 29 ++- 18 files changed, 436 insertions(+), 24 deletions(-) create mode 100644 jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/admin/BalanceController.java create mode 100644 jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/entity/Balance.java create mode 100644 jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/BalanceMapper.java create mode 100644 jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/BalanceMapper.xml create mode 100644 jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/IBalanceService.java create mode 100644 jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/BalanceServiceImpl.java create mode 100644 jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/vo/LogisticChannelChoiceError.java diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/admin/BalanceController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/admin/BalanceController.java new file mode 100644 index 000000000..2c26fa8c9 --- /dev/null +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/admin/BalanceController.java @@ -0,0 +1,175 @@ +package org.jeecg.modules.business.controller.admin; + +import java.math.BigDecimal; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.business.entity.Balance; +import org.jeecg.modules.business.service.IBalanceService; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; + +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.common.system.base.controller.JeecgController; +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 org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.apache.shiro.authz.annotation.RequiresPermissions; + + /** + * @Description: balance + * @Author: jeecg-boot + * @Date: 2023-10-12 + * @Version: V1.0 + */ +@Api(tags="balance") +@RestController +@RequestMapping("/balance") +@Slf4j +public class BalanceController extends JeecgController { + @Autowired + private IBalanceService balanceService; + + /** + * 分页列表查询 + * + * @param balance + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @GetMapping(value = "/list") + public Result> queryPageList(Balance balance, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(balance, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = balanceService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param balance + * @return + */ + @PostMapping(value = "/add") + public Result add(@RequestBody Balance balance) { + balanceService.save(balance); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param balance + * @return + */ + @AutoLog(value = "balance-编辑") + @ApiOperation(value="balance-编辑", notes="balance-编辑") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result edit(@RequestBody Balance balance) { + balanceService.updateById(balance); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "balance-通过id删除") + @ApiOperation(value="balance-通过id删除", notes="balance-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id) { + balanceService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "balance-批量删除") + @ApiOperation(value="balance-批量删除", notes="balance-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.balanceService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + //@AutoLog(value = "balance-通过id查询") + @ApiOperation(value="balance-通过id查询", notes="balance-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id",required=true) String id) { + Balance balance = balanceService.getById(id); + if(balance==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(balance); + } + + /** + * 导出excel + * + * @param request + * @param balance + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, Balance balance) { + return super.exportXls(request, balance, Balance.class, "balance"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, Balance.class); + } + + @GetMapping(value = "/getBalanceByClientIdAndCurrency") + public Result getBalanceByClientIdAndCurrency(@RequestParam(name="clientId") String clientId, @RequestParam(name="currency") String currency) { + BigDecimal balance = balanceService.getBalanceByClientIdAndCurrency(clientId, currency); + return Result.OK(balance == null ? 0 : balance); + } + +} diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/admin/UserClientController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/admin/UserClientController.java index 290ed468c..9a8ccd210 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/admin/UserClientController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/admin/UserClientController.java @@ -44,7 +44,7 @@ public class UserClientController { public Result getClientByUserId() { LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); String userId = loginUser.getId(); - userId = "1708866308713140225"; +// userId = "1708866308713140225"; Client client = userClientService.getClientByUserId(userId); if(client == null) { List sysRoles = sysUserRoleService.getUserRole(userId); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/client/TransactionController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/client/TransactionController.java index 291da7eaf..ad9f4c563 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/client/TransactionController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/client/TransactionController.java @@ -1,5 +1,6 @@ package org.jeecg.modules.business.controller.client; +import cn.hutool.core.date.DateTime; import io.swagger.annotations.Api; import lombok.extern.slf4j.Slf4j; import org.jeecg.common.api.vo.Result; @@ -80,6 +81,10 @@ public class TransactionController { List errorMessages = new ArrayList<>(); List shopIds = shopService.listIdByClient(clientId); List orders = platformOrderService.findUninvoicedOrdersByShopForClient(shopIds, Arrays.asList(1,2,3)); + if(orders.isEmpty()) + return Result.OK("No order to invoice."); + Date startDate = orders.stream().map(PlatformOrder::getOrderTime).min(Date::compareTo).get(); + Date endDate = orders.stream().map(PlatformOrder::getOrderTime).max(Date::compareTo).get(); List orderIds = orders.stream().map(PlatformOrder::getId).collect(Collectors.toList()); System.out.println("Orders size : " + orderIds.size()); System.out.println("Orders : " + orderIds); @@ -88,6 +93,8 @@ public class TransactionController { platformOrderContentService, skuDeclaredValueService, countryService, exchangeRatesMapper, purchaseOrderService, purchaseOrderContentMapper, skuPromotionHistoryMapper, savRefundService, savRefundWithDetailService); List shippingFeesEstimations = factory.getEstimations(clientId, orderIds, errorMessages); + if(shippingFeesEstimations.isEmpty()) + return Result.OK("No estimation found."); System.out.println("Estimation size : " + shippingFeesEstimations.size()); for(ShippingFeesEstimation estimation: shippingFeesEstimations) { System.out.println("estimation : " + estimation.getDueForProcessedOrders()); @@ -105,6 +112,11 @@ public class TransactionController { List skuPrices = platformOrderContentMapper.searchSkuPrice(skuIds); BigDecimal exchangeRateEurToRmb = exchangeRatesMapper.getLatestExchangeRate("EUR", "RMB"); BigDecimal purchaseEstimation = BigDecimal.ZERO; + boolean isCompleteInvoiceReady = true; + if(skuPrices.size() != skuIds.size()) { + isCompleteInvoiceReady = false; + errorMessages.add("Some sku prices are missing."); + } for(PlatformOrderContent content : orderContents){ for (SkuPrice skuPrice : skuPrices) { if(content.getSkuId().equals(skuPrice.getSkuId())) { @@ -124,6 +136,6 @@ public class TransactionController { System.out.println("Purchase Fee " + currency + " : " + purchaseEstimation); System.out.println("Shipping Fee " + currency + " : " + shippingFeesEstimation); } - return Result.ok(new Estimation(shippingFeesEstimation, purchaseEstimation, currency, errorMessages)); + return Result.ok(new Estimation(shippingFeesEstimation, purchaseEstimation, currency, errorMessages, shopIds, new DateTime(startDate).toString(), new DateTime(endDate).toString(), isCompleteInvoiceReady)); } } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/job/LogisticChannelChoiceJob.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/job/LogisticChannelChoiceJob.java index 0e0bbaf80..5ab0f31b4 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/job/LogisticChannelChoiceJob.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/job/LogisticChannelChoiceJob.java @@ -7,6 +7,7 @@ import org.codehaus.jettison.json.JSONObject; import org.jeecg.modules.business.entity.*; import org.jeecg.modules.business.mapper.PlatformOrderContentMapper; import org.jeecg.modules.business.service.*; +import org.jeecg.modules.business.vo.LogisticChannelChoiceError; import org.quartz.Job; import org.quartz.JobDataMap; import org.quartz.JobExecutionContext; @@ -51,6 +52,8 @@ public class LogisticChannelChoiceJob implements Job { @Autowired private ISensitiveAttributeService sensitiveAttributeService; @Autowired + private IShopService shopService; + @Autowired private PlatformOrderContentMapper platformOrderContentMapper; @Autowired Environment env; @@ -138,14 +141,19 @@ public class LogisticChannelChoiceJob implements Job { } } System.gc(); + List shops = orderMapByShopAndCountry.keySet().stream().map(shopId -> shopService.getById(shopId)).collect(Collectors.toList()); List countries = platformOrders.stream().map(PlatformOrder::getCountry).distinct().collect(Collectors.toList()); List countryList = countryService.findIdByEnName(countries); Map countryNameToIdMap = countryList.stream().collect(toMap(Country::getNameEn, Country::getId)); + System.out.println("Country name to id map : "); + countryNameToIdMap.keySet().forEach(System.out::println); + Map logisticChannelIdToNameMap = logisticChannelService.listByIdAndZhName().stream().collect(toMap(LogisticChannel::getId, LogisticChannel::getZhName)); - Map attributeIdToPriorityMap = sensitiveAttributeService.listIdAndPriority().stream().collect(toMap(SensitiveAttribute::getId, SensitiveAttribute::getPriority)); + List sensitiveAttributes = sensitiveAttributeService.listIdAndPriority(); + Map attributeIdToPriorityMap = sensitiveAttributes.stream().collect(toMap(SensitiveAttribute::getId, SensitiveAttribute::getPriority)); Map sortedAttributeIdToPriorityMap = attributeIdToPriorityMap.entrySet() .stream() .sorted(Map.Entry.comparingByValue()) @@ -159,7 +167,7 @@ public class LogisticChannelChoiceJob implements Job { List logisticChannelChoiceList = logisticChannelChoiceService.fetchByShopId(platformOrders.stream().map(PlatformOrder::getShopId).collect(Collectors.toList())); List ordersToUpdate = new ArrayList<>(); - List logisticChoiceErrorList = new ArrayList<>(); + List logisticChoiceErrorList = new ArrayList<>(); for( Map.Entry>> entry: orderMapByShopAndCountry.entrySet()) { String shopId = entry.getKey(); System.out.println("\nShop => " + shopId); @@ -174,9 +182,15 @@ public class LogisticChannelChoiceJob implements Job { // for(Map.Entry attributeEntry: sortedAttributeIdToPriorityMap.entrySet()) { String orderAttributeId = sensitiveAttributeService.getHighestPriorityAttributeId(order.getId()); Integer orderAttributePriority = sortedAttributeIdToPriorityMap.get(orderAttributeId); + if(order.getPlatformOrderId().equals("5709926760777")) { + System.out.println("===> 5709926760777"); + System.out.println("===> order attribute" + orderAttributeId); + System.out.println("===> order attribute priority" + orderAttributePriority); + } if(orderMapByAttribute.get(orderAttributeId) == null || orderAttributeId == null) { continue; } + //todo : what is happening to EP4 Reunion 5709926760777 List choices = logisticChannelChoiceList.stream().filter( c -> c.getShopId().equals(shopId) && c.getCountryId().equals(countryNameToIdMap.get(countryName)) && c.getSensitiveAttributeId().equals(orderAttributeId)) .collect(Collectors.toList()); @@ -217,10 +231,14 @@ public class LogisticChannelChoiceJob implements Job { break; } } -// throw new JobExecutionException("No logistic channel choice found for shop : " + shopId + ", country : " + countryName + ", attribute : " + orderAttributeId); - //Send email to admin log.info("No logistic channel choice found for shop : " + shopId + ", country : " + countryName + ", attribute : " + orderAttributeId); - logisticChoiceErrorList.add("No logistic channel choice found for shop : " + shopId + ", country : " + countryName + ", attribute : " + orderAttributeId); + List shop = shops.stream().filter(s -> (s != null && s.getId().equals(shopId))).collect(Collectors.toList()); + logisticChoiceErrorList.add(new LogisticChannelChoiceError( + shop.isEmpty() ? shopId : shop.get(0).getErpCode(), + order.getPlatformOrderId(), + countryName, + sensitiveAttributes.stream().filter(attribute -> attribute.getId().equals(orderAttributeId)).collect(Collectors.toList()).get(0).getZhName() + )); } else { System.out.println("Trouvé"); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/shippingInvoice/ShippingInvoiceFactory.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/shippingInvoice/ShippingInvoiceFactory.java index 898ba6737..7c6a07358 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/shippingInvoice/ShippingInvoiceFactory.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/shippingInvoice/ShippingInvoiceFactory.java @@ -763,7 +763,11 @@ public class ShippingInvoiceFactory { public List getEstimations(List errorMessages) { List estimations = new ArrayList<>(); Map>> uninvoicedOrdersByShopId = platformOrderService.findUninvoicedOrders(); + if(uninvoicedOrdersByShopId.isEmpty()) { + return estimations; + } Set shopIds = uninvoicedOrdersByShopId.keySet(); + System.out.println(shopIds); Set clientIds = new HashSet<>(); List shops = shopMapper.selectBatchIds(shopIds); shops.forEach(shop -> clientIds.add(clientMapper.selectById(shop.getOwnerId()).getId())); @@ -826,7 +830,12 @@ public class ShippingInvoiceFactory { public List getEstimations(String clientId, List orderIds, List errorMessages) { List estimations = new ArrayList<>(); Map> ordersMap = platformOrderService.fetchOrderData(orderIds); + if(ordersMap.isEmpty()) { + return estimations; + } Set orderSet = ordersMap.keySet(); + System.out.println("orderSet : "); + orderSet.forEach(System.out::println); Map orderMap = orderSet.stream().collect(toMap(PlatformOrder::getId, Function.identity())); Map orderMapByShopId = orderSet.stream().collect(toMap(PlatformOrder::getId, PlatformOrder::getShopId)); List orderContents = ordersMap.values().stream().flatMap(Collection::stream).collect(toList()); @@ -838,6 +847,7 @@ public class ShippingInvoiceFactory { ) ); Collection shopIds = orderMapByShopId.values(); + System.out.println("shopIds : " + shopIds); Client client = clientMapper.selectById(clientId); List shops = shopMapper.selectBatchIds(shopIds); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/entity/Balance.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/entity/Balance.java new file mode 100644 index 000000000..52d5d637f --- /dev/null +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/entity/Balance.java @@ -0,0 +1,70 @@ +package org.jeecg.modules.business.entity; + +import java.io.Serializable; +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: balance + * @Author: jeecg-boot + * @Date: 2023-10-12 + * @Version: V1.0 + */ +@Data +@TableName("balance") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="balance对象", description="balance") +public class Balance 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; + /**client ID*/ + @Excel(name = "client ID", width = 15) + @ApiModelProperty(value = "client ID") + private java.lang.String clientId; + /**currency ID*/ + @Excel(name = "currency ID", width = 15) + @ApiModelProperty(value = "currency ID") + private java.lang.String currencyId; + /**transaction type*/ + @Excel(name = "transaction type", width = 15) + @ApiModelProperty(value = "transaction type") + private java.lang.String operationType; + /**transaction ID*/ + @Excel(name = "transaction ID", width = 15) + @ApiModelProperty(value = "transaction ID") + private java.lang.String operationId; + /**balance amount*/ + @Excel(name = "balance amount", width = 15) + @ApiModelProperty(value = "balance amount") + private java.math.BigDecimal amount; +} diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/BalanceMapper.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/BalanceMapper.java new file mode 100644 index 000000000..be14a8542 --- /dev/null +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/BalanceMapper.java @@ -0,0 +1,21 @@ +package org.jeecg.modules.business.mapper; + +import java.math.BigDecimal; +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.business.entity.Balance; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + * @Description: balance + * @Author: jeecg-boot + * @Date: 2023-10-12 + * @Version: V1.0 + */ +@Repository +public interface BalanceMapper extends BaseMapper { + + BigDecimal getBalanceByClientIdAndCurrency(@Param("clientId")String clientId, @Param("currency")String currency); +} diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/BalanceMapper.xml b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/BalanceMapper.xml new file mode 100644 index 000000000..92b1f7d9b --- /dev/null +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/BalanceMapper.xml @@ -0,0 +1,14 @@ + + + + + \ No newline at end of file diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/CountryMapper.xml b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/CountryMapper.xml index 092db51e8..273d25647 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/CountryMapper.xml +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/CountryMapper.xml @@ -16,21 +16,23 @@ - SELECT id, shop_id, country + SELECT id, shop_id, country, platform_order_id FROM platform_order po WHERE logistic_channel_name = '' AND invoice_logistic_channel_name IS NULL diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/SensitiveAttributeMapper.xml b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/SensitiveAttributeMapper.xml index 14e806280..972204652 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/SensitiveAttributeMapper.xml +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/SensitiveAttributeMapper.xml @@ -30,7 +30,7 @@ ORDER BY sa.priority DESC LIMIT 1; \ No newline at end of file diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/TransactionMapper.xml b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/TransactionMapper.xml index 010c41b9e..e78e37d7c 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/TransactionMapper.xml +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/TransactionMapper.xml @@ -15,6 +15,6 @@ FROM transaction WHERE client_id = #{clientId} AND currency = #{currency} - ORDER BY create_time; + ORDER BY create_time DESC; \ No newline at end of file diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/IBalanceService.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/IBalanceService.java new file mode 100644 index 000000000..424815ebf --- /dev/null +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/IBalanceService.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.business.service; + +import org.jeecg.modules.business.entity.Balance; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.math.BigDecimal; + +/** + * @Description: balance + * @Author: jeecg-boot + * @Date: 2023-10-12 + * @Version: V1.0 + */ +public interface IBalanceService extends IService { + + BigDecimal getBalanceByClientIdAndCurrency(String clientId, String currency); +} diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/BalanceServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/BalanceServiceImpl.java new file mode 100644 index 000000000..93c795b2f --- /dev/null +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/BalanceServiceImpl.java @@ -0,0 +1,27 @@ +package org.jeecg.modules.business.service.impl; + +import org.jeecg.modules.business.entity.Balance; +import org.jeecg.modules.business.mapper.BalanceMapper; +import org.jeecg.modules.business.service.IBalanceService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +import java.math.BigDecimal; + +/** + * @Description: balance + * @Author: jeecg-boot + * @Date: 2023-10-12 + * @Version: V1.0 + */ +@Service +public class BalanceServiceImpl extends ServiceImpl implements IBalanceService { + @Autowired + private BalanceMapper balanceMapper; + @Override + public BigDecimal getBalanceByClientIdAndCurrency(String clientId, String currency) { + return balanceMapper.getBalanceByClientIdAndCurrency(clientId, currency); + } +} diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/PlatformOrderServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/PlatformOrderServiceImpl.java index 45da9f23d..6a51df0e2 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/PlatformOrderServiceImpl.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/PlatformOrderServiceImpl.java @@ -282,6 +282,7 @@ public class PlatformOrderServiceImpl extends ServiceImpl>> findUninvoicedOrders() { List orderList = platformOrderMap.findUninvoicedShippedOrders(); + System.out.println("orderList size : " + orderList.size()); List orderContents = platformOrderContentMap.findUninvoicedShippedOrderContents(); Map orderMap = orderList.stream().collect(toMap(PlatformOrder::getId, Function.identity())); Map orderMapByShopId = orderList.stream().collect(toMap(PlatformOrder::getId, PlatformOrder::getShopId)); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/vo/Estimation.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/vo/Estimation.java index ee0af3d30..94df806c3 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/vo/Estimation.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/vo/Estimation.java @@ -14,15 +14,27 @@ public class Estimation { private BigDecimal totalEstimation; private String currency; private List errorMessages; + private List shopIds; + private String startDate; + private String endDate; + private boolean isCompleteInvoiceReady; public Estimation(@JsonProperty("shippingFeesEstimation") BigDecimal shippingFeesEstimation, @JsonProperty("purchaseEstimation") BigDecimal purchaseEstimation, @JsonProperty("currency") String currency, - @JsonProperty("errorMessages") List errorMessages) { + @JsonProperty("errorMessages") List errorMessages, + @JsonProperty("orderIds") List shopIds, + @JsonProperty("startDate") String startDate, + @JsonProperty("endDate") String endDate, + @JsonProperty("isCompleteInvoiceReady") boolean isCompleteInvoiceReady) { this.currency = currency; this.purchaseEstimation = purchaseEstimation; this.shippingFeesEstimation = shippingFeesEstimation; this.errorMessages = errorMessages; + this.shopIds = shopIds; + this.startDate = startDate; + this.endDate = endDate; + this.isCompleteInvoiceReady = isCompleteInvoiceReady; totalEstimation = shippingFeesEstimation.add(purchaseEstimation).setScale(2, RoundingMode.CEILING); } } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/vo/LogisticChannelChoiceError.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/vo/LogisticChannelChoiceError.java new file mode 100644 index 000000000..0b46dddaf --- /dev/null +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/vo/LogisticChannelChoiceError.java @@ -0,0 +1,18 @@ +package org.jeecg.modules.business.vo; + +import lombok.Data; + +@Data +public class LogisticChannelChoiceError { + private String shop; + private String orderId; + private String country; + private String sensitiveAttribute; + + public LogisticChannelChoiceError(String shop, String orderId, String country, String sensitiveAttribute) { + this.shop = shop; + this.orderId = orderId; + this.country = country; + this.sensitiveAttribute = sensitiveAttribute; + } +} diff --git a/jeecg-module-system/jeecg-system-biz/src/main/resources/templates/logisticChannelChoiceError.ftl b/jeecg-module-system/jeecg-system-biz/src/main/resources/templates/logisticChannelChoiceError.ftl index 38f62336d..722814778 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/resources/templates/logisticChannelChoiceError.ftl +++ b/jeecg-module-system/jeecg-system-biz/src/main/resources/templates/logisticChannelChoiceError.ftl @@ -30,13 +30,28 @@ - <#list errors as error> - - - Error: ${error} - - - + + + + + + + + + + + + <#list errors as error> + + + + + + + + +
ShopOrder IDCountrySensitive Attribute
${error.shop}${error.orderId}${error.country}${error.sensitiveAttribute}
+ Merci d’utiliser nos services.