特定服务(APP)功能修改,增加特定服务码字段

This commit is contained in:
zhangwei
2018-06-21 09:12:25 +08:00
parent 5f401d6f1f
commit 0866888337
6 changed files with 46 additions and 44 deletions

View File

@@ -4,6 +4,7 @@ import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -13,6 +14,7 @@ import com.nis.domain.Page;
import com.nis.domain.specific.ConfigGroupInfo;
import com.nis.domain.specific.SpecificServiceCfg;
import com.nis.main.ConvertTool;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.StringUtil;
import com.nis.web.dao.specific.SpecificServiceCfgDao;
import com.nis.web.service.BaseService;
@@ -65,9 +67,10 @@ public class SpecificServiceCfgService extends BaseService{
* @throws Exception
*/
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void saveOrUpdate(SpecificServiceCfg specificServiceCfg, Integer oldId) throws Exception {
public void saveOrUpdate(SpecificServiceCfg specificServiceCfg) throws Exception {
if(specificServiceCfg.getGroupId()==null || specificServiceCfg.getGroupId()==0){
specificServiceCfg.setGroupId(new ConvertTool().getGroupId());
Integer groupId = ConfigServiceUtil.getId(2, 1).get(0);
specificServiceCfg.setGroupId(groupId);
}
//新增协议分组
ConfigGroupInfo group = specificServiceCfgDao.getConfigGroupInfoByGroupId(specificServiceCfg.getGroupId());
@@ -79,26 +82,13 @@ public class SpecificServiceCfgService extends BaseService{
group.setGroupType(1);
specificServiceCfgDao.insertConfigGroupInfo(group);
}
if(oldId==null){//新增
if(specificServiceCfg.getSpecServiceId()==null){//新增
specificServiceCfg.setIsValid(1);
specificServiceCfg.setOpTime(new Date());
specificServiceCfgDao.insert(specificServiceCfg);
}else{//修改
specificServiceCfg.setOpTime(new Date());
//修改id则将其子类的parent_id一并修改
if(oldId!=specificServiceCfg.getSpecServiceId()){
//找出所有子类
List<SpecificServiceCfg> list = specificServiceCfgDao.getChildrenById(oldId);
SpecificServiceCfg se =new SpecificServiceCfg();
se.setSpecServiceId(specificServiceCfg.getSpecServiceId());
for(SpecificServiceCfg ss:list){
if(ss!=null){
ss.setParent(se);
specificServiceCfgDao.update(ss,ss.getSpecServiceId());
}
}
}
specificServiceCfgDao.update(specificServiceCfg,oldId);
specificServiceCfgDao.update(specificServiceCfg);
}
}
/**