commit
b9bcf3eda1
149 changed files with 12755 additions and 0 deletions
@ -0,0 +1,154 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xmlns="http://maven.apache.org/POM/4.0.0" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
|
|||
<groupId>org.example</groupId> |
|||
<artifactId>new-db-script</artifactId> |
|||
<version>1.0-SNAPSHOT</version> |
|||
|
|||
<properties> |
|||
<maven.compiler.source>8</maven.compiler.source> |
|||
<maven.compiler.target>8</maven.compiler.target> |
|||
</properties> |
|||
|
|||
<dependencies> |
|||
|
|||
<dependency> |
|||
<groupId>com.zaxxer</groupId> |
|||
<artifactId>HikariCP</artifactId> |
|||
<version>4.0.3</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>commons-dbutils</groupId> |
|||
<artifactId>commons-dbutils</artifactId> |
|||
<version>1.7</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.fasterxml.jackson.core</groupId> |
|||
<artifactId>jackson-databind</artifactId> |
|||
<version>2.9.4</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.fasterxml.jackson.core</groupId> |
|||
<artifactId>jackson-annotations</artifactId> |
|||
<version>2.9.4</version> |
|||
</dependency> |
|||
|
|||
<!-- doc --> |
|||
<dependency> |
|||
<groupId>com.thoughtworks.qdox</groupId> |
|||
<artifactId>qdox</artifactId> |
|||
<version>2.0.1</version> |
|||
</dependency> |
|||
<!-- <dependency>--> |
|||
<!-- <groupId>com.github.shalousun</groupId>--> |
|||
<!-- <artifactId>qdox</artifactId>--> |
|||
<!-- <version>2.0.3</version>--> |
|||
<!-- </dependency>--> |
|||
<!-- 本示例中使用到的相关工具类 --> |
|||
<dependency> |
|||
<groupId>com.idea-aedi</groupId> |
|||
<artifactId>common-spring</artifactId> |
|||
<version>2100.5.6</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>cn.hutool</groupId> |
|||
<artifactId>hutool-all</artifactId> |
|||
<version>5.7.16</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.projectlombok</groupId> |
|||
<artifactId>lombok</artifactId> |
|||
<version>1.18.24</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>mysql</groupId> |
|||
<artifactId>mysql-connector-java</artifactId> |
|||
<version>8.0.15</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.microsoft.sqlserver</groupId> |
|||
<artifactId>mssql-jdbc</artifactId> |
|||
<version>8.2.2.jre8</version> |
|||
<scope>compile</scope> |
|||
</dependency> |
|||
|
|||
|
|||
<dependency> |
|||
<groupId>org.noear</groupId> |
|||
<artifactId>wood</artifactId> |
|||
<version>1.0.7</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.slf4j</groupId> |
|||
<artifactId>slf4j-api</artifactId> |
|||
<version>1.7.10</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>ch.qos.logback</groupId> |
|||
<artifactId>logback-classic</artifactId> |
|||
<version>1.1.2</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>ch.qos.logback</groupId> |
|||
<artifactId>logback-core</artifactId> |
|||
<version>1.1.2</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>junit</groupId> |
|||
<artifactId>junit</artifactId> |
|||
<version>4.13.1</version> |
|||
<scope>compile</scope> |
|||
</dependency> |
|||
|
|||
</dependencies> |
|||
|
|||
<build> |
|||
<finalName>app</finalName> |
|||
<plugins> |
|||
<plugin> |
|||
<groupId>org.apache.maven.plugins</groupId> |
|||
<artifactId>maven-compiler-plugin</artifactId> |
|||
<configuration> |
|||
<source>8</source> |
|||
<target>8</target> |
|||
</configuration> |
|||
</plugin> |
|||
<plugin> |
|||
<artifactId>maven-assembly-plugin</artifactId> |
|||
<configuration> |
|||
<archive> |
|||
<manifest> |
|||
<!--这里要替换成jar包main方法所在类 --> |
|||
<mainClass>com.demo.Application</mainClass> |
|||
</manifest> |
|||
<manifestEntries> |
|||
<Class-Path>.</Class-Path> |
|||
</manifestEntries> |
|||
</archive> |
|||
<descriptorRefs> |
|||
<descriptorRef>jar-with-dependencies</descriptorRef> |
|||
</descriptorRefs> |
|||
</configuration> |
|||
<executions> |
|||
<execution> |
|||
<id>make-assembly</id> <!-- this is used for inheritance merges --> |
|||
<phase>package</phase> <!-- 指定在打包节点执行jar包合并操作 --> |
|||
<goals> |
|||
<goal>single</goal> |
|||
</goals> |
|||
</execution> |
|||
</executions> |
|||
</plugin> |
|||
</plugins> |
|||
</build> |
|||
|
|||
</project> |
@ -0,0 +1,55 @@ |
|||
package com.demo; |
|||
|
|||
import com.demo.cost.SyncVerificationMain; |
|||
import com.demo.cost.TbsServiceImpl; |
|||
import com.demo.dto.DaoContext; |
|||
import com.demo.t20230616.SyncBudget; |
|||
import com.demo.t20230621.BudgetMathMain; |
|||
import com.demo.t20230703.SyncMatchActCenter; |
|||
import com.demo.util.SetData; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/3/22 |
|||
*/ |
|||
@Slf4j |
|||
public class Application { |
|||
|
|||
public static void main(String[] args) { |
|||
String ymString = "202306"; |
|||
//String ymString = System.getProperty("startId");
|
|||
String year = ymString.substring(0,4); |
|||
String month = ymString.substring(4,6); |
|||
Integer y = Integer.parseInt(year); |
|||
Integer m = Integer.parseInt(month); |
|||
//费用申请
|
|||
TbsServiceImpl service = new TbsServiceImpl(); |
|||
//service.removeYiDong(); //移除异动
|
|||
|
|||
SyncMatchActCenter matchActCenter = new SyncMatchActCenter(); |
|||
//matchActCenter.tmain();
|
|||
|
|||
for (int i = 1; i < 13; i++) { |
|||
service.syncCost(y,i); |
|||
} |
|||
//service.syncCost(y,m);
|
|||
|
|||
//费用核销
|
|||
// SyncVerificationMain verificationMain = new SyncVerificationMain();
|
|||
// verificationMain.testMain();
|
|||
|
|||
//更新核销中的预算费用占用
|
|||
// SyncDiscountBudget syncDiscountBudget = new SyncDiscountBudget();
|
|||
// syncDiscountBudget.sync();;
|
|||
|
|||
//根据活动编码,更新申请vtb_flag=1,重新录入核销
|
|||
//SyncActVtb actVtb = new SyncActVtb();
|
|||
//actVtb.tmain(;);
|
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,151 @@ |
|||
package com.demo; |
|||
|
|||
import com.demo.cost.SyncVerificationMain; |
|||
import com.demo.util.SetData; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.junit.Test; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/3/22 |
|||
*/ |
|||
@Slf4j |
|||
public class Application2 { |
|||
|
|||
@Test |
|||
public void test1000(){ |
|||
SetData.startId = 0; |
|||
SyncVerificationMain verificationMain = new SyncVerificationMain(); |
|||
verificationMain.testMain(); |
|||
} |
|||
|
|||
@Test |
|||
public void test2000(){ |
|||
SetData.startId = 1000; |
|||
SyncVerificationMain verificationMain = new SyncVerificationMain(); |
|||
verificationMain.testMain(); |
|||
} |
|||
|
|||
@Test |
|||
public void test3000(){ |
|||
SetData.startId = 2000; |
|||
SyncVerificationMain verificationMain = new SyncVerificationMain(); |
|||
verificationMain.testMain(); |
|||
} |
|||
|
|||
@Test |
|||
public void test4000(){ |
|||
SetData.startId = 3000; |
|||
SyncVerificationMain verificationMain = new SyncVerificationMain(); |
|||
verificationMain.testMain(); |
|||
} |
|||
|
|||
@Test |
|||
public void test5000(){ |
|||
SetData.startId = 4000; |
|||
SyncVerificationMain verificationMain = new SyncVerificationMain(); |
|||
verificationMain.testMain(); |
|||
} |
|||
|
|||
@Test |
|||
public void test6000(){ |
|||
SetData.startId = 5000; |
|||
SyncVerificationMain verificationMain = new SyncVerificationMain(); |
|||
verificationMain.testMain(); |
|||
} |
|||
|
|||
@Test |
|||
public void test7000(){ |
|||
SetData.startId = 6000; |
|||
SyncVerificationMain verificationMain = new SyncVerificationMain(); |
|||
verificationMain.testMain(); |
|||
} |
|||
|
|||
@Test |
|||
public void test8000(){ |
|||
SetData.startId = 7000; |
|||
SyncVerificationMain verificationMain = new SyncVerificationMain(); |
|||
verificationMain.testMain(); |
|||
} |
|||
|
|||
@Test |
|||
public void test9000(){ |
|||
SetData.startId = 8000; |
|||
SyncVerificationMain verificationMain = new SyncVerificationMain(); |
|||
verificationMain.testMain(); |
|||
} |
|||
|
|||
@Test |
|||
public void test10000(){ |
|||
SetData.startId = 9000; |
|||
SyncVerificationMain verificationMain = new SyncVerificationMain(); |
|||
verificationMain.testMain(); |
|||
} |
|||
|
|||
@Test |
|||
public void test11000(){ |
|||
SetData.startId = 10000; |
|||
SyncVerificationMain verificationMain = new SyncVerificationMain(); |
|||
verificationMain.testMain(); |
|||
} |
|||
|
|||
@Test |
|||
public void test12000(){ |
|||
SetData.startId = 11000; |
|||
SyncVerificationMain verificationMain = new SyncVerificationMain(); |
|||
verificationMain.testMain(); |
|||
} |
|||
|
|||
|
|||
////////////////////////////////
|
|||
|
|||
@Test |
|||
public void test13000(){ |
|||
SetData.startId = 12000; |
|||
SyncVerificationMain verificationMain = new SyncVerificationMain(); |
|||
verificationMain.testMain(); |
|||
} |
|||
|
|||
@Test |
|||
public void test14000(){ |
|||
SetData.startId = 13000; |
|||
SyncVerificationMain verificationMain = new SyncVerificationMain(); |
|||
verificationMain.testMain(); |
|||
} |
|||
|
|||
@Test |
|||
public void test15000(){ |
|||
SetData.startId = 14000; |
|||
SyncVerificationMain verificationMain = new SyncVerificationMain(); |
|||
verificationMain.testMain(); |
|||
} |
|||
|
|||
@Test |
|||
public void test16000(){ |
|||
SetData.startId = 15000; |
|||
SyncVerificationMain verificationMain = new SyncVerificationMain(); |
|||
verificationMain.testMain(); |
|||
} |
|||
|
|||
@Test |
|||
public void test17000(){ |
|||
SetData.startId = 16000; |
|||
SyncVerificationMain verificationMain = new SyncVerificationMain(); |
|||
verificationMain.testMain(); |
|||
} |
|||
|
|||
@Test |
|||
public void test18000(){ |
|||
SetData.startId = 17000; |
|||
SyncVerificationMain verificationMain = new SyncVerificationMain(); |
|||
verificationMain.testMain(); |
|||
} |
|||
|
|||
@Test |
|||
public void test19000(){ |
|||
SetData.startId = 18000; |
|||
SyncVerificationMain verificationMain = new SyncVerificationMain(); |
|||
verificationMain.testMain(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.demo; |
|||
|
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/6/15 |
|||
**/ |
|||
public class SqlIdUtil { |
|||
|
|||
public static String buildSqlId(List<?> sqlId) { |
|||
String ids = sqlId.stream().map(Object::toString).collect(Collectors.joining(",")); |
|||
return "("+ids+")"; |
|||
} |
|||
|
|||
public static String buildSqlIdString(List<?> sqlId) { |
|||
String ids = sqlId.stream().map(a->"'"+a.toString()+"'").collect(Collectors.joining(",")); |
|||
return "("+ids+")"; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.demo; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/7/2 |
|||
**/ |
|||
public class SyncActVtb { |
|||
|
|||
public void tmain(List<String> activityCodes){ |
|||
String sql_update = "update tbs_cost_apply left join tbs_activity " + |
|||
"set tbs_cost_apply.vtb_sync = 1 " + |
|||
"where tbs_cost_apply.vtb_sync = 2 and " + |
|||
"tbs_activity.activity_code in "+SqlIdUtil.buildSqlIdString(activityCodes); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,115 @@ |
|||
package com.demo; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
|
|||
import com.demo.cost.TbsMapper; |
|||
import com.demo.cost.entity.JslTbsBudgetLog; |
|||
import com.demo.t20230616.JslTbsScheduleItemBudget; |
|||
import com.demo.t20230702.JslTbsScheduleItemBudgetSync; |
|||
import com.demo.t20230702.XltDiscountBudget; |
|||
import lombok.SneakyThrows; |
|||
import org.junit.Test; |
|||
import org.noear.wood.DbContext; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/7/2 |
|||
**/ |
|||
public class SyncDiscountBudget { |
|||
|
|||
String xlt_sql = " select " + |
|||
" sum(v.shiJiMoney) real_money, " + |
|||
" datepart(quarter,v.timeStart) season_num, " + |
|||
" da.area k1, " + |
|||
" dp.province k2, " + |
|||
" dc.city k3, " + |
|||
" dct.dealerName k4 , " + |
|||
" s.seriesName series_name " + |
|||
" from tiShenQingView v " + |
|||
" left join dealerConnTable dct on dct.id=v.chengBenId " + |
|||
" left join dealerCity dc on dc.id=dct.cid " + |
|||
" left join dealerProvince dp on dp.id=dc.pid " + |
|||
" left join dealerArea da on da.id=dp.aid " + |
|||
" left join emp_product_series_ s on s.id = v.pinPaiId " + |
|||
" where 1=1 and state_='申请中' " + |
|||
" and ((v.timeStart <= '20231231' and v.timeEnd>= '20230101' ) or (v.timeStart>= '20230101' and v.timeStart<= '20231231' ) ) " + |
|||
" and v.shiJiMoney > 0 " + |
|||
" and (v.isZhuanXiang is null or v.isZhuanXiang = 0) " + |
|||
" and dct.dealerName is not null " + |
|||
" group by s.seriesName,datepart(quarter,v.timeStart), da.area,dp.province,dc.city,dct.dealerName " + |
|||
" order by k4"; |
|||
|
|||
@Test |
|||
@SneakyThrows |
|||
public void sync(){ |
|||
DbContext xltDbContext = TbsMapper.getXltDbContext(); |
|||
DbContext jslDbContext = TbsMapper.getJslDbContext(); |
|||
List<XltDiscountBudget> xltDiscountBudgetList = xltDbContext.sql(xlt_sql).getList(XltDiscountBudget.class); |
|||
|
|||
String del_budget_logs = "delete from tbs_budget_log where opt_user_code = 'system'"; |
|||
jslDbContext.sql(del_budget_logs).execute(); |
|||
|
|||
for (XltDiscountBudget discountBudget : xltDiscountBudgetList) { |
|||
String tmpK4 = discountBudget.getK4(); |
|||
Integer seasonNum = discountBudget.getSeasonNum(); |
|||
String seriesName = discountBudget.getSeriesName(); |
|||
if(discountBudget.getK4().contains("季度")){ |
|||
tmpK4 = discountBudget.getK4().split("季度")[1]; |
|||
} |
|||
tmpK4 = tmpK4.replace("销售区域",""); |
|||
tmpK4 = tmpK4.replace("区域",""); |
|||
tmpK4 = tmpK4.replace("预算",""); |
|||
tmpK4 = tmpK4.replace("督协",""); |
|||
String jsl_budget_item = "SELECT" + |
|||
" budget.center_id," + |
|||
" budget.center_type," + |
|||
" budget.center_code," + |
|||
" budget.center_name," + |
|||
" budget.budget_code," + |
|||
" sib.*" + |
|||
" FROM `tbs_schedule_item_budget` sib " + |
|||
" left join tbs_budget budget on sib.budget_id = budget.id " + |
|||
" where budget.budget_code like concat('%','"+tmpK4+"','%') " + |
|||
" and budget.budget_code like concat('%','"+seriesName+"','%') " + |
|||
" and sib.item_name = '2023第"+seasonNum+"季度'"; |
|||
|
|||
JslTbsScheduleItemBudgetSync itemBudget = jslDbContext.sql(jsl_budget_item).getItem(JslTbsScheduleItemBudgetSync.class); |
|||
if(itemBudget.getBudgetId()==null){ |
|||
System.out.println(jsl_budget_item); |
|||
System.out.println("-------"); |
|||
continue; |
|||
} |
|||
JslTbsBudgetLog budgetLog = new JslTbsBudgetLog(); |
|||
budgetLog.setBudgetId(itemBudget.getBudgetId()); |
|||
budgetLog.setBudgetCode(itemBudget.getBudgetCode()); |
|||
budgetLog.setOptType(3); |
|||
budgetLog.setOptUserId("0"); |
|||
budgetLog.setOptUserName("系统导入"); |
|||
budgetLog.setOptUserCode("system"); |
|||
budgetLog.setAmount(discountBudget.getRealMoney().negate()); |
|||
budgetLog.setScheduleId(itemBudget.getScheduleId()); |
|||
budgetLog.setScheduleItemId(itemBudget.getScheduleItemId()); |
|||
budgetLog.setScheduleItemBudgetId(itemBudget.getId()); |
|||
budgetLog.setItemName(itemBudget.getItemName()); |
|||
budgetLog.setStartDate(itemBudget.getStartDate()); |
|||
budgetLog.setEndDate(itemBudget.getEndDate()); |
|||
|
|||
budgetLog.setSubjectId(0L); |
|||
budgetLog.setSubjectCode(""); |
|||
budgetLog.setSubjectName(""); |
|||
budgetLog.setCenterType(itemBudget.getCenterType()); |
|||
budgetLog.setCenterId(itemBudget.getCenterId()); |
|||
budgetLog.setCenterCode(itemBudget.getCenterCode()); |
|||
budgetLog.setCenterName(itemBudget.getCenterName()); |
|||
budgetLog.setRollbackFlag(0); |
|||
budgetLog.setMigrateFlag(0); |
|||
budgetLog.setTenantId("001"); |
|||
|
|||
jslDbContext.table("tbs_budget_log").setEntity(budgetLog).insert(); |
|||
|
|||
} |
|||
} |
|||
|
|||
} |
@ -0,0 +1,102 @@ |
|||
package com.demo.cost; |
|||
|
|||
import com.demo.jsl.entity.costapply.XltCost; |
|||
import com.demo.jsl.entity.costapply.XltCostItem; |
|||
import com.demo.jsl.entity.pay.PayPayment; |
|||
import com.demo.jsl.entity.pay.PayPaymentItem; |
|||
import com.demo.jsl.entity.subject.JslSubject; |
|||
import com.demo.jsl.entity.verifi.VtbVerification; |
|||
import com.demo.jsl.entity.verifi.VtbVerificationSubject; |
|||
import org.noear.wood.DbContext; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.sql.SQLException; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/6/14 |
|||
**/ |
|||
public class Other { |
|||
|
|||
@Deprecated |
|||
private void buildAndSaveCheckPayment(DbContext jslContext, XltCost xltCost, String userId, Long supplierId, BigDecimal totalCheckMoney, Date passDate, Long costApplyId, XltCostItem costItem, Long activityId, JslSubject jslSubject) throws SQLException { |
|||
VtbVerification verification = new VtbVerification(); |
|||
verification.setVerificationCode(costItem.getCostItemCode()); |
|||
verification.setFinishedTime(passDate); |
|||
verification.setCostApplyId(costApplyId); |
|||
verification.setActivityId(activityId); |
|||
verification.setVerificationState(1); |
|||
verification.setPaymentState(1); |
|||
verification.setAmount(costItem.getCheckMoney()); |
|||
verification.setAmountRecord(costItem.getCheckMoney()); |
|||
verification.setRemark("销路通核销号:" + costItem.getCostItemCode()); |
|||
verification.setTenantId("001"); |
|||
verification.setActivityId(activityId); |
|||
verification.setSupplierId(supplierId); |
|||
verification.setSupplierName(costItem.getCusName()); |
|||
verification.setSupplierCode(costItem.getCusCode()); |
|||
verification.setUserId(userId); |
|||
verification.setUserCode(xltCost.getUserCode()); |
|||
verification.setUserName(xltCost.getUserName()); |
|||
Long varifId = jslContext.table("vtb_verification").setEntity(verification).insert(); |
|||
|
|||
VtbVerificationSubject verificationSubject = new VtbVerificationSubject(); |
|||
verificationSubject.setVerificationId(varifId); |
|||
verificationSubject.setVerificationSubCode(costItem.getCostItemCode()); |
|||
verificationSubject.setCostApplyId(costApplyId); |
|||
verificationSubject.setActivityId(activityId); |
|||
verificationSubject.setSubjectId(jslSubject.getId()); |
|||
verificationSubject.setSubjectCode(jslSubject.getSubjectCode()); |
|||
verificationSubject.setSubjectName(jslSubject.getSubjectName()); |
|||
verificationSubject.setSupplierId(supplierId); |
|||
verificationSubject.setSupplierName(costItem.getCusName()); |
|||
verificationSubject.setSupplierCode(costItem.getCusCode()); |
|||
verificationSubject.setUsedAmountRecord(costItem.getCheckMoney()); |
|||
verificationSubject.setUsedAmount(costItem.getCheckMoney()); |
|||
verificationSubject.setCountPerson(costItem.getCountPerson() == null ? 0 : costItem.getCountPerson()); |
|||
verificationSubject.setCountSession(costItem.getCountSession() == null ? 0 : costItem.getCountSession()); |
|||
verificationSubject.setTenantId("001"); |
|||
verificationSubject.setRemark(costItem.getRemark()); |
|||
|
|||
Long varifSubjectId = jslContext.table("vtb_verification_subject").setEntity(verificationSubject).insert(); |
|||
|
|||
PayPayment payPayment = new PayPayment(); |
|||
payPayment.setPayCode(costItem.getCostItemCode()); |
|||
payPayment.setPayType("pay"); |
|||
payPayment.setSupplierId(supplierId); |
|||
payPayment.setSupplierCode(costItem.getCusCode()); |
|||
payPayment.setSupplierName(costItem.getCusName()); |
|||
payPayment.setPayAmount(costItem.getCheckMoney()); |
|||
payPayment.setUserId(userId); |
|||
payPayment.setUserCode(xltCost.getUserCode()); |
|||
payPayment.setUserName(xltCost.getUserName()); |
|||
payPayment.setCreateTime(passDate); |
|||
payPayment.setErpCode(""); |
|||
payPayment.setBillNumber(""); |
|||
payPayment.setRemark("销路通核销号:" + costItem.getCostItemCode()); |
|||
payPayment.setPayTime(passDate); |
|||
payPayment.setTenantId("001"); |
|||
Long payId = jslContext.table("pay_payment").setEntity(payPayment).insert(); |
|||
|
|||
PayPaymentItem payPaymentItem = new PayPaymentItem(); |
|||
payPaymentItem.setPayType("pay"); |
|||
payPaymentItem.setPaymentId(payId); |
|||
payPaymentItem.setItemPayAmount(costItem.getCheckMoney()); |
|||
payPaymentItem.setPayType("pay"); |
|||
payPaymentItem.setSupplierId(supplierId); |
|||
payPaymentItem.setSubjectId(jslSubject.getId()); |
|||
payPaymentItem.setSubjectCode(jslSubject.getSubjectCode()); |
|||
payPaymentItem.setSubjectName(jslSubject.getSubjectName()); |
|||
payPaymentItem.setCreateTime(passDate); |
|||
payPaymentItem.setCostApplyId(costApplyId); |
|||
payPaymentItem.setActivityId(activityId); |
|||
payPaymentItem.setTenantId("001"); |
|||
payPaymentItem.setActivityCode(costItem.getCostItemCode()); |
|||
payPaymentItem.setRemark("销路通核销号:" + costItem.getCostItemCode()); |
|||
payPaymentItem.setVerificationId(varifId); |
|||
payPaymentItem.setVerificationSubjectId(varifSubjectId); |
|||
jslContext.table("pay_payment_item").setEntity(payPaymentItem).insert(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,445 @@ |
|||
package com.demo.cost; |
|||
|
|||
import com.demo.cost.entity.*; |
|||
import com.demo.util.SqlCreateUtil; |
|||
import com.demo.jsl.entity.pay.PayPayment; |
|||
import com.demo.jsl.entity.pay.PayPaymentItem; |
|||
import com.demo.jsl.entity.user.JslUser; |
|||
import com.demo.jsl.entity.verifi.VtbVerification; |
|||
import com.demo.jsl.entity.verifi.VtbVerificationSubject; |
|||
import com.demo.util.SetData; |
|||
import lombok.SneakyThrows; |
|||
import org.junit.Test; |
|||
import org.noear.wood.DbContext; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.sql.SQLException; |
|||
import java.util.*; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/6/14 |
|||
**/ |
|||
public class SyncVerificationMain { |
|||
|
|||
//insert
|
|||
private final String vtb_fund_flow = "vtb_fund_flow"; |
|||
private final String tbs_budget_log = "tbs_budget_log"; |
|||
private final String vtb_verification = "vtb_verification"; |
|||
private final String vtb_verification_subject = "vtb_verification_subject"; |
|||
private final String pay_payment = "pay_payment"; |
|||
private final String pay_payment_item = "pay_payment_item"; |
|||
//update
|
|||
private final String tbs_activity = "tbs_activity"; |
|||
|
|||
|
|||
@Test |
|||
@SneakyThrows |
|||
public void removeCostCode(){ |
|||
String[] arr = new String[]{ |
|||
"6445", |
|||
"10236", |
|||
"11133", |
|||
"11138", |
|||
"13428", |
|||
"13608", |
|||
"13609", |
|||
"13705", |
|||
"13724", |
|||
"14075", |
|||
"14076", |
|||
"14087", |
|||
"15203", |
|||
"15204", |
|||
"15364", |
|||
"15370", |
|||
"15371" |
|||
}; |
|||
this.removeCostIds(Arrays.asList(arr)); |
|||
} |
|||
|
|||
@SneakyThrows |
|||
public void removeCostIds(List<String> jslCostIds){ |
|||
DbContext jslContext = TbsMapper.getJslDbContext(); |
|||
//删除同步异常的数据
|
|||
if (jslCostIds.size() > 0) { |
|||
String rmIdsString = "(" + jslCostIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(",")) + ")"; |
|||
System.out.println("移除历史数据:"+rmIdsString); |
|||
jslContext.sql("delete from vtb_fund_flow where cost_apply_id in " + rmIdsString).execute(); |
|||
//opt_type : 4-费用释放
|
|||
jslContext.sql("delete from tbs_budget_log where opt_type = 4 and cost_apply_id in " + rmIdsString).execute(); |
|||
jslContext.sql("delete from vtb_verification where cost_apply_id in " + rmIdsString).execute(); |
|||
jslContext.sql("delete from vtb_verification_subject where cost_apply_id in " + rmIdsString).execute(); |
|||
jslContext.sql("delete from pay_payment where cost_apply_id in " + rmIdsString).execute(); |
|||
jslContext.sql("delete from pay_payment_item where cost_apply_id in " + rmIdsString).execute(); |
|||
} |
|||
} |
|||
|
|||
@SneakyThrows |
|||
public void testMain(){ |
|||
DbContext jslDbContext = TbsMapper.getJslDbContext(); |
|||
DbContext xltDbContext = TbsMapper.getXltDbContext(); |
|||
// xlt_sync = 2 同步申请预算完成
|
|||
// 获取已同步的费用ID(未完成的)
|
|||
// budget_sync=1 代表命中预算
|
|||
// vtb_sync 0 未开始,1未完成 2->成功 4无核销
|
|||
//String sql_cost_list ="select * from tbs_cost_apply where code = '202212301485' "; //测试
|
|||
//String sql_cost_list ="select * from tbs_cost_apply where xlt_sync = 2 and budget_sync = 1 and (vtb_sync =0 or vtb_sync = 1)";
|
|||
String sql_cost_list ="select * from tbs_cost_apply where xlt_sync = 2 and budget_sync = 1 and vtb_sync !=2 order by id desc"; |
|||
if(SetData.startId!=null){ |
|||
int startId = SetData.startId; |
|||
int endId = startId+1000; |
|||
sql_cost_list = "select * from tbs_cost_apply where xlt_sync = 2 and budget_sync = 1 and vtb_sync !=2 and id>="+startId+" and id <"+endId; |
|||
} |
|||
System.out.println("执行命令:"+ sql_cost_list); |
|||
List<JslTbsCostApply> costList = jslDbContext.sql(sql_cost_list).getList(JslTbsCostApply.class); |
|||
System.out.println("未完成数量:"+costList.size()); |
|||
//移除历史同步失败的
|
|||
List<String> errorCostIds = new ArrayList<>(); |
|||
for (JslTbsCostApply costApply : costList) { |
|||
if(!costApply.getVtbSync().equals(0)){ |
|||
errorCostIds.add(costApply.getId()+""); |
|||
} |
|||
} |
|||
this.removeCostIds(errorCostIds); |
|||
|
|||
int count = 1; |
|||
// 获取活动列表(未释放,以及未完成的)
|
|||
String sql_activity_list ="select * from tbs_activity where cost_apply_id = ?"; |
|||
for (JslTbsCostApply costApply : costList) { |
|||
|
|||
System.out.println(count+"/"+costList.size()+" ["+costApply.getId()+"]"); |
|||
count++; |
|||
|
|||
//标记状态
|
|||
String sql_cost_sync = "update tbs_cost_apply set vtb_sync = 1 where id = "; |
|||
jslDbContext.sql(sql_cost_sync + costApply.getId()).execute(); |
|||
|
|||
// 获取相关的支付单号
|
|||
List<JslTbsActivity> tbsActivities = jslDbContext.sql(sql_activity_list,costApply.getId().toString()).getList(JslTbsActivity.class); |
|||
boolean isOk = buildActivity(jslDbContext, xltDbContext, costApply, tbsActivities); |
|||
//完成标记状态
|
|||
if(isOk){ |
|||
String sql_cost_sync_success = "update tbs_cost_apply set vtb_sync = 2 where id = "; |
|||
jslDbContext.sql(sql_cost_sync_success + costApply.getId()).execute(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
private boolean buildActivity(DbContext jslDbContext, DbContext xltDbContext, JslTbsCostApply costApply, List<JslTbsActivity> tbsActivities) throws SQLException { |
|||
for (JslTbsActivity tbsActivity : tbsActivities) { |
|||
if(tbsActivity.getTotalAmount().compareTo(BigDecimal.ZERO)==0){ |
|||
continue; |
|||
} |
|||
String activityCode = tbsActivity.getActivityCode(); |
|||
// 获取销路通核销明细
|
|||
String sql_xlt_check_cost = |
|||
" SELECT " + |
|||
" cmain.number_ AS main_number, " + |
|||
" clist.listNumber as list_number, " + |
|||
" clist.isYuEBuYuHeXiao not_allow_flag, " + |
|||
" clist.pifumoney as apply_amt, " + |
|||
" (cList.hexiaomoney + cList.shuiJin) check_pass_amt, " + |
|||
" cList.exedate " + |
|||
" FROM " + |
|||
" costreimbursementList clist " + |
|||
" LEFT JOIN costreimbursement cmain " + |
|||
" ON clist.mainID = cmain.id " + |
|||
" WHERE " + |
|||
" cmain.state = '120' " + |
|||
" and clist.iscancel = '0' " + |
|||
" AND oldlistnumber = '"+activityCode+"'";//活动id
|
|||
|
|||
List<XltCheckCostItem> checkCostItemList = xltDbContext.sql(sql_xlt_check_cost).getList(XltCheckCostItem.class); |
|||
|
|||
if(checkCostItemList.size()==0){ |
|||
// String sql_cost_sync_error_4 = "update tbs_cost_apply set vtb_sync = 4 where id = ";
|
|||
// jslDbContext.sql(sql_cost_sync_error_4 + costApply.getId()).execute();
|
|||
System.out.println("无相关核销,活动编码:"+activityCode); |
|||
continue; |
|||
} |
|||
|
|||
String sql_budget_cost_item = "select * from tbs_budget_cost_item where activity_id = ?"; |
|||
JslTbsBudgetCostItem currCostItem = jslDbContext.sql(sql_budget_cost_item, tbsActivity.getId()).getItem(JslTbsBudgetCostItem.class); |
|||
if(currCostItem==null||currCostItem.getId()==null){ |
|||
System.out.println("没有命中核销的费用id:"+ costApply.getId()); |
|||
return false; |
|||
} |
|||
|
|||
// 创建核销
|
|||
BigDecimal totalApplyAmt = BigDecimal.ZERO; |
|||
BigDecimal totalPassAmt = BigDecimal.ZERO; |
|||
for (int i = 0; i < checkCostItemList.size(); i++) { |
|||
XltCheckCostItem checkCostItem = checkCostItemList.get(i); |
|||
this.saveVerification(i, jslDbContext, currCostItem,tbsActivity, checkCostItem); |
|||
totalApplyAmt = totalApplyAmt.add(checkCostItem.getApplyAmt()); |
|||
totalPassAmt = totalPassAmt.add(checkCostItem.getCheckPassAmt()); |
|||
} |
|||
// 不再支付
|
|||
boolean isNotAllow = checkCostItemList.stream().anyMatch(a->a.getNotAllowFlag().equals(1)); |
|||
//更新主表dto
|
|||
JslTbsActivity updAct = new JslTbsActivity(); |
|||
//updAct.setId(tbsActivity.getId());
|
|||
// 释放金额
|
|||
if(isNotAllow){ |
|||
// 不再支付返回预算到预算池
|
|||
BigDecimal totalReleaseAmt = totalApplyAmt.subtract(totalPassAmt); |
|||
if(totalReleaseAmt.compareTo(BigDecimal.ZERO)>0){ |
|||
updAct.setActivityState(4); |
|||
updAct.setReleaseFlag(1); |
|||
updAct.setFinishedFlag(1); |
|||
updAct.setReleaseUserId("0"); |
|||
updAct.setReleaseUserName("系统导入"); |
|||
updAct.setReleaseTime(checkCostItemList.get(0).getExedate()); |
|||
updAct.setReleaseAmount(totalReleaseAmt); |
|||
this.doNotAllowCost(currCostItem,totalReleaseAmt, jslDbContext, costApply, tbsActivity, totalApplyAmt); |
|||
} |
|||
} |
|||
updAct.setUsedAmount(totalPassAmt); |
|||
String sql_update_act_info = SqlCreateUtil.buildUpdateSql(updAct,tbs_activity)+" where id = "+tbsActivity.getId(); |
|||
jslDbContext.sql(sql_update_act_info).execute(); |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
/** |
|||
* |
|||
* @param totalReleaseAmt |
|||
* @param jslDbContext |
|||
* @param costApply |
|||
* @param tbsActivity |
|||
* @param totalApplyAmt |
|||
* @throws SQLException |
|||
*/ |
|||
private void doNotAllowCost(JslTbsBudgetCostItem currCostItem,BigDecimal totalReleaseAmt ,DbContext jslDbContext, JslTbsCostApply costApply, JslTbsActivity tbsActivity, BigDecimal totalApplyAmt) throws SQLException { |
|||
//插入日志流水
|
|||
JslVtbFundFlow fundFlow = new JslVtbFundFlow(); |
|||
fundFlow.setFundType("release"); |
|||
fundFlow.setVerificationId(0L); |
|||
fundFlow.setCenterGoodsCode(tbsActivity.getActivityCode()+"_00"); |
|||
fundFlow.setCostApplyId(tbsActivity.getCostApplyId()); |
|||
fundFlow.setActivityId(tbsActivity.getId()); |
|||
fundFlow.setUsedAmount(totalReleaseAmt); |
|||
fundFlow.setSupplierId(tbsActivity.getSupplierId()); |
|||
fundFlow.setSupplierCode(tbsActivity.getSupplierCode()); |
|||
fundFlow.setSupplierName(tbsActivity.getSupplierName()); |
|||
fundFlow.setTenantId("001"); |
|||
|
|||
fundFlow.setSubjectId(0L); |
|||
fundFlow.setSubjectCode(""); |
|||
fundFlow.setSubjectName(""); |
|||
|
|||
fundFlow.setCenterType(currCostItem.getCenterType()); |
|||
fundFlow.setCenterId(currCostItem.getCenterId()); |
|||
fundFlow.setCenterCode(currCostItem.getCenterCode()); |
|||
fundFlow.setCenterName(currCostItem.getCenterName()); |
|||
|
|||
fundFlow.setTargetType(currCostItem.getTargetType()); |
|||
fundFlow.setTargetId(currCostItem.getTargetId()); |
|||
fundFlow.setTargetCode(currCostItem.getTargetCode()); |
|||
fundFlow.setTargetName(currCostItem.getTargetName()); |
|||
fundFlow.setTargetLevelPathIds(currCostItem.getTargetLevelPathIds()); |
|||
fundFlow.setTargetLevelPathNames(currCostItem.getTargetLevelPathNames()); |
|||
fundFlow.setCenterGoodItemId(currCostItem.getId()); |
|||
|
|||
fundFlow.setSupplierId(tbsActivity.getSupplierId()); |
|||
fundFlow.setSupplierCode(tbsActivity.getSupplierCode()); |
|||
fundFlow.setSupplierName(tbsActivity.getSupplierName()); |
|||
|
|||
jslDbContext.table(vtb_fund_flow).setEntity(fundFlow).insert(); |
|||
|
|||
|
|||
|
|||
String sql_budget_by_ids = "select * from tbs_budget where id = "+ currCostItem.getBudgetId(); |
|||
JslTbsBudget currentBudget = jslDbContext.sql(sql_budget_by_ids).getItem(JslTbsBudget.class); |
|||
|
|||
JslUser jslUser = new JslUser(); |
|||
jslUser.setId("0"); |
|||
jslUser.setCode("0"); |
|||
jslUser.setName("系统导入"); |
|||
|
|||
JslTbsBudgetLog budgetLog = this.buildTbsBudgetLog(4,jslUser, costApply,currCostItem,currentBudget,totalReleaseAmt, tbsActivity); |
|||
budgetLog.setTenantId("001"); |
|||
jslDbContext.table(tbs_budget_log).setEntity(budgetLog).insert(); |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 费用申请相关 |
|||
* @param optType |
|||
* @param sysUser |
|||
* @param costApply |
|||
* @param item |
|||
* @param budget |
|||
* @param amount |
|||
* @param activity |
|||
* @return |
|||
*/ |
|||
public JslTbsBudgetLog buildTbsBudgetLog(Integer optType, JslUser sysUser, JslTbsCostApply costApply, |
|||
JslTbsBudgetCostItem item, JslTbsBudget budget, BigDecimal amount, JslTbsActivity activity) { |
|||
BigDecimal amountAmt = amount; |
|||
if(amountAmt.compareTo(BigDecimal.ZERO)<=0){ |
|||
amountAmt = amountAmt.negate(); |
|||
} |
|||
JslTbsBudgetLog budgetLog = new JslTbsBudgetLog(); |
|||
budgetLog.setBudgetId(item.getBudgetId()); |
|||
budgetLog.setBudgetCode(budget.getBudgetCode()); |
|||
budgetLog.setOptType(optType); |
|||
budgetLog.setOptUserId(sysUser.getId()); |
|||
budgetLog.setOptUserCode(sysUser.getCode()); |
|||
budgetLog.setOptUserName(sysUser.getName()); |
|||
budgetLog.setAmount(amountAmt); |
|||
budgetLog.setScheduleId(item.getScheduleId()); |
|||
budgetLog.setScheduleItemId(item.getScheduleItemId()); |
|||
budgetLog.setScheduleItemBudgetId(item.getId()); |
|||
budgetLog.setItemName(item.getScheduleItemName()); |
|||
budgetLog.setStartDate(item.getActStartDate().atStartOfDay()); |
|||
budgetLog.setEndDate(item.getActEndDate().atStartOfDay()); |
|||
budgetLog.setSubjectId(item.getSubjectId()); |
|||
budgetLog.setSubjectCode(item.getSubjectCode()); |
|||
budgetLog.setSubjectName(item.getSubjectName()); |
|||
budgetLog.setCenterId(item.getCenterId()); |
|||
budgetLog.setCenterCode(item.getCenterCode()); |
|||
budgetLog.setCenterName(item.getCenterName()); |
|||
budgetLog.setCenterType(item.getCenterType()); |
|||
budgetLog.setSupplierId(item.getSupplierId()); |
|||
budgetLog.setSupplierCode(item.getSupplierCode()); |
|||
budgetLog.setSupplierName(item.getSupplierName()); |
|||
budgetLog.setActivityId(item.getActivityId()); |
|||
budgetLog.setActivityCode(item.getActivityCode()); |
|||
budgetLog.setActivityTheme(activity.getActTitle()); |
|||
budgetLog.setCostApplyId(costApply.getId()); |
|||
budgetLog.setCostApplyCode(costApply.getCode()); |
|||
budgetLog.setCostApplyTheme(costApply.getChargeTheme()); |
|||
budgetLog.setTargetType(item.getTargetType()); |
|||
budgetLog.setTargetId(item.getTargetId()); |
|||
budgetLog.setTargetCode(item.getTargetCode()); |
|||
budgetLog.setTargetName(item.getTargetName()); |
|||
budgetLog.setTargetLevelPathIds(item.getTargetLevelPathIds()); |
|||
budgetLog.setTargetLevelPathNames(item.getTargetLevelPathNames()); |
|||
return budgetLog; |
|||
} |
|||
|
|||
|
|||
private void saveVerification(Integer idx , DbContext jslDbContext, JslTbsBudgetCostItem currCostItem,JslTbsActivity tbsActivity, XltCheckCostItem checkCostItem) throws SQLException { |
|||
//查询活动科目
|
|||
String sql_activity_subject = "select * from tbs_activity_subject where activity_id = ?"; |
|||
JslTbsActivitySubject activitySubject = jslDbContext.sql(sql_activity_subject,tbsActivity.getId()).getItem(JslTbsActivitySubject.class); |
|||
//核销金额
|
|||
BigDecimal checkCostAmt = checkCostItem.getCheckPassAmt(); |
|||
//申请核销金额
|
|||
BigDecimal checkApplyCostAmt = checkCostItem.getApplyAmt(); |
|||
|
|||
VtbVerification verification = new VtbVerification(); |
|||
verification.setVerificationCode(checkCostItem.getListNumber()); |
|||
verification.setFinishedTime(checkCostItem.getExedate()); |
|||
verification.setCostApplyId(tbsActivity.getCostApplyId()); |
|||
verification.setActivityId(tbsActivity.getId()); |
|||
verification.setVerificationState(1); |
|||
verification.setPaymentState(1); |
|||
verification.setAmount(checkCostAmt); |
|||
verification.setAmountRecord(checkApplyCostAmt); |
|||
verification.setTenantId("001"); |
|||
verification.setSupplierId(tbsActivity.getSupplierId()); |
|||
verification.setSupplierName(tbsActivity.getSupplierCode()); |
|||
verification.setSupplierCode(tbsActivity.getSupplierName()); |
|||
verification.setUserId("0"); |
|||
verification.setUserCode("0"); |
|||
verification.setUserName("数据导入"); |
|||
|
|||
Long varifId = jslDbContext.table(vtb_verification).setEntity(verification).insert(); |
|||
|
|||
//流水记录
|
|||
JslVtbFundFlow fundFlow = new JslVtbFundFlow(); |
|||
fundFlow.setFundType("verification"); |
|||
fundFlow.setVerificationId(varifId); |
|||
fundFlow.setCenterGoodsCode(tbsActivity.getActivityCode()+"_00"); |
|||
fundFlow.setCostApplyId(tbsActivity.getCostApplyId()); |
|||
fundFlow.setActivityId(tbsActivity.getId()); |
|||
fundFlow.setUsedAmount(checkCostAmt); |
|||
fundFlow.setSupplierId(tbsActivity.getSupplierId()); |
|||
fundFlow.setSupplierCode(tbsActivity.getSupplierCode()); |
|||
fundFlow.setSupplierName(tbsActivity.getSupplierName()); |
|||
fundFlow.setTenantId("001"); |
|||
|
|||
fundFlow.setSubjectId(0L); |
|||
fundFlow.setSubjectCode(""); |
|||
fundFlow.setSubjectName(""); |
|||
|
|||
fundFlow.setCenterType(currCostItem.getCenterType()); |
|||
fundFlow.setCenterId(currCostItem.getCenterId()); |
|||
fundFlow.setCenterCode(currCostItem.getCenterCode()); |
|||
fundFlow.setCenterName(currCostItem.getCenterName()); |
|||
|
|||
fundFlow.setTargetType(currCostItem.getTargetType()); |
|||
fundFlow.setTargetId(currCostItem.getTargetId()); |
|||
fundFlow.setTargetCode(currCostItem.getTargetCode()); |
|||
fundFlow.setTargetName(currCostItem.getTargetName()); |
|||
fundFlow.setTargetLevelPathIds(currCostItem.getTargetLevelPathIds()); |
|||
fundFlow.setTargetLevelPathNames(currCostItem.getTargetLevelPathNames()); |
|||
fundFlow.setCenterGoodItemId(currCostItem.getId()); |
|||
|
|||
fundFlow.setSupplierId(tbsActivity.getSupplierId()); |
|||
fundFlow.setSupplierCode(tbsActivity.getSupplierCode()); |
|||
fundFlow.setSupplierName(tbsActivity.getSupplierName()); |
|||
jslDbContext.table(vtb_fund_flow).setEntity(fundFlow).insert(); |
|||
|
|||
VtbVerificationSubject verificationSubject = new VtbVerificationSubject(); |
|||
verificationSubject.setVerificationId(varifId); |
|||
verificationSubject.setVerificationSubCode(checkCostItem.getMainNumber()); |
|||
verificationSubject.setCostApplyId(tbsActivity.getCostApplyId()); |
|||
verificationSubject.setActivityId(tbsActivity.getId()); |
|||
verificationSubject.setSubjectId(activitySubject.getSubjectId()); |
|||
verificationSubject.setSubjectCode(activitySubject.getSubjectCode()); |
|||
verificationSubject.setSubjectName(activitySubject.getSubjectName()); |
|||
verificationSubject.setSupplierId(tbsActivity.getSupplierId()); |
|||
verificationSubject.setSupplierName(tbsActivity.getSupplierName()); |
|||
verificationSubject.setSupplierCode(tbsActivity.getSupplierCode()); |
|||
verificationSubject.setUsedAmountRecord(checkApplyCostAmt); |
|||
verificationSubject.setUsedAmount(checkCostAmt); |
|||
verificationSubject.setCountPerson(0); |
|||
verificationSubject.setCountSession(0); |
|||
verificationSubject.setTenantId("001"); |
|||
|
|||
Long varifSubjectId = jslDbContext.table(vtb_verification_subject).setEntity(verificationSubject).insert(); |
|||
|
|||
PayPayment payPayment = new PayPayment(); |
|||
payPayment.setPayCode(checkCostItem.getMainNumber()); |
|||
payPayment.setPayType("pay"); |
|||
payPayment.setSupplierId(tbsActivity.getSupplierId()); |
|||
payPayment.setSupplierCode(tbsActivity.getSupplierCode()); |
|||
payPayment.setSupplierName(tbsActivity.getSupplierName()); |
|||
payPayment.setPayAmount(checkCostAmt); |
|||
payPayment.setUserId("0"); |
|||
payPayment.setUserCode("0"); |
|||
payPayment.setUserName("系统导入"); |
|||
payPayment.setCreateTime(checkCostItem.getExedate()); |
|||
payPayment.setErpCode(""); |
|||
payPayment.setBillNumber(""); |
|||
payPayment.setPayTime(checkCostItem.getExedate()); |
|||
payPayment.setTenantId("001"); |
|||
Long payId = jslDbContext.table(pay_payment).setEntity(payPayment).insert(); |
|||
|
|||
PayPaymentItem payPaymentItem = new PayPaymentItem(); |
|||
payPaymentItem.setPayType("pay"); |
|||
payPaymentItem.setPaymentId(payId); |
|||
payPaymentItem.setItemPayAmount(checkCostAmt); |
|||
payPaymentItem.setPolicyItemCode(checkCostItem.getListNumber()); |
|||
payPaymentItem.setPayType("pay"); |
|||
payPaymentItem.setSupplierId(tbsActivity.getSupplierId()); |
|||
payPaymentItem.setSubjectId(activitySubject.getSubjectId()); |
|||
payPaymentItem.setSubjectCode(activitySubject.getSubjectCode()); |
|||
payPaymentItem.setSubjectName(activitySubject.getSubjectName()); |
|||
payPaymentItem.setCostApplyId(tbsActivity.getCostApplyId()); |
|||
payPaymentItem.setActivityId(tbsActivity.getId()); |
|||
payPaymentItem.setTenantId("001"); |
|||
payPaymentItem.setActivityCode(tbsActivity.getActivityCode()); |
|||
payPaymentItem.setVerificationId(varifId); |
|||
payPaymentItem.setVerificationSubjectId(varifSubjectId); |
|||
jslDbContext.table(pay_payment_item).setEntity(payPaymentItem).insert(); |
|||
|
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,40 @@ |
|||
package com.demo.cost; |
|||
|
|||
import org.noear.wood.DbContext; |
|||
|
|||
import java.util.Properties; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/6/14 |
|||
**/ |
|||
public class TbsMapper { |
|||
|
|||
private static DbContext jslCtx; |
|||
private static DbContext xltCtx; |
|||
|
|||
public static DbContext getJslDbContext() { |
|||
if (jslCtx == null) { |
|||
jslCtx = new DbContext("test", |
|||
"jdbc:mysql://192.168.0.9:3306/jsl_mall_qs_dev2?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true", |
|||
"kpjsl", |
|||
"123456"); |
|||
//jslCtx = new DbContext("test", "jdbc:mysql://183.234.29.228:3333/jsl_mall_qs_dev2?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true", "kpjsl", "123456");
|
|||
} |
|||
return jslCtx; |
|||
} |
|||
|
|||
public static DbContext getXltDbContext() { |
|||
if (xltCtx == null) { |
|||
Properties properties = new Properties(); |
|||
properties.setProperty("schema", "xlt"); |
|||
properties.setProperty("url", "jdbc:sqlserver://rm-wz93l107hc277n9ieco.sqlserver.rds.aliyuncs.com:3433;DatabaseName=xiaolutong"); |
|||
properties.setProperty("username", "qs_db_user"); |
|||
properties.setProperty("password", "Aa135246"); |
|||
properties.setProperty("driverClassName", "com.microsoft.sqlserver.jdbc.SQLServerDriver"); |
|||
xltCtx = new DbContext(properties); |
|||
} |
|||
return xltCtx; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,686 @@ |
|||
package com.demo.cost; |
|||
|
|||
import com.demo.SqlIdUtil; |
|||
import com.demo.cost.entity.JslBmsRegion; |
|||
import com.demo.jsl.entity.cate.JslGoodsCategory; |
|||
import com.demo.jsl.entity.costapply.*; |
|||
import com.demo.jsl.entity.goods.JslGoodSpu; |
|||
import com.demo.jsl.entity.pay.PayPayment; |
|||
import com.demo.jsl.entity.pay.PayPaymentItem; |
|||
import com.demo.jsl.entity.subject.JslSubject; |
|||
import com.demo.jsl.entity.supplier.JslSupplier; |
|||
import com.demo.jsl.entity.user.JslUser; |
|||
import com.demo.jsl.entity.verifi.VtbVerification; |
|||
import com.demo.jsl.entity.verifi.VtbVerificationSubject; |
|||
import com.demo.util.*; |
|||
import com.demo.util.dto.DateSplitDTO; |
|||
import lombok.SneakyThrows; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.junit.Test; |
|||
import org.noear.wood.DbContext; |
|||
import org.noear.wood.WoodConfig; |
|||
|
|||
import java.io.IOException; |
|||
import java.math.BigDecimal; |
|||
import java.math.RoundingMode; |
|||
import java.sql.SQLException; |
|||
import java.util.*; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/3/16 |
|||
*/ |
|||
@Slf4j |
|||
public class TbsServiceImpl { |
|||
|
|||
@Test |
|||
@SneakyThrows |
|||
public void removeErrCode(){ |
|||
String[] errorCodes = new String[]{ |
|||
"202304210206", |
|||
"202304210275", |
|||
"202304230662", |
|||
"202304241991", |
|||
"202304241911", |
|||
"202304241916", |
|||
"202304250388", |
|||
"202304281538", |
|||
"202304300382" |
|||
}; |
|||
this.removeCostCode(Arrays.asList(errorCodes)); |
|||
} |
|||
|
|||
@Test |
|||
@SneakyThrows |
|||
public void removeYiDong(){ |
|||
DbContext xltDbContext = TbsMapper.getXltDbContext(); |
|||
List<String> array = xltDbContext.sql("select reportNumber from emp_tpmYiDongMsg where isGuiDang = 1 " + |
|||
" and rowCreateDate>'2023-06-14' GROUP BY reportNumber").getArray("reportNumber"); |
|||
//array.forEach(System.out::println);
|
|||
removeCostCode(array); |
|||
} |
|||
|
|||
@SneakyThrows |
|||
public void removeCostCode(List<String> list){ |
|||
Set<String> codes = new HashSet<>(list); |
|||
DbContext jslContext = TbsMapper.getJslDbContext(); |
|||
//删除同步异常的数据
|
|||
if (codes.size() > 0) { |
|||
String rmCodesString = "(" + codes.stream().map(code -> "'" + code + "'").collect(Collectors.joining(",")) + ")"; |
|||
String selectByCodeSql = "select id from tbs_cost_apply where code in " + rmCodesString; |
|||
List<JslCostApply> selectByCodeList = jslContext.sql(selectByCodeSql).getList(JslCostApply.class); |
|||
System.out.println("==> "+selectByCodeList.size()+"条核销将被移除"); |
|||
if(selectByCodeList.size()==0){ |
|||
return; |
|||
} |
|||
List<String> rmIDs = selectByCodeList.stream().map(a->a.getId()+"").collect(Collectors.toList()); |
|||
this.removeByCostIds(rmIDs); |
|||
} |
|||
} |
|||
|
|||
@Test |
|||
public void removeAction(){ |
|||
String[] arr = new String[]{ |
|||
"19301" |
|||
}; |
|||
this.removeByCostIds(Arrays.asList(arr)); |
|||
} |
|||
|
|||
|
|||
@SneakyThrows |
|||
private void removeByCostIds(List<String> rmIDs){ |
|||
DbContext jslContext = TbsMapper.getJslDbContext(); |
|||
String rmIdsString = "(" + rmIDs.stream().map(id -> "'" + id + "'").collect(Collectors.joining(",")) + ")"; |
|||
jslContext.sql("delete from tbs_activity where cost_apply_id in " + rmIdsString).execute(); |
|||
jslContext.sql("delete from tbs_activity_center where cost_apply_id in " + rmIdsString).execute(); |
|||
jslContext.sql("delete from tbs_activity_center_goods where cost_apply_id in " + rmIdsString).execute(); |
|||
jslContext.sql("delete from tbs_activity_goods where cost_apply_id in " + rmIdsString).execute(); |
|||
jslContext.sql("delete from tbs_activity_subject where cost_apply_id in " + rmIdsString).execute(); |
|||
jslContext.sql("delete from vtb_verification where cost_apply_id in " + rmIdsString).execute(); |
|||
jslContext.sql("delete from vtb_verification_subject where cost_apply_id in " + rmIdsString).execute(); |
|||
jslContext.sql("delete from pay_payment where cost_apply_id in " + rmIdsString).execute(); |
|||
jslContext.sql("delete from pay_payment_item where cost_apply_id in " + rmIdsString).execute(); |
|||
jslContext.sql("delete from tbs_cost_apply where id in " + rmIdsString).execute(); |
|||
jslContext.sql("delete from tbs_budget_log where cost_apply_id in " + rmIdsString).execute(); |
|||
jslContext.sql("delete from tbs_budget_cost_item where cost_apply_id in " + rmIdsString).execute(); |
|||
jslContext.sql("delete from vtb_fund_flow where cost_apply_id in " + rmIdsString).execute(); |
|||
} |
|||
|
|||
@Test |
|||
public void tsunc(){ |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 同步费用主要方法 |
|||
* |
|||
* @param year |
|||
* @param month |
|||
*/ |
|||
@SneakyThrows |
|||
public void syncCost(Integer year, Integer month) { |
|||
String title = "同步" + year + "年" + month + "月数据"; |
|||
DbContext xltContext = TbsMapper.getXltDbContext(); |
|||
DbContext jslContext = TbsMapper.getJslDbContext(); |
|||
List<XltCost> allCostList = getXltCostList(year, month, xltContext); |
|||
if (allCostList.size() < 1) { |
|||
log.info(year + "年" + month + "月无数据"); |
|||
return; |
|||
} |
|||
List<List<XltCost>> listList = CollectionUtil.createList(allCostList, 2000); |
|||
List<XltCost> costList = new ArrayList<>(); |
|||
for (List<XltCost> xltCostList : listList) { |
|||
String codes = "(" + xltCostList.stream().map(xltCost -> "'" + xltCost.getCode() + "'").collect(Collectors.joining(",")) + ")"; |
|||
List<JslCostApply> existCodes = jslContext.sql("select code,xlt_sync from tbs_cost_apply where code in " + codes).getList(JslCostApply.class); |
|||
List<String> rmCodes = new ArrayList<>(); |
|||
for (XltCost xltCost : xltCostList) { |
|||
boolean exist = false; |
|||
for (JslCostApply existCode : existCodes) { |
|||
if (xltCost.getCode().trim().equals(existCode.getCode())) { |
|||
exist = true; |
|||
if (existCode.getXltSync().equals(1)) { |
|||
rmCodes.add(existCode.getCode()); |
|||
exist = false; |
|||
} |
|||
} |
|||
} |
|||
if (!exist) { |
|||
costList.add(xltCost); |
|||
} |
|||
} |
|||
//删除同步异常的数据
|
|||
this.removeCostCode(rmCodes); |
|||
} |
|||
log.info(year + "年" + month + "月 未完成数量:" + costList.size()); |
|||
String fileName = "D:\\logs\\" + year + "_" + month + "_err_codes.log"; |
|||
FileUtil.create(fileName); |
|||
if (costList.size() > 0) { |
|||
this.syncCostMain(xltContext, jslContext, costList, fileName, title); |
|||
} |
|||
xltContext.close(); |
|||
jslContext.close(); |
|||
} |
|||
|
|||
@SneakyThrows |
|||
private void syncCostMain(DbContext xltContext, DbContext jslContext, List<XltCost> costList, String fileName, String title) { |
|||
List<JslGoodsCategory> categoryList = jslContext.sql("select id,xlt_id,code,name from goods_category").getList(JslGoodsCategory.class); |
|||
String customerIds = costList.stream().map(a -> "'" + a.getCusCode() + "'").distinct().collect(Collectors.joining(",")); |
|||
if (customerIds.length() < 1) { |
|||
log.warn("customerIds.length() < 1"); |
|||
return; |
|||
} |
|||
List<JslSupplier> jslSuppliers = jslContext.sql("SELECT id,xlt_id,name,region_first,region_second,region_third,code FROM `bms_supplier` WHERE code in (" + customerIds + ")").getList(JslSupplier.class); |
|||
for (int i = 0; i < costList.size(); i++) { |
|||
XltCost xltCost = costList.get(i); |
|||
try { |
|||
buildCostItem(xltContext, jslContext, categoryList, jslSuppliers, xltCost); |
|||
System.out.println(title + " =>" + i + "/" + costList.size()); |
|||
} catch (SQLException e) { |
|||
e.printStackTrace(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
private void buildCostItem(DbContext xltContext, DbContext jslContext, List<JslGoodsCategory> categoryList, List<JslSupplier> jslSuppliers, XltCost xltCost) throws SQLException { |
|||
JslUser jslUser = jslContext.sql("select id,code from sys_user where code = ?", xltCost.getUserCode()).getItem(JslUser.class); |
|||
String userId = "0"; |
|||
if (jslUser != null&&jslUser.getId()!=null) { |
|||
userId = jslUser.getId(); |
|||
} |
|||
Long supplierId = null; |
|||
|
|||
JslSupplier currSupplier = null; |
|||
for (JslSupplier supplier : jslSuppliers) { |
|||
if (xltCost.getCusCode().equals(supplier.getCode())) { |
|||
supplierId = supplier.getId();; |
|||
currSupplier = supplier; |
|||
break; |
|||
} |
|||
} |
|||
if (currSupplier == null) { |
|||
SetData.supplierIds.add(xltCost.getCusId()); |
|||
SetData.xltSupplierIds2.add(xltCost.getCusId()); |
|||
log.warn("xltCost.getCusId()==null ==>{}",xltCost.getCusId()); |
|||
return; |
|||
} |
|||
|
|||
String saleRegionId = currSupplier.handleSaleRegionId(); |
|||
|
|||
if(saleRegionId.equals("0")){ |
|||
log.warn("客户无销售区域:{}【{}】费用编号:{}",currSupplier.getName(),currSupplier.getCode(),xltCost.getCode()); |
|||
SetData.supplierIds2.add(currSupplier.getName()+" — "+currSupplier.getCode()); |
|||
return; |
|||
} |
|||
|
|||
String sql_sale_region_list = "select id,code,name from bms_region where id = ?"; |
|||
JslBmsRegion saleRegion = jslContext.sql(sql_sale_region_list,saleRegionId).getItem(JslBmsRegion.class); |
|||
if(saleRegion == null||saleRegion.getId()==null){ |
|||
log.warn("客户的销售区域异常:{}【{}】,销售区域ID:{}",currSupplier.getName(),currSupplier.getCode(),saleRegionId); |
|||
return; |
|||
} |
|||
|
|||
if (xltCost.getRemark() == null) { |
|||
xltCost.setRemark("无备注"); |
|||
} |
|||
String remark = xltCost.getRemark().trim().replaceAll(" ", ""); |
|||
if (remark.length() > 580) { |
|||
log.error("备注过长:" + remark); |
|||
remark = remark.substring(0, 580) + "..."; |
|||
} |
|||
xltCost.setRemark(remark); |
|||
|
|||
// Date nowDate = xltCost.getCommitDate() == null ? xltCost.getPassDate() : xltCost.getCommitDate();
|
|||
// if (nowDate == null) {
|
|||
// nowDate = xltCost.getCreateDate();
|
|||
// }
|
|||
Date submitDate = xltCost.getCommitDate(); |
|||
Date passDate = xltCost.getPassDate(); |
|||
Date createDate = xltCost.getCreateDate(); |
|||
|
|||
|
|||
JslCostApply costApply = new JslCostApply(); |
|||
costApply.setCode(xltCost.getCode()); |
|||
costApply.setChargeTheme(xltCost.getTitle()); |
|||
costApply.setSupplierId(supplierId + ""); |
|||
costApply.setSupplierCode(xltCost.getCusCode()); |
|||
costApply.setSupplierName(xltCost.getCusName()); |
|||
costApply.setUserId(userId); |
|||
costApply.setUserCode(xltCost.getUserCode()); |
|||
costApply.setUserName(xltCost.getUserName()); |
|||
costApply.setTenantId("001"); |
|||
costApply.setRemark(xltCost.getRemark()); |
|||
costApply.setSubmitTime(submitDate); |
|||
costApply.setCreateTime(createDate); |
|||
costApply.setPassTime(passDate); |
|||
List<XltCostItem> xltCostItemList = this.getXltCostItemList(costApply.getCode(), xltContext); |
|||
BigDecimal totalMoney = BigDecimal.ZERO; |
|||
BigDecimal totalCheckMoney = BigDecimal.ZERO; |
|||
for (XltCostItem costItem : xltCostItemList) { |
|||
if (costItem.getMoney() == null) { |
|||
costItem.setMoney(BigDecimal.ZERO); |
|||
} |
|||
totalMoney = totalMoney.add(costItem.getMoney()); |
|||
if (costItem.getCheckMoney() == null) { |
|||
costItem.setCheckMoney(BigDecimal.ZERO); |
|||
} |
|||
totalCheckMoney = totalCheckMoney.add(costItem.getCheckMoney()); |
|||
} |
|||
//待执行
|
|||
costApply.setChargeState(2); |
|||
if (totalMoney.compareTo(totalCheckMoney) == 0) { |
|||
//完成
|
|||
costApply.setChargeState(3); |
|||
} |
|||
costApply.setXltSync(1); |
|||
costApply.setTotalActivity(xltCostItemList.size()); |
|||
costApply.setTotalActivityAmount(totalMoney); |
|||
costApply.setTotalActivityUsedAmount(totalCheckMoney); |
|||
Long costApplyId = null; |
|||
try { |
|||
costApplyId = jslContext.table("tbs_cost_apply").setEntity(costApply).insert(); |
|||
} catch (SQLException e) { |
|||
System.out.println(costApply.getSupplierName()); |
|||
System.out.println(costApply.getRemark()); |
|||
e.printStackTrace(); |
|||
} |
|||
if(costApplyId==null){ |
|||
return; |
|||
} |
|||
for (XltCostItem costItem : xltCostItemList) { |
|||
String remark2 = costItem.getRemark().trim().replaceAll(" ", ""); |
|||
if (remark2.length() > 580) { |
|||
log.error("备注过长:" + remark2); |
|||
remark2 = remark2.substring(0, 590) + "..."; |
|||
} |
|||
costItem.setRemark(remark2); |
|||
JslActivity activity = new JslActivity(); |
|||
activity.setActivityCode(costItem.getCostItemCode()); |
|||
boolean finished = costItem.getMoney().compareTo(costItem.getCheckMoney()) == 0; |
|||
activity.setActivityState(finished ? 0 : 2); |
|||
activity.setCostApplyId(costApplyId); |
|||
activity.setCostPassTime(passDate); |
|||
activity.setCostPassFlag(1); |
|||
activity.setActTitle(costItem.getRemark()); |
|||
activity.setSupplierId(supplierId); |
|||
activity.setSupplierCode(costItem.getCusCode()); |
|||
activity.setSupplierName(costItem.getCusName()); |
|||
activity.setActStartDate(costItem.getActStartTime()); |
|||
activity.setActEndDate(costItem.getActEndTime()); |
|||
activity.setPreStartDate(costItem.getActStartTime()); |
|||
activity.setPreEndDate(costItem.getActEndTime()); |
|||
activity.setPreCheckDate(costItem.getPreCheckDate()); |
|||
activity.setRemark(costItem.getRemark()); |
|||
activity.setCreateTime(createDate); |
|||
activity.setTenantId("001"); |
|||
activity.setFinishedFlag(finished ? 1 : 0); |
|||
activity.setFinishedTime(finished ? passDate : null); |
|||
activity.setTotalAmount(costItem.getMoney()); |
|||
activity.setUsedAmount(costItem.getCheckMoney()); |
|||
activity.setXltId(costItem.getId()); |
|||
Long activityId = jslContext.table("tbs_activity").setEntity(activity).insert(); |
|||
JslSubject jslSubject = this.buildAndSaveSubject(jslContext, costApplyId, costItem, activityId); |
|||
|
|||
JslActivityGoods activityGoods = new JslActivityGoods(); |
|||
activityGoods.setCostApplyId(costApplyId); |
|||
activityGoods.setActivityId(activityId); |
|||
activityGoods.setTenantId("001"); |
|||
String targetType = ""; |
|||
String targetCode = ""; |
|||
String targetName = ""; |
|||
String levelIds = ""; |
|||
String levelNames = ""; |
|||
Long targetId = 0L; |
|||
if (costItem.getSpuId() != null) { |
|||
JslGoodSpu goodSpu = jslContext.sql("SELECT * FROM `goods_spu` where xlt_id = ?", costItem.getSpuId()).getItem(JslGoodSpu.class); |
|||
if (goodSpu.getXltId().equals(costItem.getId())) { |
|||
JslGoodsCategory category1 = null; |
|||
JslGoodsCategory category2 = null; |
|||
JslGoodsCategory category3 = null; |
|||
for (JslGoodsCategory category : categoryList) { |
|||
if (category.getXltId().equals(costItem.getCateLv1())) { |
|||
category1 = category; |
|||
} |
|||
if (category.getXltId().equals(costItem.getCateLv2())) { |
|||
category2 = category; |
|||
} |
|||
if (category.getXltId().equals(costItem.getCateLv3())) { |
|||
category3 = category; |
|||
} |
|||
} |
|||
targetType = "spu"; |
|||
targetCode = goodSpu.getSpuCode(); |
|||
targetName = goodSpu.getName(); |
|||
levelIds = goodSpu.getCategoryFirst() + "_" + goodSpu.getCategorySecond() + "_" + goodSpu.getCategoryLast(); |
|||
levelNames = category1.getName() + "_" + category2.getName() + "_" + category3.getName(); |
|||
} |
|||
} else if (costItem.getCateLv3() != null) { |
|||
JslGoodsCategory category1 = null; |
|||
JslGoodsCategory category2 = null; |
|||
JslGoodsCategory category3 = null; |
|||
for (JslGoodsCategory category : categoryList) { |
|||
if (category.getXltId() == null) { |
|||
continue; |
|||
} |
|||
if (category.getXltId().equals(costItem.getCateLv1())) { |
|||
category1 = category; |
|||
} |
|||
if (category.getXltId().equals(costItem.getCateLv2())) { |
|||
category2 = category; |
|||
} |
|||
if (category.getXltId().equals(costItem.getCateLv3())) { |
|||
category3 = category; |
|||
} |
|||
} |
|||
|
|||
targetType = "series"; |
|||
targetCode = category3.getCode(); |
|||
targetName = category3.getName(); |
|||
levelIds = category1.getId() + "_" + category2.getId() + "_" + category3.getId(); |
|||
levelNames = category1.getName() + "_" + category2.getName() + "_" + category3.getName(); |
|||
} else if (costItem.getCateLv2() != null) { |
|||
JslGoodsCategory category1 = null; |
|||
JslGoodsCategory category2 = null; |
|||
for (JslGoodsCategory category : categoryList) { |
|||
if (category.getXltId() == null) { |
|||
continue; |
|||
} |
|||
if (category.getXltId().equals(costItem.getCateLv1())) { |
|||
category1 = category; |
|||
} |
|||
if (category.getXltId().equals(costItem.getCateLv2())) { |
|||
category2 = category; |
|||
} |
|||
} |
|||
targetType = "category"; |
|||
targetCode = category2.getCode(); |
|||
targetName = category2.getName(); |
|||
levelIds = category1.getId() + "_" + category2.getId(); |
|||
levelNames = category1.getName() + "_" + category2.getName(); |
|||
} else if (costItem.getCateLv1() != null) { |
|||
JslGoodsCategory category1 = null; |
|||
for (JslGoodsCategory category : categoryList) { |
|||
if (category.getXltId() != null && category.getXltId().equals(costItem.getCateLv1())) { |
|||
category1 = category; |
|||
} |
|||
} |
|||
targetType = "brand"; |
|||
targetCode = category1.getCode(); |
|||
targetName = category1.getName(); |
|||
levelIds = category1.getId() + ""; |
|||
levelNames = category1.getName(); |
|||
} |
|||
activityGoods.setTargetType(targetType); |
|||
activityGoods.setTargetId(targetId); |
|||
activityGoods.setTargetCode(targetCode); |
|||
activityGoods.setTargetName(targetName); |
|||
activityGoods.setTargetLevelPathIds(levelIds); |
|||
activityGoods.setTargetLevelPathNames(levelNames); |
|||
activityGoods.setRemark(costItem.getProductRemark()); |
|||
jslContext.table("tbs_activity_goods").setEntity(activityGoods).insert(); |
|||
|
|||
|
|||
this.buildAndSaveCenterGoods(jslContext, supplierId,saleRegion, costApplyId, costItem, |
|||
activityId, jslSubject, targetType, targetCode, targetName, levelIds, levelNames, targetId); |
|||
this.buildAndSaveActivityCenter(jslContext, xltCost, supplierId,saleRegion, costApplyId, costItem, activityId, jslSubject); |
|||
|
|||
//核销读取另外一个表
|
|||
// if (costItem.getCheckMoney().compareTo(BigDecimal.ZERO) > 0) {
|
|||
// this.buildAndSaveCheckPayment(jslContext, xltCost, userId, supplierId, totalCheckMoney, passDate, costApplyId, costItem, activityId, jslSubject);
|
|||
// }
|
|||
} |
|||
String updCallBack = "update tbs_cost_apply set xlt_sync = 2 where code = '" + xltCost.getCode() + "'"; |
|||
jslContext.sql(updCallBack).execute(); |
|||
} |
|||
|
|||
|
|||
|
|||
private void buildAndSaveCenterGoods(DbContext jslContext, Long supplierId, JslBmsRegion saleRegion,Long costApplyId, XltCostItem costItem, Long activityId, JslSubject jslSubject, String targetType, String targetCode, String targetName, String levelIds, String levelNames, Long targetId) throws SQLException { |
|||
JslActivityCenterGoods centerGoods = new JslActivityCenterGoods(); |
|||
centerGoods.setCostApplyId(costApplyId); |
|||
centerGoods.setActivityId(activityId); |
|||
centerGoods.setSubjectId(jslSubject.getId()); |
|||
centerGoods.setCenterAmount(costItem.getMoney()); |
|||
centerGoods.setCenterRate(new BigDecimal("100")); |
|||
centerGoods.setCenterType("customer"); |
|||
centerGoods.setTenantId("001"); |
|||
// if (costItem.getCenterId().equals(xltCost.getCusId())) {
|
|||
// centerGoods.setCenterId(supplierId + "");
|
|||
// } else {
|
|||
if(saleRegion!=null&&!"0".equals(saleRegion.getId())){ |
|||
centerGoods.setCenterType("saleRegion"); |
|||
centerGoods.setCenterId(saleRegion.getId()); |
|||
centerGoods.setCenterName(saleRegion.getName()); |
|||
}else { |
|||
centerGoods.setCenterId("__"+supplierId); |
|||
} |
|||
//
|
|||
// JslSupplier centerSuppliers = jslContext.sql("SELECT id,xlt_id,name FROM `bms_supplier` WHERE xlt_id = ?", costItem.getCenterId()
|
|||
// ).getItem(JslSupplier.class);
|
|||
// centerGoods.setCenterId(centerSuppliers.getId() + "");
|
|||
// }
|
|||
centerGoods.setSupplierId(supplierId); |
|||
centerGoods.setSupplierCode(costItem.getCusCode()); |
|||
centerGoods.setSupplierName(costItem.getCusName()); |
|||
centerGoods.setCenterCode(costItem.getCenterCode()); |
|||
centerGoods.setCenterName(costItem.getCenterName()); |
|||
//todo 同步核销时更新
|
|||
//centerGoods.setUsedAmount(totalCheckMoney);
|
|||
centerGoods.setUsedAmount(BigDecimal.ZERO); |
|||
centerGoods.setRemark(costItem.getProductRemark()); |
|||
centerGoods.setCostApplyId(costApplyId); |
|||
centerGoods.setActivityId(activityId); |
|||
centerGoods.setActivityCode(costItem.getCostItemCode()); |
|||
centerGoods.setTenantId("001"); |
|||
centerGoods.setTargetType(targetType); |
|||
centerGoods.setTargetId(targetId); |
|||
centerGoods.setCenterGoodsCode(targetCode); |
|||
centerGoods.setTargetCode(targetCode); |
|||
centerGoods.setTargetName(targetName); |
|||
centerGoods.setTargetLevelPathIds(levelIds); |
|||
centerGoods.setTargetLevelPathNames(levelNames); |
|||
centerGoods.setRemark(costItem.getProductRemark()); |
|||
centerGoods.setActStartDate(costItem.getActStartTime()); |
|||
centerGoods.setActEndDate(costItem.getActEndTime()); |
|||
centerGoods.setPreStartDate(costItem.getActStartTime()); |
|||
centerGoods.setPreEndDate(costItem.getActEndTime()); |
|||
centerGoods.setPreCheckDate(costItem.getPreCheckDate()); |
|||
centerGoods.setSubjectId(jslSubject.getId()); |
|||
centerGoods.setSubjectCode(jslSubject.getSubjectCode()); |
|||
centerGoods.setSubjectName(jslSubject.getSubjectName()); |
|||
centerGoods.setCenterAmount(costItem.getMoney()); |
|||
centerGoods.setUsedAmount(costItem.getCheckMoney()); |
|||
centerGoods.setCenterGoodsAmount(costItem.getMoney()); |
|||
centerGoods.setCenterRate(new BigDecimal(100)); |
|||
centerGoods.setCenterGoodsRate(new BigDecimal(100)); |
|||
jslContext.table("tbs_activity_center_goods").setEntity(centerGoods).insert(); |
|||
} |
|||
|
|||
/** |
|||
* 保存成本中心 |
|||
* @param jslContext |
|||
* @param xltCost |
|||
* @param supplierId |
|||
* @param costApplyId |
|||
* @param costItem |
|||
* @param activityId |
|||
* @param jslSubject |
|||
* @throws SQLException |
|||
*/ |
|||
private void buildAndSaveActivityCenter(DbContext jslContext, XltCost xltCost, Long supplierId, JslBmsRegion saleRegion, Long costApplyId, XltCostItem costItem, Long activityId, JslSubject jslSubject) throws SQLException { |
|||
JslActivityCenter activityCenter = new JslActivityCenter(); |
|||
activityCenter.setCostApplyId(costApplyId); |
|||
activityCenter.setActivityId(activityId); |
|||
activityCenter.setSubjectId(jslSubject.getId()); |
|||
activityCenter.setCenterAmount(costItem.getMoney()); |
|||
activityCenter.setCenterRate(new BigDecimal("100")); |
|||
activityCenter.setCenterType("customer"); |
|||
activityCenter.setTenantId("001"); |
|||
// if (costItem.getCenterId().equals(xltCost.getCusId())) {
|
|||
// activityCenter.setCenterId(supplierId + "");
|
|||
// } else {
|
|||
if(saleRegion!=null&&!"0".equals(saleRegion.getId())){ |
|||
activityCenter.setCenterType("saleRegion"); |
|||
activityCenter.setCenterId(saleRegion.getId()); |
|||
activityCenter.setCenterName(saleRegion.getName()); |
|||
}else { |
|||
activityCenter.setCenterId("__"+supplierId); |
|||
} |
|||
// JslSupplier centerSuppliers = jslContext.sql("SELECT id,xlt_id,name FROM `bms_supplier` WHERE xlt_id = ?", costItem.getCenterId()
|
|||
// ).getItem(JslSupplier.class);
|
|||
// activityCenter.setCenterId(centerSuppliers.getId() + "");
|
|||
// }
|
|||
activityCenter.setCenterCode(costItem.getCenterCode()); |
|||
activityCenter.setCenterName(costItem.getCenterName()); |
|||
//todo 同步时更新
|
|||
//activityCenter.setUsedAmount(totalCheckMoney);
|
|||
activityCenter.setUsedAmount(BigDecimal.ZERO); |
|||
activityCenter.setRemark(costItem.getProductRemark()); |
|||
jslContext.table("tbs_activity_center").setEntity(activityCenter).insert(); |
|||
} |
|||
|
|||
private JslSubject buildAndSaveSubject(DbContext jslContext, Long costApplyId, XltCostItem costItem, Long activityId) throws SQLException { |
|||
JslSubject jslSubject = jslContext.sql( |
|||
"select id,xlt_id,subject_name,subject_code from bms_subject where xlt_id = '" + |
|||
costItem.getSubjectXltId() + "'").getItem(JslSubject.class); |
|||
JslActivitySubject activitySubject = new JslActivitySubject(); |
|||
activitySubject.setCostApplyId(costApplyId); |
|||
activitySubject.setActivityId(activityId); |
|||
activitySubject.setSubjectId(jslSubject.getId()); |
|||
activitySubject.setSubjectCode(jslSubject.getSubjectCode()); |
|||
activitySubject.setSubjectName(jslSubject.getSubjectName()); |
|||
activitySubject.setAmount(costItem.getMoney()); |
|||
activitySubject.setCountPerson(costItem.getCountPerson() == null ? 0 : costItem.getCountPerson()); |
|||
activitySubject.setCountSession(costItem.getCountSession() == null ? 0 : costItem.getCountSession()); |
|||
activitySubject.setRemark(costItem.getProductRemark()); |
|||
activitySubject.setTenantId("001"); |
|||
jslContext.table("tbs_activity_subject").setEntity(activitySubject).insert(); |
|||
return jslSubject; |
|||
} |
|||
|
|||
@SneakyThrows |
|||
private List<XltCostItem> getXltCostItemList(String xltCostCode, DbContext xltContext) { |
|||
String sql = "SELECT " + |
|||
" rel.listNumber AS cost_item_code, " + |
|||
" rel.number_ AS cost_code, " + |
|||
" rel.reportTimeStart AS report_start_time, " + |
|||
" rel.reportTimeEnd AS report_end_time, " + |
|||
" rel.changCi AS count_session, " + |
|||
" rel.renShu AS count_person, " + |
|||
" rel.remark, " + |
|||
" rel.pinPai AS cate_lv1, " + |
|||
" rel.pinLei AS cate_lv2, " + |
|||
" rel.productType AS cate_lv3, " + |
|||
" rel.sku AS spu, " + |
|||
" rel.yuSuanTimeStart AS act_start_time, " + |
|||
" rel.yuSuanTimeEnd AS act_end_time, " + |
|||
" rel.yujihexiaoDate AS pre_check_date, " + |
|||
" rel.money, " + |
|||
" rel.hexiaomoney AS check_money, " + |
|||
" rel.chanPinMiaoShu AS product_remark, " + |
|||
" costtype.ID AS subject_xlt_id, " + |
|||
" costtype.number AS subject_code, " + |
|||
" costtype.costnameForSales AS subject_name, " + |
|||
" dea.id AS cus_id, " + |
|||
" dea.dealerName AS cus_name, " + |
|||
" dea.dealerNumber AS cus_code, " + |
|||
" rel.chengBenId AS center_id, " + |
|||
" rel.chengBenName AS center_name, " + |
|||
" dea.dealerNumber AS center_code " + |
|||
" FROM " + |
|||
" ReportList rel " + |
|||
" LEFT JOIN costtype ON costtype.costnum = rel.feeType " + |
|||
" LEFT JOIN DealerConnTable dea ON dea.id LIKE rel.chengBenId"; |
|||
sql = sql + " where rel.number_ = '" + xltCostCode + "'"; |
|||
List<XltCostItem> costItemList = xltContext.sql(sql).getList(XltCostItem.class); |
|||
return costItemList; |
|||
} |
|||
|
|||
@SneakyThrows |
|||
private List<XltCost> getXltCostList(Integer year, Integer month, DbContext xltContext) { |
|||
// String sql = " SELECT " +
|
|||
// " rep.number_ AS code, " +
|
|||
// " rep.title, " +
|
|||
// " rep.fenquId AS region_id, " +
|
|||
// " rep.shengfenId AS province_id, " +
|
|||
// " rep.cityId AS city_id, " +
|
|||
// " rep.createDate AS create_date, " +
|
|||
// " rep.content AS remark2, " +
|
|||
// " rep.remark, " +
|
|||
// " rep.archiveDate AS pass_date, " +
|
|||
// " rep.commitDate AS commit_date, " +
|
|||
// " emp.id AS user_id, " +
|
|||
// " emp.name AS user_name, " +
|
|||
// " emp.numNo AS user_code, " +
|
|||
// " dea.id AS cus_id, " +
|
|||
// " dea.dealerName AS cus_name, " +
|
|||
// " dea.dealerNumber AS cus_code " +
|
|||
// "FROM " +
|
|||
// " Report rep " +
|
|||
// " LEFT JOIN employee emp ON rep.fromEmployee = emp.ID " +
|
|||
// " LEFT JOIN DealerConnTable dea ON dea.id LIKE rep.dealerid " +
|
|||
// " LEFT JOIN ReportList relist ON relist.number_ = rep.number_ " +
|
|||
// "WHERE " +
|
|||
// " rep.state = '70' " +
|
|||
// " AND YEAR ( relist.reportTimeStart ) = '2023' " +
|
|||
// " AND YEAR ( archiveDate ) = '2022' " +
|
|||
// "ORDER BY " +
|
|||
// " rep.archiveDate;";
|
|||
|
|||
String sql = " SELECT " + |
|||
"rep.number_ as code, " + |
|||
"rep.title, " + |
|||
"rep.fenquId as region_id, " + |
|||
"rep.shengfenId as province_id, " + |
|||
"rep.cityId as city_id, " + |
|||
"rep.createDate as create_date, " + |
|||
"rep.content as remark2, " + |
|||
"rep.remark, " + |
|||
"rep.archiveDate as pass_date, " + |
|||
"rep.commitDate as commit_date,"+ |
|||
"emp.id as user_id, " + |
|||
"emp.name as user_name, " + |
|||
"emp.numNo as user_code, " + |
|||
"dea.id as cus_id, " + |
|||
"dea.dealerName as cus_name, " + |
|||
"dea.dealerNumber as cus_code " + |
|||
"FROM Report rep " + |
|||
"LEFT JOIN employee emp ON rep.fromEmployee = emp.ID " + |
|||
"LEFT JOIN DealerConnTable dea ON dea.id like rep.dealerid " + |
|||
"where rep.state = '70' " + |
|||
"and year(archiveDate) = '" + year + "' " + |
|||
"and month(archiveDate) = '" + month + "' " + |
|||
" ORDER BY rep.archiveDate "; |
|||
List<XltCost> xltCostList = xltContext.sql(sql).getList(XltCost.class); |
|||
xltCostList = xltCostList.stream().distinct().collect(Collectors.toList()); |
|||
return xltCostList; |
|||
} |
|||
|
|||
public static void main(String[] args) { |
|||
System.out.println(" SELECT " + |
|||
"rep.number_ as code, " + |
|||
"rep.title, " + |
|||
"rep.fenquId as region_id, " + |
|||
"rep.shengfenId as province_id, " + |
|||
"rep.cityId as city_id, " + |
|||
"rep.createDate as create_date, " + |
|||
"rep.content as remark2, " + |
|||
"rep.remark, " + |
|||
"rep.archiveDate as pass_date, " + |
|||
"rep.commitDate as commit_date,"+ |
|||
"emp.id as user_id, " + |
|||
"emp.name as user_name, " + |
|||
"emp.numNo as user_code, " + |
|||
"dea.id as cus_id, " + |
|||
"dea.dealerName as cus_name, " + |
|||
"dea.dealerNumber as cus_code " + |
|||
"FROM Report rep " + |
|||
"LEFT JOIN employee emp ON rep.fromEmployee = emp.ID " + |
|||
"LEFT JOIN DealerConnTable dea ON dea.id like rep.dealerid " + |
|||
"where rep.state = '70' " + |
|||
"and year(archiveDate) = '' " + |
|||
"and month(archiveDate) = '' " + |
|||
"ORDER BY rep.archiveDate "); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,27 @@ |
|||
package com.demo.cost.entity; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/6/16 |
|||
**/ |
|||
@Data |
|||
public class JslBmsRegion { |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 名称 |
|||
*/ |
|||
private String name; |
|||
|
|||
/** |
|||
* 编码 |
|||
*/ |
|||
private String code; |
|||
|
|||
} |
@ -0,0 +1,147 @@ |
|||
package com.demo.cost.entity; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 费用活动 实体类 |
|||
* |
|||
* @author YenHex |
|||
* @since 2022-11-08 |
|||
*/ |
|||
@Data |
|||
public class JslTbsActivity implements Serializable { |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private Long id; |
|||
|
|||
/** |
|||
* 编码 |
|||
*/ |
|||
private String activityCode; |
|||
|
|||
/** |
|||
* 活动状态:0-待核销;1-审批中;2-完成;3-冻结;4-已释放 |
|||
*/ |
|||
private Integer activityState; |
|||
|
|||
/** |
|||
* 费用申请id |
|||
*/ |
|||
private Long costApplyId; |
|||
|
|||
/** |
|||
* 费用通过时间 |
|||
*/ |
|||
private Date costPassTime; |
|||
|
|||
/** |
|||
* 费用通过标识,用于已申请费用活动列表 |
|||
*/ |
|||
private Integer costPassFlag; |
|||
|
|||
/** |
|||
* 活动简述及目的 |
|||
*/ |
|||
private String actTitle; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private Long supplierId; |
|||
|
|||
/** |
|||
* 客户编码 |
|||
*/ |
|||
private String supplierCode; |
|||
|
|||
/** |
|||
* 客户名称 |
|||
*/ |
|||
private String supplierName; |
|||
|
|||
/** |
|||
* 活动开始时间 |
|||
*/ |
|||
private Date actStartDate; |
|||
|
|||
/** |
|||
* 活动结束时间 |
|||
*/ |
|||
private Date actEndDate; |
|||
|
|||
/** |
|||
* 预算开始时间 |
|||
*/ |
|||
private Date preStartDate; |
|||
|
|||
/** |
|||
* 预算结束时间 |
|||
*/ |
|||
private Date preEndDate; |
|||
|
|||
/** |
|||
* 预计核销时间 |
|||
*/ |
|||
private Date preCheckDate; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createTime; |
|||
|
|||
/** |
|||
* 所属租户 |
|||
*/ |
|||
private String tenantId; |
|||
|
|||
/** |
|||
* 完成标识 |
|||
*/ |
|||
private Integer finishedFlag; |
|||
|
|||
/** |
|||
* 完成时间 |
|||
*/ |
|||
private Date finishedTime; |
|||
|
|||
/** |
|||
* 合计金额 |
|||
*/ |
|||
private BigDecimal totalAmount; |
|||
|
|||
/** |
|||
* 使用金额 |
|||
*/ |
|||
private BigDecimal usedAmount; |
|||
|
|||
private String xltId; |
|||
|
|||
|
|||
private Date releaseTime; |
|||
|
|||
/** 释放人员id */ |
|||
private String releaseUserId; |
|||
|
|||
/** 释放人员 */ |
|||
private String releaseUserName; |
|||
|
|||
/** 释放标识 */ |
|||
private Integer releaseFlag; |
|||
|
|||
/** 释放金额 */ |
|||
private BigDecimal releaseAmount; |
|||
|
|||
|
|||
} |
|||
|
@ -0,0 +1,204 @@ |
|||
package com.demo.cost.entity; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/6/15 |
|||
**/ |
|||
@Data |
|||
public class JslTbsActivityCenterGoods { |
|||
|
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private Long id; |
|||
|
|||
private String centerGoodsCode; |
|||
|
|||
/** |
|||
* 费用申请id |
|||
*/ |
|||
private Long costApplyId; |
|||
|
|||
/** |
|||
* 活动id |
|||
*/ |
|||
private Long activityId; |
|||
|
|||
/** |
|||
* 活动编码 |
|||
*/ |
|||
private String activityCode; |
|||
|
|||
/** |
|||
* 科目id |
|||
*/ |
|||
private Long subjectId; |
|||
|
|||
/** |
|||
* 科目编码 |
|||
*/ |
|||
private String subjectCode; |
|||
|
|||
/** |
|||
* 科目名称 |
|||
*/ |
|||
private String subjectName; |
|||
|
|||
/** |
|||
* 费用额度 |
|||
*/ |
|||
private BigDecimal centerGoodsAmount; |
|||
|
|||
/** |
|||
* 费用占比 |
|||
*/ |
|||
private BigDecimal centerGoodsRate; |
|||
|
|||
/** |
|||
* 费用已用额度 |
|||
*/ |
|||
private BigDecimal usedAmount; |
|||
|
|||
/** |
|||
* 成本中心类型 |
|||
*/ |
|||
private String centerType; |
|||
|
|||
/** |
|||
* 成本中心id |
|||
*/ |
|||
private String centerId; |
|||
|
|||
/** |
|||
* 成本中心编码 |
|||
*/ |
|||
private String centerCode; |
|||
|
|||
/** |
|||
* 成本中心名称 |
|||
*/ |
|||
private String centerName; |
|||
|
|||
/** |
|||
* 费用额度 |
|||
*/ |
|||
private BigDecimal centerAmount; |
|||
|
|||
/** |
|||
* 费用占比 |
|||
*/ |
|||
private BigDecimal centerRate; |
|||
|
|||
/** |
|||
* 目标类型(brand、category、series、spu、sku) |
|||
*/ |
|||
private String targetType; |
|||
|
|||
/** |
|||
* 目标id |
|||
*/ |
|||
private Long targetId; |
|||
|
|||
/** |
|||
* 目标编码 |
|||
*/ |
|||
private String targetCode; |
|||
|
|||
/** |
|||
* 目标名称 |
|||
*/ |
|||
private String targetName; |
|||
|
|||
/** |
|||
* 目标等级id路径 |
|||
*/ |
|||
private String targetLevelPathIds; |
|||
|
|||
/** |
|||
* 目标等级名称路径 |
|||
*/ |
|||
private String targetLevelPathNames; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private LocalDateTime createTime; |
|||
|
|||
/** |
|||
* 最后更新时间 |
|||
*/ |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** |
|||
* 所属租户 |
|||
*/ |
|||
private String tenantId; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createBy; |
|||
|
|||
private String updateBy; |
|||
|
|||
|
|||
/** |
|||
* 活动开始时间 |
|||
*/ |
|||
private Date actStartDate; |
|||
|
|||
/** |
|||
* 活动结束时间 |
|||
*/ |
|||
private Date actEndDate; |
|||
|
|||
/** |
|||
* 预算开始时间 |
|||
*/ |
|||
private Date preStartDate; |
|||
|
|||
/** |
|||
* 预算结束时间 |
|||
*/ |
|||
private Date preEndDate; |
|||
|
|||
/** |
|||
* 预计核销时间 |
|||
*/ |
|||
private Date preCheckDate; |
|||
|
|||
/** |
|||
* 模板唯一健 |
|||
*/ |
|||
private String tmpUk; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private Long supplierId; |
|||
|
|||
/** |
|||
* 客户编码 |
|||
*/ |
|||
private String supplierCode; |
|||
|
|||
/** |
|||
* 客户名称 |
|||
*/ |
|||
private String supplierName; |
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,106 @@ |
|||
package com.demo.cost.entity; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
|
|||
/** |
|||
* 活动科目项 实体类 |
|||
* |
|||
* @author YenHex |
|||
* @since 2022-11-09 |
|||
*/ |
|||
@Data |
|||
public class JslTbsActivitySubject implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private Long id; |
|||
|
|||
/** |
|||
* 费用申请id |
|||
*/ |
|||
private Long costApplyId; |
|||
|
|||
/** |
|||
* 活动id |
|||
*/ |
|||
private Long activityId; |
|||
|
|||
/** |
|||
* 科目id |
|||
*/ |
|||
private Long subjectId; |
|||
|
|||
/** |
|||
* 科目编码 |
|||
*/ |
|||
private String subjectCode; |
|||
|
|||
/** |
|||
* 科目名称 |
|||
*/ |
|||
private String subjectName; |
|||
|
|||
/** |
|||
* 费用额度 |
|||
*/ |
|||
private BigDecimal amount; |
|||
|
|||
/** |
|||
* 费用额度 |
|||
*/ |
|||
private BigDecimal usedAmount; |
|||
|
|||
/** |
|||
* 场次 |
|||
*/ |
|||
private Integer countSession; |
|||
|
|||
/** |
|||
* 人数 |
|||
*/ |
|||
private Integer countPerson; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private LocalDateTime createTime; |
|||
|
|||
/** |
|||
* 最后更新时间 |
|||
*/ |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** |
|||
* 所属租户 |
|||
*/ |
|||
private String tenantId; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createBy; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updateBy; |
|||
|
|||
/** |
|||
* 逻辑删除标记(0:显示;1:隐藏) |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
} |
|||
|
@ -0,0 +1,85 @@ |
|||
package com.demo.cost.entity; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.time.LocalDateTime; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/6/15 |
|||
**/ |
|||
@Data |
|||
public class JslTbsBudget { |
|||
|
|||
private Long id; |
|||
|
|||
/** 预算编码 */ |
|||
private String budgetCode; |
|||
|
|||
/** 费用启用状态 0/1 */ |
|||
private Integer budgetState; |
|||
|
|||
/** 科目id */ |
|||
private Long subjectId; |
|||
|
|||
/** 科目编码 */ |
|||
private String subjectCode; |
|||
|
|||
/** 科目名称 */ |
|||
private String subjectName; |
|||
|
|||
/** 成本中心id */ |
|||
private String centerId; |
|||
|
|||
private String centerType; |
|||
|
|||
/** 成本中心编码 */ |
|||
private String centerCode; |
|||
|
|||
/** 成本中心名称 */ |
|||
private String centerName; |
|||
|
|||
/** 考核期id */ |
|||
private Long scheduleId; |
|||
|
|||
/** 考核期编码 */ |
|||
private String scheduleCode; |
|||
|
|||
/** 考核期名称 */ |
|||
private String scheduleName; |
|||
|
|||
/** 备注 */ |
|||
private String remark; |
|||
|
|||
/** 条件标识 */ |
|||
private Integer conditionFlag; |
|||
|
|||
/** 创建时间 */ |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 最后更新时间 */ |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 所属租户 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 创建人 */ |
|||
private String createBy; |
|||
|
|||
/** 更新人 */ |
|||
private String updateBy; |
|||
|
|||
/** 逻辑删除标记(0:显示;1:隐藏) */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String delFlag; |
|||
|
|||
|
|||
} |
@ -0,0 +1,211 @@ |
|||
package com.demo.cost.entity; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDate; |
|||
import java.time.LocalDateTime; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/6/15 |
|||
**/ |
|||
@Data |
|||
public class JslTbsBudgetCostItem { |
|||
|
|||
|
|||
private Long id; |
|||
|
|||
/** 成本明细编码 */ |
|||
//(max = 30,message = "成本明细编码长度不能超过30字")
|
|||
private String centerGoodsCode; |
|||
|
|||
/** 费用申请id */ |
|||
//(message = "费用申请id不能为空")
|
|||
private Long costApplyId; |
|||
|
|||
/** 活动id */ |
|||
//(message = "活动id不能为空")
|
|||
private Long activityId; |
|||
|
|||
/** 活动编码 */ |
|||
private String activityCode; |
|||
|
|||
/** 客户id */ |
|||
private Long supplierId; |
|||
|
|||
/** 客户编码 */ |
|||
private String supplierCode; |
|||
|
|||
/** 客户名称 */ |
|||
private String supplierName; |
|||
|
|||
/** 科目id */ |
|||
//(message = "科目id不能为空")
|
|||
private Long subjectId; |
|||
|
|||
/** 科目编码 */ |
|||
//(message = "科目编码不能为空")
|
|||
//(max = 50,message = "科目编码长度不能超过50字")
|
|||
private String subjectCode; |
|||
|
|||
/** 科目名称 */ |
|||
//(message = "科目名称不能为空")
|
|||
//(max = 50,message = "科目名称长度不能超过50字")
|
|||
private String subjectName; |
|||
|
|||
/** 成本中心类型 */ |
|||
//(message = "成本中心类型不能为空")
|
|||
//(max = 50,message = "成本中心类型长度不能超过50字")
|
|||
private String centerType; |
|||
|
|||
/** 成本中心id */ |
|||
//(message = "成本中心id不能为空")
|
|||
//(max = 32,message = "成本中心id长度不能超过32字")
|
|||
private String centerId; |
|||
|
|||
/** 成本中心编码 */ |
|||
//(message = "成本中心编码不能为空")
|
|||
//(max = 50,message = "成本中心编码长度不能超过50字")
|
|||
private String centerCode; |
|||
|
|||
/** 成本中心名称 */ |
|||
//(message = "成本中心名称不能为空")
|
|||
//(max = 50,message = "成本中心名称长度不能超过50字")
|
|||
private String centerName; |
|||
|
|||
/** 成本中心金额 */ |
|||
//(message = "成本中心金额不能为空")
|
|||
private BigDecimal centerAmount; |
|||
|
|||
/** 成本中心占比 */ |
|||
//(message = "成本中心占比不能为空")
|
|||
private BigDecimal centerRate; |
|||
|
|||
/** 费用额度 */ |
|||
//(message = "费用额度不能为空")
|
|||
private BigDecimal centerGoodsAmount; |
|||
|
|||
/** 费用占比 */ |
|||
//(message = "费用占比不能为空")
|
|||
private BigDecimal centerGoodsRate; |
|||
|
|||
/** 目标类型(brand、category、series、spu、sku) */ |
|||
//(message = "目标类型(brand、category、series、spu、sku)不能为空")
|
|||
//(max = 30,message = "目标类型(brand、category、series、spu、sku)长度不能超过30字")
|
|||
private String targetType; |
|||
|
|||
/** 目标id */ |
|||
//(message = "目标id不能为空")
|
|||
private Long targetId; |
|||
|
|||
/** 目标编码 */ |
|||
//(message = "目标编码不能为空")
|
|||
//(max = 30,message = "目标编码长度不能超过30字")
|
|||
private String targetCode; |
|||
|
|||
/** 目标名称 */ |
|||
//(message = "目标名称不能为空")
|
|||
//(max = 30,message = "目标名称长度不能超过30字")
|
|||
private String targetName; |
|||
|
|||
/** 目标等级路径 */ |
|||
//(max = 600,message = "目标等级路径长度不能超过600字")
|
|||
private String targetLevelPathIds; |
|||
|
|||
/** 目标等级路径 */ |
|||
//(max = 600,message = "目标等级路径长度不能超过600字")
|
|||
private String targetLevelPathNames; |
|||
|
|||
/** 备注 */ |
|||
//(max = 255,message = "备注长度不能超过255字")
|
|||
private String remark; |
|||
|
|||
/** 创建时间 */ |
|||
//(pattern = "yyyy-MM-dd HH:mm:ss")
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
//(fill = FieldFill.INSERT)
|
|||
private LocalDateTime createTime; |
|||
|
|||
/** 最后更新时间 */ |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 所属租户 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 创建人 */ |
|||
private String createBy; |
|||
|
|||
/** 更新人 */ |
|||
private String updateBy; |
|||
|
|||
/** 逻辑删除标记(0:显示;1:隐藏) */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String delFlag; |
|||
|
|||
/** 活动开始时间 */ |
|||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") |
|||
private LocalDate actStartDate; |
|||
|
|||
/** 活动结束时间 */ |
|||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") |
|||
private LocalDate actEndDate; |
|||
|
|||
/** 预算开始时间 */ |
|||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") |
|||
private LocalDate preStartDate; |
|||
|
|||
/** 预算结束时间 */ |
|||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") |
|||
private LocalDate preEndDate; |
|||
|
|||
/** 预计核销时间 */ |
|||
//(pattern = "yyyy-MM-dd")
|
|||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") |
|||
private LocalDate preCheckDate; |
|||
|
|||
/** 预算id */ |
|||
//(message = "预算id不能为空")
|
|||
private Long budgetId; |
|||
|
|||
/** 考核id */ |
|||
//(message = "考核id不能为空")
|
|||
private Long scheduleId; |
|||
|
|||
/** 考核期项id */ |
|||
//(message = "考核期项id不能为空")
|
|||
private Long scheduleItemId; |
|||
|
|||
private String scheduleItemName; |
|||
|
|||
/** 录入时考核期总预算 */ |
|||
//(message = "费用占比不能为空")
|
|||
private BigDecimal scheduleItemAmount; |
|||
|
|||
/** 后台参数:录入时,考核期已用金额(含申请占用金额) */ |
|||
private BigDecimal scheduleItemAmountUsed; |
|||
|
|||
/** 录入时,考核期申请占用金额 */ |
|||
private BigDecimal scheduleItemAmountApply; |
|||
|
|||
/** 费用考核期项id */ |
|||
//(message = "费用考核期项id不能为空")
|
|||
private Long scheduleItemBudgetId; |
|||
|
|||
/** TbsActivityCenterGoods的id */ |
|||
private Long centerGoodItemId; |
|||
|
|||
/** 标识是否政策生成的item,不参与业务,为以后拓展使用 */ |
|||
//private Integer policyFlag;
|
|||
|
|||
/** 是否无效(退回,拒绝时使用,释放则不计入预算占用) */ |
|||
private Integer invalidFlag; |
|||
|
|||
} |
@ -0,0 +1,265 @@ |
|||
package com.demo.cost.entity; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/6/15 |
|||
**/ |
|||
@Data |
|||
public class JslTbsBudgetLog { |
|||
|
|||
private Long id; |
|||
|
|||
/** 预算id */ |
|||
//(message = "预算id不能为空")
|
|||
private Long budgetId; |
|||
|
|||
/** 预算编码 */ |
|||
//(message = "预算编码不能为空")
|
|||
//(max = 30,message = "预算编码长度不能超过30字")
|
|||
//(condition = SqlCondition.LIKE)
|
|||
private String budgetCode; |
|||
|
|||
/** 类型: |
|||
* 0-预算新增;1-费用申请;2-预算调增;3-预算调减;4-费用释放;5-费用申请调增;6-费用申请调减 |
|||
**/ |
|||
//(message = "类型不能为空")
|
|||
private Integer optType; |
|||
|
|||
/** 操作人id */ |
|||
//(message = "操作人id不能为空")
|
|||
//(max = 32,message = "操作人id长度不能超过32字")
|
|||
private String optUserId; |
|||
|
|||
/** 操作人名称 */ |
|||
//(message = "操作人名称不能为空")
|
|||
//(max = 32,message = "操作人名称长度不能超过32字")
|
|||
//(condition = SqlCondition.LIKE)
|
|||
private String optUserName; |
|||
|
|||
/** 操作人编号 */ |
|||
//(message = "操作人编号不能为空")
|
|||
//(max = 32,message = "操作人编号长度不能超过32字")
|
|||
private String optUserCode; |
|||
|
|||
/** 预算金额/调整金额/释放金额 */ |
|||
//(message = "预算金额/调整金额/释放金额不能为空")
|
|||
private BigDecimal amount; |
|||
|
|||
/** 考核id */ |
|||
//(message = "考核id不能为空")
|
|||
private Long scheduleId; |
|||
|
|||
/** 考核期项id */ |
|||
//(message = "考核期项id不能为空")
|
|||
private Long scheduleItemId; |
|||
|
|||
/** 预算的考核期id */ |
|||
//(message = "预算的考核期id不能为空")
|
|||
private Long scheduleItemBudgetId; |
|||
|
|||
/** 原考核id */ |
|||
//(message = "考核id不能为空")
|
|||
private Long scheduleOrgId; |
|||
|
|||
/** 原考核期项id */ |
|||
//(message = "考核期项id不能为空")
|
|||
private Long scheduleItemOrgId; |
|||
|
|||
/** 原预算的考核期id */ |
|||
//(message = "预算的考核期id不能为空")
|
|||
private Long scheduleItemBudgetOrgId; |
|||
|
|||
/** 考核编码 */ |
|||
//(message = "考核编码不能为空")
|
|||
//(max = 30,message = "考核编码长度不能超过30字")
|
|||
private String itemName; |
|||
|
|||
/** 开始时间 */ |
|||
//(message = "开始时间不能为空")
|
|||
//(max = 0,message = "开始时间长度不能超过0字")
|
|||
//(pattern = "yyyy-MM-dd HH:mm:ss")
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
private LocalDateTime startDate; |
|||
|
|||
/** 结束时间 */ |
|||
//(message = "结束时间不能为空")
|
|||
//(max = 0,message = "结束时间长度不能超过0字")
|
|||
//(pattern = "yyyy-MM-dd HH:mm:ss")
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
private LocalDateTime endDate; |
|||
|
|||
/** 科目id */ |
|||
//(message = "科目id不能为空")
|
|||
private Long subjectId; |
|||
|
|||
/** 科目编码 */ |
|||
//(message = "科目编码不能为空")
|
|||
//(max = 30,message = "科目编码长度不能超过30字")
|
|||
private String subjectCode; |
|||
|
|||
/** 科目名称 */ |
|||
//(message = "科目名称不能为空")
|
|||
//(max = 30,message = "科目名称长度不能超过30字")
|
|||
private String subjectName; |
|||
|
|||
/** 成本中心类型 */ |
|||
//(message = "成本中心类型不能为空")
|
|||
//(max = 20,message = "成本中心类型长度不能超过20字")
|
|||
private String centerType; |
|||
|
|||
/** 成本中心id */ |
|||
//(message = "成本中心id不能为空")
|
|||
//(max = 32,message = "成本中心id长度不能超过32字")
|
|||
private String centerId; |
|||
|
|||
/** 成本中心编码 */ |
|||
//(message = "成本中心编码不能为空")
|
|||
//(max = 30,message = "成本中心编码长度不能超过30字")
|
|||
private String centerCode; |
|||
|
|||
/** 成本中心名称 */ |
|||
//(message = "成本中心名称不能为空")
|
|||
//(max = 30,message = "成本中心名称长度不能超过30字")
|
|||
private String centerName; |
|||
|
|||
|
|||
/** 原成本中心id */ |
|||
private String centerOrgId; |
|||
|
|||
/** 原成本中心编码 */ |
|||
private String centerOrgCode; |
|||
|
|||
/** 原成本中心名称 */ |
|||
private String centerOrgName; |
|||
|
|||
/** 客户id */ |
|||
private Long supplierId; |
|||
|
|||
/** 客户编码 */ |
|||
//(max = 30,message = "客户编码长度不能超过30字")
|
|||
private String supplierCode; |
|||
|
|||
/** 客户名称 */ |
|||
//(max = 30,message = "客户名称长度不能超过30字")
|
|||
private String supplierName; |
|||
|
|||
/** 活动id */ |
|||
private Long activityId; |
|||
|
|||
/** 活动编码 */ |
|||
//(max = 30,message = "活动编码长度不能超过30字")
|
|||
//(condition = SqlCondition.LIKE)
|
|||
private String activityCode; |
|||
|
|||
private String activityTheme; |
|||
|
|||
/** 政策id */ |
|||
private Long policyId; |
|||
|
|||
/** 政策编码 */ |
|||
//(max = 30,message = "政策编码长度不能超过30字")
|
|||
private String policyCode; |
|||
|
|||
/** 政策标题 */ |
|||
//(max = 255,message = "政策标题长度不能超过255字")
|
|||
private String policyTitle; |
|||
|
|||
/** 政策项id */ |
|||
private Long policyItemId; |
|||
|
|||
/** 政策项编码 */ |
|||
//(max = 30,message = "政策项编码长度不能超过30字")
|
|||
private String policyItemCode; |
|||
|
|||
/** 费用申请id */ |
|||
private Long costApplyId; |
|||
|
|||
/** 费用申请编码 */ |
|||
//(max = 30,message = "费用申请编码长度不能超过30字")
|
|||
private String costApplyCode; |
|||
|
|||
/** 费用申请主题 */ |
|||
//(max = 150,message = "费用申请主题长度不能超过150字")
|
|||
private String costApplyTheme; |
|||
|
|||
/** 备注 */ |
|||
//(max = 255,message = "备注长度不能超过255字")
|
|||
private String remark; |
|||
|
|||
/** |
|||
* 回退标识 |
|||
* */ |
|||
private Integer rollbackFlag; |
|||
|
|||
/** |
|||
* 迁移标识:0-未迁移;1-已迁移 |
|||
**/ |
|||
private Integer migrateFlag; |
|||
|
|||
/** |
|||
* 迁移时间 |
|||
**/ |
|||
private LocalDateTime migrateTime; |
|||
|
|||
/** 所属租户 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 目标类型(brand、category、series、spu、sku) */ |
|||
//(max = 30,message = "目标类型(brand、category、series、spu、sku)长度不能超过30字")
|
|||
private String targetType; |
|||
|
|||
/** 目标id */ |
|||
private Long targetId; |
|||
|
|||
/** 目标编码 */ |
|||
//(max = 30,message = "目标编码长度不能超过30字")
|
|||
private String targetCode; |
|||
|
|||
/** 目标名称 */ |
|||
//(max = 30,message = "目标名称长度不能超过30字")
|
|||
private String targetName; |
|||
|
|||
/** 目标等级路径 */ |
|||
//(max = 600,message = "目标等级路径长度不能超过600字")
|
|||
private String targetLevelPathIds; |
|||
|
|||
/** 目标等级路径 */ |
|||
//(max = 600,message = "目标等级路径长度不能超过600字")
|
|||
private String targetLevelPathNames; |
|||
|
|||
/** 创建时间 */ |
|||
//(pattern = "yyyy-MM-dd HH:mm:ss")
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
//(fill = FieldFill.INSERT)
|
|||
private LocalDateTime createTime; |
|||
|
|||
/** 最后更新时间 */ |
|||
//(pattern = "yyyy-MM-dd HH:mm:ss")
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
//(fill = FieldFill.UPDATE)
|
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 创建人 */ |
|||
//(fill = FieldFill.INSERT)
|
|||
private String createBy; |
|||
|
|||
/** 更新人 */ |
|||
//(fill = FieldFill.UPDATE)
|
|||
private String updateBy; |
|||
|
|||
/** 逻辑删除标记(0:显示;1:隐藏) */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String delFlag; |
|||
|
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.demo.cost.entity; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/6/15 |
|||
**/ |
|||
@Data |
|||
public class JslTbsCostApply { |
|||
|
|||
private Long id; |
|||
|
|||
/** 费用申请编码 */ |
|||
private String code; |
|||
|
|||
/** 费用申请主题 */ |
|||
private String chargeTheme; |
|||
|
|||
private Integer vtbSync; |
|||
|
|||
} |
@ -0,0 +1,103 @@ |
|||
package com.demo.cost.entity; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/6/15 |
|||
**/ |
|||
@Data |
|||
public class JslVtbFundFlow { |
|||
|
|||
private Long id; |
|||
|
|||
/** 核销类型 */ |
|||
private String fundType; |
|||
|
|||
/** 核销id */ |
|||
private Long verificationId; |
|||
|
|||
/** 成本明细编码 */ |
|||
private String centerGoodsCode; |
|||
|
|||
/** 费用申请id */ |
|||
private Long costApplyId; |
|||
|
|||
/** 活动id */ |
|||
private Long activityId; |
|||
|
|||
/** 科目id */ |
|||
private Long subjectId; |
|||
|
|||
/** 科目编码 */ |
|||
private String subjectCode; |
|||
|
|||
/** 科目名称 */ |
|||
private String subjectName; |
|||
|
|||
/** 成本中心类型 */ |
|||
private String centerType; |
|||
|
|||
/** 成本中心id */ |
|||
private String centerId; |
|||
|
|||
/** 成本中心编码 */ |
|||
private String centerCode; |
|||
|
|||
/** 成本中心名称 */ |
|||
private String centerName; |
|||
|
|||
/** 已用费用 */ |
|||
private BigDecimal usedAmount; |
|||
|
|||
/** 目标类型(brand、category、series、spu、sku) */ |
|||
private String targetType; |
|||
|
|||
/** 目标id */ |
|||
private Long targetId; |
|||
|
|||
/** 目标编码 */ |
|||
private String targetCode; |
|||
|
|||
/** 目标名称 */ |
|||
private String targetName; |
|||
|
|||
/** 目标等级路径 */ |
|||
private String targetLevelPathIds; |
|||
|
|||
/** 目标等级路径 */ |
|||
private String targetLevelPathNames; |
|||
|
|||
/** 备注 */ |
|||
private String remark; |
|||
|
|||
/** 所属租户 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 逻辑删除标记(0:显示;1:隐藏) */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String delFlag; |
|||
|
|||
/** TbsActivityCenterGoods的id */ |
|||
private Long centerGoodItemId; |
|||
|
|||
|
|||
/** 客户id */ |
|||
private Long supplierId; |
|||
|
|||
/** 客户编码 */ |
|||
private String supplierCode; |
|||
|
|||
/** 客户名称 */ |
|||
private String supplierName; |
|||
|
|||
} |
@ -0,0 +1,50 @@ |
|||
package com.demo.cost.entity; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/6/14 |
|||
**/ |
|||
@Data |
|||
public class XltCheckCostItem { |
|||
|
|||
/** |
|||
* 核销主编码 |
|||
*/ |
|||
String mainNumber; |
|||
|
|||
/** |
|||
* 核销列表编码 |
|||
*/ |
|||
String listNumber; |
|||
|
|||
/** |
|||
* 执行时间 |
|||
*/ |
|||
Date exedate; |
|||
|
|||
/** |
|||
* 申请金额 |
|||
*/ |
|||
BigDecimal applyAmt; |
|||
|
|||
/** |
|||
* 通过审批金额 |
|||
*/ |
|||
BigDecimal checkPassAmt; |
|||
|
|||
/** |
|||
* 不予核销 |
|||
*/ |
|||
Integer notAllowFlag; |
|||
|
|||
/** |
|||
* 不予核销金额 |
|||
*/ |
|||
//BigDecimal notAllowAmt;
|
|||
|
|||
} |
@ -0,0 +1,217 @@ |
|||
package com.demo.dbdemo; |
|||
|
|||
|
|||
import java.io.IOException; |
|||
|
|||
import java.io.InputStream; |
|||
|
|||
import java.lang.reflect.Field; |
|||
|
|||
import java.sql.Connection; |
|||
|
|||
import java.sql.DriverManager; |
|||
|
|||
import java.sql.PreparedStatement; |
|||
|
|||
import java.sql.ResultSet; |
|||
|
|||
import java.sql.SQLException; |
|||
|
|||
import java.util.ArrayList; |
|||
|
|||
import java.util.List; |
|||
|
|||
import java.util.Properties; |
|||
|
|||
|
|||
/** |
|||
* 数据库连接的封装 |
|||
* 数据库增删改查的封装 |
|||
* |
|||
* @author YenHex |
|||
* @since 2023/6/30 |
|||
**/ |
|||
public class DaoUtil{ |
|||
|
|||
private String driver; |
|||
|
|||
private String url; |
|||
|
|||
private String user; |
|||
|
|||
private String password; |
|||
|
|||
public Connection conn = null; |
|||
|
|||
public PreparedStatement pstmt = null; |
|||
|
|||
public ResultSet rs = null; |
|||
|
|||
|
|||
public DaoUtil(String url, String user, String password) { |
|||
this.url = url; |
|||
this.user = user; |
|||
this.password = password; |
|||
if(url.contains("sqlserver")){ |
|||
this.driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; |
|||
}else { |
|||
this.driver = "driverClassName: com.mysql.cj.jdbc.Driver"; |
|||
} |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 获取连接对象的封装 |
|||
* |
|||
* @return Connection |
|||
*/ |
|||
public Connection getConnection() { |
|||
try { |
|||
Class.forName(driver); |
|||
conn = DriverManager.getConnection(url, user, password); |
|||
} catch (SQLException | ClassNotFoundException e) { |
|||
e.printStackTrace(); |
|||
} |
|||
return conn; |
|||
} |
|||
|
|||
/** |
|||
* 对资源释放的封装 |
|||
* |
|||
* @param rs |
|||
* @param pstmt |
|||
* @param conn |
|||
*/ |
|||
public void closeAll(ResultSet rs, PreparedStatement pstmt, Connection conn) { |
|||
if (rs != null) { |
|||
try { |
|||
//此处为释放资源
|
|||
this.rs.close(); |
|||
} catch (SQLException e) { |
|||
e.printStackTrace(); |
|||
} |
|||
} |
|||
|
|||
if (pstmt != null) { |
|||
try { |
|||
//此处为释放资源
|
|||
this.pstmt.close(); |
|||
} catch (SQLException e) { |
|||
e.printStackTrace(); |
|||
} |
|||
} |
|||
|
|||
if (conn != null) { |
|||
try { |
|||
//此处为释放资源
|
|||
this.conn.close(); |
|||
} catch (SQLException e) { |
|||
e.printStackTrace(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 对增删改的封装 |
|||
* |
|||
* @param strSql |
|||
* @param param |
|||
* @return 返回受影响的行数 |
|||
*/ |
|||
public int execute(String strSql, Object[] param) { |
|||
//受影响的行数
|
|||
int resultLine = 0; |
|||
//获取连接对象
|
|||
conn = getConnection(); |
|||
try { |
|||
//获取执行语句的对象
|
|||
pstmt = conn.prepareStatement(strSql); |
|||
//判断是否有带条件参数
|
|||
if (param != null) { |
|||
//如果有点条件参数循环设值
|
|||
for (int i = 0; i < (param == null ? 0 : param.length); i++) { |
|||
//对第i个参数设值
|
|||
pstmt.setObject(i + 1, param[i]); |
|||
} |
|||
//执行并返回受影响的行数
|
|||
resultLine = pstmt.executeUpdate(); |
|||
} |
|||
} catch (SQLException e) { |
|||
e.printStackTrace(); |
|||
} finally { |
|||
closeAll(null, pstmt, conn); |
|||
} |
|||
//返回受影响的行数
|
|||
return resultLine; |
|||
} |
|||
|
|||
/** |
|||
* 查询的封装 |
|||
* 将查询到表的的所有数据存储在Object集合中 |
|||
* |
|||
* @param strSql |
|||
* @param param |
|||
* @return 返回数据集合 |
|||
*/ |
|||
public <T> List<T> query(String strSql, Object[] param, Class<T> clazz) { |
|||
conn = getConnection(); |
|||
//该集合存储数据表数据
|
|||
List<T> pList = new ArrayList<T>(); |
|||
//实体对象
|
|||
T t = null; |
|||
try { |
|||
//获取执行Sql对象
|
|||
pstmt = conn.prepareStatement(strSql); |
|||
if (pstmt != null) { |
|||
for (int i = 0; i < (param == null ? 0 : param.length); i++) { |
|||
pstmt.setObject(i + 1, param[i]); |
|||
} |
|||
//获取数据集合
|
|||
rs = pstmt.executeQuery(); |
|||
//将数据表数据填充到集合中
|
|||
while (rs.next()) { |
|||
t = clazz.newInstance(); |
|||
//将一行中数据的列遍历完成
|
|||
for (int i = 0; i < rs.getMetaData().getColumnCount(); i++) { |
|||
//获取每一列的名称
|
|||
String colName = rs.getMetaData().getColumnName(i + 1); |
|||
//获取每一列的名称对应的值
|
|||
Object value = rs.getObject(colName); |
|||
//把当前的值利用反射添加到实体类中
|
|||
this.setEntity(t, colName, value); |
|||
} |
|||
pList.add(t); |
|||
} |
|||
//为了方便读取,在集合的最后对改表的列数进行存储
|
|||
return pList; |
|||
} |
|||
} catch (SQLException | InstantiationException | IllegalAccessException e) { |
|||
e.printStackTrace(); |
|||
} finally { |
|||
closeAll(this.rs, this.pstmt, this.conn); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
/** |
|||
* 通过反射填充实体类 |
|||
* |
|||
* @param t 实体类对象 |
|||
* @param attr 实体类属性名 |
|||
* @param v 要给属性设的值 |
|||
*/ |
|||
public <T> void setEntity(T t, String attr, Object v) { |
|||
try { |
|||
//获取t类(实体类)的属性,根据attr属性名
|
|||
Field f = t.getClass().getDeclaredField(attr); |
|||
//实体类中的属性是私有的,故做此操作
|
|||
f.setAccessible(true); |
|||
//对改字段赋值v
|
|||
f.set(t, v); |
|||
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { |
|||
e.printStackTrace(); |
|||
} |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,53 @@ |
|||
package com.demo.doc; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/5/16 |
|||
*/ |
|||
public class PrintDemo { |
|||
|
|||
public static void main(String[] args) { |
|||
String sql = "SELECT " + |
|||
" 'tableName' = d.name, " + |
|||
" 'columnName' = A.name, " + |
|||
" 'comment' = isnull( G.[value], '' ), " + |
|||
" 'isKey' = " + |
|||
"CASE " + |
|||
" WHEN EXISTS ( " + |
|||
" SELECT " + |
|||
" 1 " + |
|||
" FROM " + |
|||
" sysobjects " + |
|||
" WHERE " + |
|||
" xtype = 'PK' " + |
|||
" AND parent_obj = A.id " + |
|||
" AND name IN ( SELECT name FROM sysindexes WHERE indid IN ( SELECT indid FROM sysindexkeys WHERE id = A.id AND colid = A.colid ) ) " + |
|||
" ) THEN " + |
|||
" 'true' ELSE 'false' " + |
|||
" END, " + |
|||
" 'dataType' = B.name, " + |
|||
" 'maxLength' = COLUMNPROPERTY( A.id, A.name, 'PRECISION' ), " + |
|||
" 'numericPrecision' = isnull( COLUMNPROPERTY( A.id, A.name, 'Scale' ), 0 ), " + |
|||
" 'isNull' = " + |
|||
"CASE " + |
|||
" " + |
|||
" WHEN A.isnullable= 1 THEN " + |
|||
" 'true' ELSE 'false' " + |
|||
" END " + |
|||
"FROM " + |
|||
" syscolumns A " + |
|||
" LEFT JOIN systypes B ON A.xusertype= B.xusertype " + |
|||
" INNER JOIN sysobjects D ON A.id= D.id " + |
|||
" AND D.xtype= 'U' " + |
|||
" AND D.name != 'dtproperties' " + |
|||
" LEFT JOIN syscomments E ON A.cdefault= E.id " + |
|||
" LEFT JOIN sys.extended_properties G ON A.id= G.major_id " + |
|||
" AND A.colid= G.minor_id " + |
|||
" LEFT JOIN sys.extended_properties F ON D.id= F.major_id " + |
|||
" AND F.minor_id= 0 " + |
|||
"WHERE " + |
|||
" d.name in "; |
|||
System.out.println(sql); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,115 @@ |
|||
package com.demo.doc; |
|||
|
|||
import com.demo.doc.util.JavaClassUtil; |
|||
import com.thoughtworks.qdox.JavaProjectBuilder; |
|||
import com.thoughtworks.qdox.model.*; |
|||
import org.junit.Test; |
|||
|
|||
import java.io.File; |
|||
import java.nio.charset.StandardCharsets; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/5/11 |
|||
*/ |
|||
public class TestDox { |
|||
|
|||
@Test |
|||
public void test1() { |
|||
JavaProjectBuilder javaProjectBuilder = new JavaProjectBuilder(); |
|||
javaProjectBuilder.setEncoding(StandardCharsets.UTF_8.name()); |
|||
// 通过addSource等相关方法, 将源码添加进QDox中 (注:可以多次添加)
|
|||
File file = new File("D:\\workspace-main\\JiaShiLi\\jsl-questionnaire-base\\src\\main\\java\\com\\qs\\serve\\modules\\"); |
|||
javaProjectBuilder.addSourceTree(file); |
|||
// 获取解析出来的JavaClass对象
|
|||
|
|||
javaProjectBuilder.getClasses().forEach(javaClass -> { |
|||
//System.out.println("包名\t" + javaClass.getPackageName());
|
|||
System.out.println("全类名\t" + javaClass.getFullyQualifiedName()); |
|||
// System.out.println("注释\t" + javaClass.getComment());
|
|||
// System.out.println("字段\t" + javaClass.getFields());
|
|||
// System.out.println("方法\t" + javaClass.getMethods());
|
|||
// System.out.println("注释上的标签\t" + javaClass.getTags());
|
|||
//
|
|||
// System.out.println("是否是抽象类\t" + javaClass.isAbstract());
|
|||
// System.out.println("是否是注解\t" + javaClass.isAnnotation());
|
|||
// System.out.println("是否是枚举\t" + javaClass.isEnum());
|
|||
|
|||
//System.out.println("源码\t" + javaClass.getSource());
|
|||
}); |
|||
|
|||
|
|||
} |
|||
|
|||
@Test |
|||
public void test2() { |
|||
JavaProjectBuilder javaProjectBuilder = new JavaProjectBuilder(); |
|||
javaProjectBuilder.setEncoding(StandardCharsets.UTF_8.name()); |
|||
// 通过addSource等相关方法, 将源码添加进QDox中 (注:可以多次添加)
|
|||
File file = new File("D:\\workspace-main\\JiaShiLi\\jsl-questionnaire-base\\src\\main\\java\\com\\qs\\serve\\modules\\sys\\controller\\"); |
|||
javaProjectBuilder.addSourceTree(file); |
|||
// 获取解析出来的JavaClass对象
|
|||
javaProjectBuilder.getClasses().forEach(javaClass -> { |
|||
System.out.println("全类名\t" + javaClass.getFullyQualifiedName()); |
|||
String rr = JavaClassUtil.getAnnotationString(javaClass, "RequestMapping", "value"); |
|||
if (rr != null) { |
|||
System.out.println(rr); |
|||
} |
|||
List<JavaMethod> methods = javaClass.getMethods(); |
|||
for (JavaMethod javaMethod : methods) { |
|||
String method = "GET"; |
|||
String url = JavaClassUtil.getAnnotationString(javaMethod, "GetMapping", "value"); |
|||
if (url == null) { |
|||
method = "POST"; |
|||
url = JavaClassUtil.getAnnotationString(javaMethod, "PostMapping", "value"); |
|||
if (url != null) { |
|||
for (JavaParameter parameter : javaMethod.getParameters()) { |
|||
JavaType javaType = parameter.getType(); |
|||
JavaAnnotation annotation = JavaClassUtil.getAnnotation(parameter, "RequestBody"); |
|||
if (annotation != null) { |
|||
System.out.println(1); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
if (url == null) { |
|||
method = "PUT"; |
|||
url = JavaClassUtil.getAnnotationString(javaMethod, "PutMapping", "value"); |
|||
} |
|||
if (url == null) { |
|||
method = "DEL"; |
|||
url = JavaClassUtil.getAnnotationString(javaMethod, "DeleteMapping", "value"); |
|||
} |
|||
if (url == null) { |
|||
method = "GET/POST/PUT/DEL"; |
|||
url = JavaClassUtil.getAnnotationString(javaMethod, "RequestMapping", "value"); |
|||
} |
|||
System.out.println("[" + method + "] " + url); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
@Test |
|||
public void test3() { |
|||
JavaProjectBuilder javaProjectBuilder = new JavaProjectBuilder(); |
|||
javaProjectBuilder.setEncoding(StandardCharsets.UTF_8.name()); |
|||
// 通过addSource等相关方法, 将源码添加进QDox中 (注:可以多次添加)
|
|||
File file = new File("D:\\workspace-main\\JiaShiLi\\jsl-questionnaire-base\\src\\main\\java\\com\\qs\\serve\\modules\\oms\\entity\\OmsOrder.java"); |
|||
javaProjectBuilder.addSourceTree(file); |
|||
// 获取解析出来的JavaClass对象
|
|||
for (JavaClass javaClass : javaProjectBuilder.getClasses()) { |
|||
//System.out.println("全类名\t" + javaClass.getFullyQualifiedName());
|
|||
for (JavaField javaField : javaClass.getFields()) { |
|||
//忽略静态的serialVersionUID
|
|||
if (javaField.getName().equals("serialVersionUID")) { |
|||
continue; |
|||
} |
|||
System.out.println(javaField.getComment() + " " + javaField.getName()); |
|||
} |
|||
|
|||
} |
|||
} |
|||
|
|||
} |
@ -0,0 +1,93 @@ |
|||
package com.demo.doc.dto; |
|||
|
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/5/11 |
|||
*/ |
|||
@NoArgsConstructor |
|||
@Data |
|||
public class Dx { |
|||
|
|||
private List<ApiModule> apiServiceList; |
|||
|
|||
@Data |
|||
public static class ApiModule { |
|||
private String moduleName; |
|||
private List<ApiService> apiServiceList; |
|||
} |
|||
|
|||
@Data |
|||
public static class ApiService { |
|||
private String serviceName; |
|||
private List<ApiRequest> apiRequestList; |
|||
} |
|||
|
|||
|
|||
@Data |
|||
public static class ApiFiled { |
|||
/** |
|||
* 字段名 |
|||
*/ |
|||
private String name; |
|||
|
|||
/** |
|||
* 字段类型 |
|||
* string、int、double、decimal、Object、List<OBJECT> |
|||
**/ |
|||
private String type; |
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String description; |
|||
/** |
|||
* 是否必须 |
|||
*/ |
|||
private boolean required; |
|||
/** |
|||
* 版本 |
|||
*/ |
|||
private String version; |
|||
|
|||
private ApiObject object; |
|||
private List<ApiObject> array; |
|||
} |
|||
|
|||
@Data |
|||
public static class ApiObject { |
|||
private String className; |
|||
private List<ApiFiled> filedList; |
|||
} |
|||
|
|||
@Data |
|||
public static class ApiRequest { |
|||
/** |
|||
* 请求方式 |
|||
*/ |
|||
private String method; |
|||
/** |
|||
* 请求地址 |
|||
*/ |
|||
private String url; |
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String comment; |
|||
/** |
|||
* 头部 |
|||
*/ |
|||
private List<ApiFiled> header; |
|||
/** |
|||
* 头部 |
|||
*/ |
|||
private List<ApiFiled> query; |
|||
private List<ApiFiled> variable; |
|||
|
|||
private ApiObject body; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,90 @@ |
|||
package com.demo.doc.util; |
|||
|
|||
import lombok.SneakyThrows; |
|||
import org.apache.commons.io.FileUtils; |
|||
import org.junit.Test; |
|||
|
|||
import java.io.File; |
|||
import java.util.ArrayList; |
|||
import java.util.HashSet; |
|||
import java.util.List; |
|||
import java.util.Set; |
|||
import java.util.regex.Matcher; |
|||
import java.util.regex.Pattern; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/5/15 |
|||
*/ |
|||
public class FileUtilTest { |
|||
|
|||
public static List<String> lisFile(String path, String fileType) { |
|||
List<String> paths = new ArrayList<>(); |
|||
File file = new File(path); |
|||
if (file.isDirectory()) { |
|||
File[] files = file.listFiles(); |
|||
for (int i = 0; i < files.length; i++) { |
|||
String filename = files[i].getName(); |
|||
if (filename.trim().toLowerCase().endsWith(fileType)) { |
|||
paths.add(files[i].getPath()); |
|||
} |
|||
if (files[i].isDirectory()) { |
|||
String childPath = files[i].getPath(); |
|||
paths.addAll(lisFile(childPath, fileType)); |
|||
} |
|||
} |
|||
} |
|||
return paths; |
|||
} |
|||
|
|||
@Test |
|||
public void listFile() { |
|||
String path = "D:\\workspace-main\\_Other\\RuoYi-Vue-Plus-5.X"; |
|||
FileUtilTest.lisFile(path, "pom.xml"); |
|||
} |
|||
|
|||
@Test |
|||
@SneakyThrows |
|||
public void listFilePom() { |
|||
String path = "D:\\workspace-main\\_Other\\RuoYi-Vue-Plus-5.X"; |
|||
List<String> paths = FileUtilTest.lisFile(path, "pom.xml"); |
|||
Set<String> groupSet = new HashSet<>(); |
|||
for (String p : paths) { |
|||
File file = new File(p); |
|||
String content = FileUtils.readFileToString(file, "UTF-8"); |
|||
// groupId
|
|||
String regex = "<groupId>(.*?)</groupId>"; |
|||
Pattern pattern = Pattern.compile(regex); |
|||
Matcher m = pattern.matcher(content); |
|||
while (m.find()) { |
|||
groupSet.add(m.group()); |
|||
} |
|||
} |
|||
groupSet.forEach(System.out::println); |
|||
} |
|||
|
|||
@Test |
|||
@SneakyThrows |
|||
public void test22() { |
|||
String path = "D:\\workspace-main\\_Other\\RuoYi-Vue-Plus-5.X\\ruoyi-admin\\pom.xml"; |
|||
File file = new File(path); |
|||
String content = FileUtils.readFileToString(file, "UTF-8"); |
|||
// groupId
|
|||
Set<String> groupSet = new HashSet<>(); |
|||
String regex = "<groupId>(.*?)</groupId>"; |
|||
Pattern pattern = Pattern.compile(regex); |
|||
Matcher m = pattern.matcher(content); |
|||
while (m.find()) { |
|||
groupSet.add(m.group()); |
|||
} |
|||
groupSet.forEach(System.out::println); |
|||
//artifactId
|
|||
/*String regex2 = "<artifactId>(.*?)</artifactId>"; |
|||
Pattern pattern2 = Pattern.compile(regex2); |
|||
Matcher m2 = pattern2.matcher(content); |
|||
while (m2.find()) { |
|||
System.out.println(m2.group()); |
|||
}*/ |
|||
} |
|||
|
|||
} |
@ -0,0 +1,62 @@ |
|||
package com.demo.doc.util; |
|||
|
|||
import com.thoughtworks.qdox.model.JavaAnnotation; |
|||
import com.thoughtworks.qdox.model.JavaClass; |
|||
import com.thoughtworks.qdox.model.JavaMethod; |
|||
import com.thoughtworks.qdox.model.JavaParameter; |
|||
import com.thoughtworks.qdox.model.expression.AnnotationValue; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/5/12 |
|||
*/ |
|||
public class JavaClassUtil { |
|||
|
|||
public static JavaAnnotation getAnnotation(JavaClass javaClass, String annotationName) { |
|||
for (JavaAnnotation annotation : javaClass.getAnnotations()) { |
|||
if (annotation.getType().getName().contains(annotationName)) { |
|||
return annotation; |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
public static JavaAnnotation getAnnotation(JavaParameter javaParameter, String annotationName) { |
|||
for (JavaAnnotation annotation : javaParameter.getAnnotations()) { |
|||
if (annotation.getType().getName().contains(annotationName)) { |
|||
return annotation; |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
public static JavaAnnotation getAnnotation(JavaMethod javaMethod, String annotationName) { |
|||
for (JavaAnnotation annotation : javaMethod.getAnnotations()) { |
|||
if (annotation.getType().getName().contains(annotationName)) { |
|||
return annotation; |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
public static String getAnnotationString(JavaAnnotation annotation, String propertyName) { |
|||
if (annotation != null) { |
|||
AnnotationValue annotationValue = annotation.getProperty(propertyName); |
|||
if (annotationValue != null) { |
|||
return annotationValue.getParameterValue().toString(); |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
public static String getAnnotationString(JavaClass javaClass, String annotationName, String propertyName) { |
|||
JavaAnnotation annotation = getAnnotation(javaClass, annotationName); |
|||
return getAnnotationString(annotation, propertyName); |
|||
} |
|||
|
|||
public static String getAnnotationString(JavaMethod javaMethod, String annotationName, String propertyName) { |
|||
JavaAnnotation annotation = getAnnotation(javaMethod, annotationName); |
|||
return getAnnotationString(annotation, propertyName); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,205 @@ |
|||
package com.demo.dto; |
|||
|
|||
import cn.hutool.core.collection.CollUtil; |
|||
import com.demo.dto.util.JdbcExecutor; |
|||
import com.demo.dto.util.SqlBuilderUtil; |
|||
import com.demo.dto.util.SqlOptionContext; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/6/27 |
|||
**/ |
|||
@Slf4j |
|||
public class DaoContext { |
|||
|
|||
private JdbcExecutor jdbcExecutor ; |
|||
|
|||
public DaoContext(String jdbcUrl,String username, String password){ |
|||
jdbcExecutor = new JdbcExecutor(username, password, jdbcUrl); |
|||
} |
|||
|
|||
public <T> String insert(T object){ |
|||
String sql = SqlBuilderUtil.buildInsertSql(object,null); |
|||
return jdbcExecutor.executeInsert(sql); |
|||
} |
|||
|
|||
public <T> String insert(String table,T object){ |
|||
String sql = SqlBuilderUtil.buildInsertSql(object,table); |
|||
return jdbcExecutor.executeInsert(sql); |
|||
} |
|||
|
|||
public <T> void deleteById(Class<T> clazz, Serializable id){ |
|||
String sql = SqlBuilderUtil.buildDeleteSql(clazz) + " where id = "+ id; |
|||
int rows = jdbcExecutor.execute(sql); |
|||
if(rows!=1){ |
|||
log.debug("deleteById rows {}, SQL:{}", rows, sql); |
|||
} |
|||
} |
|||
|
|||
public <T> void deleteByIds(Class<T> clazz, List<?> ids){ |
|||
String sql = SqlBuilderUtil.buildDeleteSql(clazz) + " where id = "+ SqlBuilderUtil.buildInSql(ids); |
|||
int rows = jdbcExecutor.execute(sql); |
|||
if(rows!=ids.size()){ |
|||
log.debug("deleteByIds ids:{} rows:{}, SQL:{}", ids.size(), rows, sql); |
|||
} |
|||
} |
|||
|
|||
public <T> int delete(T condition){ |
|||
String sql = SqlBuilderUtil.buildDeleteSql(condition.getClass()) |
|||
+ "where "+ buildWhereSql(condition); |
|||
return jdbcExecutor.execute(sql); |
|||
} |
|||
|
|||
public <T> int delete(T condition,String[] ignoreColumns){ |
|||
String sql = SqlBuilderUtil.buildDeleteSql(condition.getClass()) |
|||
+ "where "+ buildWhereSql(condition,ignoreColumns); |
|||
return jdbcExecutor.execute(sql); |
|||
} |
|||
|
|||
|
|||
public <T> int updateById(T updateVal, Serializable id){ |
|||
String sql = SqlBuilderUtil.buildUpdateSql(updateVal,null) + " where id = "+id; |
|||
return jdbcExecutor.execute(sql); |
|||
} |
|||
|
|||
public <T> void updateById(String table, T updateVal, Serializable id){ |
|||
String sql = SqlBuilderUtil.buildUpdateSql(updateVal,table) + " where id = "+id; |
|||
int rows = jdbcExecutor.execute(sql); |
|||
if(rows!=1){ |
|||
log.debug("updateById rows:{}, SQL:{}",rows,sql); |
|||
} |
|||
} |
|||
|
|||
public <T> int update(T updateVal, T condition){ |
|||
String sql = SqlBuilderUtil.buildUpdateSql(updateVal,null) + " where " + buildWhereSql(condition); |
|||
return jdbcExecutor.execute(sql); |
|||
} |
|||
|
|||
public <T> int update(String table, T updateVal, T condition){ |
|||
String sql = SqlBuilderUtil.buildUpdateSql(updateVal,table) + " where " + buildWhereSql(condition); |
|||
return jdbcExecutor.execute(sql); |
|||
} |
|||
|
|||
public <T> void insertBatch(List<T> list){ |
|||
insertBatch(list,500); |
|||
} |
|||
|
|||
public <T> void insertBatch(String table, List<T> list){ |
|||
insertBatch(table,list,500); |
|||
} |
|||
|
|||
public <T> void insertBatch(List<T> list,int batchSize){ |
|||
List<List<T>> listList = CollUtil.split(list,batchSize); |
|||
for (List<T> tList : listList) { |
|||
insertBaseBatch(null,tList); |
|||
} |
|||
} |
|||
|
|||
public <T> void insertBatch(String table, List<T> list,int batchSize){ |
|||
List<List<T>> listList = CollUtil.split(list,batchSize); |
|||
for (List<T> tList : listList) { |
|||
insertBaseBatch(table,tList); |
|||
} |
|||
} |
|||
|
|||
private <T> void insertBaseBatch(String table, List<T> list){ |
|||
String sql = SqlBuilderUtil.buildBatchInsertSql(list,table); |
|||
//TODO 返回并注入id
|
|||
jdbcExecutor.executeInsert(sql); |
|||
} |
|||
|
|||
/** 获取where条件 */ |
|||
public <T> String buildWhereSql(T condition,String alia,String[] ignoreColumns){ |
|||
return SqlBuilderUtil.buildEqualCondition(condition,alia,ignoreColumns); |
|||
} |
|||
|
|||
/** 获取where条件 */ |
|||
public <T> String buildWhereSql(T condition,String alia){ |
|||
return SqlBuilderUtil.buildEqualCondition(condition,alia,null); |
|||
} |
|||
|
|||
/** 获取where条件 */ |
|||
public <T> String buildWhereSql(T condition,String[] ignoreColumns){ |
|||
return SqlBuilderUtil.buildEqualCondition(condition,null,ignoreColumns); |
|||
} |
|||
|
|||
/** 获取where条件 */ |
|||
public <T> String buildWhereSql(T condition){ |
|||
return SqlBuilderUtil.buildEqualCondition(condition,null,null); |
|||
} |
|||
|
|||
public <T> T selectOne(T condition){ |
|||
String sql = SqlBuilderUtil.buildSelectSql(condition.getClass(),null,null,null) |
|||
+" where "+buildWhereSql(condition); |
|||
Class<T> tClass = (Class<T>) condition.getClass(); |
|||
return jdbcExecutor.queryOne(sql,tClass); |
|||
} |
|||
|
|||
public <T> T selectOne(String table, T condition,String[] ignoreColumns){ |
|||
String sql = SqlBuilderUtil.buildSelectSql(condition.getClass(),table,null,ignoreColumns) |
|||
+" where "+buildWhereSql(condition); |
|||
Class<T> tClass = (Class<T>) condition.getClass(); |
|||
return jdbcExecutor.queryOne(sql,tClass); |
|||
} |
|||
|
|||
public <T> T selectOne(T condition,String[] ignoreColumns){ |
|||
String sql = SqlBuilderUtil.buildSelectSql(condition.getClass(),null,null,ignoreColumns) |
|||
+" where "+buildWhereSql(condition); |
|||
Class<T> tClass = (Class<T>) condition.getClass(); |
|||
return jdbcExecutor.queryOne(sql,tClass); |
|||
} |
|||
|
|||
public <T> List<T> selectList(T condition){ |
|||
String sql = SqlBuilderUtil.buildSelectSql(condition.getClass(),null,null,null) |
|||
+" where "+buildWhereSql(condition); |
|||
Class<T> tClass = (Class<T>) condition.getClass(); |
|||
return jdbcExecutor.queryList(sql,tClass); |
|||
} |
|||
|
|||
public <T> List<T> selectList(String table,T condition,String[] ignoreColumns){ |
|||
String sql = SqlBuilderUtil.buildSelectSql(condition.getClass(),table,null,ignoreColumns) |
|||
+" where "+buildWhereSql(condition); |
|||
Class<T> tClass = (Class<T>) condition.getClass(); |
|||
return jdbcExecutor.queryList(sql,tClass); |
|||
} |
|||
|
|||
public <T> List<T> selectList(T condition,String[] ignoreColumns){ |
|||
String sql = SqlBuilderUtil.buildSelectSql(condition.getClass(),null,null,ignoreColumns) |
|||
+" where "+buildWhereSql(condition); |
|||
Class<T> tClass = (Class<T>) condition.getClass(); |
|||
return jdbcExecutor.queryList(sql,tClass); |
|||
} |
|||
|
|||
public <T> Long selectCount(T condition){ |
|||
String sql = SqlBuilderUtil.buildSelectCountSql(condition.getClass())+" where "+buildWhereSql(condition); |
|||
Object obj = jdbcExecutor.queryValue(sql); |
|||
if(obj!=null){ |
|||
return Long.parseLong(obj.toString()); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
public <T> Long selectCount(String table, T condition){ |
|||
String sql = "select count(1) from "+table+" where "+buildWhereSql(condition); |
|||
Object obj = jdbcExecutor.queryValue(sql); |
|||
if(obj!=null){ |
|||
return Long.parseLong(obj.toString()); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
/** |
|||
* 使用sql情况下使用 |
|||
* @param sql |
|||
* @return |
|||
*/ |
|||
public SqlOptionContext sql(String sql){ |
|||
return new SqlOptionContext(sql,this.jdbcExecutor); |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,72 @@ |
|||
package com.demo.dto; |
|||
import java.math.BigDecimal; |
|||
import java.util.ArrayList; |
|||
import java.util.Date; |
|||
import java.time.LocalDate; |
|||
import java.time.LocalDateTime; |
|||
import java.util.List; |
|||
|
|||
import com.demo.t20230702.XltDiscountBudget; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/7/2 |
|||
**/ |
|||
public class DaoTest { |
|||
|
|||
public static void main(String[] args) { |
|||
|
|||
DemoUser demoUser = new DemoUser(); |
|||
demoUser.setId(0L); |
|||
demoUser.setName("1233"); |
|||
demoUser.setBirthday(new Date()); |
|||
demoUser.setBalance(0D); |
|||
demoUser.setAmount(new BigDecimal(0)); |
|||
demoUser.setCreateDate(LocalDate.now()); |
|||
demoUser.setCreateTime(LocalDateTime.now()); |
|||
demoUser.setAge(0); |
|||
DemoUser demoUser2 = new DemoUser(); |
|||
demoUser2.setId(0L); |
|||
demoUser2.setName("1233"); |
|||
demoUser2.setBirthday(new Date()); |
|||
demoUser2.setBalance(0D); |
|||
demoUser2.setAmount(new BigDecimal(0)); |
|||
demoUser.setAge(0); |
|||
|
|||
List<DemoUser> list = new ArrayList<>(); |
|||
list.add(demoUser); |
|||
list.add(demoUser2); |
|||
|
|||
String jdbcUrl=""; |
|||
String username=""; |
|||
String password=""; |
|||
|
|||
DaoContext context = new DaoContext("","",""); |
|||
|
|||
context.insert(demoUser); |
|||
|
|||
context.insertBatch(list); |
|||
|
|||
context.delete(demoUser); |
|||
context.deleteById(DemoUser.class,1); |
|||
|
|||
context.update(demoUser,demoUser); |
|||
context.updateById(demoUser,123456); |
|||
|
|||
context.selectList(demoUser); |
|||
context.selectCount(demoUser); |
|||
context.selectOne(demoUser); |
|||
|
|||
context.buildWhereSql(demoUser); |
|||
|
|||
// context.sql("").getString();
|
|||
// context.sql("").getInt();
|
|||
// context.sql("").getList(null);
|
|||
// context.sql("").getOne(null);
|
|||
// context.sql("").execute();
|
|||
//
|
|||
// context.sql("").printBean();
|
|||
// context.sql("").printMySql();
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,33 @@ |
|||
package com.demo.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDate; |
|||
import java.time.LocalDateTime; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/7/2 |
|||
**/ |
|||
@Data |
|||
public class DemoUser { |
|||
|
|||
Long id; |
|||
|
|||
String name; |
|||
|
|||
Date birthday; |
|||
|
|||
Double balance; |
|||
|
|||
BigDecimal amount; |
|||
|
|||
LocalDate createDate; |
|||
|
|||
LocalDateTime createTime; |
|||
|
|||
Integer age; |
|||
|
|||
} |
@ -0,0 +1,33 @@ |
|||
package com.demo.dto.model; |
|||
|
|||
import java.lang.annotation.ElementType; |
|||
import java.lang.annotation.Retention; |
|||
import java.lang.annotation.RetentionPolicy; |
|||
import java.lang.annotation.Target; |
|||
|
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/6/30 |
|||
**/ |
|||
@Target({ElementType.FIELD}) |
|||
@Retention(RetentionPolicy.RUNTIME) |
|||
public @interface SqlColumn { |
|||
|
|||
/** |
|||
* 列名(默认为空字符串) |
|||
* 空字符串,采用字段转列策略 示例: userInfo -> user_info |
|||
* 非空时,采用列的值 |
|||
*/ |
|||
String value() default ""; |
|||
|
|||
|
|||
boolean ignore() default false; |
|||
|
|||
/** |
|||
* "java.util.Date" |
|||
* @return |
|||
*/ |
|||
String format() default ""; |
|||
|
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.demo.dto.model; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/7/1 |
|||
**/ |
|||
public enum SqlCondition { |
|||
|
|||
eq, |
|||
ne, |
|||
like, |
|||
likeLeft, |
|||
likeRight, |
|||
notIn, |
|||
in |
|||
|
|||
} |
@ -0,0 +1,24 @@ |
|||
package com.demo.dto.model; |
|||
|
|||
import java.lang.annotation.ElementType; |
|||
import java.lang.annotation.Retention; |
|||
import java.lang.annotation.RetentionPolicy; |
|||
import java.lang.annotation.Target; |
|||
|
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/6/30 |
|||
**/ |
|||
@Target({ElementType.TYPE}) |
|||
@Retention(RetentionPolicy.RUNTIME) |
|||
public @interface SqlTable { |
|||
|
|||
/** |
|||
* 列名(默认为空字符串) |
|||
* 空字符串,采用字段转列策略 示例: userInfo -> user_info |
|||
* 非空时,采用列的值 |
|||
*/ |
|||
String value() default ""; |
|||
|
|||
} |
@ -0,0 +1,35 @@ |
|||
package com.demo.dto.util; |
|||
|
|||
import java.lang.reflect.Field; |
|||
import java.text.SimpleDateFormat; |
|||
import java.time.LocalDateTime; |
|||
import java.time.format.DateTimeFormatter; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/7/2 |
|||
**/ |
|||
public class BeanFieldUtil { |
|||
|
|||
public static String toValueString(Object value, Field field){ |
|||
if(value==null){ |
|||
return null; |
|||
} |
|||
String dataClass = value.getClass().getName(); |
|||
if(dataClass.equals("java.util.Date")){ |
|||
//TODO 通过注解支持不同格式
|
|||
Date date = (Date) value; |
|||
SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); |
|||
return ft.format(date); |
|||
}else if (dataClass.equals("java.time.LocalDateTime")){ |
|||
LocalDateTime ldt = (LocalDateTime)value; |
|||
DateTimeFormatter dfDate = DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss"); |
|||
return dfDate.format(ldt); |
|||
} |
|||
return value.toString(); |
|||
} |
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,193 @@ |
|||
package com.demo.dto.util; |
|||
|
|||
import com.zaxxer.hikari.HikariConfig; |
|||
import com.zaxxer.hikari.HikariDataSource; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
|
|||
import java.lang.reflect.Field; |
|||
import java.lang.reflect.InvocationTargetException; |
|||
import java.lang.reflect.Method; |
|||
import java.sql.*; |
|||
import java.util.*; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/7/1 |
|||
**/ |
|||
@Slf4j |
|||
public class JdbcExecutor { |
|||
|
|||
private final boolean ONLY_PRINT = true; |
|||
|
|||
private HikariDataSource dataSource; |
|||
|
|||
public JdbcExecutor(String username, String password, String jdbcUrl){ |
|||
Properties properties = new Properties(); |
|||
properties.setProperty("jdbcUrl",jdbcUrl); |
|||
properties.setProperty("username",username); |
|||
properties.setProperty("password",password); |
|||
//properties.setProperty("driverClassName","");
|
|||
HikariConfig config = new HikariConfig(properties); |
|||
this.dataSource = new HikariDataSource(config); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* |
|||
* @param sql |
|||
* @return 返回影响行数 |
|||
*/ |
|||
public int execute(String sql){ |
|||
if(ONLY_PRINT){ |
|||
System.out.println(sql); |
|||
return 0; |
|||
} |
|||
int rows = 0; |
|||
try { |
|||
Connection conn = dataSource.getConnection(); |
|||
PreparedStatement pst = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS); |
|||
rows = pst.executeUpdate(); |
|||
pst.close(); |
|||
} catch (SQLException throwables) { |
|||
throwables.printStackTrace(); |
|||
} |
|||
return rows; |
|||
} |
|||
|
|||
/** |
|||
* |
|||
* @param sql |
|||
* @return 返回ID |
|||
*/ |
|||
public String executeInsert(String sql){ |
|||
if(ONLY_PRINT){ |
|||
System.out.println(sql); |
|||
return null; |
|||
} |
|||
String id = null; |
|||
try { |
|||
Connection conn = dataSource.getConnection(); |
|||
PreparedStatement pst = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS); |
|||
pst.execute(); |
|||
ResultSet rs = pst.getGeneratedKeys(); |
|||
if (rs.next()) { |
|||
id = rs.getObject(1).toString(); |
|||
System.out.println("主键值为:" + id); |
|||
} |
|||
rs.close(); |
|||
pst.close(); |
|||
} catch (SQLException throwables) { |
|||
throwables.printStackTrace(); |
|||
} |
|||
return id; |
|||
} |
|||
|
|||
/** |
|||
* 返回单个值查询,如count |
|||
* @param sql |
|||
* @return |
|||
*/ |
|||
public Object queryValue(String sql){ |
|||
if(ONLY_PRINT){ |
|||
System.out.println(sql); |
|||
return null; |
|||
} |
|||
Object result = null; |
|||
try { |
|||
Connection conn = dataSource.getConnection(); |
|||
Statement stmt = conn.createStatement(); |
|||
ResultSet rs = stmt.executeQuery(sql); |
|||
if(rs.next()){ |
|||
result = rs.getObject(1); |
|||
} |
|||
stmt.close(); |
|||
rs.close(); |
|||
} catch (SQLException throwables) { |
|||
throwables.printStackTrace(); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/** |
|||
* 返回单行对象 |
|||
* @param sql |
|||
* @return |
|||
*/ |
|||
public <T> T queryOne(String sql,Class<T> clazz){ |
|||
if(ONLY_PRINT){ |
|||
System.out.println(sql); |
|||
return null; |
|||
} |
|||
try { |
|||
Connection conn = dataSource.getConnection(); |
|||
Statement stmt = conn.createStatement(); |
|||
ResultSet rs = stmt.executeQuery(sql); |
|||
List<T> list = resultSetToBean(rs,clazz); |
|||
stmt.close(); |
|||
rs.close(); |
|||
if(list.size()>1){ |
|||
log.warn("sql查询数据多于1 SQL:{}",sql); |
|||
}else if (list.size()<1){ |
|||
return null; |
|||
} |
|||
return list.get(0); |
|||
} catch (SQLException throwables) { |
|||
throwables.printStackTrace(); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
/** |
|||
* 返回单个值查询,如count |
|||
* @param sql |
|||
* @return |
|||
*/ |
|||
public <T> List<T> queryList(String sql,Class<T> clazz){ |
|||
if(ONLY_PRINT){ |
|||
System.out.println(sql); |
|||
return null; |
|||
} |
|||
try { |
|||
Connection conn = dataSource.getConnection(); |
|||
Statement stmt = conn.createStatement(); |
|||
ResultSet rs = stmt.executeQuery(sql); |
|||
List<T> list = resultSetToBean(rs,clazz); |
|||
stmt.close(); |
|||
rs.close(); |
|||
return list; |
|||
} catch (SQLException throwables) { |
|||
throwables.printStackTrace(); |
|||
} |
|||
return new ArrayList<>(); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 返回实体列 |
|||
* @param resultSet |
|||
* @param beanClass |
|||
* @param <T> |
|||
* @return |
|||
*/ |
|||
public <T> List<T> resultSetToBean(ResultSet resultSet, Class beanClass){ |
|||
Field[] fields = beanClass.getDeclaredFields(); |
|||
List<T> beanList = new ArrayList<>(); |
|||
if (resultSet != null) { |
|||
try { |
|||
while (resultSet.next()) { |
|||
T object = (T) beanClass.newInstance(); |
|||
for (Field field : fields) { |
|||
String fieldName = field.getName(); |
|||
Method setField = beanClass.getMethod("set" + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1), field.getType()); |
|||
setField.invoke(object,resultSet.getObject(fieldName.toUpperCase())); |
|||
} |
|||
beanList.add(object); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
} |
|||
} |
|||
return beanList; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,85 @@ |
|||
package com.demo.dto.util; |
|||
|
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/6/30 |
|||
**/ |
|||
public class SqlBuilderUtil { |
|||
|
|||
public static String STRING_AND = " and "; |
|||
public static String STRING_SPLIT = " ,"; |
|||
public static String KH_LEFT = "("; |
|||
public static String KH_RIGHT = ")"; |
|||
|
|||
/** equal condition */ |
|||
public static String buildEqualCondition(Object object,String alia,String[] ignoreColumns){ |
|||
return SqlClazzStorage.commentBuild(object,alia,true,true,true,STRING_AND,ignoreColumns); |
|||
} |
|||
|
|||
/** delete sql */ |
|||
public static <T> String buildDeleteSql(Class<T> clazz){ |
|||
return "delete from "+SqlClazzStorage.getTableName(clazz)+" "; |
|||
} |
|||
|
|||
/** delete sql */ |
|||
public static <T> String buildSelectCountSql(Class<T> clazz){ |
|||
return "select count(1) from "+SqlClazzStorage.getTableName(clazz)+" "; |
|||
} |
|||
|
|||
/** select sql */ |
|||
public static <T> String buildSelectSql(Class<T> clazz,String table,String alia,String[] ignoreColumns){ |
|||
String aliaTemp = alia!=null?" "+alia+" " : " "; |
|||
return "select " + SqlClazzStorage.commentBuild(clazz,alia,STRING_SPLIT, ignoreColumns) + " from "+ |
|||
SqlClazzStorage.getTableName(clazz, table)+aliaTemp; |
|||
} |
|||
|
|||
/** update sql */ |
|||
public static String buildUpdateSql(Object object,String table){ |
|||
return "update "+SqlClazzStorage.getTableName(object, table)+" set "+ |
|||
SqlClazzStorage.commentBuild(object,null,true,true,true,STRING_SPLIT, |
|||
//忽略id
|
|||
new String[]{"id"} |
|||
); |
|||
} |
|||
|
|||
/** insert sql */ |
|||
public static String buildInsertSql(Object object,String table){ |
|||
return "insert into " + SqlClazzStorage.getTableName(object,table) |
|||
+ buildInsertColumns(object,true) |
|||
+ " values " |
|||
+ buildInsertValues( object,true); |
|||
} |
|||
|
|||
public static String buildBatchInsertSql(List<?> list,String table){ |
|||
Object object = list.get(0); |
|||
String sql = "insert into " + SqlClazzStorage.getTableName(object,table) |
|||
+ buildInsertColumns(object,false) |
|||
+ " values "; |
|||
for (Object obj : list) { |
|||
sql = sql + buildInsertValues(obj,false)+STRING_SPLIT; |
|||
} |
|||
return sql.substring(0,sql.length()-STRING_SPLIT.length()); |
|||
} |
|||
|
|||
/** insert columns */ |
|||
private static String buildInsertColumns(Object object,boolean ignoreNull){ |
|||
return KH_LEFT+ SqlClazzStorage.commentBuild(object,null,ignoreNull, true,false,STRING_SPLIT,null) +KH_RIGHT; |
|||
} |
|||
|
|||
/** insert values */ |
|||
private static String buildInsertValues(Object object,boolean ignoreNull){ |
|||
return KH_LEFT+ |
|||
SqlClazzStorage.commentBuild(object,null,ignoreNull,false,true,STRING_SPLIT,null) |
|||
+KH_RIGHT; |
|||
} |
|||
|
|||
/** in(...) values */ |
|||
public static String buildInSql(List<?> sqlId) { |
|||
String ids = sqlId.stream().map(a->"'"+a.toString()+"'").collect(Collectors.joining(",")); |
|||
return "("+ids+")"; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,170 @@ |
|||
package com.demo.dto.util; |
|||
|
|||
import cn.hutool.core.util.ReflectUtil; |
|||
import com.demo.dto.model.SqlColumn; |
|||
import com.demo.dto.model.SqlTable; |
|||
import com.demo.util.WordUtil; |
|||
|
|||
import java.lang.annotation.Annotation; |
|||
import java.lang.reflect.Field; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/6/30 |
|||
**/ |
|||
public class SqlClazzStorage { |
|||
|
|||
public static String STRING_EQUAL = "="; |
|||
|
|||
/** 获取表名 */ |
|||
public static String getTableName(Object object,String table){ |
|||
if(table!=null&&table.length()>0){ |
|||
return table; |
|||
}else { |
|||
//通过反射获取表名
|
|||
Class<?> clazz = object.getClass(); |
|||
String tableName = WordUtil.toLine(clazz.getSimpleName()); |
|||
SqlTable sqlTable = getSqlTable(clazz.getAnnotations()); |
|||
if(sqlTable!=null&&sqlTable.value().length()>0){ |
|||
tableName = WordUtil.toLine(sqlTable.value()); |
|||
} |
|||
return tableName; |
|||
} |
|||
} |
|||
|
|||
/** 获取表名 */ |
|||
public static String getTableName(Class<?> clazz){ |
|||
//通过反射获取表名
|
|||
String tableName = WordUtil.toLine(clazz.getSimpleName()); |
|||
SqlTable sqlTable = getSqlTable(clazz.getAnnotations()); |
|||
if(sqlTable!=null&&sqlTable.value().length()>0){ |
|||
tableName = WordUtil.toLine(sqlTable.value()); |
|||
} |
|||
return tableName; |
|||
} |
|||
|
|||
/** |
|||
* |
|||
* @param object |
|||
* @param alia |
|||
* @param ignoreNull |
|||
* @param loadColumn |
|||
* @param loadValue |
|||
* @param split and 或者 , |
|||
* @return |
|||
*/ |
|||
public static String commentBuild(Object object,String alia,boolean ignoreNull,boolean loadColumn, |
|||
boolean loadValue,String split,String[] ignoreColumns){ |
|||
Class<?> clazz = object.getClass(); |
|||
Field[] fields = clazz.getDeclaredFields(); |
|||
StringBuffer sql = new StringBuffer(); |
|||
alia = alia==null?"":alia+"."; |
|||
split = split==null?"":split; |
|||
for (Field field : fields) { |
|||
String columnName = WordUtil.toLine(field.getName()); |
|||
SqlColumn sqlColumn = getSqlColumn(field); |
|||
if(sqlColumn!=null){ |
|||
if(sqlColumn.ignore()){ |
|||
continue; |
|||
} |
|||
if(!sqlColumn.value().equals("")){ |
|||
columnName = sqlColumn.value(); |
|||
} |
|||
} |
|||
if(ignoreColumns!=null){ |
|||
boolean isIgnore = false; |
|||
for (String ignoreColumn : ignoreColumns) { |
|||
if(columnName.equals(ignoreColumn)){ |
|||
isIgnore = true; |
|||
break; |
|||
} |
|||
} |
|||
if(isIgnore){ |
|||
continue; |
|||
} |
|||
} |
|||
Object objectVal = ReflectUtil.getFieldValue(object, field.getName()); |
|||
if(ignoreNull&&objectVal==null){ |
|||
continue; |
|||
} |
|||
if(loadColumn){ |
|||
sql.append(alia).append(columnName); |
|||
} |
|||
if(loadColumn&&loadValue){ |
|||
sql.append(STRING_EQUAL); |
|||
} |
|||
if(loadValue){ |
|||
if(objectVal==null){ |
|||
sql.append(BeanFieldUtil.toValueString(objectVal,field)); |
|||
}else { |
|||
sql.append("'").append(BeanFieldUtil.toValueString(objectVal,field)).append("'"); |
|||
} |
|||
} |
|||
sql.append(split); |
|||
} |
|||
String sqlTemp = sql.toString(); |
|||
return sqlTemp.substring(0,sqlTemp.length()-split.length()); |
|||
} |
|||
|
|||
/** |
|||
* |
|||
* @param clazz |
|||
* @param alia |
|||
* @param split and 或者 , |
|||
* @return |
|||
*/ |
|||
public static String commentBuild(Class<?> clazz,String alia,String split,String[] ignoreColumns){ |
|||
Field[] fields = clazz.getDeclaredFields(); |
|||
StringBuffer sql = new StringBuffer(); |
|||
alia = alia==null?"":alia+"."; |
|||
split = split==null?"":split; |
|||
for (Field field : fields) { |
|||
String columnName = WordUtil.toLine(field.getName()); |
|||
SqlColumn sqlColumn = getSqlColumn(field); |
|||
if(sqlColumn!=null){ |
|||
if(sqlColumn.ignore()){ |
|||
continue; |
|||
} |
|||
if(!sqlColumn.value().equals("")){ |
|||
columnName = sqlColumn.value(); |
|||
} |
|||
} |
|||
if(ignoreColumns!=null){ |
|||
boolean isIgnore = false; |
|||
for (String ignoreColumn : ignoreColumns) { |
|||
if(columnName.equals(ignoreColumn)){ |
|||
isIgnore = true; |
|||
break; |
|||
} |
|||
} |
|||
if(isIgnore){ |
|||
continue; |
|||
} |
|||
} |
|||
sql.append(alia).append(columnName).append(split); |
|||
} |
|||
String sqlTemp = sql.toString(); |
|||
return sqlTemp.substring(0,sqlTemp.length()-split.length()); |
|||
} |
|||
|
|||
|
|||
private static SqlTable getSqlTable(Annotation[] annotations){ |
|||
for (Annotation annotation : annotations) { |
|||
if(annotation instanceof SqlTable){ |
|||
return (SqlTable)annotation; |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
private static SqlColumn getSqlColumn(Field field){ |
|||
Annotation[] annotations = field.getAnnotations(); |
|||
for (Annotation annotation : annotations) { |
|||
if(annotation instanceof SqlColumn){ |
|||
return (SqlColumn)annotation; |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,59 @@ |
|||
package com.demo.dto.util; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 原生JDBC工具类 |
|||
* @author JcYen |
|||
* @date 2021/6/4 |
|||
*/ |
|||
public class SqlOptionContext{ |
|||
|
|||
private String sql; |
|||
|
|||
private JdbcExecutor jdbcExecutor; |
|||
|
|||
public SqlOptionContext(String sql,JdbcExecutor jdbcExecutor){ |
|||
this.sql = sql; |
|||
this.jdbcExecutor = jdbcExecutor; |
|||
} |
|||
|
|||
public String getString(){ |
|||
Object obj = jdbcExecutor.queryValue(sql); |
|||
if(obj!=null){ |
|||
return obj.toString(); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
public Integer getInt(){ |
|||
Object obj = jdbcExecutor.queryValue(sql); |
|||
if(obj!=null){ |
|||
return Integer.parseInt(obj.toString()); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
public <T> T getOne(Class<T> objectClass){ |
|||
return jdbcExecutor.queryOne(sql,objectClass); |
|||
} |
|||
|
|||
public <T> List<T> getList(Class<T> objectClass){ |
|||
return jdbcExecutor.queryList(sql,objectClass); |
|||
} |
|||
|
|||
public String printBean(){ |
|||
//根据SQL打印Bean字段
|
|||
return null; |
|||
} |
|||
|
|||
public String printMySql(){ |
|||
//根据SQL打印Bean字段
|
|||
return null; |
|||
} |
|||
|
|||
public int execute(){ |
|||
return jdbcExecutor.execute(sql); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,196 @@ |
|||
package com.demo.jsl; |
|||
|
|||
import com.demo.jsl.entity.schedule.TbsSchedule; |
|||
import com.demo.jsl.entity.schedule.TbsScheduleItem; |
|||
import lombok.SneakyThrows; |
|||
import org.junit.Test; |
|||
import org.noear.wood.DbContext; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.time.LocalDateTime; |
|||
import java.time.temporal.TemporalAdjusters; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/2/16 |
|||
*/ |
|||
public class InitBudgetSchedule { |
|||
|
|||
public DbContext getJslDbContext() { |
|||
return new DbContext("test", "jdbc:mysql://192.168.0.9:3306/jsl_mall_qs_dev?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true", "kpjsl", "123456"); |
|||
} |
|||
|
|||
@Test |
|||
@SneakyThrows |
|||
public void init() { |
|||
int year = 2023; |
|||
DbContext jslDb = getJslDbContext(); |
|||
initMonth(year, jslDb, "(测试)", true); |
|||
initSeason(year, jslDb, "(测试)", true); |
|||
initYear(year, jslDb, "(测试)"); |
|||
} |
|||
|
|||
@SneakyThrows |
|||
public void initMonth(Integer year, DbContext jslDb, String prefix, boolean split) { |
|||
String tenantId = "001"; |
|||
Long startId = jslDb.sql("select count(1) from tbs_schedule").getCount() + 1; |
|||
if (split) { |
|||
for (int i = 1; i < 13; i++) { |
|||
long id = startId + i - 1; |
|||
String code = "Y" + year + "M" + i; |
|||
String name = prefix + year + "年" + getNumStr(i) + "月"; |
|||
//全年预算
|
|||
TbsSchedule schedule = new TbsSchedule(); |
|||
schedule.setId(id); |
|||
schedule.setCode(code); |
|||
schedule.setName(name); |
|||
schedule.setRemark(name); |
|||
schedule.setTenantId(tenantId); |
|||
jslDb.table("tbs_schedule").setEntity(schedule).insert(); |
|||
|
|||
TbsScheduleItem scheduleItem = new TbsScheduleItem(); |
|||
scheduleItem.setScheduleId(id); |
|||
scheduleItem.setItemName(code); |
|||
scheduleItem.setStartDate(getMonthFirstDate(year, i)); |
|||
scheduleItem.setEndDate(getMonthLastDate(year, i)); |
|||
scheduleItem.setTenantId("001"); |
|||
jslDb.table("tbs_schedule_item").setEntity(scheduleItem).insert(); |
|||
} |
|||
} else { |
|||
//全年预算
|
|||
TbsSchedule schedule = new TbsSchedule(); |
|||
schedule.setId(startId); |
|||
schedule.setCode("Y" + year + "M"); |
|||
schedule.setName(prefix + year + "全年各月"); |
|||
schedule.setRemark(prefix + year + "全年各月"); |
|||
schedule.setTenantId(tenantId); |
|||
jslDb.table("tbs_schedule").setEntity(schedule).insert(); |
|||
for (int i = 1; i < 13; i++) { |
|||
TbsScheduleItem scheduleItem = new TbsScheduleItem(); |
|||
scheduleItem.setScheduleId(startId); |
|||
scheduleItem.setItemName("Y" + year + "M" + i); |
|||
scheduleItem.setStartDate(getMonthFirstDate(year, i)); |
|||
scheduleItem.setEndDate(getMonthLastDate(year, i)); |
|||
scheduleItem.setTenantId("001"); |
|||
jslDb.table("tbs_schedule_item").setEntity(scheduleItem).insert(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@SneakyThrows |
|||
public void initYear(Integer year, DbContext jslDb, String prefix) { |
|||
String tenantId = "001"; |
|||
Long startId = jslDb.sql("select count(1) from tbs_schedule").getCount() + 1; |
|||
//全年预算
|
|||
TbsSchedule schedule = new TbsSchedule(); |
|||
schedule.setId(startId); |
|||
schedule.setCode("Y" + year); |
|||
schedule.setName(prefix + year + "年全年"); |
|||
schedule.setRemark(prefix + year + "年全年"); |
|||
schedule.setTenantId(tenantId); |
|||
jslDb.table("tbs_schedule").setEntity(schedule).insert(); |
|||
TbsScheduleItem scheduleItem = new TbsScheduleItem(); |
|||
scheduleItem.setScheduleId(startId); |
|||
scheduleItem.setItemName("Y" + year); |
|||
scheduleItem.setStartDate(getMonthFirstDate(year, 1)); |
|||
scheduleItem.setEndDate(getMonthLastDate(year, 12)); |
|||
scheduleItem.setTenantId("001"); |
|||
jslDb.table("tbs_schedule_item").setEntity(scheduleItem).insert(); |
|||
|
|||
} |
|||
|
|||
@SneakyThrows |
|||
public void initSeason(Integer year, DbContext jslDb, String prefix, boolean split) { |
|||
String tenantId = "001"; |
|||
Long startId = jslDb.sql("select count(id) from tbs_schedule").getCount() + 1; |
|||
if (split) { |
|||
for (int i = 1; i <= 4; i++) { |
|||
Long id = startId + i - 1; |
|||
//全年预算
|
|||
TbsSchedule schedule = new TbsSchedule(); |
|||
String code = "Y" + year + "Q" + i; |
|||
String numStr = this.getNumStr(i); |
|||
String name = prefix + year + "年第" + numStr + "季度"; |
|||
schedule.setId(id); |
|||
schedule.setCode(code); |
|||
schedule.setName(name); |
|||
schedule.setRemark(name); |
|||
schedule.setTenantId(tenantId); |
|||
jslDb.table("tbs_schedule").setEntity(schedule).insert(); |
|||
|
|||
TbsScheduleItem scheduleItem = new TbsScheduleItem(); |
|||
scheduleItem.setScheduleId(id); |
|||
scheduleItem.setItemName(code); |
|||
int startMonth = (i - 1) * 3 + 1; |
|||
int endMonth = i * 3; |
|||
scheduleItem.setStartDate(getMonthFirstDate(year, startMonth)); |
|||
scheduleItem.setEndDate(getMonthLastDate(year, endMonth)); |
|||
scheduleItem.setTenantId("001"); |
|||
jslDb.table("tbs_schedule_item").setEntity(scheduleItem).insert(); |
|||
} |
|||
} else { |
|||
//全年预算
|
|||
TbsSchedule schedule = new TbsSchedule(); |
|||
schedule.setId(startId); |
|||
schedule.setCode("Y" + year + "Q"); |
|||
schedule.setName(prefix + year + "全年四季"); |
|||
schedule.setRemark(prefix + year + "全年四季"); |
|||
schedule.setTenantId(tenantId); |
|||
jslDb.table("tbs_schedule").setEntity(schedule).insert(); |
|||
for (int i = 1; i <= 4; i++) { |
|||
String code = "Y" + year + "Q" + i; |
|||
String numStr = this.getNumStr(i); |
|||
//String name = prefix+year+"年第"+numStr+"季度";
|
|||
TbsScheduleItem scheduleItem = new TbsScheduleItem(); |
|||
scheduleItem.setScheduleId(startId); |
|||
scheduleItem.setItemName(code); |
|||
int startMonth = (i - 1) * 3 + 1; |
|||
int endMonth = i * 3; |
|||
scheduleItem.setStartDate(getMonthFirstDate(year, startMonth)); |
|||
scheduleItem.setEndDate(getMonthLastDate(year, endMonth)); |
|||
scheduleItem.setTenantId("001"); |
|||
jslDb.table("tbs_schedule_item").setEntity(scheduleItem).insert(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
private String getNumStr(int i) { |
|||
String numStr = ""; |
|||
if (i == 1) { |
|||
numStr = "一"; |
|||
} else if (i == 2) { |
|||
numStr = "二"; |
|||
} else if (i == 3) { |
|||
numStr = "三"; |
|||
} else if (i == 4) { |
|||
numStr = "四"; |
|||
} else if (i == 5) { |
|||
numStr = "五"; |
|||
} else if (i == 6) { |
|||
numStr = "六"; |
|||
} else if (i == 7) { |
|||
numStr = "七"; |
|||
} else if (i == 8) { |
|||
numStr = "八"; |
|||
} else if (i == 9) { |
|||
numStr = "九"; |
|||
} else if (i == 10) { |
|||
numStr = "十"; |
|||
} else if (i == 11) { |
|||
numStr = "十一"; |
|||
} else if (i == 12) { |
|||
numStr = "十二"; |
|||
} |
|||
return numStr; |
|||
} |
|||
|
|||
private LocalDateTime getMonthFirstDate(Integer year, Integer month) { |
|||
return LocalDate.of(year, month, 1).atStartOfDay(); |
|||
} |
|||
|
|||
private LocalDateTime getMonthLastDate(Integer year, Integer month) { |
|||
return LocalDate.of(year, month, 1).with(TemporalAdjusters.lastDayOfMonth()).atTime(23, 59, 59); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,290 @@ |
|||
package com.demo.jsl; |
|||
|
|||
import com.demo.jsl.entity.channel.*; |
|||
import com.demo.jsl.entity.region.JslRegion; |
|||
import com.demo.jsl.entity.region.XltDealerArea; |
|||
import com.demo.jsl.entity.region.XltDealerCity; |
|||
import com.demo.jsl.entity.region.XltDealerProvince; |
|||
import com.demo.jsl.entity.supplier.JslSupplier; |
|||
import com.demo.jsl.entity.supplier.XltSupplier; |
|||
import com.demo.jsl.entity.supplier.dto.XltSupplierEmp; |
|||
import lombok.SneakyThrows; |
|||
import org.junit.Test; |
|||
import org.noear.wood.DbContext; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/1/9 |
|||
*/ |
|||
public class ServiceMain { |
|||
|
|||
public DbContext getJslDbContext() { |
|||
return new DbContext("test", "jdbc:mysql://192.168.0.9:3306/jsl_mall_qs_dev2?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true", "kpjsl", "123456"); |
|||
} |
|||
|
|||
public DbContext getXltDbContext() { |
|||
return new DbContext("xlt", "jdbc:sqlserver://rm-wz93l107hc277n9ieco.sqlserver.rds.aliyuncs.com:3433;DatabaseName=xiaolutong", "qs_db_user", "Aa135246"); |
|||
} |
|||
|
|||
public DbContext getSeeYonDbContext() { |
|||
return new DbContext("oa", "jdbc:sqlserver://192.168.10.157:1433;DatabaseName=OAdata", "sa", "JSL2282125"); |
|||
} |
|||
|
|||
|
|||
@Test |
|||
public void syncChannel() throws Exception { |
|||
DbContext jslDb = getJslDbContext(); |
|||
DbContext xltDb = getXltDbContext(); |
|||
List<XltQuDaoOne> quDaoOneList = xltDb |
|||
.sql("select id,name from emp_quDaoOne") |
|||
.getList(XltQuDaoOne.class); |
|||
List<XltQuDaoTwo> quDaoTwoList = xltDb |
|||
.sql("select id,name,shangji pid from emp_quDaotwo") |
|||
.getList(XltQuDaoTwo.class); |
|||
List<JslRegion> regionList = jslDb.sql("select id,path_ids,path_names from bms_region2 where level = '3'").getList(JslRegion.class); |
|||
String prefix = "CH"; |
|||
long channelId = 100; |
|||
Map<String, JslChannel> channelMap = new HashMap<>(); |
|||
for (XltQuDaoTwo quDaoTwo : quDaoTwoList) { |
|||
XltQuDaoOne quDaoOneTmp = null; |
|||
for (XltQuDaoOne quDaoOne : quDaoOneList) { |
|||
if (quDaoOne.getId().equals(quDaoTwo.getPid())) { |
|||
quDaoOneTmp = quDaoOne; |
|||
break; |
|||
} |
|||
} |
|||
JslChannel channel = new JslChannel(); |
|||
channel.setId(channelId); |
|||
channel.setChannelCode(prefix + channelId); |
|||
channel.setChannelName(quDaoTwo.getName()); |
|||
if (quDaoOneTmp != null) { |
|||
channel.setChannelType(quDaoOneTmp.getName()); |
|||
} else { |
|||
channel.setChannelType("其他渠道"); |
|||
} |
|||
channel.setTenantId("001"); |
|||
jslDb.table("bms_channel").setEntity(channel).insert(); |
|||
channelMap.put(quDaoTwo.getId(), channel); |
|||
channelId++; |
|||
} |
|||
String wdSql = "select wd.id,wd.name,wd.number_ code,wd.cid city_id,ds.quDaoTwo channel_id,ek" + |
|||
".name type ,lv.WDLevelName level_name,wd.address " + |
|||
" from WangDian wd" + |
|||
" LEFT JOIN DealerSystem as ds ON wd.sysId = ds.id" + |
|||
" LEFT JOIN emp_keHuType as ek ON ds.keHuType = ek.id" + |
|||
" LEFT JOIN WDLevel as lv ON wd.wdLevel = lv.id"; |
|||
List<XltWangDian> wangDianList = xltDb |
|||
.sql(wdSql) |
|||
.getList(XltWangDian.class); |
|||
for (XltWangDian wangDian : wangDianList) { |
|||
JslChannel channel = channelMap.get(wangDian.getChannelId()); |
|||
if (channel == null) { |
|||
continue; |
|||
} |
|||
JslChannelPoint point = new JslChannelPoint(); |
|||
point.setChannelId(channel.getId()); |
|||
point.setChannelName(channel.getChannelName()); |
|||
point.setPointCode(wangDian.getCode()); |
|||
point.setPointName(wangDian.getName()); |
|||
point.setPointType(wangDian.getType()); |
|||
point.setAddress(wangDian.getAddress()); |
|||
point.setPointLevel(wangDian.getLevelName()); |
|||
point.setTenantId("001"); |
|||
for (JslRegion jslRegion : regionList) { |
|||
if (jslRegion.getId().equals(wangDian.getCityId())) { |
|||
point.setBizRegionPathIds(jslRegion.getPathIds()); |
|||
point.setBizRegionPath(jslRegion.getPathNames()); |
|||
break; |
|||
} |
|||
} |
|||
jslDb.table("bms_channel_point").setEntity(point).insert(); |
|||
} |
|||
} |
|||
|
|||
@Test |
|||
public void syncCustomer() throws Exception { |
|||
DbContext jslDb = getJslDbContext(); |
|||
DbContext xltDb = getXltDbContext(); |
|||
String sql = |
|||
"select d1.id,dealerName name,dealerNumber code,address,aid area_id,pid province_id,cid city_id " + |
|||
"from DealerConnTable d1 " + |
|||
"left join DealerCity d2 on d1.cid = d2.id " + |
|||
"left join DealerProvince d3 on d2.pid = d3.id " + |
|||
"left join DealerArea d4 on d3.aid = d4.id where d1.id in()"; |
|||
System.out.println(sql); |
|||
List<XltSupplier> xltSupplierList = xltDb |
|||
.sql(sql) |
|||
.getList(XltSupplier.class); |
|||
for (XltSupplier xltSupplier : xltSupplierList) { |
|||
JslSupplier jslSupplier = new JslSupplier(); |
|||
//jslSupplier.setId(supplierId);
|
|||
//TODO: this is error ids
|
|||
// jslSupplier.setRegionFirst(xltSupplier.getAreaId());
|
|||
// jslSupplier.setRegionSecond(xltSupplier.getProvinceId());
|
|||
// jslSupplier.setRegionThird(xltSupplier.getCityId());
|
|||
// jslSupplier.setRegionLast(xltSupplier.getCityId());
|
|||
// jslSupplier.setRegion2First(xltSupplier.getAreaId());
|
|||
// jslSupplier.setRegion2Second(xltSupplier.getProvinceId());
|
|||
// jslSupplier.setRegion2Third(xltSupplier.getCityId());
|
|||
// jslSupplier.setRegion2Last(xltSupplier.getCityId());
|
|||
jslSupplier.setAddress(xltSupplier.getAddress()); |
|||
jslSupplier.setName(xltSupplier.getName()); |
|||
jslSupplier.setCode(xltSupplier.getCode()); |
|||
jslSupplier.setPid("0"); |
|||
jslSupplier.setTenantId("001"); |
|||
jslSupplier.setXltId(xltSupplier.getId()); |
|||
jslDb.table("bms_supplier").setEntity(jslSupplier).insert(); |
|||
} |
|||
} |
|||
|
|||
@Test |
|||
@SneakyThrows |
|||
public void syncErrSupplierId() { |
|||
DbContext jslDb = getJslDbContext(); |
|||
DbContext xltDb = getXltDbContext(); |
|||
List<JslRegion> jslRegions = jslDb.sql("select * from bms_region where del_flag=0").getList(JslRegion.class); |
|||
|
|||
String jslSupplierSql = "SELECT " + |
|||
" id,xlt_id xltid2," + |
|||
" region_first,region_second,region_third,region_last " + |
|||
" FROM " + |
|||
" `bms_supplier` " + |
|||
" where " + |
|||
" xlt_id is not null and length(region_first)>30"; |
|||
String xlt_sql = "SELECT " + |
|||
" d1.id, " + |
|||
" emp.name emp_name " + |
|||
" FROM " + |
|||
" DealerConnTable d1 " + |
|||
" LEFT JOIN DealerCity d2 ON d1.cid = d2.id " + |
|||
" LEFT JOIN DealerProvince d3 ON d2.pid = d3.id " + |
|||
" LEFT JOIN Employee emp ON emp.id = d3.shengP " + |
|||
" where d1.id ="; |
|||
List<JslSupplier> supplierList = jslDb.sql(jslSupplierSql).getList(JslSupplier.class); |
|||
for (JslSupplier supplier : supplierList) { |
|||
XltSupplierEmp supplierEmp = xltDb.sql(xlt_sql + "'" + supplier.getXltid2() + "'").getItem(XltSupplierEmp.class); |
|||
String emp_name = supplierEmp.getEmpName(); |
|||
if (emp_name != null) { |
|||
for (JslRegion jslRegion : jslRegions) { |
|||
if(emp_name.contains(jslRegion.getName())){ |
|||
String[] ids = jslRegion.getPathIds().split("_"); |
|||
if(ids.length==3){ |
|||
supplier.setRegionFirst(ids[0]); |
|||
supplier.setRegionSecond(ids[1]); |
|||
supplier.setRegionThird(ids[2]); |
|||
supplier.setRegionLast(ids[2]); |
|||
}else if(ids.length==2){ |
|||
supplier.setRegionFirst(ids[0]); |
|||
supplier.setRegionSecond(ids[1]); |
|||
supplier.setRegionThird("0"); |
|||
supplier.setRegionLast(ids[1]); |
|||
}else{ |
|||
supplier.setRegionFirst(ids[0]); |
|||
supplier.setRegionSecond("0"); |
|||
supplier.setRegionThird("0"); |
|||
supplier.setRegionLast(ids[0]); |
|||
} |
|||
} |
|||
} |
|||
if(supplier.getRegionFirst().length()<30){ |
|||
supplier.setXltid2(null); |
|||
jslDb.table("bms_supplier").setEntity(supplier).updateBy("id"); |
|||
}else { |
|||
supplier.setRegionFirst("0"); |
|||
supplier.setRegionSecond("0"); |
|||
supplier.setRegionThird("0"); |
|||
supplier.setRegionLast("0"); |
|||
supplier.setXltid2(null); |
|||
jslDb.table("bms_supplier").setEntity(supplier).updateBy("id"); |
|||
} |
|||
} |
|||
} |
|||
jslDb.close(); |
|||
xltDb.close(); |
|||
} |
|||
|
|||
|
|||
@Test |
|||
public void syncRegion() throws Exception { |
|||
String table = "bms_region"; |
|||
DbContext jslDb = getJslDbContext(); |
|||
DbContext xltDb = getXltDbContext(); |
|||
List<XltDealerArea> areaList = xltDb.sql("select id,area from DealerArea").getList(XltDealerArea.class); |
|||
List<XltDealerProvince> provinceList = xltDb.sql("select id,province,aid from DealerProvince").getList(XltDealerProvince.class); |
|||
List<XltDealerCity> cityList = xltDb.sql("select id,city,pid from DealerCity ").getList(XltDealerCity.class); |
|||
long regionId = 1000L; |
|||
for (XltDealerArea area : areaList) { |
|||
JslRegion region = new JslRegion(); |
|||
region.setId(area.getId()); |
|||
region.setName(area.getArea()); |
|||
region.setCode("AE" + regionId); |
|||
region.setPid("0"); |
|||
region.setLevel(1); |
|||
region.setPathIds(area.getId()); |
|||
region.setPathNames(area.getArea()); |
|||
region.setTenantId("001"); |
|||
jslDb.table(table).setEntity(region).insert(); |
|||
regionId++; |
|||
} |
|||
for (XltDealerProvince province : provinceList) { |
|||
XltDealerArea currArea = null; |
|||
for (XltDealerArea area : areaList) { |
|||
if (province.getAid().equals(area.getId())) { |
|||
currArea = area; |
|||
break; |
|||
} |
|||
} |
|||
if (currArea == null) { |
|||
System.out.println("province的Area为空:" + province.getId() + " " + province.getProvince()); |
|||
continue; |
|||
} |
|||
JslRegion region = new JslRegion(); |
|||
region.setId(province.getId()); |
|||
region.setName(province.getProvince()); |
|||
region.setCode("PV" + regionId); |
|||
region.setPid(province.getAid()); |
|||
region.setLevel(2); |
|||
String pathIds = currArea.getId() + "_" + province.getId(); |
|||
String pathNames = currArea.getArea() + "_" + province.getProvince(); |
|||
province.setTempIds(pathIds); |
|||
province.setTempNames(pathNames); |
|||
region.setPathIds(pathIds); |
|||
region.setPathNames(pathNames); |
|||
region.setTenantId("001"); |
|||
jslDb.table(table).setEntity(region).insert(); |
|||
regionId++; |
|||
} |
|||
for (XltDealerCity city : cityList) { |
|||
XltDealerProvince currProvince = null; |
|||
for (XltDealerProvince province : provinceList) { |
|||
if (city.getPid().equals(province.getId())) { |
|||
currProvince = province; |
|||
break; |
|||
} |
|||
} |
|||
if (currProvince == null) { |
|||
System.out.println("city的currProvince为空:" + city.getId() + " " + city.getCity()); |
|||
continue; |
|||
} |
|||
JslRegion region = new JslRegion(); |
|||
region.setId(city.getId()); |
|||
region.setName(city.getCity()); |
|||
region.setCode("CT" + regionId); |
|||
region.setPid(city.getPid()); |
|||
region.setLevel(3); |
|||
String pathIds = currProvince.getTempIds() + "_" + city.getId(); |
|||
String pathNames = currProvince.getTempNames() + "_" + city.getCity(); |
|||
region.setPathIds(pathIds); |
|||
region.setPathNames(pathNames); |
|||
region.setTenantId("001"); |
|||
jslDb.table(table).setEntity(region).insert(); |
|||
regionId++; |
|||
} |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,33 @@ |
|||
package com.demo.jsl; |
|||
|
|||
import org.noear.wood.DbContext; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/2/9 |
|||
*/ |
|||
public class ServiceMain2 { |
|||
|
|||
final String EmptyString = ""; |
|||
final String TENANT_ID = "001"; |
|||
|
|||
DbContext jslCtx; |
|||
DbContext xltCtx; |
|||
|
|||
public DbContext getJslDbContext() { |
|||
if (jslCtx == null) { |
|||
jslCtx = new DbContext("test", "jdbc:mysql://192.168.0.9:3306/jsl_mall_qs_dev?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true", "kpjsl", "123456"); |
|||
} |
|||
return jslCtx; |
|||
} |
|||
|
|||
public DbContext getXltDbContext() { |
|||
if (xltCtx == null) { |
|||
//return new DbContext("xlt","jdbc:sqlserver://rm-wz93l107hc277n9ieco.sqlserver.rds.aliyuncs.com:3433;DatabaseName=ceshi","qs_db_user","Aa135246");
|
|||
xltCtx = new DbContext("xlt", "jdbc:sqlserver://rm-wz93l107hc277n9ieco.sqlserver.rds.aliyuncs.com:3433;DatabaseName=xiaolutong", "qs_db_user", "Aa135246"); |
|||
} |
|||
return xltCtx; |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,57 @@ |
|||
package com.demo.jsl; |
|||
|
|||
import com.demo.jsl.entity.dept.JslDept; |
|||
import com.demo.jsl.entity.dept.XltDept; |
|||
import org.noear.wood.DbContext; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/1/10 |
|||
*/ |
|||
public class ServiceOld { |
|||
|
|||
public DbContext getJslDbContext() { |
|||
return new DbContext("test", "jdbc:mysql://192.168.0.9:3306/jsl_mall_qs_test?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true", "kpjsl", "123456"); |
|||
} |
|||
|
|||
public DbContext getXltDbContext() { |
|||
return new DbContext("xlt", "jdbc:sqlserver://rm-wz93l107hc277n9ieco.sqlserver.rds.aliyuncs.com:3433;DatabaseName=ceshi", "qs_db_user", "Aa135246"); |
|||
} |
|||
|
|||
public DbContext getSeeYonDbContext() { |
|||
return new DbContext("oa", "jdbc:sqlserver://192.168.10.7:1433;DatabaseName=OAdata", "sa", "JSL2282125"); |
|||
} |
|||
|
|||
|
|||
@Deprecated |
|||
public void syncDept() throws Exception { |
|||
DbContext jslDb = getJslDbContext(); |
|||
DbContext xltDb = getXltDbContext(); |
|||
List<XltDept> deptList = xltDb |
|||
.sql("select id,deptName name,superId pid,supervisor uid ,isSellDept sell_flag from department") |
|||
.getList(XltDept.class); |
|||
String prefix = "D"; |
|||
String prefix2 = "S"; |
|||
int codeIdx = 100; |
|||
for (XltDept xltDept : deptList) { |
|||
codeIdx++; |
|||
String codePre; |
|||
if (xltDept.getSellFlag() == null || xltDept.getSellFlag().equals(0)) { |
|||
codePre = prefix; |
|||
} else { |
|||
codePre = prefix2; |
|||
} |
|||
JslDept dept = new JslDept(); |
|||
dept.setId(xltDept.getId()); |
|||
dept.setName(xltDept.getName()); |
|||
dept.setCode(codePre + codeIdx); |
|||
dept.setParentId(xltDept.getPid() == null ? "0" : xltDept.getPid()); |
|||
dept.setMgrUserId(xltDept.getUid()); |
|||
dept.setTenantId("001"); |
|||
jslDb.table("sys_dept").setEntity(dept).insert(); |
|||
} |
|||
} |
|||
|
|||
} |
@ -0,0 +1,53 @@ |
|||
package com.demo.jsl.entity.cate; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/1/9 |
|||
*/ |
|||
@Data |
|||
public class JslGoodsCategory { |
|||
|
|||
private Long id; |
|||
|
|||
private String xltId; |
|||
|
|||
/** |
|||
* (1:开启;0:关闭) |
|||
*/ |
|||
private Integer enable; |
|||
|
|||
private String code; |
|||
|
|||
/** |
|||
* 父分类编号 |
|||
*/ |
|||
private Long parentId; |
|||
|
|||
/** |
|||
* 名称 |
|||
*/ |
|||
private String name; |
|||
|
|||
/** |
|||
* 排序 |
|||
*/ |
|||
private Integer level; |
|||
|
|||
/** |
|||
* 等级路径id |
|||
*/ |
|||
private String levelPath; |
|||
|
|||
/** |
|||
* 等级路径 |
|||
*/ |
|||
private String levelPathNames; |
|||
|
|||
/** |
|||
* 所属租户 |
|||
*/ |
|||
private String tenantId; |
|||
|
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.demo.jsl.entity.cate; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/1/9 |
|||
*/ |
|||
@Data |
|||
public class XltGoodsCategory { |
|||
|
|||
private String id; |
|||
private Integer level; |
|||
private String name; |
|||
private String pid; |
|||
private String code; |
|||
private Long tempId; |
|||
private Integer sival; |
|||
|
|||
} |
@ -0,0 +1,82 @@ |
|||
package com.demo.jsl.entity.channel; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/4/18 |
|||
*/ |
|||
@Data |
|||
public class BmsMasterUser { |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private Long id; |
|||
|
|||
/** |
|||
* 类型:channel、point、center |
|||
*/ |
|||
private String type; |
|||
|
|||
/** |
|||
* 目标id |
|||
*/ |
|||
private String targetId; |
|||
|
|||
/** |
|||
* 用户id |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 主要负责人 |
|||
*/ |
|||
private Integer masterFlag; |
|||
|
|||
/** |
|||
* 渠道 |
|||
*/ |
|||
private String channelName; |
|||
|
|||
/** |
|||
* 渠道 |
|||
*/ |
|||
private String channelCode; |
|||
|
|||
/** |
|||
* 网点 |
|||
*/ |
|||
private String pointName; |
|||
|
|||
/** |
|||
* 网点 |
|||
*/ |
|||
private String pointCode; |
|||
|
|||
/** |
|||
* 用户 |
|||
*/ |
|||
private String userCode; |
|||
|
|||
/** |
|||
* 用户 |
|||
*/ |
|||
private String userName; |
|||
|
|||
/** |
|||
* 成本中心 |
|||
*/ |
|||
private String centerCode; |
|||
|
|||
/** |
|||
* 成本中心 |
|||
*/ |
|||
private String centerName; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
} |
@ -0,0 +1,44 @@ |
|||
package com.demo.jsl.entity.channel; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/1/11 |
|||
*/ |
|||
@Data |
|||
public class JslChannel { |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private Long id; |
|||
|
|||
/** |
|||
* 渠道编码 |
|||
*/ |
|||
private String channelCode; |
|||
|
|||
/** |
|||
* 渠道名称 |
|||
*/ |
|||
private String channelName; |
|||
|
|||
/** |
|||
* 渠道类型(读取数据字典) |
|||
*/ |
|||
private String channelType; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
|
|||
/** |
|||
* 所属租户 |
|||
*/ |
|||
private String tenantId; |
|||
|
|||
|
|||
} |
@ -0,0 +1,96 @@ |
|||
package com.demo.jsl.entity.channel; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/1/11 |
|||
*/ |
|||
@Data |
|||
public class JslChannelPoint { |
|||
|
|||
String shopArea; |
|||
Integer countCheckstand; |
|||
/** |
|||
* id |
|||
*/ |
|||
private Long id; |
|||
/** |
|||
* 渠道名称 |
|||
*/ |
|||
private Long channelId; |
|||
private String channelName; |
|||
/** |
|||
* 站点编码 |
|||
*/ |
|||
private String pointCode; |
|||
/** |
|||
* 站点名称 |
|||
*/ |
|||
private String pointName; |
|||
/** |
|||
* 站点等级(读取字典值) |
|||
*/ |
|||
private String pointLevel; |
|||
/** |
|||
* 站点类型(读取字典值) |
|||
*/ |
|||
private String pointType; |
|||
/** |
|||
* 详细地址 |
|||
*/ |
|||
private String address; |
|||
/** |
|||
* 销售区域id |
|||
*/ |
|||
private String saleRegionId; |
|||
/** |
|||
* 销售区域 |
|||
*/ |
|||
private String saleRegionPath; |
|||
private String saleRegionPathIds; |
|||
/** |
|||
* 行政区域id |
|||
*/ |
|||
private String bizRegionId; |
|||
/** |
|||
* 行政区域 |
|||
*/ |
|||
private String bizRegionPath; |
|||
private String bizRegionPathIds; |
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
private String mapAddress; |
|||
/** |
|||
* 所属租户 |
|||
*/ |
|||
private String tenantId; |
|||
|
|||
public static JslChannelPoint toNewObject(JslChannelSourcePoint source) { |
|||
JslChannelPoint channelPoint = new JslChannelPoint(); |
|||
// channelPoint.setChannelId(source.getChannelId());
|
|||
// channelPoint.setChannelName(source.getChannelName());
|
|||
channelPoint.setPointCode(source.getPointCode()); |
|||
channelPoint.setPointName(source.getPointName()); |
|||
channelPoint.setShopArea(source.getShopArea()); |
|||
if (source.getCountCheckstand() != null) { |
|||
Integer s = Integer.parseInt(source.getCountCheckstand()); |
|||
channelPoint.setCountCheckstand(s); |
|||
} |
|||
channelPoint.setPointLevel(source.getPointLevel()); |
|||
channelPoint.setPointType(source.getPointType()); |
|||
channelPoint.setAddress(source.getAddress()); |
|||
// channelPoint.setSaleRegionId(source.getSaleRegionId());
|
|||
// channelPoint.setSaleRegionPath(source.getSaleRegionPath());
|
|||
// channelPoint.setSaleRegionPathIds(source.getSaleRegionPathIds());
|
|||
// channelPoint.setBizRegionId(source.getBizRegionId());
|
|||
// channelPoint.setBizRegionPath(source.getBizRegionPath());
|
|||
// channelPoint.setBizRegionPathIds(source.getBizRegionPathIds());
|
|||
channelPoint.setMapAddress(source.getMapAddress()); |
|||
channelPoint.setTenantId("001"); |
|||
return channelPoint; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,57 @@ |
|||
package com.demo.jsl.entity.channel; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/1/11 |
|||
*/ |
|||
@Data |
|||
public class JslChannelSourcePoint { |
|||
|
|||
String shopArea; |
|||
String countCheckstand; |
|||
private Integer id; |
|||
private String channelCode; |
|||
/** |
|||
* 站点编码 |
|||
*/ |
|||
private String pointCode; |
|||
/** |
|||
* 站点名称 |
|||
*/ |
|||
private String pointName; |
|||
/** |
|||
* 站点等级(读取字典值) |
|||
*/ |
|||
private String pointLevel; |
|||
|
|||
/** |
|||
* 站点类型(读取字典值) |
|||
*/ |
|||
private String pointType; |
|||
|
|||
/** |
|||
* 详细地址 |
|||
*/ |
|||
private String address; |
|||
|
|||
private String mapAddress; |
|||
|
|||
private String provinceUser; |
|||
|
|||
private String cityUser; |
|||
|
|||
private String saleRegion; |
|||
|
|||
private String saleRegionMgr; |
|||
|
|||
private String pointUser; |
|||
|
|||
private String provinceName; |
|||
|
|||
private String cityName; |
|||
|
|||
private String areaName; |
|||
|
|||
} |
@ -0,0 +1,16 @@ |
|||
package com.demo.jsl.entity.channel; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/4/13 |
|||
*/ |
|||
@Data |
|||
public class JslPointUser { |
|||
|
|||
private String type; |
|||
private String targetId; |
|||
private String userId; |
|||
private String tenantId; |
|||
} |
@ -0,0 +1,10 @@ |
|||
package com.demo.jsl.entity.channel; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class SupplierMgr { |
|||
String name; |
|||
String code; |
|||
String otherUserIds; |
|||
} |
@ -0,0 +1,13 @@ |
|||
package com.demo.jsl.entity.channel; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/1/11 |
|||
*/ |
|||
@Data |
|||
public class XltQuDaoOne { |
|||
String id; |
|||
String name; |
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.demo.jsl.entity.channel; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/1/11 |
|||
*/ |
|||
@Data |
|||
public class XltQuDaoTwo { |
|||
String id; |
|||
String name; |
|||
String pid; |
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.demo.jsl.entity.channel; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/1/11 |
|||
*/ |
|||
@Data |
|||
public class XltWangDian { |
|||
|
|||
String id; |
|||
String name; |
|||
String code; |
|||
String cityId; |
|||
String channelId; |
|||
String type; |
|||
String levelName; |
|||
String address; |
|||
|
|||
} |
@ -0,0 +1,133 @@ |
|||
package com.demo.jsl.entity.costapply; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 费用活动 实体类 |
|||
* |
|||
* @author YenHex |
|||
* @since 2022-11-08 |
|||
*/ |
|||
@Data |
|||
public class JslActivity implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private Long id; |
|||
|
|||
/** |
|||
* 编码 |
|||
*/ |
|||
private String activityCode; |
|||
|
|||
/** |
|||
* 活动状态:0-待核销;1-审批中;2-完成;3-冻结;4-已释放 |
|||
*/ |
|||
private Integer activityState; |
|||
|
|||
/** |
|||
* 费用申请id |
|||
*/ |
|||
private Long costApplyId; |
|||
|
|||
/** |
|||
* 费用通过时间 |
|||
*/ |
|||
private Date costPassTime; |
|||
|
|||
/** |
|||
* 费用通过标识,用于已申请费用活动列表 |
|||
*/ |
|||
private Integer costPassFlag; |
|||
|
|||
/** |
|||
* 活动简述及目的 |
|||
*/ |
|||
private String actTitle; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private Long supplierId; |
|||
|
|||
/** |
|||
* 客户编码 |
|||
*/ |
|||
private String supplierCode; |
|||
|
|||
/** |
|||
* 客户名称 |
|||
*/ |
|||
private String supplierName; |
|||
|
|||
/** |
|||
* 活动开始时间 |
|||
*/ |
|||
private Date actStartDate; |
|||
|
|||
/** |
|||
* 活动结束时间 |
|||
*/ |
|||
private Date actEndDate; |
|||
|
|||
/** |
|||
* 预算开始时间 |
|||
*/ |
|||
private Date preStartDate; |
|||
|
|||
/** |
|||
* 预算结束时间 |
|||
*/ |
|||
private Date preEndDate; |
|||
|
|||
/** |
|||
* 预计核销时间 |
|||
*/ |
|||
private Date preCheckDate; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createTime; |
|||
|
|||
/** |
|||
* 所属租户 |
|||
*/ |
|||
private String tenantId; |
|||
|
|||
/** |
|||
* 完成标识 |
|||
*/ |
|||
private Integer finishedFlag; |
|||
|
|||
/** |
|||
* 完成时间 |
|||
*/ |
|||
private Date finishedTime; |
|||
|
|||
/** |
|||
* 合计金额 |
|||
*/ |
|||
private BigDecimal totalAmount; |
|||
|
|||
/** |
|||
* 使用金额 |
|||
*/ |
|||
private BigDecimal usedAmount; |
|||
|
|||
private String xltId; |
|||
|
|||
} |
|||
|
@ -0,0 +1,99 @@ |
|||
package com.demo.jsl.entity.costapply; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
|
|||
/** |
|||
* 活动成本中心项 实体类 |
|||
* |
|||
* @author YenHex |
|||
* @since 2022-11-09 |
|||
*/ |
|||
@Data |
|||
public class JslActivityCenter implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private Long id; |
|||
|
|||
/** |
|||
* 费用申请id |
|||
*/ |
|||
private Long costApplyId; |
|||
|
|||
/** |
|||
* 活动id |
|||
*/ |
|||
private Long activityId; |
|||
|
|||
/** |
|||
* 科目id |
|||
*/ |
|||
private Long subjectId; |
|||
|
|||
/** |
|||
* 费用额度 |
|||
*/ |
|||
private BigDecimal centerRate; |
|||
|
|||
/** |
|||
* 费用额度 |
|||
*/ |
|||
private BigDecimal centerAmount; |
|||
|
|||
private BigDecimal usedAmount; |
|||
|
|||
/** |
|||
* 成本中心类型 |
|||
* center, |
|||
* customer, |
|||
* dept, |
|||
* bizRegion, |
|||
* saleRegion, |
|||
* saleman |
|||
*/ |
|||
private String centerType; |
|||
|
|||
/** |
|||
* 成本中心id |
|||
*/ |
|||
private String centerId; |
|||
|
|||
/** |
|||
* 成本中心编码 |
|||
*/ |
|||
private String centerCode; |
|||
|
|||
/** |
|||
* 成本中心名称 |
|||
*/ |
|||
private String centerName; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private LocalDateTime createTime; |
|||
|
|||
/** |
|||
* 最后更新时间 |
|||
*/ |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** |
|||
* 所属租户 |
|||
*/ |
|||
private String tenantId; |
|||
|
|||
} |
|||
|
@ -0,0 +1,208 @@ |
|||
package com.demo.jsl.entity.costapply; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 活动成本中心配比项 实体类 |
|||
* |
|||
* @author YenHex |
|||
* @since 2022-11-08 |
|||
*/ |
|||
@Data |
|||
public class JslActivityCenterGoods implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private Long id; |
|||
|
|||
private String centerGoodsCode; |
|||
|
|||
/** |
|||
* 费用申请id |
|||
*/ |
|||
private Long costApplyId; |
|||
|
|||
/** |
|||
* 活动id |
|||
*/ |
|||
private Long activityId; |
|||
|
|||
/** |
|||
* 活动编码 |
|||
*/ |
|||
private String activityCode; |
|||
|
|||
/** |
|||
* 科目id |
|||
*/ |
|||
private Long subjectId; |
|||
|
|||
/** |
|||
* 科目编码 |
|||
*/ |
|||
private String subjectCode; |
|||
|
|||
/** |
|||
* 科目名称 |
|||
*/ |
|||
private String subjectName; |
|||
|
|||
/** |
|||
* 费用额度 |
|||
*/ |
|||
private BigDecimal centerGoodsAmount; |
|||
|
|||
/** |
|||
* 费用占比 |
|||
*/ |
|||
private BigDecimal centerGoodsRate; |
|||
|
|||
/** |
|||
* 费用已用额度 |
|||
*/ |
|||
private BigDecimal usedAmount; |
|||
|
|||
/** |
|||
* 成本中心类型 |
|||
*/ |
|||
private String centerType; |
|||
|
|||
/** |
|||
* 成本中心id |
|||
*/ |
|||
private String centerId; |
|||
|
|||
/** |
|||
* 成本中心编码 |
|||
*/ |
|||
private String centerCode; |
|||
|
|||
/** |
|||
* 成本中心名称 |
|||
*/ |
|||
private String centerName; |
|||
|
|||
/** |
|||
* 费用额度 |
|||
*/ |
|||
private BigDecimal centerAmount; |
|||
|
|||
/** |
|||
* 费用占比 |
|||
*/ |
|||
private BigDecimal centerRate; |
|||
|
|||
/** |
|||
* 目标类型(brand、category、series、spu、sku) |
|||
*/ |
|||
private String targetType; |
|||
|
|||
/** |
|||
* 目标id |
|||
*/ |
|||
private Long targetId; |
|||
|
|||
/** |
|||
* 目标编码 |
|||
*/ |
|||
private String targetCode; |
|||
|
|||
/** |
|||
* 目标名称 |
|||
*/ |
|||
private String targetName; |
|||
|
|||
/** |
|||
* 目标等级id路径 |
|||
*/ |
|||
private String targetLevelPathIds; |
|||
|
|||
/** |
|||
* 目标等级名称路径 |
|||
*/ |
|||
private String targetLevelPathNames; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private LocalDateTime createTime; |
|||
|
|||
/** |
|||
* 最后更新时间 |
|||
*/ |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** |
|||
* 所属租户 |
|||
*/ |
|||
private String tenantId; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createBy; |
|||
|
|||
private String updateBy; |
|||
|
|||
|
|||
/** |
|||
* 活动开始时间 |
|||
*/ |
|||
private Date actStartDate; |
|||
|
|||
/** |
|||
* 活动结束时间 |
|||
*/ |
|||
private Date actEndDate; |
|||
|
|||
/** |
|||
* 预算开始时间 |
|||
*/ |
|||
private Date preStartDate; |
|||
|
|||
/** |
|||
* 预算结束时间 |
|||
*/ |
|||
private Date preEndDate; |
|||
|
|||
/** |
|||
* 预计核销时间 |
|||
*/ |
|||
private Date preCheckDate; |
|||
|
|||
/** |
|||
* 模板唯一健 |
|||
*/ |
|||
private String tmpUk; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private Long supplierId; |
|||
|
|||
/** |
|||
* 客户编码 |
|||
*/ |
|||
private String supplierCode; |
|||
|
|||
/** |
|||
* 客户名称 |
|||
*/ |
|||
private String supplierName; |
|||
|
|||
|
|||
} |
|||
|
@ -0,0 +1,80 @@ |
|||
package com.demo.jsl.entity.costapply; |
|||
|
|||
import lombok.Data; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
|
|||
import java.io.Serializable; |
|||
import java.time.LocalDateTime; |
|||
|
|||
/** |
|||
* 活动商品项 实体类 |
|||
* |
|||
* @author YenHex |
|||
* @since 2022-11-08 |
|||
*/ |
|||
@Slf4j |
|||
@Data |
|||
public class JslActivityGoods implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private Long id; |
|||
|
|||
/** |
|||
* 费用申请id |
|||
*/ |
|||
private Long costApplyId; |
|||
|
|||
/** |
|||
* 活动id |
|||
*/ |
|||
private Long activityId; |
|||
|
|||
/** |
|||
* 目标类型(brand、category、series、spu、sku) |
|||
*/ |
|||
private String targetType; |
|||
|
|||
/** |
|||
* 目标id |
|||
*/ |
|||
private Long targetId; |
|||
|
|||
/** |
|||
* 目标编码 |
|||
*/ |
|||
private String targetCode; |
|||
|
|||
/** |
|||
* 目标名称 |
|||
*/ |
|||
private String targetName; |
|||
|
|||
/** |
|||
* 目标等级id路径 |
|||
*/ |
|||
private String targetLevelPathIds; |
|||
|
|||
/** |
|||
* 目标等级名称路径 |
|||
*/ |
|||
private String targetLevelPathNames; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private LocalDateTime createTime; |
|||
|
|||
private String tenantId; |
|||
|
|||
|
|||
} |
|||
|
@ -0,0 +1,106 @@ |
|||
package com.demo.jsl.entity.costapply; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
|
|||
/** |
|||
* 活动科目项 实体类 |
|||
* |
|||
* @author YenHex |
|||
* @since 2022-11-09 |
|||
*/ |
|||
@Data |
|||
public class JslActivitySubject implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private Long id; |
|||
|
|||
/** |
|||
* 费用申请id |
|||
*/ |
|||
private Long costApplyId; |
|||
|
|||
/** |
|||
* 活动id |
|||
*/ |
|||
private Long activityId; |
|||
|
|||
/** |
|||
* 科目id |
|||
*/ |
|||
private Long subjectId; |
|||
|
|||
/** |
|||
* 科目编码 |
|||
*/ |
|||
private String subjectCode; |
|||
|
|||
/** |
|||
* 科目名称 |
|||
*/ |
|||
private String subjectName; |
|||
|
|||
/** |
|||
* 费用额度 |
|||
*/ |
|||
private BigDecimal amount; |
|||
|
|||
/** |
|||
* 费用额度 |
|||
*/ |
|||
private BigDecimal usedAmount; |
|||
|
|||
/** |
|||
* 场次 |
|||
*/ |
|||
private Integer countSession; |
|||
|
|||
/** |
|||
* 人数 |
|||
*/ |
|||
private Integer countPerson; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private LocalDateTime createTime; |
|||
|
|||
/** |
|||
* 最后更新时间 |
|||
*/ |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** |
|||
* 所属租户 |
|||
*/ |
|||
private String tenantId; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createBy; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updateBy; |
|||
|
|||
/** |
|||
* 逻辑删除标记(0:显示;1:隐藏) |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
} |
|||
|
@ -0,0 +1,123 @@ |
|||
package com.demo.jsl.entity.costapply; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 费用申请 实体类 |
|||
* |
|||
* @author YenHex |
|||
* @since 2022-11-09 |
|||
*/ |
|||
@Data |
|||
public class JslCostApply implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private Long id; |
|||
|
|||
private String code; |
|||
|
|||
/** |
|||
* 主题 |
|||
*/ |
|||
private String chargeTheme; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String supplierId; |
|||
|
|||
/** |
|||
* 客户编码 |
|||
*/ |
|||
private String supplierCode; |
|||
|
|||
/** |
|||
* 客户名称 |
|||
*/ |
|||
private String supplierName; |
|||
|
|||
/** |
|||
* 状态:0=未发布;1=审批中;2=待执行;3=完成;4-被驳回 |
|||
*/ |
|||
private Integer chargeState; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 申请人 |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 用户编码 |
|||
*/ |
|||
private String userCode; |
|||
|
|||
/** |
|||
* 用户名称 |
|||
*/ |
|||
private String userName; |
|||
|
|||
private String syFormId; |
|||
|
|||
private String syFlowId; |
|||
|
|||
/** |
|||
* 合同类型:0->无;1->有合同 |
|||
*/ |
|||
private Integer contractFlag; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createTime; |
|||
private Date passTime; |
|||
|
|||
private Date submitTime; |
|||
|
|||
/** |
|||
* 最后更新时间 |
|||
*/ |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** |
|||
* 所属租户 |
|||
*/ |
|||
private String tenantId; |
|||
|
|||
/** |
|||
* 统计活动数量 |
|||
*/ |
|||
private Integer totalActivity; |
|||
|
|||
/** |
|||
* 统计所有活动申请的金额 |
|||
*/ |
|||
private BigDecimal totalActivityAmount; |
|||
|
|||
/** |
|||
* 统计所有活动使用的金额 |
|||
*/ |
|||
private BigDecimal totalActivityUsedAmount; |
|||
|
|||
/** |
|||
* 0-无关 |
|||
* 1-未同步 |
|||
* 2-已同步 |
|||
*/ |
|||
private Integer xltSync; |
|||
|
|||
} |
|||
|
@ -0,0 +1,273 @@ |
|||
package com.demo.jsl.entity.costapply; |
|||
|
|||
import com.demo.util.dto.DateSplitDTO; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 实体类 |
|||
* |
|||
* @author YenHex |
|||
* @since 2023-03-24 |
|||
*/ |
|||
@Data |
|||
public class TbsActivityCenterGoodsSplit implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private Long id; |
|||
|
|||
/** |
|||
* 活动费用明细 |
|||
*/ |
|||
private Long activityCenterGoodsId; |
|||
|
|||
/** |
|||
* 年月 |
|||
*/ |
|||
private Integer yearMonth; |
|||
|
|||
/** |
|||
* 天数 |
|||
*/ |
|||
private Integer days; |
|||
|
|||
/** |
|||
* 开始日期 |
|||
*/ |
|||
private Date starDate; |
|||
|
|||
/** |
|||
* 结束日期 |
|||
*/ |
|||
private Date endDate; |
|||
|
|||
private BigDecimal splitAmount; |
|||
|
|||
private BigDecimal splitUsedAmount; |
|||
|
|||
/** |
|||
* 成本明细编码 |
|||
*/ |
|||
private String centerGoodsCode; |
|||
|
|||
/** |
|||
* 费用申请id |
|||
*/ |
|||
private Long costApplyId; |
|||
|
|||
/** |
|||
* 活动id |
|||
*/ |
|||
private Long activityId; |
|||
|
|||
/** |
|||
* 活动编码 |
|||
*/ |
|||
private String activityCode; |
|||
|
|||
/** |
|||
* 科目id |
|||
*/ |
|||
private Long subjectId; |
|||
|
|||
/** |
|||
* 科目编码 |
|||
*/ |
|||
private String subjectCode; |
|||
|
|||
/** |
|||
* 科目名称 |
|||
*/ |
|||
private String subjectName; |
|||
|
|||
/** |
|||
* 成本中心类型 |
|||
*/ |
|||
private String centerType; |
|||
|
|||
/** |
|||
* 成本中心id |
|||
*/ |
|||
private String centerId; |
|||
|
|||
/** |
|||
* 成本中心编码 |
|||
*/ |
|||
private String centerCode; |
|||
|
|||
/** |
|||
* 成本中心名称 |
|||
*/ |
|||
private String centerName; |
|||
|
|||
/** |
|||
* 成本中心金额 |
|||
*/ |
|||
private BigDecimal centerAmount; |
|||
|
|||
/** |
|||
* 成本中心占比 |
|||
*/ |
|||
private BigDecimal centerRate; |
|||
|
|||
/** |
|||
* 费用额度 |
|||
*/ |
|||
private BigDecimal centerGoodsAmount; |
|||
|
|||
/** |
|||
* 费用占比 |
|||
*/ |
|||
private BigDecimal centerGoodsRate; |
|||
|
|||
/** |
|||
* 已用费用 |
|||
*/ |
|||
private BigDecimal usedAmount; |
|||
|
|||
/** |
|||
* 目标类型(brand、category、series、spu、sku) |
|||
*/ |
|||
private String targetType; |
|||
|
|||
/** |
|||
* 目标id |
|||
*/ |
|||
private Long targetId; |
|||
|
|||
/** |
|||
* 目标编码 |
|||
*/ |
|||
private String targetCode; |
|||
|
|||
/** |
|||
* 目标名称 |
|||
*/ |
|||
private String targetName; |
|||
|
|||
/** |
|||
* 目标等级路径 |
|||
*/ |
|||
private String targetLevelPathIds; |
|||
|
|||
/** |
|||
* 目标等级路径 |
|||
*/ |
|||
private String targetLevelPathNames; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private LocalDateTime createTime; |
|||
|
|||
/** |
|||
* 最后更新时间 |
|||
*/ |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** |
|||
* 所属租户 |
|||
*/ |
|||
private String tenantId; |
|||
|
|||
/** |
|||
* 活动开始时间 |
|||
*/ |
|||
private Date actStartDate; |
|||
|
|||
/** |
|||
* 活动结束时间 |
|||
*/ |
|||
private Date actEndDate; |
|||
|
|||
/** |
|||
* 预算开始时间 |
|||
*/ |
|||
private Date preStartDate; |
|||
|
|||
/** |
|||
* 预算结束时间 |
|||
*/ |
|||
private Date preEndDate; |
|||
|
|||
/** |
|||
* 预计核销时间 |
|||
*/ |
|||
private Date preCheckDate; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private Long supplierId; |
|||
|
|||
/** |
|||
* 客户编码 |
|||
*/ |
|||
private String supplierCode; |
|||
|
|||
/** |
|||
* 客户名称 |
|||
*/ |
|||
private String supplierName; |
|||
|
|||
|
|||
public static TbsActivityCenterGoodsSplit toNewObject(JslActivityCenterGoods source, DateSplitDTO dateSplit) { |
|||
TbsActivityCenterGoodsSplit activityCenterGoodsSplit = new TbsActivityCenterGoodsSplit(); |
|||
//activityCenterGoodsSplit.setId();
|
|||
activityCenterGoodsSplit.setActivityCenterGoodsId(source.getId()); |
|||
activityCenterGoodsSplit.setYearMonth(dateSplit.getYearMonth()); |
|||
activityCenterGoodsSplit.setDays(dateSplit.getDays()); |
|||
activityCenterGoodsSplit.setStarDate(dateSplit.getStartDate()); |
|||
activityCenterGoodsSplit.setEndDate(dateSplit.getEndDate()); |
|||
activityCenterGoodsSplit.setCenterGoodsCode(source.getCenterGoodsCode()); |
|||
activityCenterGoodsSplit.setCostApplyId(source.getCostApplyId()); |
|||
activityCenterGoodsSplit.setActivityId(source.getActivityId()); |
|||
activityCenterGoodsSplit.setActivityCode(source.getActivityCode()); |
|||
activityCenterGoodsSplit.setSubjectId(source.getSubjectId()); |
|||
activityCenterGoodsSplit.setSubjectCode(source.getSubjectCode()); |
|||
activityCenterGoodsSplit.setSubjectName(source.getSubjectName()); |
|||
activityCenterGoodsSplit.setCenterType(source.getCenterType()); |
|||
activityCenterGoodsSplit.setCenterId(source.getCenterId()); |
|||
activityCenterGoodsSplit.setCenterCode(source.getCenterCode()); |
|||
activityCenterGoodsSplit.setCenterName(source.getCenterName()); |
|||
activityCenterGoodsSplit.setCenterAmount(source.getCenterAmount()); |
|||
activityCenterGoodsSplit.setCenterRate(source.getCenterRate()); |
|||
activityCenterGoodsSplit.setCenterGoodsAmount(source.getCenterGoodsAmount()); |
|||
activityCenterGoodsSplit.setCenterGoodsRate(source.getCenterGoodsRate()); |
|||
activityCenterGoodsSplit.setUsedAmount(source.getUsedAmount()); |
|||
activityCenterGoodsSplit.setTargetType(source.getTargetType()); |
|||
activityCenterGoodsSplit.setTargetId(source.getTargetId()); |
|||
activityCenterGoodsSplit.setTargetCode(source.getTargetCode()); |
|||
activityCenterGoodsSplit.setTargetName(source.getTargetName()); |
|||
activityCenterGoodsSplit.setTargetLevelPathIds(source.getTargetLevelPathIds()); |
|||
activityCenterGoodsSplit.setTargetLevelPathNames(source.getTargetLevelPathNames()); |
|||
activityCenterGoodsSplit.setRemark(source.getRemark()); |
|||
activityCenterGoodsSplit.setCreateTime(source.getCreateTime()); |
|||
activityCenterGoodsSplit.setUpdateTime(source.getUpdateTime()); |
|||
activityCenterGoodsSplit.setTenantId(source.getTenantId()); |
|||
activityCenterGoodsSplit.setActStartDate(source.getActStartDate()); |
|||
activityCenterGoodsSplit.setActEndDate(source.getActEndDate()); |
|||
activityCenterGoodsSplit.setPreStartDate(source.getPreStartDate()); |
|||
activityCenterGoodsSplit.setPreEndDate(source.getPreEndDate()); |
|||
activityCenterGoodsSplit.setPreCheckDate(source.getPreCheckDate()); |
|||
activityCenterGoodsSplit.setSupplierId(source.getSupplierId()); |
|||
activityCenterGoodsSplit.setSupplierCode(source.getSupplierCode()); |
|||
activityCenterGoodsSplit.setSupplierName(source.getSupplierName()); |
|||
return activityCenterGoodsSplit; |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,35 @@ |
|||
package com.demo.jsl.entity.costapply; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/3/15 |
|||
*/ |
|||
@Data |
|||
public class XltCost { |
|||
|
|||
private String code; |
|||
private String title; |
|||
|
|||
private String regionId; |
|||
private String provinceId; |
|||
private String cityId; |
|||
|
|||
private Date createDate; |
|||
private Date commitDate; |
|||
private Date passDate; |
|||
private String remark; |
|||
private String remark2; |
|||
|
|||
private String userId; |
|||
private String userName; |
|||
private String userCode; |
|||
|
|||
private String cusId; |
|||
private String cusName; |
|||
private String cusCode; |
|||
|
|||
} |
@ -0,0 +1,59 @@ |
|||
package com.demo.jsl.entity.costapply; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/3/17 |
|||
*/ |
|||
@Data |
|||
public class XltCostItem { |
|||
|
|||
private String id; |
|||
|
|||
private String costItemCode; |
|||
|
|||
private String costCode; |
|||
|
|||
private Date reportStartTime; |
|||
|
|||
private Date reportEndTime; |
|||
|
|||
private Integer countSession; |
|||
|
|||
private Integer countPerson; |
|||
|
|||
private String remark; |
|||
|
|||
private String cateLv1; |
|||
|
|||
private String cateLv2; |
|||
|
|||
private String cateLv3; |
|||
|
|||
private String spuId; |
|||
|
|||
private Date actStartTime; |
|||
private Date actEndTime; |
|||
private Date preCheckDate; |
|||
|
|||
private BigDecimal money; |
|||
private BigDecimal checkMoney; |
|||
private String productRemark; |
|||
|
|||
private String subjectXltId; |
|||
private String subjectCode; |
|||
private String subjectName; |
|||
|
|||
private String cusId; |
|||
private String cusCode; |
|||
private String cusName; |
|||
|
|||
private String centerId; |
|||
private String centerName; |
|||
private String centerCode; |
|||
|
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.demo.jsl.entity.dept; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/1/10 |
|||
*/ |
|||
@Data |
|||
public class JslDept { |
|||
|
|||
private String id; |
|||
private String name; |
|||
private String code; |
|||
private String parentId; |
|||
private String mgrUserId; |
|||
private String tenantId; |
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.demo.jsl.entity.dept; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/1/10 |
|||
*/ |
|||
@Data |
|||
public class SeeYonDept { |
|||
Long id; |
|||
String name; |
|||
String code; |
|||
String path; |
|||
Integer len; |
|||
|
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.demo.jsl.entity.dept; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/1/10 |
|||
*/ |
|||
@Data |
|||
public class XltDept { |
|||
|
|||
private String id; |
|||
private String name; |
|||
private String pid; |
|||
private String uid; |
|||
private Integer sellFlag; |
|||
|
|||
} |
@ -0,0 +1,29 @@ |
|||
package com.demo.jsl.entity.goods; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/2/10 |
|||
*/ |
|||
@Data |
|||
public class JslGoodSpecValue { |
|||
|
|||
/** |
|||
* PK |
|||
*/ |
|||
private Long id; |
|||
|
|||
/** |
|||
* 规格Id |
|||
*/ |
|||
private Long specId; |
|||
|
|||
/** |
|||
* 名称 |
|||
*/ |
|||
private String name; |
|||
|
|||
private String tenantId; |
|||
|
|||
} |
@ -0,0 +1,75 @@ |
|||
package com.demo.jsl.entity.goods; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/2/10 |
|||
*/ |
|||
@Data |
|||
public class JslGoodSpu { |
|||
|
|||
/** |
|||
* PK |
|||
*/ |
|||
private Long id; |
|||
|
|||
/** |
|||
* 商品编码 |
|||
*/ |
|||
private String spuCode; |
|||
|
|||
/** |
|||
* 商品名字 |
|||
*/ |
|||
private String name; |
|||
|
|||
/** |
|||
* 一级分类、品牌ID |
|||
*/ |
|||
private String categoryFirst; |
|||
|
|||
/** |
|||
* 二级分类、类目ID |
|||
*/ |
|||
private String categorySecond; |
|||
|
|||
/** |
|||
* 三级分类、系列ID |
|||
*/ |
|||
private String categoryThird; |
|||
|
|||
/** |
|||
* 最后一级分类 |
|||
*/ |
|||
private String categoryLast; |
|||
|
|||
/** |
|||
* 是否上架(1是 0否) |
|||
*/ |
|||
private Integer shelf; |
|||
|
|||
/** |
|||
* 销量 |
|||
*/ |
|||
private Integer saleNum; |
|||
|
|||
|
|||
/** |
|||
* 产品口味(非sku规格值) |
|||
*/ |
|||
private String tasteValue; |
|||
|
|||
/** |
|||
* 所属租户 |
|||
*/ |
|||
private String tenantId; |
|||
|
|||
private String xltId; |
|||
|
|||
/** |
|||
* 可投放费用标识 |
|||
*/ |
|||
private Integer costFlag; |
|||
|
|||
} |
@ -0,0 +1,110 @@ |
|||
package com.demo.jsl.entity.goods; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* sku 实体类 |
|||
* |
|||
* @author YenHex |
|||
* @since 2022-10-09 |
|||
*/ |
|||
@Data |
|||
public class JslGoodsSku implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* PK |
|||
*/ |
|||
private Long id; |
|||
|
|||
/** |
|||
* sku编码 |
|||
*/ |
|||
private String skuCode; |
|||
|
|||
/** |
|||
* 商品Id |
|||
*/ |
|||
private Long spuId; |
|||
|
|||
/** |
|||
* 图片 |
|||
*/ |
|||
private String picUrl; |
|||
|
|||
/** |
|||
* 销售价格 |
|||
*/ |
|||
private BigDecimal salesPrice; |
|||
|
|||
/** |
|||
* 市场价 |
|||
*/ |
|||
private BigDecimal marketPrice; |
|||
|
|||
/** |
|||
* 成本价 |
|||
*/ |
|||
private BigDecimal costPrice; |
|||
|
|||
/** |
|||
* 规格值 |
|||
*/ |
|||
private String specInfos; |
|||
|
|||
/** |
|||
* 库存 |
|||
*/ |
|||
private Integer stock; |
|||
|
|||
/** |
|||
* 重量(kg) |
|||
*/ |
|||
private BigDecimal weight; |
|||
|
|||
/** |
|||
* 体积(m³) |
|||
*/ |
|||
private BigDecimal volume; |
|||
|
|||
/** |
|||
* 是否启用1、是;0否 |
|||
*/ |
|||
private Integer enable; |
|||
|
|||
/** |
|||
* 单位id |
|||
*/ |
|||
private Long unitId; |
|||
|
|||
/** |
|||
* 单位 |
|||
*/ |
|||
private String unitName; |
|||
|
|||
/** |
|||
* 版本号 |
|||
*/ |
|||
private Integer version; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
private String tenantId; |
|||
|
|||
|
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 可投放费用标识 |
|||
*/ |
|||
private Integer costFlag; |
|||
|
|||
} |
|||
|
@ -0,0 +1,46 @@ |
|||
package com.demo.jsl.entity.goods; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* sku规格值 实体类 |
|||
* |
|||
* @author YenHex |
|||
* @since 2022-10-09 |
|||
*/ |
|||
@Data |
|||
public class JslGoodsSkuSpecValue implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* PK |
|||
*/ |
|||
private Long id; |
|||
|
|||
/** |
|||
* spu_id |
|||
*/ |
|||
private Long spuId; |
|||
|
|||
/** |
|||
* sku_id |
|||
*/ |
|||
private Long skuId; |
|||
|
|||
/** |
|||
* 规格值id |
|||
*/ |
|||
private Long specValueId; |
|||
|
|||
/** |
|||
* 排序字段 |
|||
*/ |
|||
private Integer sort; |
|||
|
|||
private String tenantId; |
|||
|
|||
} |
|||
|
@ -0,0 +1,25 @@ |
|||
package com.demo.jsl.entity.goods; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/2/10 |
|||
*/ |
|||
@Data |
|||
public class JslSpuSpec { |
|||
|
|||
private Long id; |
|||
|
|||
/** |
|||
* PK |
|||
*/ |
|||
private Long spuId; |
|||
|
|||
/** |
|||
* 规格Id |
|||
*/ |
|||
private Long specId; |
|||
private String tenantId; |
|||
|
|||
} |
@ -0,0 +1,24 @@ |
|||
package com.demo.jsl.entity.goods; |
|||
|
|||
import lombok.Data; |
|||
import lombok.ToString; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/2/9 |
|||
*/ |
|||
@Data |
|||
@ToString |
|||
public class XltGoods { |
|||
|
|||
|
|||
String id; |
|||
String code; |
|||
String name; |
|||
String bgSku; |
|||
String spuId; |
|||
String tasteSku; |
|||
Double price; |
|||
Integer stopval; |
|||
|
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.demo.jsl.entity.goods; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/2/9 |
|||
*/ |
|||
@Data |
|||
public class XltSpu { |
|||
|
|||
private String id; |
|||
private Integer level; |
|||
private String name; |
|||
private String pid; |
|||
private String code; |
|||
private Long tempId; |
|||
|
|||
} |
@ -0,0 +1,122 @@ |
|||
package com.demo.jsl.entity.pay; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 支付 实体类 |
|||
* |
|||
* @author YenHex |
|||
* @since 2022-12-15 |
|||
*/ |
|||
@Data |
|||
public class PayPayment implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private Long id; |
|||
|
|||
/** |
|||
* 支付类型 |
|||
* pay - 支付 |
|||
* unPay - 不再支付 |
|||
**/ |
|||
private String payType; |
|||
|
|||
/** |
|||
* 支付编码 |
|||
**/ |
|||
private String payCode; |
|||
|
|||
/** |
|||
* 供应商id |
|||
*/ |
|||
private Long supplierId; |
|||
|
|||
/** |
|||
* 供应商编码 |
|||
*/ |
|||
private String supplierCode; |
|||
|
|||
/** |
|||
* 供应商 |
|||
*/ |
|||
private String supplierName; |
|||
|
|||
/** |
|||
* 支付金额 |
|||
*/ |
|||
private BigDecimal payAmount; |
|||
|
|||
/** |
|||
* 发货单号 |
|||
*/ |
|||
private String erpCode; |
|||
|
|||
/** |
|||
* 发票编号 |
|||
*/ |
|||
private String billNumber; |
|||
|
|||
/** |
|||
* 支付人id |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 支付人编码 |
|||
*/ |
|||
private String userCode; |
|||
|
|||
/** |
|||
* 支付人 |
|||
*/ |
|||
private String userName; |
|||
|
|||
/** |
|||
* 支付时间 |
|||
*/ |
|||
private Date payTime; |
|||
|
|||
/** |
|||
* 费用申请id |
|||
*/ |
|||
private Long costApplyId; |
|||
|
|||
/** |
|||
* 取消标识 |
|||
* 不再支付列表:0-冻结;1-解冻 |
|||
* 支付列表:0-正常;1-取消 |
|||
**/ |
|||
private Integer cancelFlag; |
|||
|
|||
/** |
|||
* 取消时间 |
|||
*/ |
|||
private LocalDateTime cancelTime; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createTime; |
|||
|
|||
/** |
|||
* 所属租户 |
|||
*/ |
|||
private String tenantId; |
|||
|
|||
|
|||
} |
|||
|
@ -0,0 +1,110 @@ |
|||
package com.demo.jsl.entity.pay; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 支付明细项 实体类 |
|||
* |
|||
* @author YenHex |
|||
* @since 2022-12-15 |
|||
*/ |
|||
@Data |
|||
public class PayPaymentItem implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private Long id; |
|||
|
|||
/** |
|||
* 支付类型 |
|||
* pay - 支付 |
|||
* unPay - 不再支付 |
|||
**/ |
|||
private String payType; |
|||
|
|||
/** |
|||
* 支付id |
|||
*/ |
|||
private Long paymentId; |
|||
|
|||
/** |
|||
* 供应商id |
|||
*/ |
|||
private Long supplierId; |
|||
|
|||
/** |
|||
* 支付金额 |
|||
*/ |
|||
private BigDecimal itemPayAmount; |
|||
|
|||
/** |
|||
* 核销id |
|||
*/ |
|||
private Long verificationId; |
|||
|
|||
/** |
|||
* 核销科目项id |
|||
*/ |
|||
private Long verificationSubjectId; |
|||
|
|||
/** |
|||
* 费用申请id |
|||
*/ |
|||
private Long costApplyId; |
|||
|
|||
/** |
|||
* 活动id |
|||
*/ |
|||
private Long activityId; |
|||
|
|||
/** |
|||
* 活动编码 |
|||
*/ |
|||
private String activityCode; |
|||
|
|||
/** |
|||
* 政策项id |
|||
*/ |
|||
private Long policyItemId; |
|||
|
|||
/** |
|||
* 政策项编码 |
|||
*/ |
|||
private String policyItemCode; |
|||
|
|||
/** |
|||
* 科目id |
|||
*/ |
|||
private Long subjectId; |
|||
|
|||
/** |
|||
* 科目编码 |
|||
*/ |
|||
private String subjectCode; |
|||
|
|||
/** |
|||
* 科目名称 |
|||
*/ |
|||
private String subjectName; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createTime; |
|||
|
|||
private String tenantId; |
|||
|
|||
} |
|||
|
@ -0,0 +1,49 @@ |
|||
package com.demo.jsl.entity.region; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/1/9 |
|||
*/ |
|||
@Data |
|||
public class JslRegion { |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 名称 |
|||
*/ |
|||
private String name; |
|||
|
|||
/** |
|||
* 编码 |
|||
*/ |
|||
private String code; |
|||
|
|||
/** |
|||
* 父级ID |
|||
*/ |
|||
private String pid; |
|||
|
|||
/** |
|||
* 层级 |
|||
*/ |
|||
private Integer level; |
|||
|
|||
/** |
|||
* 祖级id |
|||
*/ |
|||
private String pathIds; |
|||
|
|||
/** |
|||
* 祖级id |
|||
*/ |
|||
private String pathNames; |
|||
|
|||
private String tenantId; |
|||
|
|||
} |
@ -0,0 +1,24 @@ |
|||
package com.demo.jsl.entity.region; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/4/6 |
|||
*/ |
|||
@Data |
|||
public class SorRegion { |
|||
|
|||
private String areaId; |
|||
|
|||
private String area; |
|||
|
|||
private String cityId; |
|||
|
|||
private String city; |
|||
|
|||
private String provinceId; |
|||
|
|||
private String province; |
|||
|
|||
} |
@ -0,0 +1,16 @@ |
|||
package com.demo.jsl.entity.region; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/1/9 |
|||
*/ |
|||
@Data |
|||
public class XltDealerArea { |
|||
|
|||
String id; |
|||
|
|||
String area; |
|||
|
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.demo.jsl.entity.region; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/1/9 |
|||
*/ |
|||
@Data |
|||
public class XltDealerCity { |
|||
String id; |
|||
String city; |
|||
String pid; |
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.demo.jsl.entity.region; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/1/9 |
|||
*/ |
|||
@Data |
|||
public class XltDealerProvince { |
|||
|
|||
String id; |
|||
String province; |
|||
String aid; |
|||
|
|||
String tempIds; |
|||
String tempNames; |
|||
|
|||
} |
@ -0,0 +1,42 @@ |
|||
package com.demo.jsl.entity.schedule; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 考核期 实体类 |
|||
* |
|||
* @author YenHex |
|||
* @since 2022-11-08 |
|||
*/ |
|||
@Data |
|||
public class TbsSchedule implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private Long id; |
|||
|
|||
/** |
|||
* 考核名称 |
|||
*/ |
|||
private String code; |
|||
|
|||
/** |
|||
* 考核编码 |
|||
*/ |
|||
private String name; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
|
|||
private String tenantId; |
|||
|
|||
} |
|||
|
@ -0,0 +1,55 @@ |
|||
package com.demo.jsl.entity.schedule; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.time.LocalDateTime; |
|||
|
|||
/** |
|||
* 考核时间项 实体类 |
|||
* |
|||
* @author YenHex |
|||
* @since 2022-11-08 |
|||
*/ |
|||
@Data |
|||
public class TbsScheduleItem implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private Long id; |
|||
|
|||
/** |
|||
* 考核id |
|||
*/ |
|||
private Long scheduleId; |
|||
|
|||
/** |
|||
* 考核编码 |
|||
*/ |
|||
private String itemName; |
|||
|
|||
/** |
|||
* 开始时间 |
|||
*/ |
|||
private LocalDateTime startDate; |
|||
|
|||
/** |
|||
* 结束时间 |
|||
*/ |
|||
private LocalDateTime endDate; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 所属租户 |
|||
*/ |
|||
private String tenantId; |
|||
|
|||
} |
|||
|
@ -0,0 +1,21 @@ |
|||
package com.demo.jsl.entity.subject; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/1/9 |
|||
*/ |
|||
@Data |
|||
public class JslSubject { |
|||
|
|||
private Long id; |
|||
private String xltId; |
|||
private String subjectName; |
|||
private String subjectCode; |
|||
private Long pid; |
|||
private Integer level; |
|||
private String pathNames; |
|||
private String tenantId; |
|||
|
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.demo.jsl.entity.subject; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/1/9 |
|||
*/ |
|||
@Data |
|||
public class XltSubject { |
|||
|
|||
private String id; |
|||
|
|||
private String costName; |
|||
|
|||
private String number; |
|||
|
|||
private String pid; |
|||
|
|||
private Integer num; |
|||
|
|||
} |
@ -0,0 +1,161 @@ |
|||
package com.demo.jsl.entity.supplier; |
|||
|
|||
import lombok.Data; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/1/10 |
|||
*/ |
|||
@Data |
|||
public class JslSupplier { |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private Long id; |
|||
|
|||
/** |
|||
* 一级区域ID |
|||
*/ |
|||
private String regionFirst; |
|||
|
|||
/** |
|||
* 二级区域ID |
|||
*/ |
|||
private String regionSecond; |
|||
|
|||
/** |
|||
* 三级区域ID |
|||
*/ |
|||
private String regionThird; |
|||
|
|||
/** |
|||
* 四级区域ID |
|||
*/ |
|||
private String regionFourthly; |
|||
|
|||
/** |
|||
* 最子级区域ID |
|||
*/ |
|||
private String regionLast; |
|||
|
|||
/** |
|||
* 行政一级区域ID |
|||
*/ |
|||
private String region2First; |
|||
|
|||
/** |
|||
* 行政二级区域ID |
|||
*/ |
|||
private String region2Second; |
|||
|
|||
/** |
|||
* 行政三级区域ID |
|||
*/ |
|||
private String region2Third; |
|||
|
|||
/** |
|||
* 行政四级区域ID |
|||
*/ |
|||
private String region2Fourthly; |
|||
|
|||
/** |
|||
* 行政最子级区域ID |
|||
*/ |
|||
private String region2Last; |
|||
|
|||
/** |
|||
* 详细地址 |
|||
*/ |
|||
private String address; |
|||
|
|||
/** |
|||
* 名称 |
|||
*/ |
|||
private String name; |
|||
|
|||
/** |
|||
* 客户编码 |
|||
*/ |
|||
private String code; |
|||
|
|||
/** |
|||
* 父级id |
|||
*/ |
|||
private String pid; |
|||
|
|||
private String parentCode; |
|||
|
|||
/** |
|||
* 负责人 |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 负责人 |
|||
*/ |
|||
private String userCode; |
|||
|
|||
/** |
|||
* 负责人 |
|||
*/ |
|||
private String userName; |
|||
|
|||
private String[] otherUserIds; |
|||
|
|||
private String otherUserNames; |
|||
|
|||
private String otherUserCodes; |
|||
|
|||
/** |
|||
* 所属账套 |
|||
*/ |
|||
private String belong; |
|||
|
|||
/** |
|||
* 租户id |
|||
*/ |
|||
private String tenantId; |
|||
|
|||
private String xltId; |
|||
|
|||
private String xltid2; |
|||
|
|||
public String handleSaleRegionId(){ |
|||
if(isValid(this.getRegionLast())){ |
|||
return this.getRegionLast(); |
|||
}else if(isValid(this.getRegionFourthly())){ |
|||
return this.getRegionFourthly(); |
|||
}else if(isValid(this.getRegionThird())){ |
|||
return this.getRegionThird(); |
|||
}else if(isValid(this.getRegionSecond())){ |
|||
return this.getRegionSecond(); |
|||
}else if(isValid(this.getRegionFirst())){ |
|||
return this.getRegionFirst(); |
|||
}else { |
|||
return "0"; |
|||
} |
|||
} |
|||
|
|||
public String handleBizRegionId(){ |
|||
if(isValid(this.getRegion2Last())){ |
|||
return this.getRegion2Last(); |
|||
}else if(isValid(this.getRegion2Fourthly())){ |
|||
return this.getRegion2Fourthly(); |
|||
}else if(isValid(this.getRegion2Third())){ |
|||
return this.getRegion2Third(); |
|||
}else if(isValid(this.getRegion2Second())){ |
|||
return this.getRegion2Second(); |
|||
}else if(isValid(this.getRegion2First())){ |
|||
return this.getRegion2First(); |
|||
}else { |
|||
return "0"; |
|||
} |
|||
} |
|||
|
|||
private boolean isValid(String region){ |
|||
return StringUtils.isNotEmpty(region)&&!"0".equals(region); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.demo.jsl.entity.supplier; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/1/11 |
|||
*/ |
|||
@Data |
|||
public class XltSupplier { |
|||
|
|||
String id; |
|||
String name; |
|||
String code; |
|||
String address; |
|||
String areaId; |
|||
String provinceId; |
|||
String cityId; |
|||
|
|||
} |
@ -0,0 +1,16 @@ |
|||
package com.demo.jsl.entity.supplier.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/6/13 |
|||
*/ |
|||
@Data |
|||
public class XltSupplierEmp { |
|||
|
|||
private String id; |
|||
|
|||
private String empName; |
|||
|
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.demo.jsl.entity.test; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/3/17 |
|||
*/ |
|||
@Data |
|||
public class TestDemo implements Serializable { |
|||
|
|||
private Long id; |
|||
private String testName; |
|||
|
|||
} |
@ -0,0 +1,16 @@ |
|||
package com.demo.jsl.entity.user; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/5/8 |
|||
*/ |
|||
@Data |
|||
public class ExcelData0508 { |
|||
|
|||
String code; |
|||
String name; |
|||
String mobile; |
|||
|
|||
} |
@ -0,0 +1,16 @@ |
|||
package com.demo.jsl.entity.user; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/4/21 |
|||
*/ |
|||
@Data |
|||
public class ExcelUserRole { |
|||
|
|||
private String empNo; |
|||
private String empName; |
|||
private String parentRid; |
|||
|
|||
} |
@ -0,0 +1,44 @@ |
|||
package com.demo.jsl.entity.user; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/5/8 |
|||
*/ |
|||
@Data |
|||
public class JslPost { |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 名称 |
|||
*/ |
|||
private String postName; |
|||
|
|||
/** |
|||
* 编码 |
|||
*/ |
|||
private String postCode; |
|||
|
|||
private String pid; |
|||
|
|||
/** |
|||
* id路径 |
|||
*/ |
|||
private String pathIds; |
|||
|
|||
/** |
|||
* 名称路径 |
|||
*/ |
|||
private String pathNames; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
} |
@ -0,0 +1,62 @@ |
|||
package com.demo.jsl.entity.user; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/5/8 |
|||
*/ |
|||
@Data |
|||
public class JslPostUser { |
|||
|
|||
/** |
|||
* 用户id |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 用户编码 |
|||
*/ |
|||
private String userCode; |
|||
|
|||
/** |
|||
* 用户名称 |
|||
*/ |
|||
private String userName; |
|||
|
|||
/** |
|||
* 岗位id |
|||
*/ |
|||
private String postId; |
|||
|
|||
/** |
|||
* 岗位名称 |
|||
*/ |
|||
private String postName; |
|||
|
|||
/** |
|||
* 岗位编码 |
|||
*/ |
|||
private String postCode; |
|||
|
|||
/** |
|||
* 岗位pid |
|||
*/ |
|||
private String pid; |
|||
|
|||
/** |
|||
* id路径 |
|||
*/ |
|||
private String pathIds; |
|||
|
|||
/** |
|||
* 名称路径 |
|||
*/ |
|||
private String pathNames; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
} |
@ -0,0 +1,90 @@ |
|||
package com.demo.jsl.entity.user; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/1/10 |
|||
*/ |
|||
@Data |
|||
public class JslUser { |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 手机号 |
|||
*/ |
|||
private String mobile; |
|||
|
|||
/** |
|||
* 账号 |
|||
*/ |
|||
private String account; |
|||
|
|||
/** |
|||
* 昵称 |
|||
*/ |
|||
private String name; |
|||
|
|||
/** |
|||
* 编号/工号 |
|||
*/ |
|||
private String code; |
|||
|
|||
/** |
|||
* 密码 |
|||
*/ |
|||
private String password; |
|||
|
|||
|
|||
/** |
|||
* 部门ID |
|||
*/ |
|||
private String deptId; |
|||
|
|||
/** |
|||
* 职位ID |
|||
*/ |
|||
private String positionId; |
|||
|
|||
/** |
|||
* 系统登录权限【0->停用;1->启用】 |
|||
*/ |
|||
private Integer loginEnable; |
|||
|
|||
/** |
|||
* 在职状态【0->离职;1->在职】 |
|||
*/ |
|||
private Integer servingState; |
|||
|
|||
/** |
|||
* 是否销售人员 |
|||
*/ |
|||
private Integer salesFlag; |
|||
|
|||
/** |
|||
* 身份证号码 |
|||
*/ |
|||
private String identityNo; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 致远登陆账户 |
|||
*/ |
|||
private String syAccount; |
|||
|
|||
/** |
|||
* 致远用户id |
|||
*/ |
|||
private String syUserId; |
|||
|
|||
private String tenantId; |
|||
|
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.demo.jsl.entity.user; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/1/10 |
|||
*/ |
|||
@Data |
|||
public class SyUser { |
|||
|
|||
Long id; |
|||
String name; |
|||
String code; |
|||
Long deptId; |
|||
Long postId; |
|||
String mobile; |
|||
|
|||
} |
@ -0,0 +1,37 @@ |
|||
package com.demo.jsl.entity.user; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 实体类 |
|||
* |
|||
* @author YenHex |
|||
* @since 2022-10-12 |
|||
*/ |
|||
@Data |
|||
public class SysUserSales implements Serializable { |
|||
|
|||
/** |
|||
* 用户id |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 父级id |
|||
*/ |
|||
private String pid; |
|||
|
|||
|
|||
/** |
|||
* 租户id |
|||
*/ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
} |
|||
|
@ -0,0 +1,17 @@ |
|||
package com.demo.jsl.entity.user; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/4/21 |
|||
*/ |
|||
@Data |
|||
public class XltRole { |
|||
|
|||
private String id; |
|||
private String roleName; |
|||
private String pid; |
|||
private String remark; |
|||
|
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.demo.jsl.entity.user; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/1/10 |
|||
*/ |
|||
@Data |
|||
public class XltUser { |
|||
|
|||
String id; |
|||
String numNo; |
|||
String name; |
|||
String identitycard; |
|||
String posts; |
|||
String deptid; |
|||
Integer state; |
|||
String mobile; |
|||
|
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.demo.jsl.entity.user; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/4/21 |
|||
*/ |
|||
@Data |
|||
public class XltUserRole { |
|||
|
|||
private String roleid; |
|||
private String num; |
|||
private String name; |
|||
private String mobile; |
|||
|
|||
} |
@ -0,0 +1,116 @@ |
|||
package com.demo.jsl.entity.verifi; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 核销 实体类 |
|||
* |
|||
* @author YenHex |
|||
* @since 2022-11-24 |
|||
*/ |
|||
@Data |
|||
public class VtbVerification implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private Long id; |
|||
|
|||
/** |
|||
* 核销编码 |
|||
*/ |
|||
private String verificationCode; |
|||
|
|||
/** |
|||
* 活动id |
|||
*/ |
|||
private Long costApplyId; |
|||
private Long activityId; |
|||
|
|||
/** |
|||
* 政策项id |
|||
*/ |
|||
private Long policyItemId; |
|||
|
|||
/** |
|||
* 政策项编码 |
|||
*/ |
|||
private String policyItemCode; |
|||
|
|||
|
|||
/** |
|||
* 核销状态 |
|||
*/ |
|||
private Integer verificationState; |
|||
|
|||
/** |
|||
* 核销通过时间 |
|||
*/ |
|||
private Date finishedTime; |
|||
|
|||
/** |
|||
* 支付状态:0-未支付;1-已支付 |
|||
*/ |
|||
private Integer paymentState; |
|||
|
|||
/** |
|||
* 金额 |
|||
*/ |
|||
private BigDecimal amount; |
|||
|
|||
/** |
|||
* 申请时金额记录 |
|||
*/ |
|||
private BigDecimal amountRecord; |
|||
|
|||
private String syFormId; |
|||
|
|||
private String syFlowId; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private Long supplierId; |
|||
|
|||
/** |
|||
* 客户编码 |
|||
*/ |
|||
private String supplierCode; |
|||
|
|||
/** |
|||
* 客户名称 |
|||
*/ |
|||
private String supplierName; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createTime; |
|||
|
|||
private String tenantId; |
|||
|
|||
private String userId; |
|||
|
|||
/** |
|||
* 用户编码 |
|||
*/ |
|||
private String userCode; |
|||
|
|||
/** |
|||
* 用户名称 |
|||
*/ |
|||
private String userName; |
|||
|
|||
} |
|||
|
@ -0,0 +1,185 @@ |
|||
package com.demo.jsl.entity.verifi; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
|
|||
/** |
|||
* 核销科目费用 实体类 |
|||
* |
|||
* @author YenHex |
|||
* @since 2022-11-24 |
|||
*/ |
|||
@Data |
|||
public class VtbVerificationSubject implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private Long id; |
|||
|
|||
/** |
|||
* 科目核销编码 |
|||
*/ |
|||
private String verificationSubCode; |
|||
|
|||
/** |
|||
* 核算id |
|||
*/ |
|||
private Long verificationId; |
|||
|
|||
/** |
|||
* 费用申请id |
|||
*/ |
|||
private Long costApplyId; |
|||
|
|||
/** |
|||
* 活动id |
|||
*/ |
|||
private Long activityId; |
|||
|
|||
/** |
|||
* 政策项id |
|||
*/ |
|||
private Long policyItemId; |
|||
|
|||
/** |
|||
* 政策项编码 |
|||
*/ |
|||
private String policyItemCode; |
|||
|
|||
/** |
|||
* 科目id |
|||
*/ |
|||
private Long subjectId; |
|||
|
|||
/** |
|||
* 科目编码 |
|||
*/ |
|||
private String subjectCode; |
|||
|
|||
/** |
|||
* 科目名称 |
|||
*/ |
|||
private String subjectName; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private Long supplierId; |
|||
|
|||
/** |
|||
* 客户编码 |
|||
*/ |
|||
private String supplierCode; |
|||
|
|||
/** |
|||
* 客户名称 |
|||
*/ |
|||
private String supplierName; |
|||
|
|||
/** |
|||
* 本次核销额 |
|||
*/ |
|||
private BigDecimal usedAmount; |
|||
|
|||
/** |
|||
* 申请时本次核销额 |
|||
*/ |
|||
private BigDecimal usedAmountRecord; |
|||
|
|||
/** |
|||
* 已支付核销费用 |
|||
*/ |
|||
private BigDecimal payAmount; |
|||
|
|||
/** |
|||
* 支付完成标识 |
|||
*/ |
|||
private Integer payFinishedFlag; |
|||
|
|||
/** |
|||
* 场次 |
|||
*/ |
|||
private Integer countSession; |
|||
|
|||
/** |
|||
* 人数 |
|||
*/ |
|||
private Integer countPerson; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private LocalDateTime createTime; |
|||
|
|||
/** |
|||
* 最后更新时间 |
|||
*/ |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** |
|||
* 所属租户 |
|||
*/ |
|||
private String tenantId; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createBy; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updateBy; |
|||
|
|||
/** |
|||
* 逻辑删除标记(0:显示;1:隐藏) |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 是否有效(0:否;1:是) |
|||
*/ |
|||
private Integer effectiveFlag; |
|||
|
|||
/** |
|||
* 表单id |
|||
*/ |
|||
private Long formId; |
|||
|
|||
/** |
|||
* 表单标题 |
|||
*/ |
|||
private String formTitle; |
|||
|
|||
/** |
|||
* 表单版本 |
|||
*/ |
|||
private Integer formVersion; |
|||
|
|||
/** |
|||
* 表单内容 |
|||
*/ |
|||
private String formContext; |
|||
|
|||
/** |
|||
* 表单内容值 |
|||
*/ |
|||
private String formContextValue; |
|||
|
|||
/** |
|||
* 可更变的最大金额 |
|||
*/ |
|||
private BigDecimal maxChangeAmount; |
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.demo.jsl.service; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/3/16 |
|||
*/ |
|||
public interface BmsService { |
|||
|
|||
/** |
|||
* 同步科目 |
|||
*/ |
|||
void syncSubject(); |
|||
|
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.demo.jsl.service; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/4/13 |
|||
*/ |
|||
public interface ChannelPointService { |
|||
|
|||
/** |
|||
* 同步渠道 |
|||
* 2023年4月13日 |
|||
*/ |
|||
void syncChannel(); |
|||
|
|||
/** |
|||
* 同步网点 |
|||
* 2023年4月13日 |
|||
*/ |
|||
void syncPoint(); |
|||
|
|||
void syncPointMgr(); |
|||
|
|||
void syncSupplierMgr(); |
|||
|
|||
void jslMasterUser_userId(); |
|||
|
|||
void jslMasterUser_pointId(); |
|||
|
|||
void initByGaoDe(); |
|||
} |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue