Commit 42cf4d2c authored by Administrator's avatar Administrator

创建项目

parent 30578d19
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>cn.quant.andy</groupId>
<artifactId>quant-andy</artifactId>
<version>1.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>cn.quant.andy</groupId>
<artifactId>quant-andy-core</artifactId>
<name>quant-andy-core</name>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>cn.quant.andy</groupId>
<artifactId>quant-andy-csv</artifactId>
<version>1.0.0</version>
</dependency>
<!--javax-->
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<!--commons-->
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
</dependency>
<!--cache-->
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
<!--quant-->
<dependency>
<groupId>cn.quant.spring</groupId>
<artifactId>quant-spring</artifactId>
</dependency>
<!--<dependency>-->
<!--<groupId>org.springframework.data</groupId>-->
<!--<artifactId>spring-data-commons</artifactId>-->
<!--<version>2.0.11.RELEASE</version>-->
<!--</dependency>-->
<!--log-->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</dependency>
<!--database-->
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
</dependency>
<dependency>
<groupId>cn.quant.spring.data</groupId>
<artifactId>quant-spring-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>cn.quant.spring.mybatis</groupId>
<artifactId>quant-spring-mybatis-pagination</artifactId>
</dependency>
<dependency>
<groupId>cn.quant.spring.boot</groupId>
<artifactId>quant-spring-boot-starter-mybatis</artifactId>
<version>2.2.1-SNAPSHOT</version>
</dependency>
<!--jackson2-->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-hibernate5</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.package.name}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.source}</target>
<encoding>${maven.compiler.encoding}</encoding>
</configuration>
</plugin>
<!--TODO:mybatis-->
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<configuration>
<configurationFile>src/main/resources/mybatis.cfg.xml</configurationFile>
<verbose>true</verbose>
<overwrite>true</overwrite>
</configuration>
<dependencies>
<dependency>
<groupId>cn.quant.mybatis.generator</groupId>
<artifactId>quant-mybatis-generator</artifactId>
<version>1.3.6</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
package cn.quant.andy;
/**
* Created by Administrator on 2021/7/19 0019.
*/
public interface DataLoader {
void load(int term) throws Exception;
}
package cn.quant.andy;
/**
* Created by Administrator on 2021/7/19 0019.
*/
public class DataSchema {
}
package cn.quant.andy;
import cn.quant.andy.csv.CSVReader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
* Created by Administrator on 2021/7/19 0019.
*/
public class SnapshotDataLoader implements DataLoader {
private static final Logger logger = LoggerFactory.getLogger(SnapshotDataLoader.class);
private Map<String, SnapshotDataOptions> options;
public SnapshotDataLoader() {
this(new HashMap());
}
public SnapshotDataLoader(Map<String, SnapshotDataOptions> options) {
this.options = options;
}
public void setLoaderOptions(String name, SnapshotDataOptions option) {
options.put(name, option);
}
@Override
public void load(int term) throws Exception {
Set<String> keySet = options.keySet();
for (String key : keySet) {
SnapshotDataOptions options = this.options.get(key);
long millis = System.currentTimeMillis();
logger.info(">>> start load data. {} - {}", millis, options.getName());
CSVReader.read(term, options.getImportFile()
, options.getStartLine()
, options.getHandler());
logger.info("<<< end load data. {} - {}", millis, System.currentTimeMillis() - millis);
}
}
}
package cn.quant.andy;
/**
* Created by Administrator on 2021/7/19 0019.
*/
public class SnapshotDataOptions {
private String name;
private String accountNo;
private String importFile;
private String importUrl;
private Integer startLine;
private Integer endLine;
private SummaryHandler handler;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAccountNo() {
return accountNo;
}
public void setAccountNo(String accountNo) {
this.accountNo = accountNo;
}
public String getImportFile() {
return importFile;
}
public void setImportFile(String importFile) {
this.importFile = importFile;
}
public String getImportUrl() {
return importUrl;
}
public void setImportUrl(String importUrl) {
this.importUrl = importUrl;
}
public Integer getStartLine() {
return startLine;
}
public void setStartLine(Integer startLine) {
this.startLine = startLine;
}
public Integer getEndLine() {
return endLine;
}
public void setEndLine(Integer endLine) {
this.endLine = endLine;
}
public SummaryHandler getHandler() {
return handler;
}
public void setHandler(SummaryHandler handler) {
this.handler = handler;
}
}
package cn.quant.andy;
import cn.quant.andy.csv.CSVRecordHandler;
import cn.quant.andy.jpa.model.ImportMapSchema;
import cn.quant.andy.text.StringFormatter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.ParseException;
import java.util.List;
/**
* Created by Administrator on 2021/7/19 0019.
*/
public class SummaryHandler implements CSVRecordHandler {
private static final Logger logger = LoggerFactory.getLogger(SummaryHandler.class);
private String name;
private List<ImportMapSchema> schemas;
private String prefix;
private SummaryRepository repository;
public SummaryHandler(String name, String prefix) {
this.name = name;
this.prefix = prefix;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPrefix() {
return prefix;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
}
public List<ImportMapSchema> getSchemas() {
return schemas;
}
public void setSchemas(List<ImportMapSchema> schemas) {
this.schemas = schemas;
}
public SummaryRepository getRepository() {
return repository;
}
public void setRepository(SummaryRepository repository) {
this.repository = repository;
}
@Override
public boolean read(int term, long number, String[] record) {
List<String> fields = getRepository().fields();
Object[] objects = new Object[fields.size()];
try {
for (ImportMapSchema schema : schemas) {
parse(schema, record, objects);
}
repository.importData(name, term, objects);
} catch (Exception e) {
logger.error("CSV record parse exception - " + String.join(",", record) + "; " + e.getMessage());
e.printStackTrace();
return false;
}
return true;
}
private Object[] parse(ImportMapSchema schema, String[] record, Object[] values) throws ParseException {
int i = Integer.parseInt(schema.getColumn()) - 1;
String value = record[i];
if ((prefix != null) && (prefix.length() > 0) && (record[i].startsWith(prefix))) {
value = value.substring(prefix.length());
}
String index = schema.getIndex();
if (schema.getFormat() != null) {
StringFormatter.Group group = StringFormatter.format(schema.getType(), schema.getFormat(), value);
String placeholder;
while (group != null) {
placeholder = group.getPlaceholder();
if (index == null) {
if (placeholder == null || placeholder.length() == 0) {
} else {
values[Integer.parseInt(placeholder) - 1] = group.getValue();
}
} else {
values[Integer.parseInt(index) - 1] = group.getValue();
}
group = group.next();
}
} else {
values[Integer.parseInt(index) - 1] = value;
}
return values;
}
}
package cn.quant.andy;
import cn.quant.andy.jpa.entity.EntityConstant;
import cn.quant.andy.jpa.mybatis.mapper.SummaryMapper;
import cn.quant.spring.context.ServerApplicationContext;
import cn.quant.spring.util.CommonUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
/**
* Created by Administrator on 2021/7/19 0019.
*/
public class SummaryRepository {
private static final Logger logger = LoggerFactory.getLogger(SummaryRepository.class);
private ServerApplicationContext context;
private List<String> fields;
private Integer postDateIndex;
private SummaryMapper mapper;
/**
* @param fields - 导入数据对应的表字段
* @param index - 代表入账时间的字段索引
* @param mapper
* @param context
*/
public SummaryRepository(List<String> fields, int index, SummaryMapper mapper, ServerApplicationContext context) {
this.fields = fields;
this.mapper = mapper;
this.context = context;
this.postDateIndex = index;
}
public List<String> fields() {
return this.fields;
}
public void importData(String base, Integer termNo, Object[] values) {
HashMap<Object, Object> params = new HashMap<>();
params.put(EntityConstant.TRANSACTION_ID, context.getIdentitySequencer().nextId());
params.put(EntityConstant.BASE_CODE, base);
params.put(EntityConstant.TERM_NO, termNo);
Date now = CommonUtils.now();
LocalDateTime localDate = CommonUtils.toLocalDateTime((Date) values[postDateIndex]);
params.put(EntityConstant.POST_DATE, localDate.toLocalDate());
params.put(EntityConstant.POST_TIME, localDate.toLocalTime());
params.put(EntityConstant.IMPORT_TIME, now);
params.put(EntityConstant.POSTED_FLAG, false);
params.put(EntityConstant.CREATED_BY, EntityConstant.CREATED_BY_SYS);
params.put(EntityConstant.CREATED_DATE, now);
params.put(EntityConstant.MODIFIED_BY, EntityConstant.MODIFIED_BY_SYS);
params.put(EntityConstant.MODIFIED_DATE, now);
try {
mapper.importData(String.join(",", fields), values, params);
} catch (Exception e) {
logger.error("Failed import data - {}, {}", Arrays.toString(values), e.getMessage());
e.printStackTrace();
}
}
}
package cn.quant.andy;
import cn.quant.spring.context.ServerApplicationContext;
/**
* @author hechao
* @description
* @date 2020/4/21 15:01
* @modify 2020/4/21 15:01 by hechao
*/
public class TransactionSession {
private ServerApplicationContext context;
public TransactionSession(ServerApplicationContext context) {
this.context = context;
}
public ServerApplicationContext getContext() {
return context;
}
}
\ No newline at end of file
package cn.quant.andy.aspect;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.util.Objects;
/**
* Created by Administrator on 2021/7/25 0025.
*/
@Aspect
@Component
public class ExplainAspect {
private static final Logger logger = LoggerFactory.getLogger(ExplainAspect.class);
@Pointcut("@annotation(cn.quant.andy.aspect.ExplainPoint)")
private void pointCut() {
}
@Around("pointCut()")
private Object around(ProceedingJoinPoint joinPoint) throws Throwable {
long time = System.currentTimeMillis();
int code = Objects.hashCode(joinPoint);
logger.info("!> [{}{}]Start process '{}'", time, code, joinPoint.getSignature());
try {
Object object = joinPoint.proceed();
return object;
} finally {
logger.info("<! [{}{}]End process. {}", time, code, System.currentTimeMillis() - time);
}
}
}
package cn.quant.andy.aspect;
import java.lang.annotation.*;
/**
* Created by Administrator on 2021/6/25 0025.
*/
@Documented
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface ExplainPoint {
}
package cn.quant.andy.config;
import cn.quant.andy.*;
import cn.quant.andy.jpa.entity.ApplicationProfileEntity;
import cn.quant.andy.jpa.entity.InstitutionProfileEntity;
import cn.quant.andy.jpa.model.ImportMapSchema;
import cn.quant.andy.jpa.mybatis.mapper.ApplicationProfileMapper;
import cn.quant.andy.jpa.mybatis.mapper.InstitutionProfileMapper;
import cn.quant.andy.jpa.mybatis.mapper.InstitutionTransactionSummaryMapper;
import cn.quant.andy.jpa.mybatis.mapper.TransactionSummaryMapper;
import cn.quant.andy.text.*;
import cn.quant.spring.context.ServerApplicationContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static cn.quant.andy.jpa.entity.EntityConstant.*;
/**
* Created by Administrator on 2021/7/19 0019.
*/
@Configuration
public class ApplicationConfiguration {
@Autowired
private InstitutionProfileMapper institutionProfileMapper;
@Autowired
private ApplicationProfileMapper applicationProfileMapper;
@Autowired
private InstitutionTransactionSummaryMapper institutionTransactionSummaryMapper;
@Autowired
private TransactionSummaryMapper transactionSummaryMapper;
@Autowired
protected ServerApplicationContext serverApplicationContext;
@PostConstruct
public void init() {
StringFormatter.register(PlaceholderSpiltFormatter.FORMATTER_TYPE + "-", new PlaceholderSpiltFormatter("-"));
StringFormatter.register(DateStringFormatter.FORMATTER_TYPE, new DateStringFormatter());
StringFormatter.register(BigDecimalFormatter.FORMATTER_TYPE, new BigDecimalFormatter());
StringFormatter.register(IntStringFormatter.FORMATTER_TYPE, new IntStringFormatter());
}
private Map<String, SummaryRepository> repositories(List<ApplicationProfileEntity> entities) {
//TODO: [hechao]waiting database config bean for mapper
Map<String, SummaryRepository> repositories = new HashMap<>();
for (ApplicationProfileEntity entity : entities) {
if (INSTITUTION_TYPE_CODE.equals(entity.getTypeCode())) {
SummaryRepository repository = new SummaryRepository(entity.getTableFields(), entity.getPostDateIndex(), institutionTransactionSummaryMapper, serverApplicationContext);
repositories.put(entity.getTypeCode(), repository);
} else if (PRODCT_TYPE_CODE.equals(entity.getTypeCode())) {
SummaryRepository repository = new SummaryRepository(entity.getTableFields(), entity.getPostDateIndex(), transactionSummaryMapper, serverApplicationContext);
repositories.put(entity.getTypeCode(), repository);
}
}
return repositories;
}
@Bean
public DataLoader dataLoader() {
// InstitutionTransactionSummaryEntity oneById = institutionTransactionSummaryEntityMapper.findOneById(75590144801505280L);
Map<String, SummaryRepository> repositories = repositories(applicationProfileMapper.findAll());
SnapshotDataLoader loader = new SnapshotDataLoader();
HashMap<String, Object> params = new HashMap<>();
params.put(AVAILABLE_FLAG, true);
List<InstitutionProfileEntity> profileEntities = institutionProfileMapper.findAll(params);
for (InstitutionProfileEntity entity : profileEntities) {
SnapshotDataOptions option = new SnapshotDataOptions();
option.setName(entity.getBaseCode() + "-" + entity.getTypeCode());
option.setAccountNo(entity.getAccountNo());
option.setEndLine(entity.getEndLine());
option.setImportFile(entity.getImportFile());
option.setStartLine(entity.getStartLine());
List<ImportMapSchema> schemas = entity.getImportDataSchema();
SummaryHandler handler = new SummaryHandler(entity.getBaseCode(), entity.getDataPrefix());
handler.setSchemas(schemas);
SummaryRepository repository = repositories.get(entity.getTypeCode());
if (repository == null) {
throw new IllegalArgumentException("No such summary repository." + entity.getTypeCode());
}
handler.setRepository(repository);
option.setHandler(handler);
loader.setLoaderOptions(entity.getBaseCode() + "$" + entity.getTypeCode(), option);
}
repositories.clear();
return loader;
}
}
package cn.quant.andy.dict;
/**
* Created by Administrator on 2021/7/23 0023.
*/
public enum BillCode {
DSLF("左侧有争议"),
DSRT("右侧有争议"),
DSBS("全有争议"),
LEFT("只左侧有"),
BOTH("两侧有"),
RAIT("只右侧有");
public String text;
BillCode(String text) {
this.text = text;
}
}
package cn.quant.andy.dict;
/**
* Created by Administrator on 2021/7/25 0025.
*/
public enum BillStatusCode {
WARN(null, null),
SUCC(null, null),
PEND(SUCC, WARN),
INIT(PEND, WARN);
public BillStatusCode next;
public BillStatusCode interrupt;
BillStatusCode(BillStatusCode next, BillStatusCode interrupt) {
this.next = next;
this.interrupt = interrupt;
}
}
package cn.quant.andy.dict;
/**
* Created by Administrator on 2021/7/25 0025.
*/
public class TxnStatusCode {
public static final String SUCC = "SUCC";
public static final String PEND = "PEND";
}
package cn.quant.andy.jpa.entity;
import cn.quant.spring.data.jpa.entity.DescriptionEntity;
import javax.persistence.Column;
import javax.persistence.Id;
import java.util.List;
public class ApplicationProfileEntity extends DescriptionEntity {
@Id
@Column(name = "TYPE_CODE", nullable = false, updatable = false)
private String typeCode;
@Column(name = "TABLE_FIELDS", nullable = false, updatable = true)
private List<String> tableFields;
@Column(name = "POST_DATE_INDEX", nullable = false, updatable = true)
private Integer postDateIndex;
public String getTypeCode() {
return typeCode;
}
public void setTypeCode(String typeCode) {
this.typeCode = typeCode;
}
public List<String> getTableFields() {
return tableFields;
}
public void setTableFields(List<String> tableFields) {
this.tableFields = tableFields;
}
public Integer getPostDateIndex() {
return postDateIndex;
}
public void setPostDateIndex(Integer postDateIndex) {
this.postDateIndex = postDateIndex;
}
@Override
public Object primaryKey() {
return null;
}
}
\ No newline at end of file
package cn.quant.andy.jpa.entity;
import cn.quant.spring.data.jpa.entity.DescriptionEntity;
import javax.persistence.Column;
import javax.persistence.Id;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Objects;
public class BalanceBillingEntity extends DescriptionEntity {
@Id
@Column(name = "TERM_NO", nullable = false, updatable = false)
private Integer termNo;
@Id
@Column(name = "TYPE_CODE", nullable = false, updatable = false)
private String typeCode;
@Column(name = "NEXT_SUMMARY_NO", nullable = false, updatable = true)
private Integer nextSummaryNo;
@Column(name = "BALANCE", nullable = false, updatable = true)
private BigDecimal balance;
@Column(name = "CREDIT_AMT", nullable = false, updatable = true)
private BigDecimal creditAmt;
@Column(name = "CREDIT_COUNT", nullable = false, updatable = true)
private Integer creditCount;
@Column(name = "DEBIT_AMT", nullable = false, updatable = true)
private BigDecimal debitAmt;
@Column(name = "DEBIT_COUNT", nullable = false, updatable = true)
private Integer debitCount;
@Column(name = "STATUS_CODE", nullable = false, updatable = true)
private String statusCode;
@Column(name = "TARGET_BILLS", nullable = false, updatable = false)
private Integer targetBills;
@Column(name = "TOTAL_BILLS", nullable = false, updatable = true)
private Integer totalBills;
@Column(name = "LF_FAILED_BILLS", nullable = false, updatable = true)
private Integer lfFailedBills;
@Column(name = "RT_FAILED_BILLS", nullable = false, updatable = true)
private Integer rtFailedBills;
@Column(name = "LAST_STATUS_CODE", nullable = true, updatable = true)
private String lastStatusCode;
@Column(name = "BILL_DATE", nullable = true, updatable = true)
private LocalDate billDate;
public Integer getTermNo() {
return termNo;
}
public void setTermNo(Integer termNo) {
this.termNo = termNo;
}
public String getTypeCode() {
return typeCode;
}
public void setTypeCode(String typeCode) {
this.typeCode = typeCode;
}
public Integer getNextSummaryNo() {
return nextSummaryNo;
}
public void setNextSummaryNo(Integer nextSummaryNo) {
this.nextSummaryNo = nextSummaryNo;
}
public BigDecimal getBalance() {
return balance;
}
public void setBalance(BigDecimal balance) {
this.balance = balance;
}
public BigDecimal getCreditAmt() {
return creditAmt;
}
public void setCreditAmt(BigDecimal creditAmt) {
this.creditAmt = creditAmt;
}
public Integer getCreditCount() {
return creditCount;
}
public void setCreditCount(Integer creditCount) {
this.creditCount = creditCount;
}
public BigDecimal getDebitAmt() {
return debitAmt;
}
public void setDebitAmt(BigDecimal debitAmt) {
this.debitAmt = debitAmt;
}
public Integer getDebitCount() {
return debitCount;
}
public void setDebitCount(Integer debitCount) {
this.debitCount = debitCount;
}
public String getStatusCode() {
return statusCode;
}
public void setStatusCode(String statusCode) {
this.statusCode = statusCode;
}
public Integer getTargetBills() {
return targetBills;
}
public void setTargetBills(Integer targetBills) {
this.targetBills = targetBills;
}
public Integer getTotalBills() {
return totalBills;
}
public void setTotalBills(Integer totalBills) {
this.totalBills = totalBills;
}
public Integer getLfFailedBills() {
return lfFailedBills;
}
public void setLfFailedBills(Integer lfFailedBills) {
this.lfFailedBills = lfFailedBills;
}
public Integer getRtFailedBills() {
return rtFailedBills;
}
public void setRtFailedBills(Integer rtFailedBills) {
this.rtFailedBills = rtFailedBills;
}
public String getLastStatusCode() {
return lastStatusCode;
}
public void setLastStatusCode(String lastStatusCode) {
this.lastStatusCode = lastStatusCode;
}
public LocalDate getBillDate() {
return billDate;
}
public void setBillDate(LocalDate billDate) {
this.billDate = billDate;
}
@Override
public Object primaryKey() {
return hashCode();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof BalanceBillingEntity)) return false;
BalanceBillingEntity that = (BalanceBillingEntity) o;
return Objects.equals(termNo, that.termNo) &&
Objects.equals(typeCode, that.typeCode);
}
@Override
public int hashCode() {
return Objects.hash(BalanceBillingEntity.class, termNo, typeCode);
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("BalanceBillingEntity{");
sb.append("termNo=").append(termNo);
sb.append(", typeCode='").append(typeCode).append('\'');
sb.append(", nextSummaryNo=").append(nextSummaryNo);
sb.append(", balance=").append(balance);
sb.append(", creditAmt=").append(creditAmt);
sb.append(", creditCount=").append(creditCount);
sb.append(", debitAmt=").append(debitAmt);
sb.append(", debitCount=").append(debitCount);
sb.append(", statusCode='").append(statusCode).append('\'');
sb.append(", targetBills=").append(targetBills);
sb.append(", totalBills=").append(totalBills);
sb.append(", lfFailedBills=").append(lfFailedBills);
sb.append(", rtFailedBills=").append(rtFailedBills);
sb.append(", lastStatusCode='").append(lastStatusCode).append('\'');
sb.append(", billDate=").append(billDate);
sb.append(',').append(super.toString());
sb.append('}');
return sb.toString();
}
}
\ No newline at end of file
package cn.quant.andy.jpa.entity;
import cn.quant.spring.data.jpa.entity.DescriptionEntity;
import javax.persistence.Column;
import javax.persistence.Id;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Objects;
public class BalanceSummaryEntity extends DescriptionEntity {
@Id
@Column(name = "TERM_NO", nullable = false, updatable = false)
private Integer termNo;
@Id
@Column(name = "BASE_CODE", nullable = false, updatable = false)
private String baseCode;
@Id
@Column(name = "BASE_ORDER_NO", nullable = false, updatable = false)
private String baseOrderNo;
@Column(name = "SUMMARY_NO", nullable = false, updatable = false)
private Integer summaryNo;
@Column(name = "RT_TERM_NO", nullable = false, updatable = false)
private Integer rtTermNo;
@Column(name = "RT_BASE_CODE", nullable = false, updatable = false)
private String rtBaseCode;
@Column(name = "OPEN_BALANCE", nullable = false, updatable = false)
private BigDecimal openBalance;
@Column(name = "CLOSE_BALANCE", nullable = false, updatable = true)
private BigDecimal closeBalance;
@Column(name = "CREDIT_AMT", nullable = false, updatable = true)
private BigDecimal creditAmt;
@Column(name = "CREDIT_COUNT", nullable = false, updatable = true)
private Integer creditCount;
@Column(name = "DEBIT_AMT", nullable = false, updatable = true)
private BigDecimal debitAmt;
@Column(name = "DEBIT_COUNT", nullable = false, updatable = true)
private Integer debitCount;
@Column(name = "BILL_CODE", nullable = false, updatable = true)
private String billCode;
@Column(name = "BILL_DATE", nullable = false, updatable = true)
private LocalDate billDate;
public Integer getTermNo() {
return termNo;
}
public void setTermNo(Integer termNo) {
this.termNo = termNo;
}
public String getBaseCode() {
return baseCode;
}
public void setBaseCode(String baseCode) {
this.baseCode = baseCode;
}
public String getBaseOrderNo() {
return baseOrderNo;
}
public void setBaseOrderNo(String baseOrderNo) {
this.baseOrderNo = baseOrderNo;
}
public Integer getSummaryNo() {
return summaryNo;
}
public void setSummaryNo(Integer summaryNo) {
this.summaryNo = summaryNo;
}
public Integer getRtTermNo() {
return rtTermNo;
}
public void setRtTermNo(Integer rtTermNo) {
this.rtTermNo = rtTermNo;
}
public String getRtBaseCode() {
return rtBaseCode;
}
public void setRtBaseCode(String rtBaseCode) {
this.rtBaseCode = rtBaseCode;
}
public BigDecimal getOpenBalance() {
return openBalance;
}
public void setOpenBalance(BigDecimal openBalance) {
this.openBalance = openBalance;
}
public BigDecimal getCloseBalance() {
return closeBalance;
}
public void setCloseBalance(BigDecimal closeBalance) {
this.closeBalance = closeBalance;
}
public BigDecimal getCreditAmt() {
return creditAmt;
}
public void setCreditAmt(BigDecimal creditAmt) {
this.creditAmt = creditAmt;
}
public Integer getCreditCount() {
return creditCount;
}
public void setCreditCount(Integer creditCount) {
this.creditCount = creditCount;
}
public BigDecimal getDebitAmt() {
return debitAmt;
}
public void setDebitAmt(BigDecimal debitAmt) {
this.debitAmt = debitAmt;
}
public Integer getDebitCount() {
return debitCount;
}
public void setDebitCount(Integer debitCount) {
this.debitCount = debitCount;
}
public String getBillCode() {
return billCode;
}
public void setBillCode(String billCode) {
this.billCode = billCode;
}
public LocalDate getBillDate() {
return billDate;
}
public void setBillDate(LocalDate billDate) {
this.billDate = billDate;
}
@Override
public Object primaryKey() {
return hashCode();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof BalanceSummaryEntity)) return false;
BalanceSummaryEntity that = (BalanceSummaryEntity) o;
return Objects.equals(termNo, that.termNo) &&
Objects.equals(baseCode, that.baseCode) &&
Objects.equals(baseOrderNo, that.baseOrderNo);
}
@Override
public int hashCode() {
return Objects.hash(BalanceSummaryEntity.class, termNo, baseCode, baseOrderNo);
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("BalanceSummaryEntity{");
sb.append("termNo=").append(termNo);
sb.append(", baseCode='").append(baseCode).append('\'');
sb.append(", baseOrderNo='").append(baseOrderNo).append('\'');
sb.append(", summaryNo=").append(summaryNo);
sb.append(", rtTermNo=").append(rtTermNo);
sb.append(", rtBaseCode='").append(rtBaseCode).append('\'');
sb.append(", openBalance=").append(openBalance);
sb.append(", closeBalance=").append(closeBalance);
sb.append(", creditAmt=").append(creditAmt);
sb.append(", creditCount=").append(creditCount);
sb.append(", debitAmt=").append(debitAmt);
sb.append(", debitCount=").append(debitCount);
sb.append(", billCode='").append(billCode).append('\'');
sb.append(", billDate=").append(billDate);
sb.append(',').append(super.toString());
sb.append('}');
return sb.toString();
}
}
\ No newline at end of file
package cn.quant.andy.jpa.entity;
/**
* Created by Administrator on 2021/7/17 0017.
*/
public abstract class EntityConstant {
public static final String INSTITUTION_CODE="institutionCode";
public static final String BASE_CODE="baseCode";
public static final String PRODUCT_CODE="productCode";
public static final String TRANSACTION_ID="transactionId";
public static final String TERM_NO="termNo";
public static final String POST_DATE="postDate";
public static final String POST_TIME="postTime";
public static final String IMPORT_TIME="importTime";
public static final String POSTED_FLAG="postedFlag";
public static final String DESC_TEXT="descText";
public static final String CREATED_BY="createdBy";
public static final String CREATED_BY_SYS="SYS";
public static final String CREATED_DATE="createdDate";
public static final String MODIFIED_BY="modifiedBy";
public static final String MODIFIED_BY_SYS="SYS";
public static final String MODIFIED_DATE="modifiedDate";
public static final String MODIFIED_NO="modifiedNo";
public static final String AVAILABLE_FLAG="availableFlag";
public static final String INSTITUTION_TYPE_CODE="INST";
public static final String PRODCT_TYPE_CODE="PROD";
public static final String DATA_SCHEMA_TYPE="type";
public static final String DATA_SCHEMA_COLUMN="column";
public static final String DATA_SCHEMA_FORMAT="format";
public static final int EMPTY_TERM_NO=-1;
public static final String EMPTY_BASE_CODE="$$$$";
public static final String CREDIT_TXN_FLAG="C";
public static final String DEBIT_TXN_FLAG="D";
}
package cn.quant.andy.jpa.entity;
import cn.quant.andy.jpa.model.ImportMapSchema;
import cn.quant.spring.data.jpa.entity.DescriptionEntity;
import javax.persistence.Column;
import javax.persistence.Id;
import java.util.List;
public class InstitutionProfileEntity extends DescriptionEntity {
@Id
@Column(name = "BASE_CODE", nullable = false, updatable = false)
private String baseCode;
@Column(name = "TYPE_CODE", nullable = false, updatable = false)
private String typeCode;
@Column(name = "ACCOUNT_NO", nullable = false, updatable = false)
private String accountNo;
@Column(name = "IMPORT_FILE", nullable = true, updatable = true)
private String importFile;
@Column(name = "IMPORT_URL", nullable = true, updatable = true)
private String importUrl;
@Column(name = "IMPORT_DATA_COL_NUM", nullable = false, updatable = true)
private Integer importDataColNum;
@Column(name = "IMPORT_DATA_SCHEMA", nullable = false, updatable = true)
private List<ImportMapSchema> importDataSchema;
@Column(name = "DATA_PREFIX", nullable = false, updatable = true)
private String dataPrefix;
@Column(name = "START_LINE", nullable = false, updatable = true)
private Integer startLine;
@Column(name = "END_LINE", nullable = false, updatable = true)
private Integer endLine;
@Column(name = "AVAILABLE_FLAG", nullable = false, updatable = true)
private Boolean availableFlag;
public String getBaseCode() {
return baseCode;
}
public void setBaseCode(String baseCode) {
this.baseCode = baseCode;
}
public String getTypeCode() {
return typeCode;
}
public void setTypeCode(String typeCode) {
this.typeCode = typeCode;
}
public String getAccountNo() {
return accountNo;
}
public void setAccountNo(String accountNo) {
this.accountNo = accountNo;
}
public String getImportFile() {
return importFile;
}
public void setImportFile(String importFile) {
this.importFile = importFile;
}
public String getImportUrl() {
return importUrl;
}
public void setImportUrl(String importUrl) {
this.importUrl = importUrl;
}
public Integer getImportDataColNum() {
return importDataColNum;
}
public void setImportDataColNum(Integer importDataColNum) {
this.importDataColNum = importDataColNum;
}
public List<ImportMapSchema> getImportDataSchema() {
return importDataSchema;
}
public void setImportDataSchema(List<ImportMapSchema> importDataSchema) {
this.importDataSchema = importDataSchema;
}
public String getDataPrefix() {
return dataPrefix;
}
public void setDataPrefix(String dataPrefix) {
this.dataPrefix = dataPrefix;
}
public Integer getStartLine() {
return startLine;
}
public void setStartLine(Integer startLine) {
this.startLine = startLine;
}
public Integer getEndLine() {
return endLine;
}
public void setEndLine(Integer endLine) {
this.endLine = endLine;
}
public Boolean getAvailableFlag() {
return availableFlag;
}
public void setAvailableFlag(Boolean availableFlag) {
this.availableFlag = availableFlag;
}
@Override
public Object primaryKey() {
return null;
}
}
\ No newline at end of file
package cn.quant.andy.jpa.entity;
import cn.quant.spring.data.jpa.entity.DescriptionEntity;
import javax.persistence.Column;
import javax.persistence.Id;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalTime;
import java.util.Date;
import java.util.Objects;
public class InstitutionTransactionSummaryEntity extends DescriptionEntity {
@Id
@Column(name = "TRANSACTION_ID", nullable = false, updatable = false)
private Long transactionId;
@Column(name = "BASE_CODE", nullable = false, updatable = false)
private String baseCode;
@Column(name = "TERM_NO", nullable = false, updatable = false)
private Integer termNo;
@Column(name = "LEVEL_NO", nullable = false, updatable = false)
private Integer levelNo;
@Column(name = "TXN_CODE", nullable = false, updatable = false)
private String txnCode;
@Column(name = "TXN_TYPE", nullable = false, updatable = false)
private String txnType;
@Column(name = "TXN_NO", nullable = false, updatable = false)
private String txnNo;
@Column(name = "SERIAL_NO", nullable = false, updatable = false)
private String serialNo;
@Column(name = "TXN_FLAG", nullable = false, updatable = false)
private String txnFlag;
@Column(name = "BASE_ORDER_NO", nullable = false, updatable = false)
private String baseOrderNo;
@Column(name = "STATUS_CODE", nullable = false, updatable = false)
private String statusCode;
@Column(name = "PRODUCT_ORDER_NO", nullable = false, updatable = false)
private String productOrderNo;
@Column(name = "COMMODITY_NAME", nullable = false, updatable = false)
private String commodityName;
@Column(name = "BANK_CODE", nullable = false, updatable = false)
private String bankCode;
@Column(name = "BANK_ACCT_NO", nullable = false, updatable = false)
private String bankAcctNo;
@Column(name = "TXN_TIME", nullable = false, updatable = false)
private Date txnTime;
@Column(name = "POST_AMT", nullable = false, updatable = false)
private BigDecimal postAmt;
@Column(name = "POST_DATE", nullable = false, updatable = false)
private LocalDate postDate;
@Column(name = "POST_TIME", nullable = false, updatable = false)
private LocalTime postTime;
@Column(name = "IMPORT_TIME", nullable = false, updatable = false)
private Date importTime;
@Column(name = "POSTED_FLAG", nullable = false, updatable = true)
private Boolean postedFlag;
public Long getTransactionId() {
return transactionId;
}
public void setTransactionId(Long transactionId) {
this.transactionId = transactionId;
}
public String getBaseCode() {
return baseCode;
}
public void setBaseCode(String baseCode) {
this.baseCode = baseCode;
}
public Integer getTermNo() {
return termNo;
}
public void setTermNo(Integer termNo) {
this.termNo = termNo;
}
public Integer getLevelNo() {
return levelNo;
}
public void setLevelNo(Integer levelNo) {
this.levelNo = levelNo;
}
public String getTxnType() {
return txnType;
}
public void setTxnType(String txnType) {
this.txnType = txnType;
}
public String getTxnCode() {
return txnCode;
}
public void setTxnCode(String txnCode) {
this.txnCode = txnCode;
}
public String getTxnNo() {
return txnNo;
}
public void setTxnNo(String txnNo) {
this.txnNo = txnNo;
}
public String getSerialNo() {
return serialNo;
}
public void setSerialNo(String serialNo) {
this.serialNo = serialNo;
}
public String getTxnFlag() {
return txnFlag;
}
public void setTxnFlag(String txnFlag) {
this.txnFlag = txnFlag;
}
public String getBaseOrderNo() {
return baseOrderNo;
}
public void setBaseOrderNo(String baseOrderNo) {
this.baseOrderNo = baseOrderNo;
}
public String getStatusCode() {
return statusCode;
}
public void setStatusCode(String statusCode) {
this.statusCode = statusCode;
}
public String getProductOrderNo() {
return productOrderNo;
}
public void setProductOrderNo(String productOrderNo) {
this.productOrderNo = productOrderNo;
}
public String getCommodityName() {
return commodityName;
}
public void setCommodityName(String commodityName) {
this.commodityName = commodityName;
}
public String getBankCode() {
return bankCode;
}
public void setBankCode(String bankCode) {
this.bankCode = bankCode;
}
public String getBankAcctNo() {
return bankAcctNo;
}
public void setBankAcctNo(String bankAcctNo) {
this.bankAcctNo = bankAcctNo;
}
public Date getTxnTime() {
return txnTime;
}
public void setTxnTime(Date txnTime) {
this.txnTime = txnTime;
}
public BigDecimal getPostAmt() {
return postAmt;
}
public void setPostAmt(BigDecimal postAmt) {
this.postAmt = postAmt;
}
public LocalDate getPostDate() {
return postDate;
}
public void setPostDate(LocalDate postDate) {
this.postDate = postDate;
}
public LocalTime getPostTime() {
return postTime;
}
public void setPostTime(LocalTime postTime) {
this.postTime = postTime;
}
public Date getImportTime() {
return importTime;
}
public void setImportTime(Date importTime) {
this.importTime = importTime;
}
public Boolean getPostedFlag() {
return postedFlag;
}
public void setPostedFlag(Boolean postedFlag) {
this.postedFlag = postedFlag;
}
@Override
public Object primaryKey() {
return hashCode();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof InstitutionTransactionSummaryEntity)) return false;
InstitutionTransactionSummaryEntity entity = (InstitutionTransactionSummaryEntity) o;
return Objects.equals(transactionId, entity.transactionId);
}
@Override
public int hashCode() {
return Objects.hash(InstitutionTransactionSummaryEntity.class, transactionId);
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("InstitutionTransactionSummaryEntity{");
sb.append("transactionId=").append(transactionId);
sb.append(", baseCode='").append(baseCode).append('\'');
sb.append(", termNo=").append(termNo);
sb.append(", levelNo=").append(levelNo);
sb.append(", txnCode='").append(txnCode).append('\'');
sb.append(", txnType='").append(txnType).append('\'');
sb.append(", txnNo='").append(txnNo).append('\'');
sb.append(", serialNo='").append(serialNo).append('\'');
sb.append(", txnFlag='").append(txnFlag).append('\'');
sb.append(", baseOrderNo='").append(baseOrderNo).append('\'');
sb.append(", statusCode='").append(statusCode).append('\'');
sb.append(", productOrderNo='").append(productOrderNo).append('\'');
sb.append(", commodityName='").append(commodityName).append('\'');
sb.append(", bankCode='").append(bankCode).append('\'');
sb.append(", bankAcctNo='").append(bankAcctNo).append('\'');
sb.append(", txnTime=").append(txnTime);
sb.append(", postAmt=").append(postAmt);
sb.append(", postDate=").append(postDate);
sb.append(", postTime=").append(postTime);
sb.append(", importTime=").append(importTime);
sb.append(", postedFlag=").append(postedFlag);
sb.append(',').append(super.toString());
sb.append('}');
return sb.toString();
}
}
\ No newline at end of file
package cn.quant.andy.jpa.entity;
import cn.quant.spring.data.jpa.entity.DescriptionEntity;
import javax.persistence.Column;
import javax.persistence.Id;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalTime;
import java.util.Date;
import java.util.Objects;
public class TransactionSummaryEntity extends DescriptionEntity{
@Id
@Column(name = "TRANSACTION_ID", nullable = false, updatable = false)
private Long transactionId;
@Column(name = "BASE_ORDER_NO", nullable = false, updatable = false)
private String baseOrderNo;
@Column(name = "TERM_NO", nullable = false, updatable = false)
private Integer termNo;
@Column(name = "BASE_CODE", nullable = false, updatable = false)
private String baseCode;
@Column(name = "ORDER_NO", nullable = false, updatable = false)
private String orderNo;
@Column(name = "GEN_ORDER_NO", nullable = false, updatable = false)
private String genOrderNo;
@Column(name = "ROOT_FLAG", nullable = false, updatable = false)
private String rootFlag;
@Column(name = "VOLUME", nullable = false, updatable = false)
private Integer volume;
@Column(name = "SERIAL_NO", nullable = false, updatable = false)
private String serialNo;
@Column(name = "TXN_CODE", nullable = false, updatable = false)
private String txnCode;
@Column(name = "TXN_TYPE", nullable = false, updatable = false)
private String txnType;
@Column(name = "TXN_FLAG", nullable = false, updatable = false)
private String txnFlag;
@Column(name = "ORIGINAL_AMT", nullable = false, updatable = false)
private BigDecimal originalAmt;
@Column(name = "POST_AMT", nullable = false, updatable = false)
private BigDecimal postAmt;
@Column(name = "POST_DATE", nullable = false, updatable = false)
private LocalDate postDate;
@Column(name = "POST_TIME", nullable = false, updatable = false)
private LocalTime postTime;
@Column(name = "TXN_TIME", nullable = false, updatable = false)
private Date txnTime;
@Column(name = "IMPORT_TIME", nullable = false, updatable = false)
private Date importTime;
@Column(name = "POSTED_FLAG", nullable = false, updatable = true)
private Boolean postedFlag;
public Long getTransactionId() {
return transactionId;
}
public void setTransactionId(Long transactionId) {
this.transactionId = transactionId;
}
public String getBaseOrderNo() {
return baseOrderNo;
}
public void setBaseOrderNo(String baseOrderNo) {
this.baseOrderNo = baseOrderNo;
}
public Integer getTermNo() {
return termNo;
}
public void setTermNo(Integer termNo) {
this.termNo = termNo;
}
public String getBaseCode() {
return baseCode;
}
public void setBaseCode(String baseCode) {
this.baseCode = baseCode;
}
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public String getGenOrderNo() {
return genOrderNo;
}
public void setGenOrderNo(String genOrderNo) {
this.genOrderNo = genOrderNo;
}
public String getRootFlag() {
return rootFlag;
}
public void setRootFlag(String rootFlag) {
this.rootFlag = rootFlag;
}
public Integer getVolume() {
return volume;
}
public void setVolume(Integer volume) {
this.volume = volume;
}
public String getSerialNo() {
return serialNo;
}
public void setSerialNo(String serialNo) {
this.serialNo = serialNo;
}
public String getTxnCode() {
return txnCode;
}
public void setTxnCode(String txnCode) {
this.txnCode = txnCode;
}
public String getTxnType() {
return txnType;
}
public void setTxnType(String txnType) {
this.txnType = txnType;
}
public String getTxnFlag() {
return txnFlag;
}
public void setTxnFlag(String txnFlag) {
this.txnFlag = txnFlag;
}
public BigDecimal getOriginalAmt() {
return originalAmt;
}
public void setOriginalAmt(BigDecimal originalAmt) {
this.originalAmt = originalAmt;
}
public BigDecimal getPostAmt() {
return postAmt;
}
public void setPostAmt(BigDecimal postAmt) {
this.postAmt = postAmt;
}
public LocalDate getPostDate() {
return postDate;
}
public void setPostDate(LocalDate postDate) {
this.postDate = postDate;
}
public LocalTime getPostTime() {
return postTime;
}
public void setPostTime(LocalTime postTime) {
this.postTime = postTime;
}
public Date getTxnTime() {
return txnTime;
}
public void setTxnTime(Date txnTime) {
this.txnTime = txnTime;
}
public Date getImportTime() {
return importTime;
}
public void setImportTime(Date importTime) {
this.importTime = importTime;
}
public Boolean getPostedFlag() {
return postedFlag;
}
public void setPostedFlag(Boolean postedFlag) {
this.postedFlag = postedFlag;
}
@Override
public Object primaryKey() {
return hashCode();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof TransactionSummaryEntity)) return false;
TransactionSummaryEntity that = (TransactionSummaryEntity) o;
return Objects.equals(transactionId, that.transactionId);
}
@Override
public int hashCode() {
return Objects.hash(TransactionSummaryEntity.class, transactionId);
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("TransactionSummaryEntity{");
sb.append("transactionId=").append(transactionId);
sb.append(", baseOrderNo='").append(baseOrderNo).append('\'');
sb.append(", termNo=").append(termNo);
sb.append(", baseCode='").append(baseCode).append('\'');
sb.append(", orderNo='").append(orderNo).append('\'');
sb.append(", genOrderNo='").append(genOrderNo).append('\'');
sb.append(", rootFlag='").append(rootFlag).append('\'');
sb.append(", volume=").append(volume);
sb.append(", serialNo='").append(serialNo).append('\'');
sb.append(", txnCode='").append(txnCode).append('\'');
sb.append(", txnType='").append(txnType).append('\'');
sb.append(", txnFlag='").append(txnFlag).append('\'');
sb.append(", originalAmt=").append(originalAmt);
sb.append(", postAmt=").append(postAmt);
sb.append(", postDate=").append(postDate);
sb.append(", postTime=").append(postTime);
sb.append(", txnTime=").append(txnTime);
sb.append(", importTime=").append(importTime);
sb.append(", postedFlag=").append(postedFlag);
sb.append(',').append(super.toString());
sb.append('}');
return sb.toString();
}
}
\ No newline at end of file
package cn.quant.andy.jpa.model;
/**
* Created by Administrator on 2021/7/17 0017.
*/
public class ImportMapSchema {
private String column;
private String type;
private String index;
private String format;
public String getColumn() {
return column;
}
public void setColumn(String column) {
this.column = column;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getIndex() {
return index;
}
public void setIndex(String index) {
this.index = index;
}
public String getFormat() {
return format;
}
public void setFormat(String format) {
this.format = format;
}
}
package cn.quant.andy.jpa.mybatis.mapper;
import cn.quant.andy.jpa.entity.ApplicationProfileEntity;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import java.util.List;
@Mapper
@Repository
public interface ApplicationProfileMapper {
List<ApplicationProfileEntity> findAll();
// int deleteByPrimaryKey(String code);
//
// int insert(ApplicationProfileEntity record);
//
// int insertSelective(ApplicationProfileEntity record);
//
// ApplicationProfileEntity selectByPrimaryKey(String code);
//
// int updateByPrimaryKeySelective(ApplicationProfileEntity record);
//
// int updateByPrimaryKey(ApplicationProfileEntity record);
}
\ No newline at end of file
package cn.quant.andy.jpa.mybatis.mapper;
import cn.quant.andy.jpa.entity.BalanceBillingEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@Mapper
@Repository
public interface BalanceBillingMapper {
BalanceBillingEntity findTypeTerm(@Param("typeCode") String typeCode, @Param("termNo") int termNo);
int save(BalanceBillingEntity entity);
}
\ No newline at end of file
package cn.quant.andy.jpa.mybatis.mapper;
import cn.quant.andy.jpa.entity.BalanceSummaryEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@Mapper
@Repository
public interface BalanceSummaryMapper extends BaseMapper<BalanceSummaryEntity>{
BalanceSummaryEntity findOneByIds(@Param("termNo") int termNo, @Param("baseCode") String baseCode, @Param("baseOrderNo") String baseOrderNo);
}
\ No newline at end of file
package cn.quant.andy.jpa.mybatis.mapper;
/**
* Created by Administrator on 2021/7/24 0024.
*/
public interface BaseMapper<E> {
void insert(E entity);
int save(E entity);
}
package cn.quant.andy.jpa.mybatis.mapper;
import cn.quant.andy.jpa.entity.InstitutionProfileEntity;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
@Mapper
@Repository
public interface InstitutionProfileMapper {
List<InstitutionProfileEntity> findAll(Map<String, Object> params);
InstitutionProfileEntity findOne(Map<String, Object> params);
// int deleteByPrimaryKey(String institutionCode);
//
// int insert(InstitutionProfileEntity record);
//
// int insertSelective(InstitutionProfileEntity record);
//
// InstitutionProfileEntity selectByPrimaryKey(String institutionCode);
//
// int updateByPrimaryKeySelective(InstitutionProfileEntity record);
//
// int updateByPrimaryKey(InstitutionProfileEntity record);
}
\ No newline at end of file
package cn.quant.andy.jpa.mybatis.mapper;
import cn.quant.andy.jpa.entity.InstitutionTransactionSummaryEntity;
import cn.quant.spring.data.domain.Pagination;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Mapper
@Repository
public interface InstitutionTransactionSummaryMapper extends SummaryMapper, BaseMapper<InstitutionTransactionSummaryEntity> {
int countTypes(@Param("txnType") String txnType, @Param("termNo") int termNo, @Param("postedFlag") boolean postedFlag);
InstitutionTransactionSummaryEntity findOneById(@Param("id") Long id);
List<InstitutionTransactionSummaryEntity> findDebitsByTermBase(@Param("baseCode") String baseCode, @Param("termNo") int termNo
, @Param("baseOrderNo") String baseOrderNo, @Param("postedFlag") boolean postedFlag);
List<InstitutionTransactionSummaryEntity> findAllByTerm(Pagination pagination, @Param("termNo") int termNo, @Param("txnFlag") String txnFlag
, @Param("postedFlag") boolean postedFlag);
// int deleteByPrimaryKey(Long transactionId);
//
// int insert(InstitutionTransactionSummaryEntity record);
//
// int insertSelective(InstitutionTransactionSummaryEntity record);
//
// InstitutionTransactionSummaryEntity selectByPrimaryKey(Long transactionId);
//
// int updateByPrimaryKeySelective(InstitutionTransactionSummaryEntity record);
//
// int updateByPrimaryKey(InstitutionTransactionSummaryEntity record);
}
\ No newline at end of file
package cn.quant.andy.jpa.mybatis.mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
/**
* Created by Administrator on 2021/7/20 0020.
*/
public interface SummaryMapper {
void importData(@Param("fields") String fields, @Param("values") Object[] values, @Param("params") Map params);
}
\ No newline at end of file
package cn.quant.andy.jpa.mybatis.mapper;
import cn.quant.andy.jpa.entity.TransactionSummaryEntity;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
@Mapper
@Repository
public interface TransactionSummaryMapper extends SummaryMapper, BaseMapper<TransactionSummaryEntity> {
}
\ No newline at end of file
package cn.quant.andy.jpa.mybatis.type;
import cn.quant.spring.mybatis.type.CharBoolTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;
import org.apache.ibatis.type.MappedTypes;
/**
* Created by Administrator on 2021/7/28 0028.
*/
@MappedJdbcTypes(JdbcType.CHAR)
@MappedTypes(Boolean.class)
public class MybatisCharBoolTypeHandler extends CharBoolTypeHandler {
}
package cn.quant.andy.jpa.mybatis.type;
import cn.quant.spring.mybatis.type.IntLocalDateTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;
import org.apache.ibatis.type.MappedTypes;
import java.time.LocalDate;
/**
* Created by Administrator on 2021/7/28 0028.
*/
@MappedJdbcTypes(JdbcType.INTEGER)
@MappedTypes(LocalDate.class)
public class MybatisIntLocalDateTypeHandler extends IntLocalDateTypeHandler {
}
package cn.quant.andy.jpa.mybatis.type;
import cn.quant.spring.mybatis.type.IntLocalTimeTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;
import org.apache.ibatis.type.MappedTypes;
import java.time.LocalTime;
/**
* Created by Administrator on 2021/7/28 0028.
*/
@MappedJdbcTypes(JdbcType.INTEGER)
@MappedTypes(LocalTime.class)
public class MybatisIntLocalTimeTypeHandler extends IntLocalTimeTypeHandler {
}
package cn.quant.andy.jpa.mybatis.type;
import cn.quant.spring.mybatis.type.StringListTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;
import org.apache.ibatis.type.MappedTypes;
import java.util.List;
/**
* Created by Administrator on 2021/7/28 0028.
*/
@MappedJdbcTypes(JdbcType.VARCHAR)
@MappedTypes(List.class)
public class MybatisStringListTypeHandler extends StringListTypeHandler {
}
package cn.quant.andy.jpa.mybatis.type;
import cn.quant.andy.jpa.model.ImportMapSchema;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;
import org.apache.ibatis.type.MappedTypes;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.List;
/**
* Created by Administrator on 2021/7/17 0017.
*/
@MappedJdbcTypes(JdbcType.LONGVARCHAR)
@MappedTypes(List.class)
public class SchemaListTypeHandler extends BaseTypeHandler<List<ImportMapSchema>> {
private final static ObjectMapper mapper = new ObjectMapper();
static {
mapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
}
@Override
public void setNonNullParameter(PreparedStatement preparedStatement, int i, List<ImportMapSchema> importDataSchema, JdbcType jdbcType) throws SQLException {
}
@Override
public List getNullableResult(ResultSet resultSet, String s) throws SQLException {
return getNullableResult(resultSet.getString(s));
}
@Override
public List<ImportMapSchema> getNullableResult(ResultSet resultSet, int i) throws SQLException {
return getNullableResult(resultSet.getString(i));
}
@Override
public List<ImportMapSchema> getNullableResult(CallableStatement callableStatement, int i) throws SQLException {
return null;
}
public List<ImportMapSchema> getNullableResult(String val) {
try {
if (val.charAt(0) == '[') {
if (val.charAt(Math.max(val.length() - 1, 0)) == ']') {
return mapper.readValue(val, new TypeReference<List<ImportMapSchema>>() {});
}
}
return null;
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
}
package cn.quant.andy.service;
import cn.quant.andy.TransactionSession;
import cn.quant.spring.context.ServerApplicationContext;
import org.springframework.beans.factory.annotation.Autowired;
/**
* Created by Administrator on 2021/7/24 0024.
*/
public abstract class AbstractService {
@Autowired
private ServerApplicationContext serverApplicationContext;
private static final ThreadLocal<TransactionSession> local = new ThreadLocal();
public TransactionSession session() {
if (local.get() != null) {
return local.get();
}
TransactionSession session = new TransactionSession(serverApplicationContext);
local.set(session);
return session;
}
public void release() {
local.remove();
}
}
package cn.quant.andy.service;
import cn.quant.andy.aspect.ExplainPoint;
import cn.quant.andy.dict.BillStatusCode;
import cn.quant.andy.jpa.entity.BalanceBillingEntity;
import cn.quant.andy.jpa.entity.BalanceSummaryEntity;
import cn.quant.andy.jpa.entity.EntityConstant;
import cn.quant.andy.jpa.entity.InstitutionTransactionSummaryEntity;
import cn.quant.andy.jpa.mybatis.mapper.BalanceBillingMapper;
import cn.quant.andy.jpa.mybatis.mapper.BalanceSummaryMapper;
import cn.quant.andy.jpa.mybatis.mapper.InstitutionTransactionSummaryMapper;
import cn.quant.andy.util.BalanceUtils;
import cn.quant.andy.util.TransactionBuilder;
import cn.quant.spring.data.domain.Pagination;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.time.LocalDate;
import java.util.List;
/**
* Created by Administrator on 2021/7/21 0021.
*/
@Service
public class BalanceService extends AbstractService {
private static final Logger logger = LoggerFactory.getLogger(BalanceService.class);
@Autowired
private InstitutionTransactionSummaryMapper institutionTransactionSummaryMapper;
@Autowired
private BalanceSummaryMapper balanceSummaryMapper;
@Autowired
private BalanceBillingMapper balanceBillingMapper;
private void billingLeft(BalanceBillingEntity bill, InstitutionTransactionSummaryEntity entity) {
Integer termNo = entity.getTermNo();
String baseCode = entity.getBaseCode();
String baseOrderNo = entity.getBaseOrderNo();
BalanceSummaryEntity balance = balanceSummaryMapper.findOneByIds(termNo, baseCode, baseOrderNo);
boolean newbalance = balance == null;
if (newbalance) {
balance = TransactionBuilder.createLeftTransactionBalance(BalanceUtils.nextSummaryNo(bill), entity);
}
List<InstitutionTransactionSummaryEntity> debits = institutionTransactionSummaryMapper.findDebitsByTermBase(baseCode, termNo
, baseOrderNo, false);
for (InstitutionTransactionSummaryEntity debit : debits) {
balance.setRtTermNo(debit.getTermNo());
balance.setRtBaseCode(debit.getBaseCode());
balance.setDebitAmt(balance.getDebitAmt().add(debit.getPostAmt()));
balance.setDebitCount(balance.getDebitCount() + 1);
debit.setPostedFlag(true);
institutionTransactionSummaryMapper.save(debit);
BalanceUtils.billCode(balance, entity, debit);
BalanceUtils.billing(bill, debit);
BalanceUtils.refresh(balance);
}
entity.setPostedFlag(true);
entity.setPostDate(LocalDate.now());
institutionTransactionSummaryMapper.save(entity);
if (newbalance) {
balanceSummaryMapper.insert(balance);
} else {
balanceSummaryMapper.save(balance);
}
BalanceUtils.billing(bill, entity);
}
@ExplainPoint
@Transactional(rollbackOn = Exception.class, value = Transactional.TxType.NOT_SUPPORTED)
public int billing(String type, int termNo) {
logger.info("Start billing by {}, {}", type, termNo);
BalanceBillingEntity billing = balanceBillingMapper.findTypeTerm(type, termNo);
billing.setBillDate(LocalDate.now());
boolean loop = true;
Pagination pagination = new Pagination(1, 10, false);
try {
while (loop) {
loop = billing(billing, pagination, 202106) > 0;
}
loop = true;
pagination = new Pagination(1, 10, false);
while (loop) {
loop = billingRight(billing, pagination, 202106) > 0;
}
BalanceUtils.refresh(billing, BillStatusCode.SUCC);
} catch (Exception e) {
BalanceUtils.refresh(billing, BillStatusCode.WARN);
logger.error("[ERROR]"+e.getMessage());
e.printStackTrace();
} finally {
balanceBillingMapper.save(billing);
}
return 0;
}
@ExplainPoint
@Transactional(rollbackOn = Exception.class, value = Transactional.TxType.REQUIRES_NEW)
public int billing(BalanceBillingEntity bill, Pagination pagination, int termNo) {
try {
List<InstitutionTransactionSummaryEntity> entities = institutionTransactionSummaryMapper.findAllByTerm(pagination, termNo
, EntityConstant.CREDIT_TXN_FLAG, false);
if (entities.size() > 0) {
for (InstitutionTransactionSummaryEntity entity : entities) {
try {
billingLeft(bill, entity);
} catch (Exception e) {
BalanceUtils.nextLfFailedBills(bill);
logger.error("Failed billing left - " + entity.toString());
e.printStackTrace();
}
}
}
return entities.size();
} finally {
release();
}
}
private void billingRight(BalanceBillingEntity bill, InstitutionTransactionSummaryEntity entity) {
Integer termNo = entity.getTermNo();
String baseCode = entity.getBaseCode();
String baseOrderNo = entity.getBaseOrderNo();
BalanceSummaryEntity balance = balanceSummaryMapper.findOneByIds(termNo, baseCode, baseOrderNo);
boolean newbalance = balance == null;
if (newbalance) {
balance = TransactionBuilder.createRightTransactionBalance(BalanceUtils.nextSummaryNo(bill), entity);
BalanceUtils.refresh(balance);
}
entity.setPostedFlag(true);
entity.setPostDate(LocalDate.now());
institutionTransactionSummaryMapper.save(entity);
if (newbalance) {
balanceSummaryMapper.insert(balance);
} else {
balanceSummaryMapper.save(balance);
}
BalanceUtils.billing(bill, entity);
}
@ExplainPoint
@Transactional(rollbackOn = Exception.class, value = Transactional.TxType.REQUIRES_NEW)
public int billingRight(BalanceBillingEntity bill, Pagination pagination, int termNo) {
try {
List<InstitutionTransactionSummaryEntity> entities = institutionTransactionSummaryMapper.findAllByTerm(pagination, termNo
, EntityConstant.DEBIT_TXN_FLAG, false);
if (entities.size() > 0) {
for (InstitutionTransactionSummaryEntity entity : entities) {
try {
billingRight(bill, entity);
} catch (Exception e) {
BalanceUtils.nextRtFailedBills(bill);
logger.error("Failed billing right - " + entity.toString());
e.printStackTrace();
}
}
}
return entities.size();
} finally {
release();
}
}
}
package cn.quant.andy.text;
import java.math.BigDecimal;
import java.text.ParseException;
/**
* Created by Administrator on 2021/7/19 0019.
*/
public class BigDecimalFormatter extends StringFormatter {
public final static String FORMATTER_TYPE = "b";
Group format(String pattern, String text) throws ParseException {
String[] split = pattern.split("\\.");
BigDecimal bigDecimal = new BigDecimal(text);
bigDecimal = bigDecimal.setScale(Integer.parseInt(split[1]));
Group group = new Group();
group.value = bigDecimal;
return group;
}
}
package cn.quant.andy.text;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;
/**
* Created by Administrator on 2021/7/19 0019.
*/
public class DateStringFormatter extends StringFormatter {
public final static String FORMATTER_TYPE = "d";
private Map<String, SimpleDateFormat> formats = new HashMap<>();
Group format(String pattern, String text) throws ParseException {
SimpleDateFormat format = formats.get(pattern);
if (format == null) {
format = new SimpleDateFormat(pattern);
formats.put(pattern, format);
}
Group group = new Group();
group.value = format.parse(text);
return group;
}
}
package cn.quant.andy.text;
/**
* Created by Administrator on 2021/7/19 0019.
*/
public class FormatConstant {
}
package cn.quant.andy.text;
import java.text.ParseException;
/**
* Created by Administrator on 2021/7/29 0029.
*/
public class IntStringFormatter extends StringFormatter {
public final static String FORMATTER_TYPE = "i";
@Override
Group format(String pattern, String text) throws ParseException {
Group group = new Group();
group.value = Integer.parseInt(text);
return group;
}
}
package cn.quant.andy.text;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created by Administrator on 2021/7/17 0017.
*/
public class PlaceholderSpiltFormatter extends StringFormatter {
public final static String FORMATTER_TYPE = "s";
private String separator;
public PlaceholderSpiltFormatter(String separator) {
this.separator = separator;
}
Group format(String style, String val) {
String[] split = val.split(separator);
Pattern pattern = Pattern.compile("(?<=\\{)\\d*(?=\\})");
Matcher matcher = pattern.matcher(style);
int i = 0;
Group parent = null, group = null;
while (matcher.find()) {
int index = index(i++, style, matcher.start(), matcher.end(), split);
if (group != null) {
group = group.next = new Group();
} else {
group = new Group();
}
group.placeholder = matcher.group();
group.value = split[index];
if (parent == null) {
parent = group;
}
}
return parent;
}
private int index(int index, String input, int start, int end, String[] split) {
int s = Math.max(0, start - 1);
char sc = input.charAt(s);
if (sc == '{') {
if (s == 0) {
return 0;
}
if (separator.equals(input.substring(Math.max(0, s - 1), s))) {
if (input.length() - end == 1) {
return Math.max(0, split.length - 1);
}
}
}
return index;
}
public static void main(String[] args) {
PlaceholderSpiltFormatter formatter = new PlaceholderSpiltFormatter("-");
Group format = formatter.format("{}-{8}", "dfdwqfwqfew-234324323");
System.currentTimeMillis();
}
}
package cn.quant.andy.text;
import java.text.ParseException;
import java.util.HashMap;
import java.util.Map;
/**
* Created by Administrator on 2021/7/19 0019.
*/
public abstract class StringFormatter {
private final static Map<Object, StringFormatter> formatter = new HashMap<>();
public static void register(String key, StringFormatter format) {
if (formatter.containsKey(key)) {
return;
}
formatter.put(key, format);
}
abstract Group format(String pattern, String text) throws ParseException;
public static Group format(Object key, String pattern, String text) throws ParseException {
StringFormatter formatter = StringFormatter.formatter.get(key);
if (formatter == null) {
throw new IllegalArgumentException("No such string formatter." + key);
}
return formatter.format(pattern, text);
}
public class Group {
String placeholder;
Object value;
Group next = null;
public String getIndex() {
return placeholder;
}
public Object getValue() {
return value;
}
public <T> T getValue(T t) {
return (T) value;
}
public String getPlaceholder() {
return placeholder;
}
public boolean hasNext() {
return this.next != null;
}
public Group next() {
return this.next;
}
}
}
package cn.quant.andy.util;
import cn.quant.andy.dict.BillCode;
import cn.quant.andy.dict.BillStatusCode;
import cn.quant.andy.dict.TxnStatusCode;
import cn.quant.andy.jpa.entity.BalanceBillingEntity;
import cn.quant.andy.jpa.entity.BalanceSummaryEntity;
import cn.quant.andy.jpa.entity.EntityConstant;
import cn.quant.andy.jpa.entity.InstitutionTransactionSummaryEntity;
/**
* Created by Administrator on 2021/7/25 0025.
*/
public class BalanceUtils {
public static void refresh(BalanceBillingEntity entity, BillStatusCode code) {
entity.setLastStatusCode(entity.getStatusCode());
entity.setStatusCode(code.name());
entity.setBalance(entity.getCreditAmt().subtract(entity.getDebitAmt()));
}
public static void billing(BalanceBillingEntity bill, InstitutionTransactionSummaryEntity summary) {
if (EntityConstant.DEBIT_TXN_FLAG.equals(summary.getTxnFlag())) {
bill.setDebitAmt(bill.getDebitAmt().add(summary.getPostAmt()));
bill.setDebitCount(bill.getDebitCount() + 1);
} else if (EntityConstant.CREDIT_TXN_FLAG.equals(summary.getTxnFlag())) {
bill.setCreditAmt(bill.getCreditAmt().add(summary.getPostAmt()));
bill.setCreditCount(bill.getCreditCount() + 1);
}
bill.setTotalBills(bill.getTotalBills() + 1);
}
public static int nextSummaryNo(BalanceBillingEntity entity) {
int i = entity.getNextSummaryNo() + 1;
entity.setNextSummaryNo(i);
return i;
}
public static int addTotalBills(BalanceBillingEntity entity, int num) {
int i = entity.getTotalBills() + num;
entity.setTotalBills(i);
return i;
}
public static int nextLfFailedBills(BalanceBillingEntity entity) {
int i = entity.getLfFailedBills() + 1;
entity.setLfFailedBills(i);
return i;
}
public static int nextRtFailedBills(BalanceBillingEntity entity) {
int i = entity.getRtFailedBills() + 1;
entity.setRtFailedBills(i);
return i;
}
public static void billCode(BalanceSummaryEntity entity, InstitutionTransactionSummaryEntity left, InstitutionTransactionSummaryEntity right) {
String lf = left.getStatusCode();
String rt = right.getStatusCode();
if (TxnStatusCode.SUCC.equals(lf)) {
if (TxnStatusCode.SUCC.equals(rt)) {
entity.setBillCode(BillCode.BOTH.name());
} else {
entity.setBillCode(BillCode.DSRT.name());
}
return;
} else if (TxnStatusCode.SUCC.equals(rt)) {
entity.setBillCode(BillCode.DSLF.name());
return;
}
entity.setBillCode(BillCode.DSBS.name());
}
public static void refresh(BalanceSummaryEntity entity) {
entity.setCloseBalance(entity.getCreditAmt().subtract(entity.getDebitAmt()));
}
}
//package cn.quant.bbr.util;
//
//import org.apache.ibatis.type.BaseTypeHandler;
//import org.apache.ibatis.type.JdbcType;
//
//import java.sql.CallableStatement;
//import java.sql.PreparedStatement;
//import java.sql.ResultSet;
//import java.sql.SQLException;
//import java.util.Set;
//
///**
// * Created by Administrator on 2021/7/27 0027.
// */
//public class StringListTypeHandler extends BaseTypeHandler<Set> {
// @Override
// public void setNonNullParameter(PreparedStatement preparedStatement, int i, Set strings, JdbcType jdbcType) throws SQLException {
//
// }
//
// @Override
// public Set getNullableResult(ResultSet resultSet, String s) throws SQLException {
// return null;
// }
//
// @Override
// public Set getNullableResult(ResultSet resultSet, int i) throws SQLException {
// return null;
// }
//
// @Override
// public Set getNullableResult(CallableStatement callableStatement, int i) throws SQLException {
// return null;
// }
//}
package cn.quant.andy.util;
import cn.quant.andy.dict.BillCode;
import cn.quant.andy.jpa.entity.BalanceSummaryEntity;
import cn.quant.andy.jpa.entity.EntityConstant;
import cn.quant.andy.jpa.entity.InstitutionTransactionSummaryEntity;
import java.math.BigDecimal;
import java.time.LocalDate;
/**
* Created by Administrator on 2021/7/23 0023.
*/
public class TransactionBuilder {
public static BalanceSummaryEntity createRightTransactionBalance(int summaryNo, InstitutionTransactionSummaryEntity entity) {
if (entity.getTxnFlag().equals(EntityConstant.CREDIT_TXN_FLAG)) {
throw new IllegalArgumentException("[ERROR]");
}
BalanceSummaryEntity balanceEntity = new BalanceSummaryEntity();
balanceEntity.setSummaryNo(summaryNo);
balanceEntity.setTermNo(entity.getTermNo());
balanceEntity.setBaseCode(entity.getBaseCode());
balanceEntity.setRtBaseCode(entity.getBaseCode());
balanceEntity.setRtTermNo(entity.getTermNo());
balanceEntity.setBaseOrderNo(entity.getBaseOrderNo());
balanceEntity.setCloseBalance(entity.getPostAmt());
balanceEntity.setBillCode(BillCode.RAIT.name());
balanceEntity.setBillDate(LocalDate.now());
balanceEntity.setOpenBalance(BigDecimal.ZERO);
balanceEntity.setCreditAmt(BigDecimal.ZERO);
balanceEntity.setCreditCount(0);
balanceEntity.setDebitAmt(entity.getPostAmt());
balanceEntity.setDebitCount(1);
balanceEntity.setCreatedBy(EntityConstant.CREATED_BY_SYS);
balanceEntity.setModifiedBy(EntityConstant.CREATED_BY_SYS);
return balanceEntity;
}
public static BalanceSummaryEntity createLeftTransactionBalance(int summaryNo, InstitutionTransactionSummaryEntity entity) {
if (entity.getTxnFlag().equals(EntityConstant.DEBIT_TXN_FLAG)) {
throw new IllegalArgumentException("[ERROR]");
}
BalanceSummaryEntity balanceEntity = new BalanceSummaryEntity();
balanceEntity.setSummaryNo(summaryNo);
balanceEntity.setBaseCode(entity.getBaseCode());
balanceEntity.setBaseOrderNo(entity.getBaseOrderNo());
balanceEntity.setRtTermNo(EntityConstant.EMPTY_TERM_NO);
balanceEntity.setRtBaseCode(EntityConstant.EMPTY_BASE_CODE);
balanceEntity.setCloseBalance(BigDecimal.ZERO);
balanceEntity.setBillCode(BillCode.LEFT.name());
balanceEntity.setBillDate(LocalDate.now());
balanceEntity.setOpenBalance(entity.getPostAmt());
balanceEntity.setCreditAmt(entity.getPostAmt());
balanceEntity.setCreditCount(1);
balanceEntity.setDebitAmt(BigDecimal.ZERO);
balanceEntity.setDebitCount(0);
balanceEntity.setTermNo(entity.getTermNo());
balanceEntity.setCreatedBy(EntityConstant.CREATED_BY_SYS);
balanceEntity.setModifiedBy(EntityConstant.CREATED_BY_SYS);
return balanceEntity;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.quant.andy.jpa.mybatis.mapper.ApplicationProfileMapper">
<resultMap id="ApplicationProfileMap" type="cn.quant.andy.jpa.entity.ApplicationProfileEntity">
<id column="TYPE_CODE" jdbcType="CHAR" property="typeCode" />
<result column="TABLE_FIELDS" jdbcType="VARCHAR" property="tableFields" />
<result column="POST_DATE_INDEX" jdbcType="TINYINT" property="postDateIndex"/>
<result column="DESC_TEXT" jdbcType="VARCHAR" property="descText"/>
<result column="CREATED_BY" jdbcType="VARCHAR" property="createdBy"/>
<result column="CREATED_DATE" jdbcType="TIMESTAMP" property="createdDate"/>
<result column="MODIFIED_BY" jdbcType="VARCHAR" property="modifiedBy"/>
<result column="MODIFIED_DATE" jdbcType="TIMESTAMP" property="modifiedDate"/>
<result column="MODIFIED_NO" jdbcType="INTEGER" property="modifiedNo"/>
</resultMap>
<sql id="AppProfColumnList">
TYPE_CODE
, TABLE_FIELDS
, POST_DATE_INDEX
, DESC_TEXT
, CREATED_BY
, CREATED_DATE
, MODIFIED_BY
, MODIFIED_DATE
, MODIFIED_NO
</sql>
<select id="findAll" resultMap="ApplicationProfileMap">
select
<include refid="AppProfColumnList" />
from application_profile
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.quant.andy.jpa.mybatis.mapper.BalanceBillingMapper">
<resultMap id="BalBillMap" type="cn.quant.andy.jpa.entity.BalanceBillingEntity">
<id column="TERM_NO" jdbcType="INTEGER" property="termNo"/>
<id column="TYPE_CODE" jdbcType="CHAR" property="typeCode"/>
<result column="NEXT_SUMMARY_NO" jdbcType="INTEGER" property="nextSummaryNo"/>
<result column="BALANCE" jdbcType="DECIMAL" property="balance"/>
<result column="CREDIT_AMT" jdbcType="DECIMAL" property="creditAmt"/>
<result column="CREDIT_COUNT" jdbcType="INTEGER" property="creditCount"/>
<result column="DEBIT_AMT" jdbcType="DECIMAL" property="debitAmt"/>
<result column="DEBIT_COUNT" jdbcType="INTEGER" property="debitCount"/>
<result column="STATUS_CODE" jdbcType="CHAR" property="statusCode"/>
<result column="TARGET_BILLS" jdbcType="INTEGER" property="targetBills"/>
<result column="TOTAL_BILLS" jdbcType="INTEGER" property="totalBills"/>
<result column="LF_FAILED_BILLS" jdbcType="INTEGER" property="lfFailedBills"/>
<result column="RT_FAILED_BILLS" jdbcType="INTEGER" property="rtFailedBills"/>
<result column="LAST_STATUS_CODE" jdbcType="CHAR" property="lastStatusCode"/>
<result column="BILL_DATE" jdbcType="INTEGER" property="billDate"/>
<result column="DESC_TEXT" jdbcType="VARCHAR" property="descText"/>
<result column="CREATED_BY" jdbcType="VARCHAR" property="createdBy"/>
<result column="CREATED_DATE" jdbcType="TIMESTAMP" property="createdDate"/>
<result column="MODIFIED_BY" jdbcType="VARCHAR" property="modifiedBy"/>
<result column="MODIFIED_DATE" jdbcType="TIMESTAMP" property="modifiedDate"/>
<result column="MODIFIED_NO" jdbcType="INTEGER" property="modifiedNo"/>
</resultMap>
<sql id="BalBillColumnList">
TERM_NO, TYPE_CODE, NEXT_SUMMARY_NO, BALANCE, CREDIT_AMT, CREDIT_COUNT,
DEBIT_AMT, DEBIT_COUNT, STATUS_CODE
, TARGET_BILLS
, TOTAL_BILLS
, LF_FAILED_BILLS
, RT_FAILED_BILLS
, LAST_STATUS_CODE, BILL_DATE, DESC_TEXT,
CREATED_BY, CREATED_DATE, MODIFIED_BY, MODIFIED_DATE, MODIFIED_NO
</sql>
<select id="findTypeTerm" resultMap="BalBillMap">
select
<include refid="BalBillColumnList"/>
from balance_billing
where TERM_NO = #{termNo,jdbcType=INTEGER}
AND TYPE_CODE = #{typeCode,jdbcType=CHAR}
</select>
<update id="save" parameterType="cn.quant.andy.jpa.entity.BalanceBillingEntity">
UPDATE
balance_billing
SET
NEXT_SUMMARY_NO= #{nextSummaryNo}
, BALANCE= #{balance}
, CREDIT_AMT= #{creditAmt}
, CREDIT_COUNT= #{creditCount}
, DEBIT_AMT= #{debitAmt}
, DEBIT_COUNT= #{debitCount}
, STATUS_CODE= #{statusCode}
, TOTAL_BILLS= #{totalBills}
, LF_FAILED_BILLS= #{lfFailedBills}
, RT_FAILED_BILLS= #{rtFailedBills}
, LAST_STATUS_CODE= #{lastStatusCode}
, BILL_DATE= #{billDate, jdbcType=INTEGER}
, DESC_TEXT= #{descText}
WHERE
TERM_NO=#{termNo}
AND TYPE_CODE=#{typeCode}
</update>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.quant.andy.jpa.mybatis.mapper.BalanceSummaryMapper">
<resultMap id="BalSumMap" type="cn.quant.andy.jpa.entity.BalanceSummaryEntity">
<result column="TERM_NO" jdbcType="INTEGER" property="termNo"/>
<result column="BASE_CODE" jdbcType="CHAR" property="baseCode"/>
<result column="BASE_ORDER_NO" jdbcType="CHAR" property="baseOrderNo"/>
<result column="SUMMARY_NO" jdbcType="INTEGER" property="summaryNo"/>
<result column="RT_TERM_NO" jdbcType="INTEGER" property="rtTermNo"/>
<result column="RT_BASE_CODE" jdbcType="CHAR" property="rtBaseCode"/>
<result column="OPEN_BALANCE" jdbcType="DECIMAL" property="openBalance"/>
<result column="CLOSE_BALANCE" jdbcType="DECIMAL" property="closeBalance"/>
<result column="CREDIT_AMT" jdbcType="DECIMAL" property="creditAmt"/>
<result column="CREDIT_COUNT" jdbcType="INTEGER" property="creditCount"/>
<result column="DEBIT_AMT" jdbcType="DECIMAL" property="debitAmt"/>
<result column="DEBIT_COUNT" jdbcType="INTEGER" property="debitCount"/>
<result column="BILL_CODE" jdbcType="CHAR" property="billCode"/>
<result column="BILL_DATE" jdbcType="INTEGER" property="billDate"/>
<result column="DESC_TEXT" jdbcType="VARCHAR" property="descText"/>
<result column="CREATED_BY" jdbcType="VARCHAR" property="createdBy"/>
<result column="CREATED_DATE" jdbcType="TIMESTAMP" property="createdDate"/>
<result column="MODIFIED_BY" jdbcType="VARCHAR" property="modifiedBy"/>
<result column="MODIFIED_DATE" jdbcType="TIMESTAMP" property="modifiedDate"/>
<result column="MODIFIED_NO" jdbcType="INTEGER" property="modifiedNo"/>
</resultMap>
<sql id="BalSumColumnList">
TERM_NO, BASE_CODE, BASE_ORDER_NO
, SUMMARY_NO
, RT_TERM_NO
, RT_BASE_CODE, OPEN_BALANCE, CLOSE_BALANCE
, CREDIT_AMT, CREDIT_COUNT, DEBIT_AMT, DEBIT_COUNT, BILL_CODE, BILL_DATE
, DESC_TEXT, CREATED_BY, CREATED_DATE, MODIFIED_BY, MODIFIED_DATE, MODIFIED_NO
</sql>
<select id="findOneByIds" resultMap="BalSumMap">
SELECT
<include refid="BalSumColumnList"/>
FROM balance_summary
WHERE TERM_NO=#{termNo,jdbcType=INTEGER}
AND BASE_CODE=#{baseCode,jdbcType=CHAR}
AND BASE_ORDER_NO=#{baseOrderNo,jdbcType=CHAR}
</select>
<insert id="insert" parameterType="cn.quant.andy.jpa.entity.BalanceSummaryEntity">
insert into balance_summary (
TERM_NO
, BASE_CODE
, BASE_ORDER_NO
, SUMMARY_NO
, RT_TERM_NO
, RT_BASE_CODE
, OPEN_BALANCE
, CLOSE_BALANCE
, CREDIT_AMT
, CREDIT_COUNT
, DEBIT_AMT
, DEBIT_COUNT
, BILL_CODE
, BILL_DATE
, DESC_TEXT
, CREATED_BY
, MODIFIED_BY
<if test="createdDate != null">
, CREATED_DATE
</if>
<if test="modifiedDate != null">
, MODIFIED_DATE
</if>)
values (
#{termNo}
, #{baseCode}
, #{baseOrderNo}
, #{summaryNo}
, #{rtTermNo}
, #{rtBaseCode}
, #{openBalance}
, #{closeBalance}
, #{creditAmt}
, #{creditCount}
, #{debitAmt}
, #{debitCount}
, #{billCode}
, #{billDate, jdbcType=INTEGER}
, #{descText}
, #{createdBy}
, #{modifiedBy}
<if test="createdDate != null">
, #{createdDate}
</if>
<if test="modifiedDate != null">
, #{modifiedDate}
</if>
)
</insert>
<update id="save" parameterType="cn.quant.andy.jpa.entity.BalanceSummaryEntity">
UPDATE balance_summary SET
OPEN_BALANCE=#{openBalance}
, CLOSE_BALANCE=#{closeBalance}
, CREDIT_AMT=#{creditAmt}
, CREDIT_COUNT=#{creditCount}
, DEBIT_AMT=#{debitAmt}
, DEBIT_COUNT=#{debitCount}
, BILL_CODE=#{billCode}
, BILL_DATE=#{billDate, jdbcType=INTEGER}
WHERE
TERM_NO=#{termNo}
AND BASE_CODE=#{baseCode}
AND BASE_ORDER_NO=#{baseOrderNo}
</update>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.quant.andy.jpa.mybatis.mapper.InstitutionProfileMapper">
<resultMap id="BaseResultMap" type="cn.quant.andy.jpa.entity.InstitutionProfileEntity">
<id column="BASE_CODE" jdbcType="CHAR" property="baseCode"/>
<result column="TYPE_CODE" jdbcType="CHAR" property="typeCode"/>
<result column="ACCOUNT_NO" jdbcType="VARCHAR" property="accountNo"/>
<result column="IMPORT_FILE" jdbcType="VARCHAR" property="importFile"/>
<result column="IMPORT_URL" jdbcType="VARCHAR" property="importUrl"/>
<result column="IMPORT_DATA_COL_NUM" jdbcType="TINYINT" property="importDataColNum"/>
<result column="IMPORT_DATA_SCHEMA" jdbcType="LONGVARCHAR" property="importDataSchema"/>
<result column="DATA_PREFIX" jdbcType="CHAR" property="dataPrefix"/>
<result column="START_LINE" jdbcType="TINYINT" property="startLine"/>
<result column="END_LINE" jdbcType="TINYINT" property="endLine"/>
<result column="AVAILABLE_FLAG" jdbcType="CHAR" property="availableFlag"/>
<result column="DESC_TEXT" jdbcType="VARCHAR" property="descText"/>
<result column="CREATED_BY" jdbcType="VARCHAR" property="createdBy"/>
<result column="CREATED_DATE" jdbcType="TIMESTAMP" property="createdDate"/>
<result column="MODIFIED_BY" jdbcType="VARCHAR" property="modifiedBy"/>
<result column="MODIFIED_DATE" jdbcType="TIMESTAMP" property="modifiedDate"/>
<result column="MODIFIED_NO" jdbcType="INTEGER" property="modifiedNo"/>
</resultMap>
<sql id="Base_Column_List">
BASE_CODE, TYPE_CODE, ACCOUNT_NO, IMPORT_FILE, IMPORT_URL, IMPORT_DATA_COL_NUM, IMPORT_DATA_SCHEMA
, DATA_PREFIX ,START_LINE, END_LINE
, AVAILABLE_FLAG
, DESC_TEXT, CREATED_BY, CREATED_DATE, MODIFIED_BY, MODIFIED_DATE,MODIFIED_NO
</sql>
<select id="findAll" parameterType="Map" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from institution_profile
WHERE
1=1
<if test="availableFlag != null">
AND AVAILABLE_FLAG=#{availableFlag, jdbcType=CHAR}
</if>
</select>
<select id="findOne" parameterType="Map" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from institution_profile WHERE BASE_CODE=#{baseCode}
</select>
<!--<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">-->
<!--select -->
<!--<include refid="Base_Column_List" />-->
<!--from institution_profile-->
<!--where BASE_CODE = #{baseCode,jdbcType=CHAR}-->
<!--</select>-->
<!--<delete id="deleteByPrimaryKey" parameterType="java.lang.String">-->
<!--delete from institution_profile-->
<!--where BASE_CODE = #{baseCode,jdbcType=CHAR}-->
<!--</delete>-->
<!--<insert id="insert" parameterType="cn.quant.andyy.jpa.entity.InstitutionProfileEntity">-->
<!--insert into institution_profile (BASE_CODE, ACCOUNT_NO, IMPORT_FILE, -->
<!--IMPORT_URL, IMPORT_DATA_COL_NUM, IMPORT_DATA_SCHEMA, -->
<!--START_LINE, END_LINE, PARTITION_KEY, -->
<!--CREATED_BY, CREATED_DATE, MODIFIED_BY, -->
<!--MODIFIED_DATE, MODIFIED_NO, EXTENDED_FIELD1, -->
<!--EXTENDED_FIELD2, EXTENDED_FIELD3)-->
<!--values (#{baseCode,jdbcType=CHAR}, #{accountNo,jdbcType=VARCHAR}, #{importFile,jdbcType=VARCHAR}, -->
<!--#{importUrl,jdbcType=VARCHAR}, #{importDataColNum,jdbcType=TINYINT}, #{importDataSchema,jdbcType=VARCHAR}, -->
<!--#{startLine,jdbcType=TINYINT}, #{endLine,jdbcType=TINYINT}, #{partitionKey,jdbcType=SMALLINT}, -->
<!--#{createdBy,jdbcType=VARCHAR}, #{createdDate,jdbcType=TIMESTAMP}, #{modifiedBy,jdbcType=VARCHAR}, -->
<!--#{modifiedDate,jdbcType=TIMESTAMP}, #{modifiedNo,jdbcType=INTEGER}, #{extendedField1,jdbcType=VARCHAR}, -->
<!--#{extendedField2,jdbcType=VARCHAR}, #{extendedField3,jdbcType=VARCHAR})-->
<!--</insert>-->
<!--<insert id="insertSelective" parameterType="cn.quant.andyy.jpa.entity.InstitutionProfileEntity">-->
<!--insert into institution_profile-->
<!--<trim prefix="(" suffix=")" suffixOverrides=",">-->
<!--<if test="baseCode != null">-->
<!--BASE_CODE,-->
<!--</if>-->
<!--<if test="accountNo != null">-->
<!--ACCOUNT_NO,-->
<!--</if>-->
<!--<if test="importFile != null">-->
<!--IMPORT_FILE,-->
<!--</if>-->
<!--<if test="importUrl != null">-->
<!--IMPORT_URL,-->
<!--</if>-->
<!--<if test="importDataColNum != null">-->
<!--IMPORT_DATA_COL_NUM,-->
<!--</if>-->
<!--<if test="importDataSchema != null">-->
<!--IMPORT_DATA_SCHEMA,-->
<!--</if>-->
<!--<if test="startLine != null">-->
<!--START_LINE,-->
<!--</if>-->
<!--<if test="endLine != null">-->
<!--END_LINE,-->
<!--</if>-->
<!--<if test="partitionKey != null">-->
<!--PARTITION_KEY,-->
<!--</if>-->
<!--<if test="createdBy != null">-->
<!--CREATED_BY,-->
<!--</if>-->
<!--<if test="createdDate != null">-->
<!--CREATED_DATE,-->
<!--</if>-->
<!--<if test="modifiedBy != null">-->
<!--MODIFIED_BY,-->
<!--</if>-->
<!--<if test="modifiedDate != null">-->
<!--MODIFIED_DATE,-->
<!--</if>-->
<!--<if test="modifiedNo != null">-->
<!--MODIFIED_NO,-->
<!--</if>-->
<!--<if test="extendedField1 != null">-->
<!--EXTENDED_FIELD1,-->
<!--</if>-->
<!--<if test="extendedField2 != null">-->
<!--EXTENDED_FIELD2,-->
<!--</if>-->
<!--<if test="extendedField3 != null">-->
<!--EXTENDED_FIELD3,-->
<!--</if>-->
<!--</trim>-->
<!--<trim prefix="values (" suffix=")" suffixOverrides=",">-->
<!--<if test="baseCode != null">-->
<!--#{baseCode,jdbcType=CHAR},-->
<!--</if>-->
<!--<if test="accountNo != null">-->
<!--#{accountNo,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="importFile != null">-->
<!--#{importFile,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="importUrl != null">-->
<!--#{importUrl,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="importDataColNum != null">-->
<!--#{importDataColNum,jdbcType=TINYINT},-->
<!--</if>-->
<!--<if test="importDataSchema != null">-->
<!--#{importDataSchema,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="startLine != null">-->
<!--#{startLine,jdbcType=TINYINT},-->
<!--</if>-->
<!--<if test="endLine != null">-->
<!--#{endLine,jdbcType=TINYINT},-->
<!--</if>-->
<!--<if test="partitionKey != null">-->
<!--#{partitionKey,jdbcType=SMALLINT},-->
<!--</if>-->
<!--<if test="createdBy != null">-->
<!--#{createdBy,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="createdDate != null">-->
<!--#{createdDate,jdbcType=TIMESTAMP},-->
<!--</if>-->
<!--<if test="modifiedBy != null">-->
<!--#{modifiedBy,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="modifiedDate != null">-->
<!--#{modifiedDate,jdbcType=TIMESTAMP},-->
<!--</if>-->
<!--<if test="modifiedNo != null">-->
<!--#{modifiedNo,jdbcType=INTEGER},-->
<!--</if>-->
<!--<if test="extendedField1 != null">-->
<!--#{extendedField1,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="extendedField2 != null">-->
<!--#{extendedField2,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="extendedField3 != null">-->
<!--#{extendedField3,jdbcType=VARCHAR},-->
<!--</if>-->
<!--</trim>-->
<!--</insert>-->
<!--<update id="updateByPrimaryKeySelective" parameterType="cn.quant.andyy.jpa.entity.InstitutionProfileEntity">-->
<!--update institution_profile-->
<!--<set>-->
<!--<if test="accountNo != null">-->
<!--ACCOUNT_NO = #{accountNo,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="importFile != null">-->
<!--IMPORT_FILE = #{importFile,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="importUrl != null">-->
<!--IMPORT_URL = #{importUrl,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="importDataColNum != null">-->
<!--IMPORT_DATA_COL_NUM = #{importDataColNum,jdbcType=TINYINT},-->
<!--</if>-->
<!--<if test="importDataSchema != null">-->
<!--IMPORT_DATA_SCHEMA = #{importDataSchema,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="startLine != null">-->
<!--START_LINE = #{startLine,jdbcType=TINYINT},-->
<!--</if>-->
<!--<if test="endLine != null">-->
<!--END_LINE = #{endLine,jdbcType=TINYINT},-->
<!--</if>-->
<!--<if test="partitionKey != null">-->
<!--PARTITION_KEY = #{partitionKey,jdbcType=SMALLINT},-->
<!--</if>-->
<!--<if test="createdBy != null">-->
<!--CREATED_BY = #{createdBy,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="createdDate != null">-->
<!--CREATED_DATE = #{createdDate,jdbcType=TIMESTAMP},-->
<!--</if>-->
<!--<if test="modifiedBy != null">-->
<!--MODIFIED_BY = #{modifiedBy,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="modifiedDate != null">-->
<!--MODIFIED_DATE = #{modifiedDate,jdbcType=TIMESTAMP},-->
<!--</if>-->
<!--<if test="modifiedNo != null">-->
<!--MODIFIED_NO = #{modifiedNo,jdbcType=INTEGER},-->
<!--</if>-->
<!--<if test="extendedField1 != null">-->
<!--EXTENDED_FIELD1 = #{extendedField1,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="extendedField2 != null">-->
<!--EXTENDED_FIELD2 = #{extendedField2,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="extendedField3 != null">-->
<!--EXTENDED_FIELD3 = #{extendedField3,jdbcType=VARCHAR},-->
<!--</if>-->
<!--</set>-->
<!--where BASE_CODE = #{baseCode,jdbcType=CHAR}-->
<!--</update>-->
<!--<update id="updateByPrimaryKey" parameterType="cn.quant.andyy.jpa.entity.InstitutionProfileEntity">-->
<!--update institution_profile-->
<!--set ACCOUNT_NO = #{accountNo,jdbcType=VARCHAR},-->
<!--IMPORT_FILE = #{importFile,jdbcType=VARCHAR},-->
<!--IMPORT_URL = #{importUrl,jdbcType=VARCHAR},-->
<!--IMPORT_DATA_COL_NUM = #{importDataColNum,jdbcType=TINYINT},-->
<!--IMPORT_DATA_SCHEMA = #{importDataSchema,jdbcType=VARCHAR},-->
<!--START_LINE = #{startLine,jdbcType=TINYINT},-->
<!--END_LINE = #{endLine,jdbcType=TINYINT},-->
<!--PARTITION_KEY = #{partitionKey,jdbcType=SMALLINT},-->
<!--CREATED_BY = #{createdBy,jdbcType=VARCHAR},-->
<!--CREATED_DATE = #{createdDate,jdbcType=TIMESTAMP},-->
<!--MODIFIED_BY = #{modifiedBy,jdbcType=VARCHAR},-->
<!--MODIFIED_DATE = #{modifiedDate,jdbcType=TIMESTAMP},-->
<!--MODIFIED_NO = #{modifiedNo,jdbcType=INTEGER},-->
<!--EXTENDED_FIELD1 = #{extendedField1,jdbcType=VARCHAR},-->
<!--EXTENDED_FIELD2 = #{extendedField2,jdbcType=VARCHAR},-->
<!--EXTENDED_FIELD3 = #{extendedField3,jdbcType=VARCHAR}-->
<!--where BASE_CODE = #{baseCode,jdbcType=CHAR}-->
<!--</update>-->
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.quant.andy.jpa.mybatis.mapper.InstitutionTransactionSummaryMapper">
<resultMap id="InstTxnSumMap" type="cn.quant.andy.jpa.entity.InstitutionTransactionSummaryEntity">
<id column="TRANSACTION_ID" jdbcType="BIGINT" property="transactionId"/>
<result column="BASE_CODE" jdbcType="CHAR" property="baseCode"/>
<result column="TERM_NO" jdbcType="INTEGER" property="termNo"/>
<result column="LEVEL_NO" jdbcType="TINYINT" property="levelNo"/>
<result column="TXN_CODE" jdbcType="CHAR" property="txnCode"/>
<result column="TXN_TYPE" jdbcType="CHAR" property="txnType"/>
<result column="TXN_NO" jdbcType="CHAR" property="txnNo"/>
<result column="SERIAL_NO" jdbcType="CHAR" property="serialNo"/>
<result column="TXN_FLAG" jdbcType="CHAR" property="txnFlag"/>
<result column="BASE_ORDER_NO" jdbcType="CHAR" property="baseOrderNo"/>
<result column="STATUS_CODE" jdbcType="CHAR" property="statusCode"/>
<result column="PRODUCT_ORDER_NO" jdbcType="VARCHAR" property="productOrderNo"/>
<result column="COMMODITY_NAME" jdbcType="VARCHAR" property="commodityName"/>
<result column="BANK_CODE" jdbcType="CHAR" property="bankCode"/>
<result column="BANK_ACCT_NO" jdbcType="CHAR" property="bankAcctNo"/>
<result column="TXN_TIME" jdbcType="DATE" property="txnTime"/>
<result column="POST_AMT" jdbcType="DECIMAL" property="postAmt"/>
<result column="POST_DATE" jdbcType="INTEGER" property="postDate"/>
<result column="POST_TIME" jdbcType="INTEGER" property="postTime"/>
<result column="IMPORT_TIME" jdbcType="TIMESTAMP" property="importTime"/>
<result column="POSTED_FLAG" jdbcType="CHAR" property="postedFlag"/>
<result column="DESC_TEXT" jdbcType="VARCHAR" property="descText"/>
<result column="CREATED_BY" jdbcType="VARCHAR" property="createdBy"/>
<result column="CREATED_DATE" jdbcType="TIMESTAMP" property="createdDate"/>
<result column="MODIFIED_BY" jdbcType="VARCHAR" property="modifiedBy"/>
<result column="MODIFIED_DATE" jdbcType="TIMESTAMP" property="modifiedDate"/>
<result column="MODIFIED_NO" jdbcType="INTEGER" property="modifiedNo"/>
</resultMap>
<sql id="InstTxnSumColumnList">
TRANSACTION_ID, BASE_CODE, TERM_NO, TXN_CODE, TXN_TYPE, TXN_NO, LEVEL_NO, SERIAL_NO, TXN_FLAG,
BASE_ORDER_NO, STATUS_CODE, PRODUCT_ORDER_NO, COMMODITY_NAME, BANK_CODE, BANK_ACCT_NO, TXN_TIME,
POST_AMT, POST_DATE, POST_TIME, IMPORT_TIME
, POSTED_FLAG, DESC_TEXT, CREATED_BY,
CREATED_DATE, MODIFIED_BY, MODIFIED_DATE, MODIFIED_NO
</sql>
<select id="countTypes" resultType="INTEGER">
select count(*) from institution_transaction_summary WHERE
TXN_TYPE=#{txnType}
AND TERM_NO=#{termNo}
AND POSTED_FLAG = #{postedFlag,jdbcType=CHAR}
</select>
<select id="findOneById" parameterType="java.lang.Long" resultMap="InstTxnSumMap">
select
<include refid="InstTxnSumColumnList"/>
from institution_transaction_summary
where TRANSACTION_ID = #{id, jdbcType=BIGINT}
</select>
<select id="findDebitsByTermBase" resultMap="InstTxnSumMap">
select
<include refid="InstTxnSumColumnList"/>
from institution_transaction_summary
where
BASE_CODE = #{baseCode,jdbcType=CHAR}
AND TERM_NO = #{termNo,jdbcType=INTEGER}
AND BASE_ORDER_NO=#{baseOrderNo,jdbcType=CHAR}
AND TXN_FLAG ='D'
</select>
<select id="findAllByTerm" resultMap="InstTxnSumMap">
select
<include refid="InstTxnSumColumnList"/>
from institution_transaction_summary
where
TERM_NO = #{termNo,jdbcType=INTEGER}
AND POSTED_FLAG = #{postedFlag,jdbcType=CHAR}
AND TXN_FLAG =#{txnFlag,jdbcType=CHAR} ORDER BY TXN_TIME ASC
</select>
<insert id="importData">
insert into institution_transaction_summary (
TRANSACTION_ID
, BASE_CODE
, TERM_NO
, ${fields}
, POST_DATE
, POST_TIME
, IMPORT_TIME
, POSTED_FLAG
, DESC_TEXT
, CREATED_BY
, MODIFIED_BY
<if test="params.createdDate != null">
, CREATED_DATE
</if>
<if test="params.modifiedDate != null">
, MODIFIED_DATE
</if>
)
values(
#{params.transactionId}
, #{params.baseCode}
, #{params.termNo}
,
<foreach collection="values" item="item">
#{item},
</foreach>
#{params.postDate, jdbcType=INTEGER}
, #{params.postTime, jdbcType=INTEGER}
, #{params.importTime}
, 'N'
, #{params.descText}
, #{params.createdBy}
, #{params.modifiedBy}
<if test="params.createdDate != null">
, #{params.createdDate}
</if>
<if test="params.modifiedDate != null">
, #{params.modifiedDate}
</if>
)
</insert>
<update id="save" parameterType="cn.quant.andy.jpa.entity.InstitutionTransactionSummaryEntity">
UPDATE institution_transaction_summary SET
POSTED_FLAG = #{postedFlag,jdbcType=CHAR}
, MODIFIED_BY = #{modifiedBy}
WHERE
TRANSACTION_ID=#{transactionId}
</update>
<!--<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="InstTxnSumMap">-->
<!--select -->
<!--<include refid="Base_Column_List" />-->
<!--from institution_transaction_summary-->
<!--where BASE_CODE = #{transactionId,jdbcType=BIGINT}-->
<!--</select>-->
<!--<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">-->
<!--delete from institution_transaction_summary-->
<!--where BASE_CODE = #{transactionId,jdbcType=BIGINT}-->
<!--</delete>-->
<!--<insert id="insert" parameterType="cn.quant.andyy.jpa.entity.InstitutionTransactionSummaryEntity">-->
<!--insert into institution_transaction_summary (BASE_CODE, INSTITUTION_CODE, TERM_NO, -->
<!--TXN_CODE, TXN_NO, SERIAL_NO, TXN_FLAG, -->
<!--BASE_ORDER_NO, PRODUCT_ORDER_NO, COMMODITY_NAME, -->
<!--BANK_CODE, BANK_ACCT_NO, TXN_TIME, -->
<!--POST_AMT, POST_DATE, POST_TIME, -->
<!--IMPORT_TIME, PARTITION_KEY, DESC_TEXT, -->
<!--CREATED_BY, CREATED_DATE, MODIFIED_BY, -->
<!--MODIFIED_DATE, MODIFIED_NO, EXTENDED_FIELD1, -->
<!--EXTENDED_FIELD2, EXTENDED_FIELD3)-->
<!--values (#{transactionId,jdbcType=BIGINT}, #{baseCode,jdbcType=CHAR}, #{termNo,jdbcType=SMALLINT}, -->
<!--#{txnCode,jdbcType=CHAR}, #{txnNo,jdbcType=CHAR}, #{serialNo,jdbcType=CHAR}, #{txnFlag,jdbcType=CHAR}, -->
<!--#{baseOrderNo,jdbcType=CHAR}, #{productOrderNo,jdbcType=VARCHAR}, #{commodityName,jdbcType=VARCHAR}, -->
<!--#{bankCode,jdbcType=CHAR}, #{bankAcctNo,jdbcType=CHAR}, #{txnTime,jdbcType=TIMESTAMP}, -->
<!--#{postAmt,jdbcType=DECIMAL}, #{postDate,jdbcType=INTEGER}, #{postTime,jdbcType=INTEGER}, -->
<!--#{importTime,jdbcType=TIMESTAMP}, #{partitionKey,jdbcType=SMALLINT}, #{descText,jdbcType=VARCHAR}, -->
<!--#{createdBy,jdbcType=VARCHAR}, #{createdDate,jdbcType=TIMESTAMP}, #{modifiedBy,jdbcType=VARCHAR}, -->
<!--#{modifiedDate,jdbcType=TIMESTAMP}, #{modifiedNo,jdbcType=INTEGER}, #{extendedField1,jdbcType=VARCHAR}, -->
<!--#{extendedField2,jdbcType=VARCHAR}, #{extendedField3,jdbcType=VARCHAR})-->
<!--</insert>-->
<!--<insert id="insertSelective" parameterType="cn.quant.andyy.jpa.entity.InstitutionTransactionSummaryEntity">-->
<!--insert into institution_transaction_summary-->
<!--<trim prefix="(" suffix=")" suffixOverrides=",">-->
<!--<if test="transactionId != null">-->
<!--BASE_CODE,-->
<!--</if>-->
<!--<if test="baseCode != null">-->
<!--INSTITUTION_CODE,-->
<!--</if>-->
<!--<if test="termNo != null">-->
<!--TERM_NO,-->
<!--</if>-->
<!--<if test="txnCode != null">-->
<!--TXN_CODE,-->
<!--</if>-->
<!--<if test="txnNo != null">-->
<!--TXN_NO,-->
<!--</if>-->
<!--<if test="serialNo != null">-->
<!--SERIAL_NO,-->
<!--</if>-->
<!--<if test="txnFlag != null">-->
<!--TXN_FLAG,-->
<!--</if>-->
<!--<if test="baseOrderNo != null">-->
<!--BASE_ORDER_NO,-->
<!--</if>-->
<!--<if test="productOrderNo != null">-->
<!--PRODUCT_ORDER_NO,-->
<!--</if>-->
<!--<if test="commodityName != null">-->
<!--COMMODITY_NAME,-->
<!--</if>-->
<!--<if test="bankCode != null">-->
<!--BANK_CODE,-->
<!--</if>-->
<!--<if test="bankAcctNo != null">-->
<!--BANK_ACCT_NO,-->
<!--</if>-->
<!--<if test="txnTime != null">-->
<!--TXN_TIME,-->
<!--</if>-->
<!--<if test="postAmt != null">-->
<!--POST_AMT,-->
<!--</if>-->
<!--<if test="postDate != null">-->
<!--POST_DATE,-->
<!--</if>-->
<!--<if test="postTime != null">-->
<!--POST_TIME,-->
<!--</if>-->
<!--<if test="importTime != null">-->
<!--IMPORT_TIME,-->
<!--</if>-->
<!--<if test="partitionKey != null">-->
<!--PARTITION_KEY,-->
<!--</if>-->
<!--<if test="descText != null">-->
<!--DESC_TEXT,-->
<!--</if>-->
<!--<if test="createdBy != null">-->
<!--CREATED_BY,-->
<!--</if>-->
<!--<if test="createdDate != null">-->
<!--CREATED_DATE,-->
<!--</if>-->
<!--<if test="modifiedBy != null">-->
<!--MODIFIED_BY,-->
<!--</if>-->
<!--<if test="modifiedDate != null">-->
<!--MODIFIED_DATE,-->
<!--</if>-->
<!--<if test="modifiedNo != null">-->
<!--MODIFIED_NO,-->
<!--</if>-->
<!--<if test="extendedField1 != null">-->
<!--EXTENDED_FIELD1,-->
<!--</if>-->
<!--<if test="extendedField2 != null">-->
<!--EXTENDED_FIELD2,-->
<!--</if>-->
<!--<if test="extendedField3 != null">-->
<!--EXTENDED_FIELD3,-->
<!--</if>-->
<!--</trim>-->
<!--<trim prefix="values (" suffix=")" suffixOverrides=",">-->
<!--<if test="transactionId != null">-->
<!--#{transactionId,jdbcType=BIGINT},-->
<!--</if>-->
<!--<if test="baseCode != null">-->
<!--#{baseCode,jdbcType=CHAR},-->
<!--</if>-->
<!--<if test="termNo != null">-->
<!--#{termNo,jdbcType=SMALLINT},-->
<!--</if>-->
<!--<if test="txnCode != null">-->
<!--#{txnCode,jdbcType=CHAR},-->
<!--</if>-->
<!--<if test="txnNo != null">-->
<!--#{txnNo,jdbcType=CHAR},-->
<!--</if>-->
<!--<if test="serialNo != null">-->
<!--#{serialNo,jdbcType=CHAR},-->
<!--</if>-->
<!--<if test="txnFlag != null">-->
<!--#{txnFlag,jdbcType=CHAR},-->
<!--</if>-->
<!--<if test="baseOrderNo != null">-->
<!--#{baseOrderNo,jdbcType=CHAR},-->
<!--</if>-->
<!--<if test="productOrderNo != null">-->
<!--#{productOrderNo,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="commodityName != null">-->
<!--#{commodityName,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="bankCode != null">-->
<!--#{bankCode,jdbcType=CHAR},-->
<!--</if>-->
<!--<if test="bankAcctNo != null">-->
<!--#{bankAcctNo,jdbcType=CHAR},-->
<!--</if>-->
<!--<if test="txnTime != null">-->
<!--#{txnTime,jdbcType=TIMESTAMP},-->
<!--</if>-->
<!--<if test="postAmt != null">-->
<!--#{postAmt,jdbcType=DECIMAL},-->
<!--</if>-->
<!--<if test="postDate != null">-->
<!--#{postDate,jdbcType=INTEGER},-->
<!--</if>-->
<!--<if test="postTime != null">-->
<!--#{postTime,jdbcType=INTEGER},-->
<!--</if>-->
<!--<if test="importTime != null">-->
<!--#{importTime,jdbcType=TIMESTAMP},-->
<!--</if>-->
<!--<if test="partitionKey != null">-->
<!--#{partitionKey,jdbcType=SMALLINT},-->
<!--</if>-->
<!--<if test="descText != null">-->
<!--#{descText,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="createdBy != null">-->
<!--#{createdBy,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="createdDate != null">-->
<!--#{createdDate,jdbcType=TIMESTAMP},-->
<!--</if>-->
<!--<if test="modifiedBy != null">-->
<!--#{modifiedBy,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="modifiedDate != null">-->
<!--#{modifiedDate,jdbcType=TIMESTAMP},-->
<!--</if>-->
<!--<if test="modifiedNo != null">-->
<!--#{modifiedNo,jdbcType=INTEGER},-->
<!--</if>-->
<!--<if test="extendedField1 != null">-->
<!--#{extendedField1,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="extendedField2 != null">-->
<!--#{extendedField2,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="extendedField3 != null">-->
<!--#{extendedField3,jdbcType=VARCHAR},-->
<!--</if>-->
<!--</trim>-->
<!--</insert>-->
<!--<update id="updateByPrimaryKeySelective" parameterType="cn.quant.andyy.jpa.entity.InstitutionTransactionSummaryEntity">-->
<!--update institution_transaction_summary-->
<!--<set>-->
<!--<if test="baseCode != null">-->
<!--INSTITUTION_CODE = #{baseCode,jdbcType=CHAR},-->
<!--</if>-->
<!--<if test="termNo != null">-->
<!--TERM_NO = #{termNo,jdbcType=SMALLINT},-->
<!--</if>-->
<!--<if test="txnCode != null">-->
<!--TXN_CODE = #{txnCode,jdbcType=CHAR},-->
<!--</if>-->
<!--<if test="txnNo != null">-->
<!--TXN_NO = #{txnNo,jdbcType=CHAR},-->
<!--</if>-->
<!--<if test="serialNo != null">-->
<!--SERIAL_NO = #{serialNo,jdbcType=CHAR},-->
<!--</if>-->
<!--<if test="txnFlag != null">-->
<!--TXN_FLAG = #{txnFlag,jdbcType=CHAR},-->
<!--</if>-->
<!--<if test="baseOrderNo != null">-->
<!--BASE_ORDER_NO = #{baseOrderNo,jdbcType=CHAR},-->
<!--</if>-->
<!--<if test="productOrderNo != null">-->
<!--PRODUCT_ORDER_NO = #{productOrderNo,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="commodityName != null">-->
<!--COMMODITY_NAME = #{commodityName,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="bankCode != null">-->
<!--BANK_CODE = #{bankCode,jdbcType=CHAR},-->
<!--</if>-->
<!--<if test="bankAcctNo != null">-->
<!--BANK_ACCT_NO = #{bankAcctNo,jdbcType=CHAR},-->
<!--</if>-->
<!--<if test="txnTime != null">-->
<!--TXN_TIME = #{txnTime,jdbcType=TIMESTAMP},-->
<!--</if>-->
<!--<if test="postAmt != null">-->
<!--POST_AMT = #{postAmt,jdbcType=DECIMAL},-->
<!--</if>-->
<!--<if test="postDate != null">-->
<!--POST_DATE = #{postDate,jdbcType=INTEGER},-->
<!--</if>-->
<!--<if test="postTime != null">-->
<!--POST_TIME = #{postTime,jdbcType=INTEGER},-->
<!--</if>-->
<!--<if test="importTime != null">-->
<!--IMPORT_TIME = #{importTime,jdbcType=TIMESTAMP},-->
<!--</if>-->
<!--<if test="partitionKey != null">-->
<!--PARTITION_KEY = #{partitionKey,jdbcType=SMALLINT},-->
<!--</if>-->
<!--<if test="descText != null">-->
<!--DESC_TEXT = #{descText,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="createdBy != null">-->
<!--CREATED_BY = #{createdBy,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="createdDate != null">-->
<!--CREATED_DATE = #{createdDate,jdbcType=TIMESTAMP},-->
<!--</if>-->
<!--<if test="modifiedBy != null">-->
<!--MODIFIED_BY = #{modifiedBy,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="modifiedDate != null">-->
<!--MODIFIED_DATE = #{modifiedDate,jdbcType=TIMESTAMP},-->
<!--</if>-->
<!--<if test="modifiedNo != null">-->
<!--MODIFIED_NO = #{modifiedNo,jdbcType=INTEGER},-->
<!--</if>-->
<!--<if test="extendedField1 != null">-->
<!--EXTENDED_FIELD1 = #{extendedField1,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="extendedField2 != null">-->
<!--EXTENDED_FIELD2 = #{extendedField2,jdbcType=VARCHAR},-->
<!--</if>-->
<!--<if test="extendedField3 != null">-->
<!--EXTENDED_FIELD3 = #{extendedField3,jdbcType=VARCHAR},-->
<!--</if>-->
<!--</set>-->
<!--where BASE_CODE = #{transactionId,jdbcType=BIGINT}-->
<!--</update>-->
<!--<update id="updateByPrimaryKey" parameterType="cn.quant.andyy.jpa.entity.InstitutionTransactionSummaryEntity">-->
<!--update institution_transaction_summary-->
<!--set INSTITUTION_CODE = #{baseCode,jdbcType=CHAR},-->
<!--TERM_NO = #{termNo,jdbcType=SMALLINT},-->
<!--TXN_CODE = #{txnCode,jdbcType=CHAR},-->
<!--TXN_NO = #{txnNo,jdbcType=CHAR},-->
<!--SERIAL_NO = #{serialNo,jdbcType=CHAR},-->
<!--TXN_FLAG = #{txnFlag,jdbcType=CHAR},-->
<!--BASE_ORDER_NO = #{baseOrderNo,jdbcType=CHAR},-->
<!--PRODUCT_ORDER_NO = #{productOrderNo,jdbcType=VARCHAR},-->
<!--COMMODITY_NAME = #{commodityName,jdbcType=VARCHAR},-->
<!--BANK_CODE = #{bankCode,jdbcType=CHAR},-->
<!--BANK_ACCT_NO = #{bankAcctNo,jdbcType=CHAR},-->
<!--TXN_TIME = #{txnTime,jdbcType=TIMESTAMP},-->
<!--POST_AMT = #{postAmt,jdbcType=DECIMAL},-->
<!--POST_DATE = #{postDate,jdbcType=INTEGER},-->
<!--POST_TIME = #{postTime,jdbcType=INTEGER},-->
<!--IMPORT_TIME = #{importTime,jdbcType=TIMESTAMP},-->
<!--PARTITION_KEY = #{partitionKey,jdbcType=SMALLINT},-->
<!--DESC_TEXT = #{descText,jdbcType=VARCHAR},-->
<!--CREATED_BY = #{createdBy,jdbcType=VARCHAR},-->
<!--CREATED_DATE = #{createdDate,jdbcType=TIMESTAMP},-->
<!--MODIFIED_BY = #{modifiedBy,jdbcType=VARCHAR},-->
<!--MODIFIED_DATE = #{modifiedDate,jdbcType=TIMESTAMP},-->
<!--MODIFIED_NO = #{modifiedNo,jdbcType=INTEGER},-->
<!--EXTENDED_FIELD1 = #{extendedField1,jdbcType=VARCHAR},-->
<!--EXTENDED_FIELD2 = #{extendedField2,jdbcType=VARCHAR},-->
<!--EXTENDED_FIELD3 = #{extendedField3,jdbcType=VARCHAR}-->
<!--where BASE_CODE = #{transactionId,jdbcType=BIGINT}-->
<!--</update>-->
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.quant.andy.jpa.mybatis.mapper.TransactionSummaryMapper">
<resultMap id="TxnSumMap" type="cn.quant.andy.jpa.entity.TransactionSummaryEntity">
<id column="TRANSACTION_ID" jdbcType="BIGINT" property="transactionId" />
<result column="BASE_ORDER_NO" jdbcType="CHAR" property="baseOrderNo" />
<result column="TERM_NO" jdbcType="INTEGER" property="termNo" />
<result column="BASE_CODE" jdbcType="CHAR" property="baseCode" />
<result column="ORDER_NO" jdbcType="CHAR" property="orderNo" />
<result column="GEN_ORDER_NO" jdbcType="CHAR" property="genOrderNo" />
<result column="LEVEL_NO" jdbcType="TINYINT" property="levelNo" />
<result column="VOLUME" jdbcType="TINYINT" property="volume" />
<result column="SERIAL_NO" jdbcType="CHAR" property="serialNo" />
<result column="TXN_CODE" jdbcType="CHAR" property="txnCode" />
<result column="TXN_TYPE" jdbcType="CHAR" property="txnType" />
<result column="TXN_FLAG" jdbcType="CHAR" property="txnFlag" />
<result column="ORIGINAL_AMT" jdbcType="DECIMAL" property="originalAmt" />
<result column="POST_AMT" jdbcType="DECIMAL" property="postAmt" />
<result column="POST_DATE" jdbcType="INTEGER" property="postDate" />
<result column="POST_TIME" jdbcType="INTEGER" property="postTime" />
<result column="TXN_TIME" jdbcType="TIMESTAMP" property="txnTime" />
<result column="REFERENCE_NO" jdbcType="CHAR" property="REFERENCE_NO" />
<result column="DESC_TEXT" jdbcType="VARCHAR" property="descText" />
<result column="IMPORT_TIME" jdbcType="TIMESTAMP" property="importTime" />
<result column="CREATED_BY" jdbcType="VARCHAR" property="createdBy" />
<result column="CREATED_DATE" jdbcType="TIMESTAMP" property="createdDate" />
<result column="MODIFIED_BY" jdbcType="VARCHAR" property="modifiedBy" />
<result column="MODIFIED_DATE" jdbcType="TIMESTAMP" property="modifiedDate" />
<result column="MODIFIED_NO" jdbcType="INTEGER" property="modifiedNo" />
</resultMap>
<sql id="TxnSumColumnList">
TRANSACTION_ID, BASE_ORDER_NO, TERM_NO, BASE_CODE, ORDER_NO, GEN_ORDER_NO, LEVEL_NO,
VOLUME, SERIAL_NO, TXN_CODE, TXN_TYPE, TXN_FLAG, ORIGINAL_AMT, POST_AMT, POST_DATE,
POST_TIME, TXN_TIME
, REFERENCE_NO,
DESC_TEXT, IMPORT_TIME, POSTED_FLAG, CREATED_BY, CREATED_DATE, MODIFIED_BY,
MODIFIED_DATE, MODIFIED_NO
</sql>
<insert id="importData">
insert into transaction_summary (
TRANSACTION_ID
, BASE_CODE
, TERM_NO
, ${fields}
, POST_DATE
, POST_TIME
, IMPORT_TIME
, POSTED_FLAG
, DESC_TEXT
, CREATED_BY
, MODIFIED_BY
<if test="params.createdDate != null">
, CREATED_DATE
</if>
<if test="params.modifiedDate != null">
, MODIFIED_DATE
</if>
)
values(
#{params.transactionId}
, #{params.baseCode}
, #{params.termNo}
,
<foreach collection="values" item="item">
#{item},
</foreach>
#{params.postDate, jdbcType=INTEGER}
, #{params.postTime, jdbcType=INTEGER}
, #{params.importTime}
, #{params.postedFlag}
, #{params.descText}
, #{params.createdBy}
, #{params.modifiedBy}
<if test="params.createdDate != null">
, #{params.createdDate}
</if>
<if test="params.modifiedDate != null">
, #{params.modifiedDate}
</if>
)
</insert>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<!--这里的loacation是你连接数据库的jar包,可以从项目依赖里面找-->
<classPathEntry location="d:\repository\mysql\mysql-connector-java\5.1.46\mysql-connector-java-5.1.46.jar"/>
<context id="context">
<!-- 是否生成注释 -->
<commentGenerator>
<property name="suppressDate" value="true"/>
<property name="suppressAllComments" value="true"/>
</commentGenerator>
<!-- 数据库连接,数据库版本高的话需要添加时区serverTimezone=GMT%2B8 -->
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://127.0.0.1:3306/reconciliation-1.0.0"
userId="root" password="111111" />
<!-- 生成的包名和工程名 -->
<javaModelGenerator targetPackage="cn.quant.andy.jpa.entity"
targetProject="src/main/java/"/>
<!-- xml映射文件 -->
<sqlMapGenerator targetPackage="mapping"
targetProject="src/main/resources/" />
<!-- mapper接口 -->
<javaClientGenerator targetPackage="cn.quant.andy.jpa.mybatis.mapper"
targetProject="src/main/java/" type="XMLMAPPER" />
<!-- 数据库表 以及是否生成example,可以同时生成多个-->
<table tableName="transaction_summary" domainObjectName="TransactionSummaryEntity"
enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" selectByExampleQueryId="false" />
<!--<table tableName="institution_profile" domainObjectName="InstitutionProfileEntity"-->
<!--enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"-->
<!--enableSelectByExample="false" selectByExampleQueryId="false" />-->
<!--<table tableName="application_profile" domainObjectName="ApplicationProfileEntity"-->
<!--enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"-->
<!--enableSelectByExample="false" selectByExampleQueryId="false" />-->
<!--<table tableName="institution_transaction_summary" domainObjectName="InstitutionTransactionSummaryEntity"-->
<!--enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"-->
<!--enableSelectByExample="false" selectByExampleQueryId="false" />-->
<!--<table tableName="transaction_balance" domainObjectName="TransactionBalanceEntity"-->
<!--enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"-->
<!--enableSelectByExample="false" selectByExampleQueryId="false" />-->
<!--<table tableName="balance_billing" domainObjectName="BalanceBillingEntity"-->
<!--enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"-->
<!--enableSelectByExample="false" selectByExampleQueryId="false" />-->
</context>
</generatorConfiguration>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment