1.天津卡扣添加注释,优化内容,修复当扣款金额为限额的倍数时造成的实收表金额为0问题。
This commit is contained in:
parent
98cdac9583
commit
846df5ab83
@ -828,30 +828,35 @@ public class CollectAuditInfoCacheTj {
|
||||
String bank_name = bo.getAttribute("BANK_NAME").toString();
|
||||
int m = 0;
|
||||
String[] singleRent = null;
|
||||
BigDecimal mi = new BigDecimal(rent);
|
||||
|
||||
List<BizObject> codelist = JBOFactory.getFactory().getBizObjectManager(CODE_LIBRARY.CLASS_NAME).createQuery("O.codeno = 'TjbankType' and O.itemdescribe is not null ").getResultList(false);
|
||||
for (BizObject code : codelist) {
|
||||
String itemname = code.getAttribute("itemname").toString().trim();
|
||||
double itemdescribe = code.getAttribute("itemdescribe").getDouble();
|
||||
if (bank_name.indexOf(itemname) !=-1 && Double.parseDouble(bo.getAttribute("rent").toString()) > itemdescribe) {
|
||||
BigDecimal mi = new BigDecimal(bo.getAttribute("rent").toString());
|
||||
int singlerent = mi.multiply(new BigDecimal(100)).intValue();
|
||||
BigDecimal mj = new BigDecimal(itemdescribe);
|
||||
long divide = mj.multiply(new BigDecimal(100)).longValue();
|
||||
if(divide!=0){
|
||||
int k = (int) Math.floor(singlerent/divide);
|
||||
int l = (int) Math.ceil(singlerent%divide);
|
||||
for (int j = 0; j < k; j++) {
|
||||
m++;
|
||||
}
|
||||
if (l!=0) {
|
||||
m++;
|
||||
}
|
||||
singleRent = new String[m];
|
||||
for (int i = 0; i < k; i++) {
|
||||
singleRent[i] = itemdescribe+"";
|
||||
}
|
||||
singleRent[m-1] = String.format("%.2f",bo.getAttribute("rent").getDouble() - k*itemdescribe);
|
||||
break;//如果匹配到,则跳出循环
|
||||
if (bank_name.indexOf(itemname) !=-1) {
|
||||
BigDecimal limit_money = new BigDecimal(code.getAttribute("itemdescribe").getString());
|
||||
BigDecimal mj = limit_money;
|
||||
if(mi.compareTo(mj)==1){
|
||||
int singlerent = mi.multiply(new BigDecimal(100)).intValue();
|
||||
int divide = mj.multiply(new BigDecimal(100)).intValue();
|
||||
if(divide!=0){
|
||||
int k = singlerent/divide;
|
||||
int l = singlerent%divide;
|
||||
for (int j = 0; j < k; j++) {
|
||||
m++;
|
||||
}
|
||||
if (l!=0) {
|
||||
m++;
|
||||
}
|
||||
singleRent = new String[m];
|
||||
for (int i = 0; i < k; i++) {
|
||||
singleRent[i] = limit_money.toString();
|
||||
}
|
||||
if(l!=0){
|
||||
singleRent[m-1] = mi.subtract(mj.multiply(new BigDecimal(k))).setScale(2, BigDecimal.ROUND_HALF_UP).toString();
|
||||
}
|
||||
break;//如果匹配到,则跳出循环
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -871,6 +876,7 @@ public class CollectAuditInfoCacheTj {
|
||||
for (int i = 1; i <= snArray.length; i++) {
|
||||
Map<String, String> map = querySingleBatchCollect(tx, bo, query_sn, snArray[(i-1)]);
|
||||
if (snArray.length == 1) {
|
||||
//回盘成功
|
||||
if (map.containsKey("RET_CODE") && "0000".equals(map.get("RET_CODE"))) {
|
||||
querysingleCollectMoeny(tx, bc, bo, rent,i+"");
|
||||
//更新收付状态
|
||||
@ -888,6 +894,7 @@ public class CollectAuditInfoCacheTj {
|
||||
bo.setAttributeValue("BATCH_STATUS", "complete");
|
||||
//bo.setAttributeValue("rent", bo.getAttribute("rent").toString());
|
||||
saveBuckle(bo,tx,sn,rent);
|
||||
//处理中
|
||||
}else if (map.containsKey("RET_CODE") && ("2007".equals(map.get("RET_CODE")) || "2005".equals(map.get("RET_CODE")) || "2003".equals(map.get("RET_CODE")) || "2001".equals(map.get("RET_CODE")) || "2000".equals(map.get("RET_CODE")))){
|
||||
//更新银联处理中的反馈信息
|
||||
bc.createQuery("update O set O.COLLECT_MSG=:COLLECT_MSG where O.id=:id")
|
||||
@ -895,6 +902,7 @@ public class CollectAuditInfoCacheTj {
|
||||
.setParameter("id", bo.getAttribute("id").toString()).executeUpdate();
|
||||
bo.setAttributeValue("COLLECT_MSG", map.get("ERR_MSG"));
|
||||
saveBuckle(bo,tx,sn,"0.00");
|
||||
//扣款失败
|
||||
}else{
|
||||
//更新收付状态
|
||||
bc.createQuery("update O set O.COLLECT_STATUS=:COLLECT_STATUS ,O.COLLECT_MSG=:COLLECT_MSG,O.BATCH_STATUS=:BATCH_STATUS,O.BATCH_NO='',O.BATCH_SN='' where O.id=:id")
|
||||
@ -927,7 +935,7 @@ public class CollectAuditInfoCacheTj {
|
||||
bo.setAttributeValue("COLLECT_MSG", "批量代收,收款成功");
|
||||
bo.setAttributeValue("BATCH_STATUS", "complete");
|
||||
//bo.setAttributeValue("rent", bo.getAttribute("rent").toString());
|
||||
saveBuckle(bo,tx,i+"",singleRent[i-1]);
|
||||
saveBuckle(bo,tx,snArray[(i-1)],singleRent[i-1]);
|
||||
}else{
|
||||
//更新收付状态
|
||||
bc.createQuery("update O set O.COLLECT_STATUS=:COLLECT_STATUS ,O.COLLECT_MSG=:COLLECT_MSG,O.BATCH_STATUS=:BATCH_STATUS where O.id=:id")
|
||||
@ -938,15 +946,15 @@ public class CollectAuditInfoCacheTj {
|
||||
bo.setAttributeValue("COLLECT_STATUS", "部分收款");
|
||||
bo.setAttributeValue("COLLECT_MSG", map.get("ERR_MSG"));
|
||||
bo.setAttributeValue("BATCH_STATUS", "complete");
|
||||
saveBuckle(bo,tx,i+"",singleRent[i-1]);
|
||||
saveBuckle(bo,tx,snArray[(i-1)],singleRent[i-1]);
|
||||
}
|
||||
}else if (map.containsKey("RET_CODE") && ("2007".equals(map.get("RET_CODE")) || "2005".equals(map.get("RET_CODE")) || "2003".equals(map.get("RET_CODE")) || "2001".equals(map.get("RET_CODE")) || "2000".equals(map.get("RET_CODE")))){
|
||||
//更新银联处理中的反馈信息
|
||||
bc.createQuery("update O set O.COLLECT_MSG=:COLLECT_MSG where O.id=:id")
|
||||
.setParameter("COLLECT_MSG", map.get("ERR_MSG"))
|
||||
.setParameter("id", bo.getAttribute("id").toString()).executeUpdate();
|
||||
bo.setAttributeValue("COLLECT_MSG", map.get("ERR_MSG"));
|
||||
saveBuckle(bo,tx,i+"","0.00");
|
||||
bo.setAttributeValue("COLLECT_MSG", map.get("ER R_MSG"));
|
||||
saveBuckle(bo,tx,snArray[(i-1)],"0.00");
|
||||
}else{//批量拆分多笔扣款,如果扣款成功条数未 0 ,则更新扣款状态为 未扣款
|
||||
if (i == snArray.length && n == 0) {
|
||||
//更新收付状态
|
||||
@ -958,7 +966,7 @@ public class CollectAuditInfoCacheTj {
|
||||
bo.setAttributeValue("COLLECT_STATUS", "未收款");
|
||||
bo.setAttributeValue("COLLECT_MSG", map.get("ERR_MSG"));
|
||||
bo.setAttributeValue("BATCH_STATUS", "");
|
||||
saveBuckle(bo,tx,i+"","0.00");
|
||||
saveBuckle(bo,tx,snArray[(i-1)],"0.00");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1176,6 +1184,7 @@ public class CollectAuditInfoCacheTj {
|
||||
savaFile(tx, strResp,batch_title,bo);
|
||||
}
|
||||
Map<String, String> map = getRetAndCodeByBatch(strResp);
|
||||
//包含RET_CODE说明响应没有成功
|
||||
if (map.containsKey("RET_CODE")) {//清空批量代收状态
|
||||
for (BizObject biz : list) {
|
||||
//清空批量处理状态
|
||||
@ -1189,6 +1198,7 @@ public class CollectAuditInfoCacheTj {
|
||||
trans.commit();
|
||||
}
|
||||
}else{
|
||||
//响应成功
|
||||
int m = 0;//统计发送的代收的批数
|
||||
for (int n = 1; n <= map.size(); n++) {
|
||||
if (map.containsKey("SN"+n)) {
|
||||
@ -1196,10 +1206,12 @@ public class CollectAuditInfoCacheTj {
|
||||
}
|
||||
}
|
||||
for (int k = 1; k <= m; k++) {
|
||||
//每条响应成功
|
||||
if (map.containsKey("REQ_SN") && map.containsKey("RET_CODE"+k) && "0000".equals(map.get("RET_CODE"+k))) {
|
||||
JBOTransaction trans = JBOFactory.createJBOTransaction();
|
||||
BizObjectManager bm = JBOFactory.getFactory().getManager(LC_RENT_PLAN.CLASS_NAME,trans);
|
||||
BizObject bo0 = bm.createQuery("O.BATCH_NO=:BATCH_NO and O.BATCH_SN like '%"+map.get("SN"+k)+"%'").setParameter("BATCH_NO", map.get("REQ_SN")).getSingleResult(false);
|
||||
//不知道为啥这么写
|
||||
if (bo0 != null && "process".equals(bo0.getAttribute("BATCH_STATUS"))) {
|
||||
bm.createQuery("update O set O.BATCH_STATUS=:BATCH_STATUS where O.BATCH_NO=:BATCH_NO and O.BATCH_SN like '%"+map.get("SN"+k)+"%' ")
|
||||
.setParameter("BATCH_STATUS", "process")//处理状态标记为--处理中
|
||||
@ -1258,34 +1270,34 @@ public class CollectAuditInfoCacheTj {
|
||||
strbuff.append("</INFO>");
|
||||
strbuff.append("<BODY>");
|
||||
strbuff.append("<TRANS_SUM>");
|
||||
//总金额
|
||||
BigDecimal mutly = new BigDecimal("0");
|
||||
//总条数
|
||||
int i = 0;
|
||||
for (BizObject bo : list) {
|
||||
String single = bo.getAttribute("rent").toString();
|
||||
BigDecimal m = new BigDecimal(single);
|
||||
mutly = mutly.add(m);
|
||||
String single_s = bo.getAttribute("rent").toString();
|
||||
BigDecimal m_s = new BigDecimal(single_s);
|
||||
mutly = mutly.add(m_s);
|
||||
String bank_name = bo.getAttribute("BANK_NAME").toString();
|
||||
List<BizObject> codelist = JBOFactory.getFactory().getBizObjectManager(CODE_LIBRARY.CLASS_NAME).createQuery("O.codeno = 'TjbankType' and O.itemdescribe is not null ").getResultList(false);
|
||||
//数据字典中的itemdescribe字段代表银行单笔限
|
||||
double itemdescribe = 0;
|
||||
BigDecimal itemdescribe = new BigDecimal("0");
|
||||
boolean flag = false;
|
||||
for (BizObject code : codelist) {
|
||||
String itemnameTmp = code.getAttribute("itemname").toString().trim();
|
||||
double itemdescribeTmp = code.getAttribute("itemdescribe").getDouble();
|
||||
String itemdescribeTmp1 = code.getAttribute("itemdescribe").toString();
|
||||
if (bank_name.indexOf(itemnameTmp) != -1 && itemdescribeTmp1 != null && !"".equals(itemdescribeTmp1)) {
|
||||
itemdescribe = new BigDecimal(itemdescribeTmp).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
itemdescribe = new BigDecimal(itemdescribeTmp1).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag == true && Double.parseDouble(bo.getAttribute("rent").toString()) > itemdescribe) {
|
||||
BigDecimal mi = new BigDecimal(bo.getAttribute("rent").toString());
|
||||
int singlerent = mi.multiply(new BigDecimal(100)).intValue();
|
||||
int singleitem = new BigDecimal(itemdescribe).multiply(new BigDecimal(100)).intValue();
|
||||
int k = (int) Math.floor(singlerent/singleitem);
|
||||
int l = (int) Math.ceil(singlerent%singleitem);
|
||||
if (flag == true && m_s.compareTo(itemdescribe)==1) {
|
||||
BigDecimal mi_s = m_s;
|
||||
int singlerent = mi_s.multiply(new BigDecimal(100)).intValue();
|
||||
int singleitem = itemdescribe.multiply(new BigDecimal(100)).intValue();
|
||||
int k = singlerent/singleitem;
|
||||
int l = singlerent%singleitem;
|
||||
for (int j = 0; j < k; j++) {
|
||||
i++;
|
||||
}
|
||||
@ -1316,33 +1328,36 @@ public class CollectAuditInfoCacheTj {
|
||||
String account = biz.getAttribute("account").toString();
|
||||
String bank_name = biz.getAttribute("BANK_NAME").toString();
|
||||
List<BizObject> codelist = JBOFactory.getFactory().getBizObjectManager(CODE_LIBRARY.CLASS_NAME).createQuery("O.codeno = 'TjbankType' and O.itemdescribe is not null ").getResultList(false);
|
||||
double itemdescribe = 0;
|
||||
BigDecimal itemdescribe = new BigDecimal("0");
|
||||
boolean flag = false;
|
||||
for (BizObject code : codelist) {
|
||||
String itemnameTmp = code.getAttribute("itemname").toString().trim();
|
||||
double itemdescribeTmp = code.getAttribute("itemdescribe").getDouble();
|
||||
String itemdescribeTmp1 = code.getAttribute("itemdescribe").toString();
|
||||
if (bank_name.indexOf(itemnameTmp) != -1 && itemdescribeTmp1 != null && !"".equals(itemdescribeTmp1)) {
|
||||
itemdescribe = new BigDecimal(itemdescribeTmp).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
itemdescribe = new BigDecimal(itemdescribeTmp1).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag == true && Double.parseDouble(biz.getAttribute("rent").toString()) > itemdescribe) {
|
||||
BigDecimal mi = new BigDecimal(biz.getAttribute("rent").toString());
|
||||
if (flag == true && m.compareTo(itemdescribe)==1) {
|
||||
BigDecimal mi = m;
|
||||
int singlerent = mi.multiply(new BigDecimal(100)).intValue();
|
||||
int singleitem = new BigDecimal(itemdescribe).multiply(new BigDecimal(100)).intValue();
|
||||
int k = (int) Math.floor(singlerent/singleitem);
|
||||
int l = (int) Math.ceil(singlerent%singleitem);
|
||||
int singleitem = itemdescribe.multiply(new BigDecimal(100)).intValue();
|
||||
int k = singlerent/singleitem;
|
||||
int l = singlerent%singleitem;
|
||||
for (int k2 = 1; k2 <= k; k2++) {
|
||||
Trans_Detail trans_detail = new Trans_Detail();
|
||||
String sn = "";
|
||||
if (item >= 9&&item<99) {
|
||||
sn = "000"+ (++item);
|
||||
}else if(item >= 99){
|
||||
sn = "00"+ (++item);
|
||||
}else{
|
||||
if(item < 9){
|
||||
sn = "0000"+ (++item);
|
||||
}else if (item >= 9&&item<99) {
|
||||
sn = "000"+ (++item);
|
||||
}else if(item >= 99&&item<999){
|
||||
sn = "00"+ (++item);
|
||||
}else if(item >= 999&&item<9999){
|
||||
sn = "0"+ (++item);
|
||||
}else{
|
||||
sn = "" + (++item);
|
||||
}
|
||||
//追加批量处理状态
|
||||
JBOTransaction trans = JBOFactory.createJBOTransaction();
|
||||
@ -1374,17 +1389,20 @@ public class CollectAuditInfoCacheTj {
|
||||
strbuff.append(EntityTransform.toXmlByBatchCollect(trans_detail));
|
||||
}
|
||||
if (l != 0) {
|
||||
String surprent = String.format("%.2f", biz.getAttribute("rent").getDouble() - k*itemdescribe);
|
||||
BigDecimal mj = new BigDecimal(surprent);
|
||||
BigDecimal mj = mi.subtract(itemdescribe.multiply(new BigDecimal(k))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
String singlerent0 = String.valueOf(mj.multiply(new BigDecimal(100)).longValue());
|
||||
Trans_Detail trans_detail = new Trans_Detail();
|
||||
String sn = "";
|
||||
if (item >= 9&&item<99) {
|
||||
sn = "000"+ (++item);
|
||||
}else if(item >= 99){
|
||||
sn = "00"+ (++item);
|
||||
}else{
|
||||
if(item < 9){
|
||||
sn = "0000"+ (++item);
|
||||
}else if (item >= 9&&item<99) {
|
||||
sn = "000"+ (++item);
|
||||
}else if(item >= 99&&item<999){
|
||||
sn = "00"+ (++item);
|
||||
}else if(item >= 999&&item<9999){
|
||||
sn = "0"+ (++item);
|
||||
}else{
|
||||
sn = "" + (++item);
|
||||
}
|
||||
//追加批量处理状态
|
||||
JBOTransaction trans = JBOFactory.createJBOTransaction();
|
||||
@ -1418,12 +1436,16 @@ public class CollectAuditInfoCacheTj {
|
||||
}else{
|
||||
Trans_Detail trans_detail = new Trans_Detail();
|
||||
String sn = "";
|
||||
if (item >= 9&&item<99) {
|
||||
sn = "000"+ (++item);
|
||||
}else if(item >= 99){
|
||||
sn = "00"+ (++item);
|
||||
}else{
|
||||
if(item < 9){
|
||||
sn = "0000"+ (++item);
|
||||
}else if (item >= 9&&item<99) {
|
||||
sn = "000"+ (++item);
|
||||
}else if(item >= 99&&item<999){
|
||||
sn = "00"+ (++item);
|
||||
}else if(item >= 999&&item<9999){
|
||||
sn = "0"+ (++item);
|
||||
}else{
|
||||
sn = "" + (++item);
|
||||
}
|
||||
//追加批量处理状态
|
||||
JBOTransaction trans = JBOFactory.createJBOTransaction();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user