spring.datasource.username=admin
spring.datasource.password=123456
database.dbtype=postgresql
+
+logging.level.org.hibernate.SQL=ERROR
# Redis settings
spring.redis.host=localhost
spring.redis.port=16379
##################################################
## quartz task scheduler
shopbalance.updater.cron=-
-download.ynrcc.chkfile.cron =3 0/2 * * * ?
+#download.ynrcc.chkfile.cron =3 0/2 * * * ?
+query.third.transdtl.result.cron=7 0/1 * * * ?
#############################################
spring.cloud.consul.enabled=false
spring.cloud.consul.host=172.28.201.70
private String payinfo;
private String reverseFlag;
private String transdesc;
+ private String remark;
}
package com.supwisdom.dlpay.agent.citizencard;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement(name = "root")
public class DlpayResp {
private String code;
private String message;
private String trxdate; //银行记账日期
private Integer amount; //查询时返回流水金额
- @XmlElement(name = "CODE")
public String getCode() {
return code;
}
this.code = code;
}
- @XmlElement(name = "MESSAGE")
public String getMessage() {
return message;
}
this.message = message;
}
- @XmlElement(name = "TRANSDATE")
public String getTransdate() {
return transdate;
}
this.transdate = transdate;
}
- @XmlElement(name = "TRANSTIME")
public String getTranstime() {
return transtime;
}
this.transtime = transtime;
}
- @XmlElement(name = "BANKJOURNO")
public String getBankjourno() {
return bankjourno;
}
this.bankjourno = bankjourno;
}
- @XmlElement(name = "SINSTATUS")
public String getSinstatus() {
return sinstatus;
}
this.sinstatus = sinstatus;
}
- @XmlElement(name = "CAPTCHA")
public String getCaptcha() {
return captcha;
}
this.captcha = captcha;
}
- @XmlElement(name = "STATUS")
public String getStatus() {
return status;
}
this.status = status;
}
- @XmlElement(name = "FILENAME")
public String getFilename() {
return filename;
}
this.filename = filename;
}
- @XmlElement(name = "TRXDATE")
public String getTrxdate() {
return trxdate;
}
this.trxdate = trxdate;
}
- @XmlElement(name = "AMOUNT")
public Integer getAmount() {
return amount;
}
errcode.add(Pair.of(AgentCode.SHORT_OF_BALANCE, new YnrccRespCode("0302", "余额不足")));
errcode.add(Pair.of(AgentCode.SERVER_INTERNAL_ERROR, new YnrccRespCode("0303", "MD5校验失败")));
errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0304", "该卡号已经解约,不允许重复解约")));
+
errcode.add(Pair.of(AgentCode.REFNO_NOT_EXISTS, new YnrccRespCode("0401", "原始流水不存在")));
errcode.add(Pair.of(AgentCode.FAIL, new YnrccRespCode("0402", "原始流水未成功")));
errcode.add(Pair.of(AgentCode.FAIL, new YnrccRespCode("0403", "原始流水已退款")));
errcode.add(Pair.of(AgentCode.SUCCESS, new YnrccRespCode("0406", "当日无交易明细")));
errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0407", "非大理市民卡,不允许交易")));
errcode.add(Pair.of(AgentCode.FAIL, new YnrccRespCode("0408", "同一请求流水号不允许重复提交")));
+ errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0409", "商户卡号为空")));
+ errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0410", "商户户名错")));
+ errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0411", "退款金额大于原代扣金额")));
+ errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0412", "退款金额大于剩余可退金额")));
+ errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0413", "不允许该类型的商户账户交易")));
+ errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0414", "退款时请输入原应用系统唯一流水号")));
+ errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0415", "交易金额大于单笔限额")));
+ errcode.add(Pair.of(AgentCode.SERVER_INTERNAL_ERROR, new YnrccRespCode("0416", "通用限额未配置")));
+
errcode.add(Pair.of(AgentCode.COMMON_ERROR, new YnrccRespCode("4444", "其他错误")));
errcode.add(Pair.of(AgentCode.REQUIRE_QUERY, new YnrccRespCode(CODE_EXCEPTION, "待查询")));
errcode.add(Pair.of(AgentCode.SERVER_INTERNAL_ERROR, new YnrccRespCode(PARAM_CONFIG_ERROR, "{message}")));
@Override
@Cacheable(cacheNames = "dictionary_cache", key = "@tenantHolder.genKey('sourcetype', #sourceType)")
public TSourceType getBySourceType(String sourceType) {
- return sourceTypeDao.getOne(sourceType);
+ return sourceTypeDao.getBySourceType(sourceType);
}
@Override
//sql,xss过滤
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
- logger.info("CrosXssFilter.......orignal url:{},ParameterMap:{}",
- httpServletRequest.getRequestURI(),
- new Gson().toJson(httpServletRequest.getParameterMap()));
+// logger.info("CrosXssFilter.......orignal url:{},ParameterMap:{}", httpServletRequest.getRequestURI(), new Gson().toJson(httpServletRequest.getParameterMap()));
XssHttpServletRequestWrapper xssHttpServletRequestWrapper = new XssHttpServletRequestWrapper(
httpServletRequest);
chain.doFilter(xssHttpServletRequestWrapper, response);
- logger.info("CrosXssFilter..........doFilter url:{},ParameterMap:{}",
- xssHttpServletRequestWrapper.getRequestURI(),
- new Gson().toJson(xssHttpServletRequestWrapper.getParameterMap()));
+// logger.info("CrosXssFilter..........doFilter url:{},ParameterMap:{}", xssHttpServletRequestWrapper.getRequestURI(), new Gson().toJson(xssHttpServletRequestWrapper.getParameterMap()));
}
@Override
override fun pay(transaction: TTransactionMain): AgentResponse<DtlStatus> {
val resp = citizencardPayService.cardPay(transaction.shopDtl.shopaccno, transaction.personDtl.userid, transaction.accdate,
- MoneyUtil.YuanToFen(transaction.personDtl.amount), transaction.refno)
+ Math.abs(MoneyUtil.YuanToFen(transaction.personDtl.amount)), transaction.refno)
return AgentResponse<DtlStatus>().also {
val code = agentCode(resp.code, resp.message)
import com.google.gson.Gson
import com.sun.jersey.api.client.Client
import com.sun.jersey.api.client.ClientResponse
+import com.sun.jersey.core.util.MultivaluedMapImpl
import com.supwisdom.dlpay.agent.citizencard.DlpayResp
import com.supwisdom.dlpay.api.service.CardService
import com.supwisdom.dlpay.api.service.SourceTypeService
val systime = systemUtilService.sysdatetime
val refno = systemUtilService.refno
val params = hashMapOf<String, String>()
- params.plus(mapOf(
- "transcode" to YnrccUtil.BANKCARD_BIND_TRANSCODE,
- "transdate" to systime.hostdate,
- "transtime" to systime.hosttime,
- "categorie" to YnrccUtil.DLPAY_CATEGORIE,
- "refno" to refno,
- "bankcardno" to bankcardno,
- "username" to username,
- "idtype" to idType,
- "idno" to idno,
- "phone" to phone,
- "sign_type" to "MD5"
- ))
+ params["transcode"] = YnrccUtil.BANKCARD_BIND_TRANSCODE
+ params["transdate"] = systime.hostdate
+ params["transtime"] = systime.hosttime
+ params["categorie"] = YnrccUtil.DLPAY_CATEGORIE
+ params["refno"] = refno
+ params["bankcardno"] = bankcardno
+ params["username"] = username
+ params["idtype"] = idType.toString()
+ params["idno"] = idno
+ params["phone"] = phone
+ params["sign_type"] = "MD5"
val sign = MD5.encodeByMD5(StringUtil.createLinkString(StringUtil.paraFilter(params)) + config[YnrccUtil.YNRCC_SIGNKEY]!!.trim())
params["sign"] = sign
+
+ val postData = MultivaluedMapImpl()
+ params.forEach { (t, u) -> postData.add(t, u) }
+
val url = config[YnrccUtil.YNRCC_ANGENT_URL]!!.trim() + "/bindcard"
logger.error("url=[$url], params=[" + Gson().toJson(params) + "]")
val client = Client.create()
client.setConnectTimeout(YnrccUtil.AGENT_CONNECT_TIMEOUT * 1000)
- val respClient = client.resource(url).type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).post(ClientResponse::class.java)
+ val respClient = client.resource(url).type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).accept(MediaType.APPLICATION_JSON).post(ClientResponse::class.java, postData)
return if (200 == respClient.status) {
- resp = respClient.getEntity(DlpayResp::class.java)
- logger.error("refno=[$refno], url=[$url], return=[" + Gson().toJson(resp) + "]")
+ val jsonStr = respClient.getEntity(String::class.java)
+ logger.error("refno=[$refno], url=[$url], return=[$jsonStr]")
+ resp = Gson().fromJson(jsonStr, DlpayResp::class.java)
resp
} else {
resp.code = "99"
val systime = systemUtilService.sysdatetime
val refno = systemUtilService.refno
val params = hashMapOf<String, String>()
- params.plus(mapOf(
- "transcode" to YnrccUtil.BANKCARD_SIGN_TRANSCODE,
- "transdate" to systime.hostdate,
- "transtime" to systime.hosttime,
- "refno" to refno,
- "categorie" to YnrccUtil.DLPAY_CATEGORIE,
- "transtype" to transtype,
- "bankcardno" to bankcardno,
- "username" to username,
- "idtype" to idType,
- "idno" to idno,
- "phone" to phone,
- "sign_type" to "MD5"
- ))
+ params["transcode"] = YnrccUtil.BANKCARD_SIGN_TRANSCODE
+ params["transdate"] = systime.hostdate
+ params["transtime"] = systime.hosttime
+ params["refno"] = refno
+ params["categorie"] = YnrccUtil.DLPAY_CATEGORIE
+ params["transtype"] = transtype
+ params["bankcardno"] = bankcardno
+ params["username"] = username
+ params["idtype"] = idType.toString()
+ params["idno"] = idno
+ params["phone"] = phone
+ params["sign_type"] = "MD5"
val sign = MD5.encodeByMD5(StringUtil.createLinkString(StringUtil.paraFilter(params)) + config[YnrccUtil.YNRCC_SIGNKEY]!!.trim())
params["sign"] = sign
+
+ val postData = MultivaluedMapImpl()
+ params.forEach { (t, u) -> postData.add(t, u) }
+
val url = config[YnrccUtil.YNRCC_ANGENT_URL]!!.trim() + "/signcard"
logger.error("url=[$url], params=[" + Gson().toJson(params) + "]")
val client = Client.create()
client.setConnectTimeout(YnrccUtil.AGENT_CONNECT_TIMEOUT * 1000)
- val respClient = client.resource(url).type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).post(ClientResponse::class.java)
+ val respClient = client.resource(url).type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).accept(MediaType.APPLICATION_JSON).post(ClientResponse::class.java, postData)
return if (200 == respClient.status) {
- resp = respClient.getEntity(DlpayResp::class.java)
- logger.error("refno=[$refno], url=[$url], return=[" + Gson().toJson(resp) + "]")
+ val jsonStr = respClient.getEntity(String::class.java)
+ logger.error("refno=[$refno], url=[$url], return=[$jsonStr]")
+ resp = Gson().fromJson(jsonStr, DlpayResp::class.java)
resp
} else {
resp.code = "99"
val systime = systemUtilService.sysdatetime
val params = hashMapOf<String, String>()
- params.plus(mapOf(
- "transcode" to YnrccUtil.BANKCARD_PAY_TRANSCODE,
- "transdate" to accdate, //我们的记账日期
- "transtime" to systime.hosttime,
- "refno" to refno,
- "categorie" to YnrccUtil.DLPAY_CATEGORIE,
- "bankcardno" to bankcardno,
- "username" to person.name,
- "idtype" to idType,
- "idno" to person.idno,
- "merchant_bankcardno" to merchantBankcardno,
- "merchant_bankaccname" to merchantBankaccname,
- "amount" to amount,
- "description" to "市民卡代扣消费",
- "sign_type" to "MD5"
- ))
+ params["transcode"] = YnrccUtil.BANKCARD_PAY_TRANSCODE
+ params["transdate"] = accdate
+ params["transtime"] = systime.hosttime
+ params["refno"] = refno
+ params["categorie"] = YnrccUtil.DLPAY_CATEGORIE
+ params["bankcardno"] = bankcardno
+ params["username"] = person.name
+ params["idtype"] = idType.toString()
+ params["idno"] = person.idno
+ params["merchant_bankcardno"] = merchantBankcardno!!
+ params["merchant_bankaccname"] = merchantBankaccname!!
+ params["amount"] = amount.toString()
+ params["description"] = "市民卡代扣消费"
+ params["sign_type"] = "MD5"
val sign = MD5.encodeByMD5(StringUtil.createLinkString(StringUtil.paraFilter(params)) + config[YnrccUtil.YNRCC_SIGNKEY]!!.trim())
params["sign"] = sign
+
+ val postData = MultivaluedMapImpl()
+ params.forEach { (t, u) -> postData.add(t, u) }
+
val url = config[YnrccUtil.YNRCC_ANGENT_URL]!!.trim() + "/cardpay"
logger.error("url=[$url], params=[" + Gson().toJson(params) + "]")
try {
val client = Client.create()
client.setConnectTimeout(YnrccUtil.AGENT_CONNECT_TIMEOUT * 1000)
- val respClient = client.resource(url).type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).post(ClientResponse::class.java)
+ val respClient = client.resource(url).type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).accept(MediaType.APPLICATION_JSON).post(ClientResponse::class.java, postData)
return if (200 == respClient.status) {
- resp = respClient.getEntity(DlpayResp::class.java)
- logger.error("refno=[$refno], url=[$url], return=[" + Gson().toJson(resp) + "]")
+ val jsonStr = respClient.getEntity(String::class.java)
+ logger.error("refno=[$refno], url=[$url], return=[$jsonStr]")
+ resp = Gson().fromJson(jsonStr, DlpayResp::class.java)
resp
} else {
resp.code = "99"
val systime = systemUtilService.sysdatetime
val params = hashMapOf<String, String>()
- params.plus(mapOf(
- "transcode" to YnrccUtil.BANKCARD_PAYREFUND_TRANSCODE,
- "transdate" to accdate, //我们的记账日期
- "transtime" to systime.hosttime,
- "refno" to refno,
- "refundRefno" to orignRefno,
- "amount" to amount,
- "description" to "市民卡代扣消费退款",
- "sign_type" to "MD5"
- ))
+ params["transcode"] = YnrccUtil.BANKCARD_PAYREFUND_TRANSCODE
+ params["transdate"] = accdate //我们的记账日期
+ params["transtime"] = systime.hosttime
+ params["refno"] = refno
+ params["refundRefno"] = orignRefno
+ params["amount"] = amount.toString()
+ params["description"] = "市民卡代扣消费退款"
+ params["sign_type"] = "MD5"
val sign = MD5.encodeByMD5(StringUtil.createLinkString(StringUtil.paraFilter(params)) + config[YnrccUtil.YNRCC_SIGNKEY]!!.trim())
params["sign"] = sign
+
+ val postData = MultivaluedMapImpl()
+ params.forEach { (t, u) -> postData.add(t, u) }
+
val url = config[YnrccUtil.YNRCC_ANGENT_URL]!!.trim() + "/cardpayrefund"
logger.error("url=[$url], params=[" + Gson().toJson(params) + "]")
try {
val client = Client.create()
client.setConnectTimeout(YnrccUtil.AGENT_CONNECT_TIMEOUT * 1000)
- val respClient = client.resource(url).type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).post(ClientResponse::class.java)
+ val respClient = client.resource(url).type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).accept(MediaType.APPLICATION_JSON).post(ClientResponse::class.java, postData)
return if (200 == respClient.status) {
- resp = respClient.getEntity(DlpayResp::class.java)
- logger.error("refno=[$refno], url=[$url], return=[" + Gson().toJson(resp) + "]")
+ val jsonStr = respClient.getEntity(String::class.java)
+ logger.error("refno=[$refno],refundRefno=[$orignRefno], url=[$url], return=[$jsonStr]")
+ resp = Gson().fromJson(jsonStr, DlpayResp::class.java)
resp
} else {
resp.code = "99"
val systime = systemUtilService.sysdatetime
val refno = systemUtilService.refno
val params = hashMapOf<String, String>()
- params.plus(mapOf(
- "transcode" to YnrccUtil.BANKCARD_QUERYRESULT_TRANSCODE,
- "transdate" to systime.hostdate,
- "transtime" to systime.hosttime,
- "refno" to refno,
- "orignRefno" to orignRefno,
- "sign_type" to "MD5"
- ))
+ params["transcode"] = YnrccUtil.BANKCARD_QUERYRESULT_TRANSCODE
+ params["transdate"] = systime.hostdate
+ params["transtime"] = systime.hosttime
+ params["refno"] = refno
+ params["orignRefno"] = orignRefno
+ params["sign_type"] = "MD5"
val sign = MD5.encodeByMD5(StringUtil.createLinkString(StringUtil.paraFilter(params)) + config[YnrccUtil.YNRCC_SIGNKEY]!!.trim())
params["sign"] = sign
+
+ val postData = MultivaluedMapImpl()
+ params.forEach { (t, u) -> postData.add(t, u) }
+
val url = config[YnrccUtil.YNRCC_ANGENT_URL]!!.trim() + "/queryresult"
logger.error("url=[$url], params=[" + Gson().toJson(params) + "]")
try {
val client = Client.create()
client.setConnectTimeout(YnrccUtil.AGENT_CONNECT_TIMEOUT * 1000)
- val respClient = client.resource(url).type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).post(ClientResponse::class.java)
+ val respClient = client.resource(url).type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).accept(MediaType.APPLICATION_JSON).post(ClientResponse::class.java, postData)
return if (200 == respClient.status) {
- resp = respClient.getEntity(DlpayResp::class.java)
- logger.error("refno=[$orignRefno], url=[$url], return=[" + Gson().toJson(resp) + "]")
+ val jsonStr = respClient.getEntity(String::class.java)
+ logger.error("refno=[$orignRefno], url=[$url], return=[$jsonStr]")
+ resp = Gson().fromJson(jsonStr, DlpayResp::class.java)
resp
} else {
resp.code = "99"
val systime = systemUtilService.sysdatetime
val refno = systemUtilService.refno
val params = hashMapOf<String, String>()
- params.plus(mapOf(
- "transcode" to YnrccUtil.BANKCARD_CHKFILE_TRANSCODE,
- "transdate" to systime.hostdate,
- "transtime" to systime.hosttime,
- "refno" to refno,
- "checkdate" to checkdate,
- "merchant_bankcardno" to merchantBankcardno,
- "sign_type" to "MD5"
- ))
+ params["transcode"] = YnrccUtil.BANKCARD_CHKFILE_TRANSCODE
+ params["transdate"] = systime.hostdate
+ params["transtime"] = systime.hosttime
+ params["refno"] = refno
+ params["checkdate"] = checkdate
+ params["merchant_bankcardno"] = merchantBankcardno ?: ""
+ params["sign_type"] = "MD5"
val sign = MD5.encodeByMD5(StringUtil.createLinkString(StringUtil.paraFilter(params)) + config[YnrccUtil.YNRCC_SIGNKEY]!!.trim())
params["sign"] = sign
- val url = config[YnrccUtil.YNRCC_ANGENT_URL]!!.trim() + "/bindcard"
+
+ val postData = MultivaluedMapImpl()
+ params.forEach { (t, u) -> postData.add(t, u) }
+
+ val url = config[YnrccUtil.YNRCC_ANGENT_URL]!!.trim() + "/checkdtl"
logger.error("url=[$url], params=[" + Gson().toJson(params) + "]")
val client = Client.create()
client.setConnectTimeout(YnrccUtil.AGENT_CONNECT_TIMEOUT * 1000)
- val respClient = client.resource(url).type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).post(ClientResponse::class.java)
+ val respClient = client.resource(url).type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).accept(MediaType.APPLICATION_JSON).post(ClientResponse::class.java, postData)
return if (200 == respClient.status) {
- resp = respClient.getEntity(DlpayResp::class.java)
- logger.error("refno=[$refno], url=[$url], return=[" + Gson().toJson(resp) + "]")
+ val jsonStr = respClient.getEntity(String::class.java)
+ logger.error("refno=[$refno],chkdate=[$checkdate], url=[$url], return=[$jsonStr]")
+ resp = Gson().fromJson(jsonStr, DlpayResp::class.java)
resp
} else {
resp.code = "99"
import com.supwisdom.dlpay.framework.service.SystemUtilService
import com.supwisdom.dlpay.framework.tenant.TenantContext
import com.supwisdom.dlpay.framework.util.ApplicationUtil
+import com.supwisdom.dlpay.framework.util.Constants
import com.supwisdom.dlpay.framework.util.TradeDict
import com.supwisdom.dlpay.util.ConstantUtil
import mu.KotlinLogging
@Async("queryAgentPayResult")
fun queryResult(transaction: TTransactionMain, qcnt: Int) {
try {
+ if (null == TenantContext.getTenantSchema()) TenantContext.setTenantSchema(transaction.tenantid)
+
if (qcnt >= YnrccUtil.QUERY_MAX_COUNT) {
//查询超最大次数
logger.error("查询refno=[${transaction.refno}]流水结果超最大查询次数[${YnrccUtil.QUERY_MAX_COUNT}]")
return ResponseEntity.ok(ResponseBodyBuilder.create()
.success(QueryTransDtlResponse(it.refno, it.outTradeNo, it.shopDtl.amount,
it.status, it.sourceType, it.personDtl.payinfo, it.reverseFlag,
- it.shopDtl.transdesc), "查询成功"))
+ it.shopDtl.transdesc,it.personDtl.remark), "查询成功"))
} ?: return ResponseEntity.ok(ResponseBodyBuilder.create()
.fail(TradeErrorCode.TRANSACTION_NOT_EXISTS, "流水不存在"))
}
import com.supwisdom.dlpay.framework.ResponseBodyBuilder
import com.supwisdom.dlpay.framework.service.SystemUtilService
import com.supwisdom.dlpay.framework.tenant.TenantContext
+import com.supwisdom.dlpay.framework.util.Constants
import com.supwisdom.dlpay.framework.util.DateUtil
import com.supwisdom.dlpay.framework.util.StringUtil
import com.supwisdom.dlpay.framework.util.SysparaUtil
@PostMapping("/datasync")
fun daliDatasync(@RequestBody param: DaliDatasyncParam): ResponseEntity<Any> {
try {
- if (TenantContext.getTenantSchema() == null) TenantContext.setTenantSchema("{tenantid}") //fixme: tenantid设置
+ if (TenantContext.getTenantSchema() == null) TenantContext.setTenantSchema(Constants.DEFAULT_TENANTID) //fixme: tenantid设置
param.checkParam()
val appid = systemUtilService.getSysparaValue(SysparaUtil.DLCARDMANAGER_APPID)
val appkey = systemUtilService.getSysparaValue(SysparaUtil.DLCARDMANAGER_SECRET)
}
try {
- if (TenantContext.getTenantSchema() == null) TenantContext.setTenantSchema("{tenantid}") //fixme: tenantid设置
+ if (TenantContext.getTenantSchema() == null) TenantContext.setTenantSchema(Constants.DEFAULT_TENANTID) //fixme: tenantid设置
val txtFile = File(filename)
val batchSize = 1000
var sumCount = 0
}
try {
- if (TenantContext.getTenantSchema() == null) TenantContext.setTenantSchema("{tenantid}") //fixme: tenantid设置
+ if (TenantContext.getTenantSchema() == null) TenantContext.setTenantSchema(Constants.DEFAULT_TENANTID) //fixme: tenantid设置
var totalcnt = 0
var failcnt = 0
var detailMsg = ""
TradeDict.STATUS_LOST == cityCard.transStatus -> throw TransactionProcessException(TradeErrorCode.ACCOUNT_IS_LOSS, "市民卡[$cardno]已经挂失!")
TradeDict.STATUS_FROZEN == cityCard.transStatus -> throw TransactionProcessException(TradeErrorCode.ACCOUNT_IS_FROZEN, "市民卡[$cardno]已经冻结!")
TradeDict.STATUS_LOCKED == cityCard.transStatus -> throw TransactionProcessException(TradeErrorCode.ACCOUNT_IS_LOCKED, "市民卡[$cardno]已被锁定!")
+ TradeDict.STATUS_UNUSE == cityCard.transStatus -> throw TransactionProcessException(TradeErrorCode.ACCOUNT_IS_LOCKED, "市民卡[$cardno]未启用!")
+ TradeDict.STATUS_ABNORMAL == cityCard.transStatus -> throw TransactionProcessException(TradeErrorCode.ACCOUNT_IS_LOCKED, "市民卡[$cardno]状态异常!")
}
}
import com.supwisdom.dlpay.exception.TransactionProcessException
import com.supwisdom.dlpay.framework.service.SystemUtilService
import com.supwisdom.dlpay.framework.tenant.TenantContext
+import com.supwisdom.dlpay.framework.util.MoneyUtil
import com.supwisdom.dlpay.framework.util.Subject
import com.supwisdom.dlpay.framework.util.TradeDict
import com.supwisdom.dlpay.framework.util.TradeErrorCode
?: throw TransactionProcessException(TradeErrorCode.BUSINESS_DEAL_ERROR,
"系统异常,无法处理退款流水")
originTrans.reverseFlag = transaction.reverseType
+ if(originTrans.person){
+ originTrans.personDtl.reverseFlag = originTrans.reverseFlag
+ originTrans.personDtl.reverseAmount = originTrans.refundAmount
+ }
+ if(originTrans.shop){
+ originTrans.shopDtl.reverseFlag = originTrans.reverseFlag
+ }
transactionMainDao.save(originTrans)
}
val originTrans = transactionMainDao.findByRefnoForUpdate(originRefno)
?: throw TransactionProcessException(TradeErrorCode.TRANSACTION_NOT_EXISTS
, "被退款流水不存在")
+ if (TradeDict.REVERSE_FLAG_NONE != originTrans.reverseType) {
+ throw TransactionProcessException(TradeErrorCode.TRANSDTL_STATUS_ERROR,
+ "原始流水为撤销或退款流水,不能再被退款")
+ }
+
if (originTrans.status != TradeDict.DTL_STATUS_SUCCESS) {
throw TransactionProcessException(TradeErrorCode.TRANSDTL_STATUS_ERROR,
"原流水不是成功状态")
}
doReversePrepareAndCheck(originTrans, builder, refundAmount)
- // 判断退款金额
- builder.preCheck()
+ //fixme: 判断退款金额 check 不支持部分退款
+ if (originTrans.person) {
+ if (!MoneyUtil.moneyEqual(Math.abs(originTrans.personDtl.amount), refundAmount)) {
+ throw TransactionProcessException(TradeErrorCode.BUSINESS_DEAL_ERROR
+ , "暂不支持部分退款")
+ }
+ }
val transaction = doReverseProcess(originTrans, builder)
originTrans.reverseFlag = TradeDict.REVERSE_FLAG_WIP
val originTrans = transactionMainDao.findByRefnoForUpdate(originRefno)
?: throw TransactionProcessException(TradeErrorCode.TRANSACTION_NOT_EXISTS
, "被冲正流水不存在")
+ if (TradeDict.REVERSE_FLAG_NONE != originTrans.reverseType) {
+ throw TransactionProcessException(TradeErrorCode.TRANSDTL_STATUS_ERROR,
+ "原始流水为撤销或退款流水,不能再被撤销")
+ }
+
if (originTrans.status != TradeDict.DTL_STATUS_SUCCESS) {
throw TransactionProcessException(TradeErrorCode.TRANSDTL_STATUS_ERROR,
"原流水不是成功状态")
}
private fun doReverseProcess(originTrans: TTransactionMain, builder: TransactionBuilder): TTransactionMain {
-
+ val summarySuffix = getReverseSuffix(builder.reverseType)
if (originTrans.person) {
builder.person().apply {
setAmount(-originTrans.personDtl.amount, getOppositeTradeFlag(originTrans.personDtl.tradeflag))
setOpposite(originTrans.personDtl.oppositeAccNo, originTrans.personDtl.oppositeAccName)
}
+ builder.description = "${originTrans.personDtl.transdesc}$summarySuffix"
+ builder.payinfo = originTrans.personDtl.payinfo
}
if (originTrans.shop) {
builder.shop().apply {
setAmount(-originTrans.shopDtl.amount, getOppositeTradeFlag(originTrans.shopDtl.tradeflag))
setOpposite(originTrans.shopDtl.oppositeAccNo, originTrans.shopDtl.oppositeAccName)
}
+ builder.description = "${originTrans.shopDtl.transdesc}$summarySuffix"
+ builder.payinfo = originTrans.shopDtl.payInfo
}
- val summarySuffix = getReverseSuffix(builder.reverseType)
+
originTrans.details.forEach {
builder.addDebitCreditRecord(it.draccno, it.drsubjno, it.craccno, it.crsubjno,
-it.amount, "${it.summary}$summarySuffix")
}
+ builder.dtltype = originTrans.dtltype
+ if(builder.operId.isNullOrEmpty()){
+ builder.operator(originTrans.operid, originTrans.opertype)
+ }
return builderRecords(builder, TradeDict.DTL_STATUS_INIT)
}
## quartz task scheduler
shopbalance.updater.cron=10/* * * * * ?
dayend.settletask.cron=0 3/30 2-3 * * ?
-query.third.transdtl.result.cron=7 0/3 * * * ?
+query.third.transdtl.result.cron=7 0/1 * * * ?
download.ynrcc.chkfile.cron =3 0/10 1 * * ?
#dayend.settletask.cron = 0 0/2 * * * ?
################################################
VALUES ('DAYENDSETTLETASK', '日终结算', '0', '20190619100600', '{tenantid}');
INSERT INTO "tb_shop" ("shopid", "shopname", "shoptype", "fshopid", "status", "opendate", "tenantid")
-VALUES (1, '支付中心', 0, 0, 'normal', '20190517', '{tenantid}');
+VALUES (1, '支付中心', 'root', 0, 'normal', '20190517', '{tenantid}');
INSERT INTO "tb_transcode" ("transcode", "transname", "tenantid")
VALUES (3010, '市民卡代扣', '{tenantid}');
VALUES (3500, '账户充值', '{tenantid}');
INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
-VALUES (1, 'cancel', 'reverseFlagList', '冲正', '冲正状态', '{tenantid}');
+VALUES (1, 'cancel', 'reverseFlagList', '被撤销', '冲正状态', '{tenantid}');
INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
-VALUES (2, 'reverse', 'reverseFlagList', '手工撤销', '冲正状态', '{tenantid}');
+VALUES (2, 'refund', 'reverseFlagList', '被退款', '冲正状态', '{tenantid}');
INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
VALUES (3, 'none', 'reverseFlagList', '-', '冲正状态', '{tenantid}');
INSERT INTO "tb_dictionary" ("id", "dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
<div class="layui-inline">
<label class="layui-form-label">支付方式</label>
<div class="layui-input-block" style="height: 38px;">
- <select name="sourceType" id="userdtl-search-sourceType" class="layui-select">
+ <select name="sourcetype" id="userdtl-search-sourceType" class="layui-select">
<option value=""> 全部</option>
<option th:each="pt:${paytypelist}" th:value="${pt.sourceType}"
th:text="${pt.paydesc}"></option>
<div class="layui-inline">
<label class="layui-form-label">状态</label>
<div class="layui-input-block" style="height:38px;">
- <select name="transStatus" id="userdtl-search-transStatus" class="layui-select">
+ <select name="status" id="userdtl-search-transStatus" class="layui-select">
<option value=""> 全部</option>
<option th:each="st:${dtlStatusList}" th:value="${st.dictval}"
th:text="${st.dictcaption}"></option>
endTransdate: $("#userdtl-search-endTransdate").val(),
personname: $("#userdtl-search-personname").val(),
cardno: $("#userdtl-search-cardno").val(),
- sourceType: $("#userdtl-search-sourceType").val(),
+ sourcetype: $("#userdtl-search-sourceType").val(),
tradeflag: $("#userdtl-search-tradeflag").val(),
transcode: $("#userdtl-search-transcode").val(),
- transStatus: $("#userdtl-search-transStatus").val()
+ status: $("#userdtl-search-transStatus").val()
}, page: {curr: 1}
});
});
"endTransdate": "",
"personname": "",
"cardno": "",
- "sourceType": "",
+ "sourcetype": "",
"tradeflag": "",
"transcode": "",
- "transStatus": ""
+ "status": ""
});
form.render("select");
});
import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;
import javax.servlet.http.HttpServletResponse;
-import javax.validation.constraints.NotNull;
import javax.ws.rs.FormParam;
import java.io.*;
import java.lang.reflect.InvocationTargetException;
}
}
- return true;
+ return false;
}
@Override