Commit 8d71de82 by fukai

Merge remote-tracking branch 'origin/develop' into develop

parents 9d098bb5 53d36940
...@@ -40,7 +40,7 @@ public class BopCalPilotController { ...@@ -40,7 +40,7 @@ public class BopCalPilotController {
@Autowired @Autowired
private BchService bchService; private BchService bchService;
@PostMapping("/bopcalcom/pilotbopbch") @PostMapping("/pilotbopbch")
public ResponseSet<String> bopPilotBch(@RequestBody Map<String, String> params) { public ResponseSet<String> bopPilotBch(@RequestBody Map<String, String> params) {
try { try {
settleContext.simpleLoadSettleSession(); settleContext.simpleLoadSettleSession();
......
package com.brilliance.isc.common.lock.impl; package com.brilliance.isc.common.lock.impl;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import com.brilliance.isc.bo.Lck; import com.brilliance.isc.bo.Lck;
import com.brilliance.isc.bo.Stb; import com.brilliance.isc.bo.Stb;
import com.brilliance.isc.common.lock.LockInfo; import com.brilliance.isc.common.lock.LockInfo;
import com.brilliance.isc.mda.dao.StbMapper; import com.brilliance.isc.mda.dao.StbMapper;
import com.brilliance.isc.vo.manager.StbVo; import com.brilliance.isc.vo.manager.StbVo;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -31,63 +32,62 @@ public class DBLckBizLocker extends AbstractBizLocker { ...@@ -31,63 +32,62 @@ public class DBLckBizLocker extends AbstractBizLocker {
private final String DBLOCKER = "DBLOCK"; private final String DBLOCKER = "DBLOCK";
private boolean getSwitchFlag(){ private boolean getSwitchFlag() {
StbVo stbVo = new StbVo(); StbVo stbVo = new StbVo();
stbVo.setTbl(DBLOCKER); stbVo.setTbl(DBLOCKER);
List<Stb> stbs = stbMapper.queryByPage(stbVo); List<Stb> stbs = stbMapper.queryByPage(stbVo);
if(stbs == null || stbs.size() == 0){ if (stbs == null || stbs.size() == 0) {
return false; return false;
} }
return "Y".equals(stbs.get(0).getCod()) ? true : false; return "Y".equals(stbs.get(0).getCod()) ? true : false;
} }
/** /**
* @param key 为业务主键,使用LockInfo的方法生成key * @param key 为业务主键,使用LockInfo的方法生成key
* @param value 为业务锁定信息,一般为交易码+操作人,使用LockInfo的方法生成value * @param value 为业务锁定信息,一般为交易码+操作人,使用LockInfo的方法生成value
* @param seconds 锁定时间,db模式下无效 * @param seconds 锁定时间,db模式下无效
* @return * @return
*/ */
@Transactional(propagation = Propagation.REQUIRES_NEW,rollbackFor = Exception.class) @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public boolean lock(String key,String value, long seconds) { public boolean lock(String key, String value, long seconds) {
if(!getSwitchFlag()){ if (!getSwitchFlag()) {
logger.info("锁定函数暂时关闭"); logger.info("锁定函数暂时关闭");
return true; return true;
} }
LockInfo lockInfo = new LockInfo(key,value); LockInfo lockInfo = new LockInfo(key, value);
boolean isSuccess = lckComponent.tryInsert(lockInfo); boolean isSuccess = lckComponent.tryInsert(lockInfo);
// 插入成功,新增 // 插入成功,新增
if (isSuccess) { if (isSuccess) {
logger.info("锁key:{},value:{},结果:成功",key,value); logger.info("锁key:{},value:{},结果:成功", key, value);
return true; return true;
} }
lockInfo = getLock(lockInfo); lockInfo = getLock(lockInfo);
String oldValue = lockInfo.genLockValue(); String oldValue = lockInfo.genLockValue();
// 相同时,刷新时间 // 相同时,刷新时间
if (oldValue.equals(value)) { if (oldValue.equals(value)) {
if(value.endsWith("#true")) { if (value.endsWith("#true")) {
logger.info("锁已重入key:{},value:{}",key,value); logger.info("锁已重入key:{},value:{}", key, value);
isSuccess = true; isSuccess = true;
}else{ } else {
logger.info("锁无法重入key:{},value:{}",key,value); logger.info("锁无法重入key:{},value:{}", key, value);
} }
} }
return isSuccess; return isSuccess;
} }
@Override @Override
public LockInfo getLock(LockInfo lockInfo) { public LockInfo getLock(LockInfo lockInfo) {
if(!getSwitchFlag()){ if (!getSwitchFlag()) {
logger.info("锁定函数暂时关闭"); logger.info("锁定函数暂时关闭");
return null; return null;
} }
String key = lockInfo.genLockKey(); String key = lockInfo.genLockKey();
LockInfo dbLockInfo = lckComponent.getLck(lockInfo); LockInfo dbLockInfo = lckComponent.getLck(lockInfo);
if(dbLockInfo != null){ if (dbLockInfo != null) {
String value = dbLockInfo.genLockValue(); String value = dbLockInfo.genLockValue();
logger.info("返回锁信息key:{},value:{}",key,value); logger.info("返回锁信息key:{},value:{}", key, value);
return dbLockInfo; return dbLockInfo;
} }
return null; return null;
...@@ -96,37 +96,36 @@ public class DBLckBizLocker extends AbstractBizLocker { ...@@ -96,37 +96,36 @@ public class DBLckBizLocker extends AbstractBizLocker {
@Override @Override
public boolean unlock(LockInfo lockInfo) { public boolean unlock(LockInfo lockInfo) {
if(!getSwitchFlag()){ if (!getSwitchFlag()) {
logger.info("锁定函数暂时关闭"); logger.info("锁定函数暂时关闭");
return true; return true;
} }
String key = lockInfo.genLockKey(); String key = lockInfo.genLockKey();
LockInfo oldLockInfo = getLock(lockInfo); LockInfo oldLockInfo = getLock(lockInfo);
if(oldLockInfo != null){ if (oldLockInfo != null) {
logger.info("返回锁信息key:{},value:{}",key,oldLockInfo.genLockValue()); logger.info("返回锁信息key:{},value:{}", key, oldLockInfo.genLockValue());
if(oldLockInfo.getUsrId().equals(lockInfo.getUsrId())){ if (oldLockInfo.getUsrId().equals(lockInfo.getUsrId())) {
logger.info("删除锁{}",key); logger.info("删除锁{}", key);
int cnt = lckComponent.deleteLck(oldLockInfo); int cnt = lckComponent.deleteLck(oldLockInfo);
logger.info("删除锁成功{},影响行数{}",key,cnt); logger.info("删除锁成功{},影响行数{}", key, cnt);
return true; return true;
}else{ } else {
logger.info("{}锁定人不一致,不允许删除,oldUserId:{},curUserId{},",key,oldLockInfo.getUsrId(),lockInfo.getUsrId()); logger.info("{}锁定人不一致,不允许删除,oldUserId:{},curUserId{},", key, oldLockInfo.getUsrId(), lockInfo.getUsrId());
} }
} }
return false; return false;
} }
@Transactional(propagation = Propagation.REQUIRES_NEW,rollbackFor = Exception.class) @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public boolean lockForce(String key,String value, long seconds) { public boolean lockForce(String key, String value, long seconds) {
logger.info("强制占用锁{}:{}",key,value); logger.info("强制占用锁{}:{}", key, value);
LockInfo lockInfo = new LockInfo(key,value); LockInfo lockInfo = new LockInfo(key, value);
lckComponent.updateLockInfo(lockInfo); lckComponent.updateLockInfo(lockInfo);
logger.info("强制占用锁{}:{}成功",key,value); logger.info("强制占用锁{}:{}成功", key, value);
return true; return true;
} }
/** /**
* 强制解锁 * 强制解锁
* *
...@@ -136,9 +135,9 @@ public class DBLckBizLocker extends AbstractBizLocker { ...@@ -136,9 +135,9 @@ public class DBLckBizLocker extends AbstractBizLocker {
@Override @Override
public boolean unlockForce(LockInfo lockInfo) { public boolean unlockForce(LockInfo lockInfo) {
String key = lockInfo.genLockKey(); String key = lockInfo.genLockKey();
logger.info("强制删除锁{}",key); logger.info("强制删除锁{}", key);
int cnt = lckComponent.deleteLck(lockInfo); int cnt = lckComponent.deleteLck(lockInfo);
logger.info("强制删除锁成功{},影响行数{}",key,cnt); logger.info("强制删除锁成功{},影响行数{}", key, cnt);
return true; return true;
} }
...@@ -151,10 +150,10 @@ public class DBLckBizLocker extends AbstractBizLocker { ...@@ -151,10 +150,10 @@ public class DBLckBizLocker extends AbstractBizLocker {
@Override @Override
public boolean unlockAllOfTrans(String transName, String userId) { public boolean unlockAllOfTrans(String transName, String userId) {
Lck lck = new Lck(); Lck lck = new Lck();
lck.setLcktrn(transName); lck.setLcktrn(StringUtils.upperCase(transName));
lck.setLckusr(userId); lck.setLckusr(userId);
int cnt = lckComponent.deleteLckByUserAndTrn(lck); int cnt = lckComponent.deleteLckByUserAndTrn(lck);
logger.info("解除{}用户在{}交易的所有锁定,影响行数{}",userId,transName,cnt); logger.info("解除{}用户在{}交易的所有锁定,影响行数{}", userId, transName, cnt);
return true; return true;
} }
...@@ -166,12 +165,12 @@ public class DBLckBizLocker extends AbstractBizLocker { ...@@ -166,12 +165,12 @@ public class DBLckBizLocker extends AbstractBizLocker {
*/ */
@Override @Override
public boolean unlockAllOfUser(String userId) { public boolean unlockAllOfUser(String userId) {
logger.info("退出锁定{}",userId); logger.info("退出锁定{}", userId);
Lck lck = new Lck(); Lck lck = new Lck();
lck.setLcktrn(null); lck.setLcktrn(null);
lck.setLckusr(userId); lck.setLckusr(userId);
int cnt = lckComponent.deleteLckByUserAndTrn(lck); int cnt = lckComponent.deleteLckByUserAndTrn(lck);
logger.info("退出锁定成功{},影响行数{}",userId,cnt); logger.info("退出锁定成功{},影响行数{}", userId, cnt);
return false; return false;
} }
} }
package com.brilliance.isc.common.lock.impl; package com.brilliance.isc.common.lock.impl;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import com.brilliance.isc.bo.Lck; import com.brilliance.isc.bo.Lck;
import com.brilliance.isc.common.lock.LockInfo; import com.brilliance.isc.common.lock.LockInfo;
import com.brilliance.isc.mda.dao.LckMapper; import com.brilliance.isc.mda.dao.LckMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date; import java.util.Date;
...@@ -25,40 +24,39 @@ public class LckComponent { ...@@ -25,40 +24,39 @@ public class LckComponent {
int cnt = lckMapper.insert(lck); int cnt = lckMapper.insert(lck);
logger.info("锁定信息插入成功,影响行数:{}", cnt); logger.info("锁定信息插入成功,影响行数:{}", cnt);
return true; return true;
}catch(DuplicateKeyException e){ } catch (Exception e) {
logger.info("已存在锁{}",lockInfo.genLockKey()); logger.info("已存在锁{}", lockInfo.genLockKey());
} } finally {
finally {
} }
return false; return false;
} }
public Lck lockInfo2Lck(LockInfo lockInfo){ public Lck lockInfo2Lck(LockInfo lockInfo) {
Lck dataLck = new Lck(); Lck dataLck = new Lck();
dataLck.setLckdattim(new Date()); dataLck.setLckdattim(new Date());
dataLck.setLcktrn(lockInfo.getTrnName()); dataLck.setLcktrn(lockInfo.getTrnName());
dataLck.setLckusr(lockInfo.getUsrId()); dataLck.setLckusr(lockInfo.getUsrId());
dataLck.setLckstr(lockInfo.genLockKey()); dataLck.setLckstr(lockInfo.genLockKey());
if(lockInfo.isReentrant()){ if (lockInfo.isReentrant()) {
dataLck.setLckhld(""); dataLck.setLckhld("");
}else{ } else {
dataLck.setLckhld("X"); dataLck.setLckhld("X");
} }
return dataLck; return dataLck;
} }
public LockInfo lck2Info(Lck dataLck){ public LockInfo lck2Info(Lck dataLck) {
if(dataLck == null){ if (dataLck == null) {
return null; return null;
} }
LockInfo lockInfo = new LockInfo(dataLck.getLckstr()); LockInfo lockInfo = new LockInfo(dataLck.getLckstr());
lockInfo.setTrnName(dataLck.getLcktrn()); lockInfo.setTrnName(dataLck.getLcktrn());
lockInfo.setUsrId(dataLck.getLckusr()); lockInfo.setUsrId(dataLck.getLckusr());
if(dataLck.getLckhld() == null || dataLck.getLckhld().trim().isEmpty()){ if (dataLck.getLckhld() == null || dataLck.getLckhld().trim().isEmpty()) {
lockInfo.setReentrant(true); lockInfo.setReentrant(true);
}else{ } else {
lockInfo.setReentrant(false); lockInfo.setReentrant(false);
} }
return lockInfo; return lockInfo;
......
...@@ -1350,9 +1350,10 @@ public class GlemodServiceImpl implements GlemodService { ...@@ -1350,9 +1350,10 @@ public class GlemodServiceImpl implements GlemodService {
* source:glemod.0017.script * source:glemod.0017.script
*/ */
public String actgetsql(String ptyinr, String dsp, String cur) { public String actgetsql(String ptyinr, String dsp, String cur) {
String res = "WHERE EXTKEY <> ''"; // String res = "WHERE EXTKEY <> ''";
String res = "WHERE (EXTKEY is not null or EXTKEY <> '') ";
if (StringUtils.isNotEmpty(cur)) { if (StringUtils.isNotEmpty(cur)) {
res += " AND (CUR = '" + cur + "' or CUR = ' ')"; res += " AND (CUR = '" + cur + "' or CUR = ' ' or cur is null)";
} }
//String res = "WHERE (CUR = '" + cur + "' or CUR = ' ')"; //String res = "WHERE (CUR = '" + cur + "' or CUR = ' ')";
// DSP有两种情况,一个是确定的单个账号,比如AS-LIS,另一个是账号列表,比如LOD // DSP有两种情况,一个是确定的单个账号,比如AS-LIS,另一个是账号列表,比如LOD
...@@ -1689,11 +1690,11 @@ public class GlemodServiceImpl implements GlemodService { ...@@ -1689,11 +1690,11 @@ public class GlemodServiceImpl implements GlemodService {
} }
String res = ""; String res = "";
if (MdaUtils.compareTo(amt, 0) < 0) { if (MdaUtils.compareTo(amt, 0) < 0) {
sqlblk += " AND DIRFLG <> 'D'"; sqlblk += " AND (DIRFLG is null or DIRFLG <> 'D' )";
} else { } else {
sqlblk += " AND DIRFLG <> 'C'"; sqlblk += " AND (DIRFLG is null or DIRFLG <> 'C' )";
} }
sqlblk += " AND DELFLG <> 'X' "; sqlblk += " AND (DELFLG is null or DELFLG <> 'X') ";
sqlblk = Utils.sdbEtyGenSql("ACT", sqlblk); sqlblk = Utils.sdbEtyGenSql("ACT", sqlblk);
sqlblk += " ORDER BY PRI DESC, INR DESC"; sqlblk += " ORDER BY PRI DESC, INR DESC";
String sql = "select EXTKEY from ACT " + sqlblk; String sql = "select EXTKEY from ACT " + sqlblk;
......
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