|
@@ -34,29 +34,34 @@ import com.jtgh.yjpt.webService.WsResult;
|
|
|
*/
|
|
|
@Service
|
|
|
@WebService(targetNamespace = "http://webService.yjpt.com/", serviceName = "jyrService")
|
|
|
-@HandlerChain(file="handle-chain.xml")
|
|
|
-public class JyrWebService extends BaseController{
|
|
|
+@HandlerChain(file = "handle-chain.xml")
|
|
|
+public class JyrWebService extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private JyrService service;
|
|
|
-
|
|
|
+
|
|
|
public JyrEntity findOne(Long id) {
|
|
|
return service.findById(id);
|
|
|
}
|
|
|
-
|
|
|
- public List<JyrEntity> findAll( final String gkjyr, final CodeEntity szd,
|
|
|
- final GqEntity szgq, final String fddbr,final String sfwhqy){
|
|
|
+
|
|
|
+ public List<JyrEntity> findAll(final String gkjyr, final CodeEntity szd,
|
|
|
+ final GqEntity szgq, final String fddbr, final String sfwhqy) {
|
|
|
List<PredicateModel> filterList = new ArrayList<PredicateModel>();
|
|
|
- filterList.add(new PredicateModel("recordStatus", BaseEntity.RECORD_STATE_DELETE, Operator.NEQ));
|
|
|
- filterList.add(new PredicateModel("recordStatus", BaseEntity.RECORD_STATE_DRAFT, Operator.NEQ));
|
|
|
+ filterList.add(new PredicateModel("recordStatus",
|
|
|
+ BaseEntity.RECORD_STATE_DELETE, Operator.NEQ));
|
|
|
+ filterList.add(new PredicateModel("recordStatus",
|
|
|
+ BaseEntity.RECORD_STATE_DRAFT, Operator.NEQ));
|
|
|
if (null != gkjyr && !"".equals(gkjyr))
|
|
|
- filterList.add(new PredicateModel("gkjyr", gkjyr.trim(), Operator.LIKE));
|
|
|
+ filterList.add(new PredicateModel("gkjyr", gkjyr.trim(),
|
|
|
+ Operator.LIKE));
|
|
|
if (null != szd)
|
|
|
- filterList.add(new PredicateModel("szd.id", szd.getId(), Operator.LIKE_R));
|
|
|
+ filterList.add(new PredicateModel("szd.id", szd.getId(),
|
|
|
+ Operator.LIKE_R));
|
|
|
if (null != szgq)
|
|
|
filterList.add(new PredicateModel("szgq", szgq, Operator.EQ));
|
|
|
if (null != fddbr && !"".equals(fddbr))
|
|
|
- filterList.add(new PredicateModel("fddbr", fddbr.trim(), Operator.LIKE));
|
|
|
+ filterList.add(new PredicateModel("fddbr", fddbr.trim(),
|
|
|
+ Operator.LIKE));
|
|
|
if (null != sfwhqy && !"".equals(sfwhqy))
|
|
|
filterList.add(new PredicateModel("sfwhqy", sfwhqy, Operator.EQ));
|
|
|
Specification<JyrEntity> spec = SpecificationCreater
|
|
@@ -67,78 +72,70 @@ public class JyrWebService extends BaseController{
|
|
|
/**
|
|
|
* 保存信息
|
|
|
*/
|
|
|
- public void save(JyrEntity jyrEntity,
|
|
|
- List<JyrdcxxEntity> dcxxeditlist,
|
|
|
+ public void save(JyrEntity jyrEntity, List<JyrdcxxEntity> dcxxeditlist,
|
|
|
List<JyrdcxxEntity> dcxxdeletelist, List<BwEntity> bw_add_list,
|
|
|
List<BwEntity> bw_del_list, List<JyrckxxEntity> ckList,
|
|
|
List<JyrckxxEntity> delCkList) {
|
|
|
- jyrEntity.setAddUser(Utils.getWebServiceUser());
|
|
|
- jyrEntity.setUpdateUser(Utils.getWebServiceUser());
|
|
|
- for(JyrdcxxEntity dcEntity:dcxxeditlist){
|
|
|
- dcEntity.setAddUser(Utils.getWebServiceUser());
|
|
|
- dcEntity.setUpdateUser(Utils.getWebServiceUser());
|
|
|
- if(jyrEntity != null) {
|
|
|
- dcEntity.setSzd(jyrEntity.getSzd());
|
|
|
- dcEntity.setSzgq(jyrEntity.getSzgq());
|
|
|
- dcEntity.setQymc(jyrEntity);
|
|
|
- }
|
|
|
- }
|
|
|
- //
|
|
|
- for(BwEntity entity:bw_add_list){
|
|
|
- entity.setAddUser(Utils.getWebServiceUser());
|
|
|
- entity.setUpdateUser(Utils.getWebServiceUser());
|
|
|
- if(jyrEntity != null) {
|
|
|
- entity.setSzd(jyrEntity.getSzd());
|
|
|
- entity.setSzgq(jyrEntity.getSzgq());
|
|
|
- entity.setQymc(jyrEntity);
|
|
|
- }
|
|
|
- }
|
|
|
- for(JyrckxxEntity entity:ckList){
|
|
|
- entity.setAddUser(Utils.getWebServiceUser());
|
|
|
- entity.setUpdateUser(Utils.getWebServiceUser());
|
|
|
- if(jyrEntity != null) {
|
|
|
- entity.setSzd(jyrEntity.getSzd());
|
|
|
- entity.setGq(jyrEntity.getSzgq());
|
|
|
- entity.setSsjyr(jyrEntity);
|
|
|
- }
|
|
|
- }
|
|
|
- service.save(jyrEntity, dcxxeditlist, dcxxdeletelist, bw_add_list, bw_del_list, ckList, delCkList,"tb");
|
|
|
+ jyrEntity.setAddUser(Utils.getWebServiceUser());
|
|
|
+ jyrEntity.setUpdateUser(Utils.getWebServiceUser());
|
|
|
+ for (JyrdcxxEntity dcEntity : dcxxeditlist) {
|
|
|
+ dcEntity.setAddUser(Utils.getWebServiceUser());
|
|
|
+ dcEntity.setUpdateUser(Utils.getWebServiceUser());
|
|
|
+ }
|
|
|
+ //
|
|
|
+ for (BwEntity entity : bw_add_list) {
|
|
|
+ entity.setAddUser(Utils.getWebServiceUser());
|
|
|
+ entity.setUpdateUser(Utils.getWebServiceUser());
|
|
|
+ }
|
|
|
+ for (JyrckxxEntity entity : ckList) {
|
|
|
+ entity.setAddUser(Utils.getWebServiceUser());
|
|
|
+ entity.setUpdateUser(Utils.getWebServiceUser());
|
|
|
+ }
|
|
|
+ service.save(jyrEntity, dcxxeditlist, dcxxdeletelist, bw_add_list,
|
|
|
+ bw_del_list, ckList, delCkList, "tb");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 外部调用
|
|
|
*/
|
|
|
public JyrEntity svaeEntity(JyrEntity jyrEntity,
|
|
|
- List<JyrdcxxEntity> dcxxeditlist,
|
|
|
- List<BwEntity> bw_add_list,
|
|
|
- List<JyrckxxEntity> ckList
|
|
|
- ){
|
|
|
+ List<JyrdcxxEntity> dcxxeditlist, List<BwEntity> bw_add_list,
|
|
|
+ List<JyrckxxEntity> ckList) {
|
|
|
jyrEntity.setAddUser(Utils.getWebServiceUser());
|
|
|
jyrEntity.setUpdateUser(Utils.getWebServiceUser());
|
|
|
jyrEntity.setTbzt(Constants.NO);
|
|
|
jyrEntity = service.save(jyrEntity);
|
|
|
- for(JyrdcxxEntity dcEntity:dcxxeditlist){
|
|
|
+ for (JyrdcxxEntity dcEntity : dcxxeditlist) {
|
|
|
dcEntity.setAddUser(Utils.getWebServiceUser());
|
|
|
dcEntity.setUpdateUser(Utils.getWebServiceUser());
|
|
|
dcEntity.setQymc(jyrEntity);
|
|
|
dcEntity.setTbzt(Constants.NO);
|
|
|
}
|
|
|
//
|
|
|
- for(BwEntity entity:bw_add_list){
|
|
|
+ for (BwEntity entity : bw_add_list) {
|
|
|
entity.setAddUser(Utils.getWebServiceUser());
|
|
|
entity.setUpdateUser(Utils.getWebServiceUser());
|
|
|
entity.setTbzt(Constants.NO);
|
|
|
entity.setQymc(jyrEntity);
|
|
|
+ if (entity.getMtmc() != null && entity.getMtmc().getJyr() != null
|
|
|
+ && entity.getMtmc().getJyr().getId() == null) {
|
|
|
+ entity.getMtmc().setJyr(jyrEntity);
|
|
|
+ }
|
|
|
}
|
|
|
- for(JyrckxxEntity entity:ckList){
|
|
|
+ for (JyrckxxEntity entity : ckList) {
|
|
|
entity.setAddUser(Utils.getWebServiceUser());
|
|
|
entity.setUpdateUser(Utils.getWebServiceUser());
|
|
|
entity.setTbzt(Constants.NO);
|
|
|
entity.setSsjyr(jyrEntity);
|
|
|
+ if (entity.getMt() != null && entity.getMt().getJyr() != null
|
|
|
+ && entity.getMt().getJyr().getId() == null) {
|
|
|
+ entity.getMt().setJyr(jyrEntity);
|
|
|
+ }
|
|
|
}
|
|
|
- service.save(jyrEntity, dcxxeditlist, null, bw_add_list, null, ckList, null,"tb");
|
|
|
+ service.save(jyrEntity, dcxxeditlist, null, bw_add_list, null, ckList,
|
|
|
+ null, "tb");
|
|
|
return jyrEntity;
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 删除
|
|
@@ -146,7 +143,7 @@ public class JyrWebService extends BaseController{
|
|
|
public WsResult delete(JyrEntity jyr) {
|
|
|
WsResult ws = new WsResult();
|
|
|
try {
|
|
|
- service.delete(jyr,"tb");
|
|
|
+ service.delete(jyr, "tb");
|
|
|
ws.setResultCode(WsResult.SUCCESS);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -154,25 +151,27 @@ public class JyrWebService extends BaseController{
|
|
|
}
|
|
|
return ws;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 根据名字查找对应的经营人信息
|
|
|
*/
|
|
|
- public JyrEntity queryByName(String name){
|
|
|
+ public JyrEntity queryByName(String name) {
|
|
|
List<JyrEntity> list = service.findByName(name);
|
|
|
- if(list!=null&&list.size()>0){
|
|
|
+ if (list != null && list.size() > 0) {
|
|
|
return list.get(0);
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 保存经营人
|
|
|
*/
|
|
|
- public JyrEntity saveData(JyrEntity entity){
|
|
|
+ public JyrEntity saveData(JyrEntity entity) {
|
|
|
return service.save(entity);
|
|
|
}
|
|
|
-
|
|
|
- public List<JyrEntity> queryJyrByParams(String szd,String szgq,String gkjyr,String fddbr,String sfwhqy){
|
|
|
+
|
|
|
+ public List<JyrEntity> queryJyrByParams(String szd, String szgq,
|
|
|
+ String gkjyr, String fddbr, String sfwhqy) {
|
|
|
try {
|
|
|
|
|
|
List<PredicateModel> filterList = new ArrayList<PredicateModel>();
|
|
@@ -180,43 +179,37 @@ public class JyrWebService extends BaseController{
|
|
|
BaseEntity.RECORD_STATE_DRAFT, Operator.NEQ);
|
|
|
// 根据所在地过滤
|
|
|
if (szd != null)
|
|
|
- addNotEmptyModel(filterList, "szd.id", szd,
|
|
|
- Operator.EQ);
|
|
|
+ addNotEmptyModel(filterList, "szd.id", szd, Operator.EQ);
|
|
|
// 根据港区过滤
|
|
|
- if(szgq != null && !szgq.equals("")){
|
|
|
+ if (szgq != null && !szgq.equals("")) {
|
|
|
addNotEmptyModel(filterList, "szgq.id", szgq, Operator.EQ);
|
|
|
}
|
|
|
- if(gkjyr != null && !gkjyr.equals("")){
|
|
|
- addNotEmptyModel(filterList, "gkjyr",gkjyr, Operator.EQ);
|
|
|
- }
|
|
|
- if(sfwhqy != null && !sfwhqy.equals("")){
|
|
|
+ if (gkjyr != null && !gkjyr.equals("")) {
|
|
|
+ addNotEmptyModel(filterList, "gkjyr", gkjyr, Operator.EQ);
|
|
|
+ }
|
|
|
+ if (sfwhqy != null && !sfwhqy.equals("")) {
|
|
|
addNotEmptyModel(filterList, "sfwhqy", sfwhqy, Operator.EQ);
|
|
|
}
|
|
|
- if(fddbr != null && !fddbr.equals("")){
|
|
|
+ if (fddbr != null && !fddbr.equals("")) {
|
|
|
addNotEmptyModel(filterList, "fddbr", fddbr, Operator.LIKE);
|
|
|
}
|
|
|
Specification<JyrEntity> spec = SpecificationCreater
|
|
|
.searchByPredicateModels(filterList);
|
|
|
- List<JyrEntity> list = service
|
|
|
- .findAll(spec);
|
|
|
- if(list !=null && list.size()>0){
|
|
|
- for(JyrEntity jyrEntity :list){
|
|
|
- if(jyrEntity.getParentJyr() !=null){
|
|
|
+ List<JyrEntity> list = service.findAll(spec);
|
|
|
+ if (list != null && list.size() > 0) {
|
|
|
+ for (JyrEntity jyrEntity : list) {
|
|
|
+ if (jyrEntity.getParentJyr() != null) {
|
|
|
jyrEntity.getParentJyr().getId();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return list;
|
|
|
-
|
|
|
+
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|