Commit 50a0e6f3 by huangshunlin

多实体:swift发报行根据usr找ety 找总行ownbic

parent 5419a3a5
package com.brilliance.isc.common.cache.pty; package com.brilliance.isc.common.cache.pty;
import com.brilliance.isc.bo.Ety;
import com.brilliance.isc.bo.Pty; import com.brilliance.isc.bo.Pty;
import com.brilliance.isc.bo.Usr;
import com.brilliance.isc.common.context.SettleContext;
import com.brilliance.isc.common.util.StringUtils;
import com.brilliance.isc.mda.dao.EtyMapper;
import com.brilliance.isc.mda.dao.PtyMapper; import com.brilliance.isc.mda.dao.PtyMapper;
import com.brilliance.mda.runtime.mda.Constants;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import javax.annotation.PostConstruct; import java.util.Objects;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@Service @Service
...@@ -23,7 +30,7 @@ public class PtyCacheServiceImpl implements PtyCacheService { ...@@ -23,7 +30,7 @@ public class PtyCacheServiceImpl implements PtyCacheService {
private static final TimeUnit EXPIRETYPE = TimeUnit.SECONDS; private static final TimeUnit EXPIRETYPE = TimeUnit.SECONDS;
private static Pty ownPty = null; // private static Pty ownPty = null;
@Autowired @Autowired
@Qualifier("jacksonRedisTemplate") @Qualifier("jacksonRedisTemplate")
...@@ -31,17 +38,34 @@ public class PtyCacheServiceImpl implements PtyCacheService { ...@@ -31,17 +38,34 @@ public class PtyCacheServiceImpl implements PtyCacheService {
@Autowired @Autowired
private PtyMapper ptyMapper; private PtyMapper ptyMapper;
@Autowired
private EtyMapper etyMapper;
@PostConstruct // @PostConstruct
public void initOwnPty() { // public void initOwnPty() {
ownPty = ptyMapper.queryDetailByExtkey("EVERCNBJXXX"); // ownPty = ptyMapper.queryDetailByExtkey("EVERCNBJXXX");
//验证环境 bic第8位都改成了0 // //验证环境 bic第8位都改成了0
if (ownPty == null) { // if (ownPty == null) {
ownPty = ptyMapper.queryDetailByExtkey("EVERCNB0XXX"); // ownPty = ptyMapper.queryDetailByExtkey("EVERCNB0XXX");
} // }
} // }
public Pty getOwnPty() { public Pty getOwnPty() {
String ownbic = Constants.NULLSTR;
Ety ety = SettleContext.getUserSession().getEty();
if (Objects.isNull(ety)) {
Usr usr = SettleContext.getUserSession().getUsr();
if (Objects.nonNull(usr) && StringUtils.isNotEmpty(usr.getEtyextkey())) {
String etyextkey = usr.getEtyextkey();
ety = etyMapper.getEtyByExtkey(etyextkey);
}
}
if (Objects.nonNull(ety) && StringUtils.isNotEmpty(ety.getOwnbic())) {
ownbic = ety.getOwnbic();
}
Assert.hasText(ownbic, "UserSession:usr.Etyextkey ety.Ownbic isEmpty");
Pty ownPty = ptyMapper.queryDetailByExtkey(ownbic);
Assert.notNull(ownPty, String.format("pty cannot be found by ownbic=[%s]", ownbic));
return ownPty; return ownPty;
} }
......
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