mirror of https://github.com/jeecgboot/jeecg-boot
add generation of detail files (WIP)
parent
c78af057e9
commit
ce95c69801
|
@ -1,5 +1,5 @@
|
||||||
CREATE database if NOT EXISTS `wia_app_3` default character set utf8mb4 collate utf8mb4_general_ci;
|
CREATE database if NOT EXISTS `wia_app` default character set utf8mb4 collate utf8mb4_general_ci;
|
||||||
USE `wia_app_3`;
|
USE `wia_app`;
|
||||||
/*
|
/*
|
||||||
Navicat Premium Data Transfer
|
Navicat Premium Data Transfer
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import net.sf.saxon.functions.ScalarSystemFunction;
|
|
||||||
import org.jeecg.modules.business.domain.api.mabang.getorderlist.OrderStatus;
|
import org.jeecg.modules.business.domain.api.mabang.getorderlist.OrderStatus;
|
||||||
import org.jeecg.modules.business.mapper.PlatformOrderMapper;
|
import org.jeecg.modules.business.mapper.PlatformOrderMapper;
|
||||||
import org.jeecg.modules.business.vo.PlatformOrderQuantity;
|
import org.jeecg.modules.business.vo.PlatformOrderQuantity;
|
||||||
|
|
|
@ -29,6 +29,7 @@ import org.jeecg.modules.business.service.impl.ProviderMabangServiceImpl;
|
||||||
import org.jeecg.modules.business.vo.*;
|
import org.jeecg.modules.business.vo.*;
|
||||||
import org.jeecg.modules.quartz.entity.QuartzJob;
|
import org.jeecg.modules.quartz.entity.QuartzJob;
|
||||||
import org.jeecg.modules.quartz.service.IQuartzJobService;
|
import org.jeecg.modules.quartz.service.IQuartzJobService;
|
||||||
|
import org.jeecg.modules.system.service.ISysDepartService;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
@ -118,6 +119,8 @@ public class InvoiceController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysBaseAPI ISysBaseApi;
|
private ISysBaseAPI ISysBaseApi;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private ISysDepartService sysDepartService;
|
||||||
|
@Autowired
|
||||||
Environment env;
|
Environment env;
|
||||||
|
|
||||||
@Value("${jeecg.path.shippingInvoiceDir}")
|
@Value("${jeecg.path.shippingInvoiceDir}")
|
||||||
|
@ -957,6 +960,7 @@ public class InvoiceController {
|
||||||
|
|
||||||
@GetMapping(value = "/checkInvoiceValidity")
|
@GetMapping(value = "/checkInvoiceValidity")
|
||||||
public Result<?> checkInvoiceValidity(@RequestParam("invoiceNumber") String invoiceNumber) {
|
public Result<?> checkInvoiceValidity(@RequestParam("invoiceNumber") String invoiceNumber) {
|
||||||
|
String companyOrgCode = sysDepartService.queryCodeByDepartName(env.getProperty("company.orgName"));
|
||||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
String orgCode = sysUser.getOrgCode();
|
String orgCode = sysUser.getOrgCode();
|
||||||
String email = sysUser.getEmail();
|
String email = sysUser.getEmail();
|
||||||
|
@ -979,7 +983,7 @@ public class InvoiceController {
|
||||||
client = clientService.getClientFromPurchase(invoiceID);
|
client = clientService.getClientFromPurchase(invoiceID);
|
||||||
customerFullName = client.fullName();
|
customerFullName = client.fullName();
|
||||||
String destEmail;
|
String destEmail;
|
||||||
if(orgCode.contains("A04")) {
|
if(!orgCode.equals(companyOrgCode)) {
|
||||||
System.out.println(email + " - " + client.getEmail());
|
System.out.println(email + " - " + client.getEmail());
|
||||||
if(!client.getEmail().equals(email)) {
|
if(!client.getEmail().equals(email)) {
|
||||||
return Result.error(403,"Not authorized to view this page.");
|
return Result.error(403,"Not authorized to view this page.");
|
||||||
|
|
|
@ -29,4 +29,6 @@ public interface ClientMapper extends BaseMapper<Client> {
|
||||||
List<String> getClientsFromPurchases(@Param("purchaseIds") List<String> purchaseIds);
|
List<String> getClientsFromPurchases(@Param("purchaseIds") List<String> purchaseIds);
|
||||||
|
|
||||||
Client getClientBySku(@Param("skuId") String skuId);
|
Client getClientBySku(@Param("skuId") String skuId);
|
||||||
|
|
||||||
|
Client getClientFromInvoice(@Param("invoiceNumber") String invoiceNumber);
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,4 +64,12 @@
|
||||||
JOIN client_sku cs ON c.id = cs.client_id
|
JOIN client_sku cs ON c.id = cs.client_id
|
||||||
WHERE cs.sku_id = #{skuId};
|
WHERE cs.sku_id = #{skuId};
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getClientFromInvoice" resultType="org.jeecg.modules.business.entity.Client">
|
||||||
|
SELECT DISTINCT c.*
|
||||||
|
FROM client c
|
||||||
|
JOIN shop s ON s.owner_id = c.id
|
||||||
|
JOIN platform_order po ON po.shop_id = s.id
|
||||||
|
WHERE po.shipping_invoice_number = #{invoiceNumber} OR po.purchase_invoice_number = #{invoiceNumber};
|
||||||
|
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -56,4 +56,6 @@ public interface IClientService extends IService<Client> {
|
||||||
List<String> getClientsFromPurchases(List<String> purchaseIds);
|
List<String> getClientsFromPurchases(List<String> purchaseIds);
|
||||||
|
|
||||||
Client getClientBySku(String skuId);
|
Client getClientBySku(String skuId);
|
||||||
|
|
||||||
|
Client getClientFromInvoice(String invoiceNumber);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,8 @@ import static org.jeecg.modules.business.entity.Invoice.InvoiceType.*;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class PlatformOrderShippingInvoiceService {
|
public class PlatformOrderShippingInvoiceService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
IClientService clientService;
|
||||||
@Autowired
|
@Autowired
|
||||||
ICurrencyService currencyService;
|
ICurrencyService currencyService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -745,6 +747,13 @@ public class PlatformOrderShippingInvoiceService {
|
||||||
log.info("Generating a new invoice file ...");
|
log.info("Generating a new invoice file ...");
|
||||||
if(filetype.equals("invoice"))
|
if(filetype.equals("invoice"))
|
||||||
pathList = generateInvoiceExcel(invoiceNumber, filetype);
|
pathList = generateInvoiceExcel(invoiceNumber, filetype);
|
||||||
|
else if(filetype.equals("detail")){
|
||||||
|
Client client = clientService.getClientFromInvoice(invoiceNumber);
|
||||||
|
List<FactureDetail> details = getInvoiceDetail(invoiceNumber);
|
||||||
|
List<SavRefundWithDetail> refunds = savRefundWithDetailService.getRefundsByInvoiceNumber(invoiceNumber);
|
||||||
|
exportToExcel(details, refunds, invoiceNumber, client.getInvoiceEntity(), client.getInternalCode());
|
||||||
|
pathList = getPath(INVOICE_DETAIL_DIR, invoiceNumber);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
return "ERROR";
|
return "ERROR";
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,6 +143,11 @@ public class ClientServiceImpl extends ServiceImpl<ClientMapper, Client> impleme
|
||||||
return clientMapper.getClientBySku(skuId);
|
return clientMapper.getClientBySku(skuId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Client getClientFromInvoice(String invoiceNumber) {
|
||||||
|
return clientMapper.getClientFromInvoice(invoiceNumber);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getClientEntity(String id) {
|
public String getClientEntity(String id) {
|
||||||
return clientMapper.getClientEntity(id);
|
return clientMapper.getClientEntity(id);
|
||||||
|
|
|
@ -170,4 +170,6 @@ public interface SysDepartMapper extends BaseMapper<SysDepart> {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<SysDepartExportVo> getSysDepartList(@Param("parentId") String parentId,@Param("tenantId") Integer tenantId);
|
List<SysDepartExportVo> getSysDepartList(@Param("parentId") String parentId,@Param("tenantId") Integer tenantId);
|
||||||
|
|
||||||
|
String queryCodeByDepartName(@Param("departName") String departName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,4 +176,9 @@
|
||||||
</choose>
|
</choose>
|
||||||
ORDER BY depart_order DESC
|
ORDER BY depart_order DESC
|
||||||
</select>
|
</select>
|
||||||
|
<select id="queryCodeByDepartName" resultType="java.lang.String">
|
||||||
|
SELECT org_code
|
||||||
|
FROM sys_depart
|
||||||
|
WHERE depart_name = #{departName}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -231,4 +231,6 @@ public interface ISysDepartService extends IService<SysDepart>{
|
||||||
* @param errorMessageList
|
* @param errorMessageList
|
||||||
*/
|
*/
|
||||||
void importSysDepart(List<SysDepartExportVo> listSysDeparts, List<String> errorMessageList);
|
void importSysDepart(List<SysDepartExportVo> listSysDeparts, List<String> errorMessageList);
|
||||||
|
|
||||||
|
String queryCodeByDepartName(String departName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1339,6 +1339,11 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String queryCodeByDepartName(String departName) {
|
||||||
|
return departMapper.queryCodeByDepartName(departName);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 寻找部门路径
|
* 寻找部门路径
|
||||||
*
|
*
|
||||||
|
|
|
@ -160,9 +160,9 @@ spring:
|
||||||
slow-sql-millis: 5000
|
slow-sql-millis: 5000
|
||||||
datasource:
|
datasource:
|
||||||
master:
|
master:
|
||||||
url: jdbc:mysql://127.0.0.1:3306/wia_app_3?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Europe/Paris
|
url: jdbc:mysql://192.168.31.16:3306/wia_app?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Europe/Paris
|
||||||
username: admin
|
username: admin
|
||||||
password: admin
|
password: WIASourcing2023+
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
# 多数据源配置
|
# 多数据源配置
|
||||||
#multi-datasource1:
|
#multi-datasource1:
|
||||||
|
@ -223,6 +223,7 @@ jeecg:
|
||||||
purchaseTemplatePath: C://dev//templates//Purchase_Invoice_Template.xlsx
|
purchaseTemplatePath: C://dev//templates//Purchase_Invoice_Template.xlsx
|
||||||
# where to store generated file
|
# where to store generated file
|
||||||
purchaseInvoiceDir: C://dev//invoices//purchase
|
purchaseInvoiceDir: C://dev//invoices//purchase
|
||||||
|
purchaseInventoryDir: C://dev//invoices//inventory
|
||||||
|
|
||||||
# purchase invoice template
|
# purchase invoice template
|
||||||
shippingTemplatePath_EU: C://dev//templates//Shipping_Invoice_Template_EU.xlsx
|
shippingTemplatePath_EU: C://dev//templates//Shipping_Invoice_Template_EU.xlsx
|
||||||
|
@ -343,3 +344,9 @@ justauth:
|
||||||
type: default
|
type: default
|
||||||
prefix: 'demo::'
|
prefix: 'demo::'
|
||||||
timeout: 1h
|
timeout: 1h
|
||||||
|
mabang:
|
||||||
|
api:
|
||||||
|
appkey: "87a1a0c46df86eb2683e74776894dae9"
|
||||||
|
devid: "200809"
|
||||||
|
company:
|
||||||
|
orgName: "WIA"
|
Loading…
Reference in New Issue