Commit 47d88e40 by gechengyang

提交最新代码

parent 70df2811
......@@ -192,11 +192,11 @@ public class CpdController {
for (Pts pts : ptsList) {
String ptsinr = cntService.counter("PTS");
pts.setInr(ptsinr);
if (pts.getRol().equals("PYE") && tempAdrInrIsNull) {
if (pts.getRol() != null && pts.getRol().equals("PYE") && tempAdrInrIsNull) {
pts.setPtainr(pyePtaInr);
pts.setPtyinr(pyePtyInr);
}
trnService.save(trn);
ptsService.save(pts);
}
// 最大CBE CBB
......@@ -250,6 +250,7 @@ public class CpdController {
} catch (Exception e) {
log.error("save cpd error:", e);
transactionManager.rollback(status);
return ResultUtil.result(ErrorCodes.ERROR, "save error", null);
}
return ResultUtil.result(ErrorCodes.SUCCESS, "sucess", null);
......
......@@ -2,10 +2,10 @@ package com.brilliance.remit.service;
import com.brilliance.remit.db.model.Adr;
/**
This java was generated by Auto Generator.
created at time 2018-12-18 22:06:10
created at time 2018-12-21 16:59:58
**/
public interface AdrService {
public boolean save(Adr adr);
public boolean save(Adr adr) throws Exception;
}
......@@ -2,10 +2,10 @@ package com.brilliance.remit.service;
import com.brilliance.remit.db.model.Bch;
/**
This java was generated by Auto Generator.
created at time 2018-12-18 22:06:09
created at time 2018-12-21 16:59:58
**/
public interface BchService {
public boolean save(Bch bch);
public boolean save(Bch bch) throws Exception;
}
......@@ -2,10 +2,10 @@ package com.brilliance.remit.service;
import com.brilliance.remit.db.model.Cbb;
/**
This java was generated by Auto Generator.
created at time 2018-12-18 22:06:10
created at time 2018-12-21 16:59:58
**/
public interface CbbService {
public boolean save(Cbb cbb);
public boolean save(Cbb cbb) throws Exception;
}
......@@ -2,10 +2,10 @@ package com.brilliance.remit.service;
import com.brilliance.remit.db.model.Cbe;
/**
This java was generated by Auto Generator.
created at time 2018-12-18 22:06:10
created at time 2018-12-21 16:59:58
**/
public interface CbeService {
public boolean save(Cbe cbe);
public boolean save(Cbe cbe) throws Exception;
}
......@@ -2,10 +2,10 @@ package com.brilliance.remit.service;
import com.brilliance.remit.db.model.Cpd;
/**
This java was generated by Auto Generator.
created at time 2018-12-18 22:06:10
created at time 2018-12-21 16:59:58
**/
public interface CpdService {
public boolean save(Cpd cpd);
public boolean save(Cpd cpd) throws Exception;
}
......@@ -2,10 +2,10 @@ package com.brilliance.remit.service;
import com.brilliance.remit.db.model.Cpt;
/**
This java was generated by Auto Generator.
created at time 2018-12-18 22:06:10
created at time 2018-12-21 16:59:58
**/
public interface CptService {
public boolean save(Cpt cpt);
public boolean save(Cpt cpt) throws Exception;
}
......@@ -2,10 +2,10 @@ package com.brilliance.remit.service;
import com.brilliance.remit.db.model.Fep;
/**
This java was generated by Auto Generator.
created at time 2018-12-21 09:25:17
created at time 2018-12-21 16:59:58
**/
public interface FepService {
public boolean save(Fep fep);
public boolean save(Fep fep) throws Exception;
}
......@@ -2,10 +2,10 @@ package com.brilliance.remit.service;
import com.brilliance.remit.db.model.Gle;
/**
This java was generated by Auto Generator.
created at time 2018-12-21 09:33:08
created at time 2018-12-21 16:59:57
**/
public interface GleService {
public boolean save(Gle gle);
public boolean save(Gle gle) throws Exception;
}
......@@ -4,12 +4,12 @@ import com.brilliance.remit.db.model.Cpdgrp;
import com.brilliance.remit.db.model.Pta;
/**
* This java was generated by Auto Generator. created at time 2018-12-18
* 22:06:10
* This java was generated by Auto Generator. created at time 2018-12-21
* 16:59:58
**/
public interface PtaService {
public boolean save(Pta pta);
public boolean save(Pta pta) throws Exception;
public Cpdgrp custormerInfo(String extkey);
......
......@@ -2,10 +2,10 @@ package com.brilliance.remit.service;
import com.brilliance.remit.db.model.Pts;
/**
This java was generated by Auto Generator.
created at time 2018-12-18 22:06:10
created at time 2018-12-21 16:59:58
**/
public interface PtsService {
public boolean save(Pts pts);
public boolean save(Pts pts) throws Exception;
}
......@@ -5,12 +5,13 @@ import java.util.List;
import com.brilliance.remit.db.model.Pty;
/**
* This java was generated by Auto Generator. created at time 2018-12-18
* 22:06:10
* This java was generated by Auto Generator. created at time 2018-12-21
* 16:59:58
**/
public interface PtyService {
public boolean save(Pty pty);
public boolean save(Pty pty) throws Exception;
public List<Pty> ptyInfos(String extkey, String ptytyp);
}
......@@ -2,10 +2,10 @@ package com.brilliance.remit.service;
import com.brilliance.remit.db.model.Trn;
/**
This java was generated by Auto Generator.
created at time 2018-12-18 22:06:10
created at time 2018-12-21 16:59:58
**/
public interface TrnService {
public boolean save(Trn trn);
public boolean save(Trn trn) throws Exception;
}
......@@ -14,7 +14,7 @@ import com.brilliance.remit.db.dao.AdrMapper;
import com.brilliance.remit.db.model.Adr;
/**
This java was generated by Auto Generator.
created at time 2018-12-18 22:06:10
created at time 2018-12-21 16:59:58
**/
@Service("adrService")
......@@ -27,7 +27,7 @@ public class AdrServiceImp implements AdrService {
private static Log log = LogFactory.getLog(AdrServiceImp.class);
@Override
public boolean save(Adr adr) {
public boolean save(Adr adr) throws Exception{
// 事务操作
TransactionStatus status = transactionManager.getTransaction(DbUtil.getDbDefinition());
try {
......@@ -38,7 +38,7 @@ public class AdrServiceImp implements AdrService {
} catch (Exception e) {
log.error("error", e);
transactionManager.rollback(status);
return false;
throw new Exception("error", e);
}
}
......
......@@ -14,7 +14,7 @@ import com.brilliance.remit.db.dao.BchMapper;
import com.brilliance.remit.db.model.Bch;
/**
This java was generated by Auto Generator.
created at time 2018-12-18 22:06:10
created at time 2018-12-21 16:59:58
**/
@Service("bchService")
......@@ -27,7 +27,7 @@ public class BchServiceImp implements BchService {
private static Log log = LogFactory.getLog(BchServiceImp.class);
@Override
public boolean save(Bch bch) {
public boolean save(Bch bch) throws Exception{
// 事务操作
TransactionStatus status = transactionManager.getTransaction(DbUtil.getDbDefinition());
try {
......@@ -38,7 +38,7 @@ public class BchServiceImp implements BchService {
} catch (Exception e) {
log.error("error", e);
transactionManager.rollback(status);
return false;
throw new Exception("error", e);
}
}
......
......@@ -14,7 +14,7 @@ import com.brilliance.remit.db.dao.CbbMapper;
import com.brilliance.remit.db.model.Cbb;
/**
This java was generated by Auto Generator.
created at time 2018-12-18 22:06:10
created at time 2018-12-21 16:59:58
**/
@Service("cbbService")
......@@ -27,7 +27,7 @@ public class CbbServiceImp implements CbbService {
private static Log log = LogFactory.getLog(CbbServiceImp.class);
@Override
public boolean save(Cbb cbb) {
public boolean save(Cbb cbb) throws Exception{
// 事务操作
TransactionStatus status = transactionManager.getTransaction(DbUtil.getDbDefinition());
try {
......@@ -38,7 +38,7 @@ public class CbbServiceImp implements CbbService {
} catch (Exception e) {
log.error("error", e);
transactionManager.rollback(status);
return false;
throw new Exception("error", e);
}
}
......
......@@ -14,7 +14,7 @@ import com.brilliance.remit.db.dao.CbeMapper;
import com.brilliance.remit.db.model.Cbe;
/**
This java was generated by Auto Generator.
created at time 2018-12-18 22:06:10
created at time 2018-12-21 16:59:58
**/
@Service("cbeService")
......@@ -27,7 +27,7 @@ public class CbeServiceImp implements CbeService {
private static Log log = LogFactory.getLog(CbeServiceImp.class);
@Override
public boolean save(Cbe cbe) {
public boolean save(Cbe cbe) throws Exception{
// 事务操作
TransactionStatus status = transactionManager.getTransaction(DbUtil.getDbDefinition());
try {
......@@ -38,7 +38,7 @@ public class CbeServiceImp implements CbeService {
} catch (Exception e) {
log.error("error", e);
transactionManager.rollback(status);
return false;
throw new Exception("error", e);
}
}
......
......@@ -2,9 +2,14 @@ package com.brilliance.remit.service.imp;
import java.math.BigDecimal;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.stereotype.Service;
import org.springframework.transaction.TransactionStatus;
import com.brilliance.remit.common.util.DbUtil;
import com.brilliance.remit.db.dao.CouMapper;
import com.brilliance.remit.db.model.Cou;
import com.brilliance.remit.service.CntService;
......@@ -14,21 +19,31 @@ public class CntServiceImpl implements CntService {
@Autowired
private CouMapper couMapper;
@Resource(name = "txManager")
private DataSourceTransactionManager transactionManager;
@Override
public synchronized String counter(String nam) {
Cou cnt = couMapper.selectByPrimaryKey(nam);
if (cnt == null) {
cnt = new Cou();
cnt.setCounam(nam);
cnt.setCoustp(new BigDecimal(1));
cnt.setCouval(new BigDecimal(1));
couMapper.insert(cnt);
} else {
cnt.setCouval(new BigDecimal(cnt.getCouval().intValue() + 1));
couMapper.updateByPrimaryKey(cnt);
// 事务操作
TransactionStatus status = transactionManager.getTransaction(DbUtil.getDbDefinition());
try {
Cou cnt = couMapper.selectByPrimaryKey(nam);
if (cnt == null) {
cnt = new Cou();
cnt.setCounam(nam);
cnt.setCoustp(new BigDecimal(1));
cnt.setCouval(new BigDecimal(1));
couMapper.insert(cnt);
} else {
cnt.setCouval(new BigDecimal(cnt.getCouval().intValue() + 1));
couMapper.updateByPrimaryKey(cnt);
}
transactionManager.commit(status);
return String.format("%08d", cnt.getCouval().intValue());
} catch (Exception e) {
transactionManager.rollback(status);
}
return String.format("%08d", cnt.getCouval().intValue());
return "";
}
}
......@@ -14,7 +14,7 @@ import com.brilliance.remit.db.dao.CpdMapper;
import com.brilliance.remit.db.model.Cpd;
/**
This java was generated by Auto Generator.
created at time 2018-12-18 22:06:10
created at time 2018-12-21 16:59:58
**/
@Service("cpdService")
......@@ -27,7 +27,7 @@ public class CpdServiceImp implements CpdService {
private static Log log = LogFactory.getLog(CpdServiceImp.class);
@Override
public boolean save(Cpd cpd) {
public boolean save(Cpd cpd) throws Exception{
// 事务操作
TransactionStatus status = transactionManager.getTransaction(DbUtil.getDbDefinition());
try {
......@@ -38,7 +38,7 @@ public class CpdServiceImp implements CpdService {
} catch (Exception e) {
log.error("error", e);
transactionManager.rollback(status);
return false;
throw new Exception("error", e);
}
}
......
......@@ -14,7 +14,7 @@ import com.brilliance.remit.db.dao.CptMapper;
import com.brilliance.remit.db.model.Cpt;
/**
This java was generated by Auto Generator.
created at time 2018-12-18 22:06:10
created at time 2018-12-21 16:59:58
**/
@Service("cptService")
......@@ -27,7 +27,7 @@ public class CptServiceImp implements CptService {
private static Log log = LogFactory.getLog(CptServiceImp.class);
@Override
public boolean save(Cpt cpt) {
public boolean save(Cpt cpt) throws Exception{
// 事务操作
TransactionStatus status = transactionManager.getTransaction(DbUtil.getDbDefinition());
try {
......@@ -38,7 +38,7 @@ public class CptServiceImp implements CptService {
} catch (Exception e) {
log.error("error", e);
transactionManager.rollback(status);
return false;
throw new Exception("error", e);
}
}
......
......@@ -14,7 +14,7 @@ import com.brilliance.remit.db.dao.FepMapper;
import com.brilliance.remit.db.model.Fep;
/**
This java was generated by Auto Generator.
created at time 2018-12-21 09:25:18
created at time 2018-12-21 16:59:58
**/
@Service("fepService")
......@@ -27,7 +27,7 @@ public class FepServiceImp implements FepService {
private static Log log = LogFactory.getLog(FepServiceImp.class);
@Override
public boolean save(Fep fep) {
public boolean save(Fep fep) throws Exception{
// 事务操作
TransactionStatus status = transactionManager.getTransaction(DbUtil.getDbDefinition());
try {
......@@ -38,7 +38,7 @@ public class FepServiceImp implements FepService {
} catch (Exception e) {
log.error("error", e);
transactionManager.rollback(status);
return false;
throw new Exception("error", e);
}
}
......
......@@ -14,7 +14,7 @@ import com.brilliance.remit.db.dao.GleMapper;
import com.brilliance.remit.db.model.Gle;
/**
This java was generated by Auto Generator.
created at time 2018-12-21 09:33:08
created at time 2018-12-21 16:59:58
**/
@Service("gleService")
......@@ -27,7 +27,7 @@ public class GleServiceImp implements GleService {
private static Log log = LogFactory.getLog(GleServiceImp.class);
@Override
public boolean save(Gle gle) {
public boolean save(Gle gle) throws Exception{
// 事务操作
TransactionStatus status = transactionManager.getTransaction(DbUtil.getDbDefinition());
try {
......@@ -38,7 +38,7 @@ public class GleServiceImp implements GleService {
} catch (Exception e) {
log.error("error", e);
transactionManager.rollback(status);
return false;
throw new Exception("error", e);
}
}
......
......@@ -20,8 +20,8 @@ import com.brilliance.remit.db.model.Pty;
import com.brilliance.remit.service.PtaService;
/**
* This java was generated by Auto Generator. created at time 2018-12-18
* 22:06:10
* This java was generated by Auto Generator. created at time 2018-12-21
* 16:59:58
**/
@Service("ptaService")
......@@ -38,7 +38,7 @@ public class PtaServiceImp implements PtaService {
private static Log log = LogFactory.getLog(PtaServiceImp.class);
@Override
public boolean save(Pta pta) {
public boolean save(Pta pta) throws Exception {
// 事务操作
TransactionStatus status = transactionManager.getTransaction(DbUtil.getDbDefinition());
try {
......@@ -49,7 +49,7 @@ public class PtaServiceImp implements PtaService {
} catch (Exception e) {
log.error("error", e);
transactionManager.rollback(status);
return false;
throw new Exception("error", e);
}
}
......
......@@ -14,7 +14,7 @@ import com.brilliance.remit.db.dao.PtsMapper;
import com.brilliance.remit.db.model.Pts;
/**
This java was generated by Auto Generator.
created at time 2018-12-18 22:06:10
created at time 2018-12-21 16:59:58
**/
@Service("ptsService")
......@@ -27,7 +27,7 @@ public class PtsServiceImp implements PtsService {
private static Log log = LogFactory.getLog(PtsServiceImp.class);
@Override
public boolean save(Pts pts) {
public boolean save(Pts pts) throws Exception{
// 事务操作
TransactionStatus status = transactionManager.getTransaction(DbUtil.getDbDefinition());
try {
......@@ -38,7 +38,7 @@ public class PtsServiceImp implements PtsService {
} catch (Exception e) {
log.error("error", e);
transactionManager.rollback(status);
return false;
throw new Exception("error", e);
}
}
......
......@@ -17,8 +17,8 @@ import com.brilliance.remit.db.model.Pty;
import com.brilliance.remit.service.PtyService;
/**
* This java was generated by Auto Generator. created at time 2018-12-18
* 22:06:10
* This java was generated by Auto Generator. created at time 2018-12-21
* 16:59:58
**/
@Service("ptyService")
......@@ -31,7 +31,7 @@ public class PtyServiceImp implements PtyService {
private static Log log = LogFactory.getLog(PtyServiceImp.class);
@Override
public boolean save(Pty pty) {
public boolean save(Pty pty) throws Exception {
// 事务操作
TransactionStatus status = transactionManager.getTransaction(DbUtil.getDbDefinition());
try {
......@@ -42,7 +42,7 @@ public class PtyServiceImp implements PtyService {
} catch (Exception e) {
log.error("error", e);
transactionManager.rollback(status);
return false;
throw new Exception("error", e);
}
}
......
......@@ -14,7 +14,7 @@ import com.brilliance.remit.db.dao.TrnMapper;
import com.brilliance.remit.db.model.Trn;
/**
This java was generated by Auto Generator.
created at time 2018-12-18 22:06:10
created at time 2018-12-21 16:59:58
**/
@Service("trnService")
......@@ -27,7 +27,7 @@ public class TrnServiceImp implements TrnService {
private static Log log = LogFactory.getLog(TrnServiceImp.class);
@Override
public boolean save(Trn trn) {
public boolean save(Trn trn) throws Exception{
// 事务操作
TransactionStatus status = transactionManager.getTransaction(DbUtil.getDbDefinition());
try {
......@@ -38,7 +38,7 @@ public class TrnServiceImp implements TrnService {
} catch (Exception e) {
log.error("error", e);
transactionManager.rollback(status);
return false;
throw new Exception("error", e);
}
}
......
......@@ -6,6 +6,6 @@ import com.brilliance.remit.db.model.${entity.name};
**/
public interface ${entity.name}Service {
public boolean save(${entity.name} ${entity.lowerName});
public boolean save(${entity.name} ${entity.lowerName}) throws Exception;
}
......@@ -27,7 +27,7 @@ public class ${entity.name}ServiceImp implements ${entity.name}Service {
private static Log log = LogFactory.getLog(${entity.name}ServiceImp.class);
@Override
public boolean save(${entity.name} ${entity.lowerName}) {
public boolean save(${entity.name} ${entity.lowerName}) throws Exception{
// 事务操作
TransactionStatus status = transactionManager.getTransaction(DbUtil.getDbDefinition());
try {
......@@ -38,7 +38,7 @@ public class ${entity.name}ServiceImp implements ${entity.name}Service {
} catch (Exception e) {
log.error("error", e);
transactionManager.rollback(status);
return false;
throw new Exception("error", e);
}
}
......
......@@ -21,12 +21,17 @@ public class Genarate {
String rootPath = "G:/work/cbpp/remit";
List<String> list = new ArrayList<String>();
list.add("gle");
/*
* list.add("bch"); list.add("cpd"); list.add("cpt"); list.add("trn");
* list.add("pts"); list.add("cbb"); list.add("cbe"); list.add("pty");
* list.add("pta"); list.add("adr");
*/
list.add("fep");
list.add("bch");
list.add("cpd");
list.add("cpt");
list.add("trn");
list.add("pts");
list.add("cbb");
list.add("cbe");
list.add("pty");
list.add("pta");
list.add("adr");
for (int i = 0; i < list.size(); i++) {
String name = list.get(i);
......
......@@ -17,6 +17,8 @@ import com.brilliance.remit.db.model.Cbe;
import com.brilliance.remit.db.model.Cpd;
import com.brilliance.remit.db.model.Cpdgrp;
import com.brilliance.remit.db.model.Cpt;
import com.brilliance.remit.db.model.Fep;
import com.brilliance.remit.db.model.Gle;
import com.brilliance.remit.db.model.Pta;
import com.brilliance.remit.db.model.Pts;
import com.brilliance.remit.db.model.Pty;
......@@ -161,6 +163,15 @@ public class HttpTest {
cpdgrp.setNomcbe(new Cbe());
cpdgrp.setNomcbb(new Cbb());
List<Fep> fepList = new ArrayList<Fep>();
fepList.add(new Fep());
cpdgrp.setFepList(fepList);
List<Gle> gleList = new ArrayList<Gle>();
gleList.add(new Gle());
cpdgrp.setGleList(gleList);
String str = new Gson().toJson(cpdgrp);
Cpdgrp cpdgrp2 = new Gson().fromJson(str, Cpdgrp.class);
System.out.println("save info=" + str);
......
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