mirror of https://github.com/jeecgboot/jeecg-boot
feature : (WÏP) credit Page + balance + invoicing
parent
9d765591a9
commit
cd924ce2d1
|
@ -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<Balance, IBalanceService> {
|
||||
@Autowired
|
||||
private IBalanceService balanceService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param balance
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<Balance>> queryPageList(Balance balance,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<Balance> queryWrapper = QueryGenerator.initQueryWrapper(balance, req.getParameterMap());
|
||||
Page<Balance> page = new Page<Balance>(pageNo, pageSize);
|
||||
IPage<Balance> pageList = balanceService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param balance
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> 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<String> 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<String> 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<String> 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<Balance> 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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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<SysRole> sysRoles = sysUserRoleService.getUserRole(userId);
|
||||
|
|
|
@ -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<String> errorMessages = new ArrayList<>();
|
||||
List<String> shopIds = shopService.listIdByClient(clientId);
|
||||
List<PlatformOrder> 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<String> 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<ShippingFeesEstimation> 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<SkuPrice> 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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<Shop> shops = orderMapByShopAndCountry.keySet().stream().map(shopId -> shopService.getById(shopId)).collect(Collectors.toList());
|
||||
List<String> countries = platformOrders.stream().map(PlatformOrder::getCountry).distinct().collect(Collectors.toList());
|
||||
|
||||
List<Country> countryList = countryService.findIdByEnName(countries);
|
||||
Map<String, String> countryNameToIdMap = countryList.stream().collect(toMap(Country::getNameEn, Country::getId));
|
||||
|
||||
System.out.println("Country name to id map : ");
|
||||
countryNameToIdMap.keySet().forEach(System.out::println);
|
||||
|
||||
Map<String, String> logisticChannelIdToNameMap = logisticChannelService.listByIdAndZhName().stream().collect(toMap(LogisticChannel::getId, LogisticChannel::getZhName));
|
||||
|
||||
Map<String, Integer> attributeIdToPriorityMap = sensitiveAttributeService.listIdAndPriority().stream().collect(toMap(SensitiveAttribute::getId, SensitiveAttribute::getPriority));
|
||||
List<SensitiveAttribute> sensitiveAttributes = sensitiveAttributeService.listIdAndPriority();
|
||||
Map<String, Integer> attributeIdToPriorityMap = sensitiveAttributes.stream().collect(toMap(SensitiveAttribute::getId, SensitiveAttribute::getPriority));
|
||||
Map<String, Integer> sortedAttributeIdToPriorityMap = attributeIdToPriorityMap.entrySet()
|
||||
.stream()
|
||||
.sorted(Map.Entry.comparingByValue())
|
||||
|
@ -159,7 +167,7 @@ public class LogisticChannelChoiceJob implements Job {
|
|||
List<LogisticChannelChoice> logisticChannelChoiceList = logisticChannelChoiceService.fetchByShopId(platformOrders.stream().map(PlatformOrder::getShopId).collect(Collectors.toList()));
|
||||
|
||||
List<PlatformOrder> ordersToUpdate = new ArrayList<>();
|
||||
List<String> logisticChoiceErrorList = new ArrayList<>();
|
||||
List<LogisticChannelChoiceError> logisticChoiceErrorList = new ArrayList<>();
|
||||
for( Map.Entry<String, Map<String, List<PlatformOrder>>> entry: orderMapByShopAndCountry.entrySet()) {
|
||||
String shopId = entry.getKey();
|
||||
System.out.println("\nShop => " + shopId);
|
||||
|
@ -174,9 +182,15 @@ public class LogisticChannelChoiceJob implements Job {
|
|||
// for(Map.Entry<String, Integer> 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<LogisticChannelChoice> 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> 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é");
|
||||
|
|
|
@ -763,7 +763,11 @@ public class ShippingInvoiceFactory {
|
|||
public List<ShippingFeesEstimation> getEstimations(List<String> errorMessages) {
|
||||
List<ShippingFeesEstimation> estimations = new ArrayList<>();
|
||||
Map<String, Map<PlatformOrder, List<PlatformOrderContent>>> uninvoicedOrdersByShopId = platformOrderService.findUninvoicedOrders();
|
||||
if(uninvoicedOrdersByShopId.isEmpty()) {
|
||||
return estimations;
|
||||
}
|
||||
Set<String> shopIds = uninvoicedOrdersByShopId.keySet();
|
||||
System.out.println(shopIds);
|
||||
Set<String> clientIds = new HashSet<>();
|
||||
List<Shop> shops = shopMapper.selectBatchIds(shopIds);
|
||||
shops.forEach(shop -> clientIds.add(clientMapper.selectById(shop.getOwnerId()).getId()));
|
||||
|
@ -826,7 +830,12 @@ public class ShippingInvoiceFactory {
|
|||
public List<ShippingFeesEstimation> getEstimations(String clientId, List<String> orderIds, List<String> errorMessages) {
|
||||
List<ShippingFeesEstimation> estimations = new ArrayList<>();
|
||||
Map<PlatformOrder, List<PlatformOrderContent>> ordersMap = platformOrderService.fetchOrderData(orderIds);
|
||||
if(ordersMap.isEmpty()) {
|
||||
return estimations;
|
||||
}
|
||||
Set<PlatformOrder> orderSet = ordersMap.keySet();
|
||||
System.out.println("orderSet : ");
|
||||
orderSet.forEach(System.out::println);
|
||||
Map<String, PlatformOrder> orderMap = orderSet.stream().collect(toMap(PlatformOrder::getId, Function.identity()));
|
||||
Map<String, String> orderMapByShopId = orderSet.stream().collect(toMap(PlatformOrder::getId, PlatformOrder::getShopId));
|
||||
List<PlatformOrderContent> orderContents = ordersMap.values().stream().flatMap(Collection::stream).collect(toList());
|
||||
|
@ -838,6 +847,7 @@ public class ShippingInvoiceFactory {
|
|||
)
|
||||
);
|
||||
Collection<String> shopIds = orderMapByShopId.values();
|
||||
System.out.println("shopIds : " + shopIds);
|
||||
Client client = clientMapper.selectById(clientId);
|
||||
List<Shop> shops = shopMapper.selectBatchIds(shopIds);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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<Balance> {
|
||||
|
||||
BigDecimal getBalanceByClientIdAndCurrency(@Param("clientId")String clientId, @Param("currency")String currency);
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?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.BalanceMapper">
|
||||
<select id="getBalanceByClientIdAndCurrency" resultType="java.math.BigDecimal">
|
||||
SELECT amount
|
||||
FROM balance b
|
||||
JOIN currency c
|
||||
ON b.currency_id = c.id
|
||||
WHERE client_id = #{clientId}
|
||||
AND c.code = #{currency}
|
||||
ORDER BY b.create_time DESC
|
||||
LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
|
@ -16,21 +16,23 @@
|
|||
<select id="findIdByEnName" resultType="org.jeecg.modules.business.entity.Country">
|
||||
SELECT id,
|
||||
CASE
|
||||
WHEN c.name_en IN
|
||||
WHEN c.name_en collate utf8mb4_bin IN
|
||||
<foreach collection="countries" separator="," open="(" close=")" item="country">
|
||||
#{country}
|
||||
</foreach> THEN c.name_en
|
||||
WHEN c.special_name IN
|
||||
</foreach>
|
||||
THEN c.name_en
|
||||
WHEN c.special_name collate utf8mb4_bin IN
|
||||
<foreach collection="countries" separator="," open="(" close=")" item="country">
|
||||
#{country}
|
||||
</foreach> THEN c.special_name
|
||||
</foreach>
|
||||
THEN c.special_name
|
||||
END as name_en
|
||||
FROM country as c
|
||||
WHERE c.name_en IN
|
||||
WHERE c.name_en collate utf8mb4_bin IN
|
||||
<foreach collection="countries" separator="," open="(" close=")" item="country">
|
||||
#{country}
|
||||
</foreach>
|
||||
OR c.special_name IN
|
||||
OR c.special_name collate utf8mb4_bin IN
|
||||
<foreach collection="countries" separator="," open="(" close=")" item="country">
|
||||
#{country}
|
||||
</foreach>
|
||||
|
|
|
@ -647,7 +647,7 @@
|
|||
</foreach>;
|
||||
</update>
|
||||
<select id="fetchEmptyLogisticChannelOrders" resultType="org.jeecg.modules.business.entity.PlatformOrder">
|
||||
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
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
ORDER BY sa.priority DESC LIMIT 1;
|
||||
</select>
|
||||
<select id="listIdAndPriority" resultType="org.jeecg.modules.business.entity.SensitiveAttribute">
|
||||
SELECT id, priority
|
||||
SELECT id, priority, zh_name
|
||||
FROM wia_app.sensitive_attribute
|
||||
</select>
|
||||
</mapper>
|
|
@ -15,6 +15,6 @@
|
|||
FROM transaction
|
||||
WHERE client_id = #{clientId}
|
||||
AND currency = #{currency}
|
||||
ORDER BY create_time;
|
||||
ORDER BY create_time DESC;
|
||||
</select>
|
||||
</mapper>
|
|
@ -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<Balance> {
|
||||
|
||||
BigDecimal getBalanceByClientIdAndCurrency(String clientId, String currency);
|
||||
}
|
|
@ -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<BalanceMapper, Balance> implements IBalanceService {
|
||||
@Autowired
|
||||
private BalanceMapper balanceMapper;
|
||||
@Override
|
||||
public BigDecimal getBalanceByClientIdAndCurrency(String clientId, String currency) {
|
||||
return balanceMapper.getBalanceByClientIdAndCurrency(clientId, currency);
|
||||
}
|
||||
}
|
|
@ -282,6 +282,7 @@ public class PlatformOrderServiceImpl extends ServiceImpl<PlatformOrderMapper, P
|
|||
@Override
|
||||
public Map<String, Map<PlatformOrder, List<PlatformOrderContent>>> findUninvoicedOrders() {
|
||||
List<PlatformOrder> orderList = platformOrderMap.findUninvoicedShippedOrders();
|
||||
System.out.println("orderList size : " + orderList.size());
|
||||
List<PlatformOrderContent> orderContents = platformOrderContentMap.findUninvoicedShippedOrderContents();
|
||||
Map<String, PlatformOrder> orderMap = orderList.stream().collect(toMap(PlatformOrder::getId, Function.identity()));
|
||||
Map<String, String> orderMapByShopId = orderList.stream().collect(toMap(PlatformOrder::getId, PlatformOrder::getShopId));
|
||||
|
|
|
@ -14,15 +14,27 @@ public class Estimation {
|
|||
private BigDecimal totalEstimation;
|
||||
private String currency;
|
||||
private List<String> errorMessages;
|
||||
private List<String> 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<String> errorMessages) {
|
||||
@JsonProperty("errorMessages") List<String> errorMessages,
|
||||
@JsonProperty("orderIds") List<String> 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -30,13 +30,28 @@
|
|||
</#if>
|
||||
</td>
|
||||
</tr>
|
||||
<#list errors as error>
|
||||
<tr>
|
||||
<td style="padding:10px 0;">
|
||||
Error: ${error}
|
||||
</td>
|
||||
</tr>
|
||||
</#list>
|
||||
<tr>
|
||||
<table style="border: 1px solid #bbb; text-align: center;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Shop</th>
|
||||
<th>Order ID</th>
|
||||
<th>Country</th>
|
||||
<th>Sensitive Attribute</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<#list errors as error>
|
||||
<tr>
|
||||
<td>${error.shop}</td>
|
||||
<td>${error.orderId}</td>
|
||||
<td>${error.country}</td>
|
||||
<td>${error.sensitiveAttribute}</td>
|
||||
</tr>
|
||||
</#list>
|
||||
</tbody>
|
||||
</table>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:35px 0 5px 0;">Merci d’utiliser nos services.</td>
|
||||
</tr>
|
||||
|
|
Loading…
Reference in New Issue