| | |
| | | import com.yeshi.fanli.dao.config.SystemSecondProblemDao;
|
| | | import com.yeshi.fanli.dao.mybatis.SystemClientParamsMapper;
|
| | | import com.yeshi.fanli.entity.admin.SystemClientParamsAdmin;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.entity.system.CustomerContent;
|
| | | import com.yeshi.fanli.entity.system.CustomerName;
|
| | | import com.yeshi.fanli.entity.system.System;
|
| | | import com.yeshi.fanli.entity.system.SystemClientParams;
|
| | | import com.yeshi.fanli.service.inter.config.BusinessSystemService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemClientParamsService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | | public class SystemClientParamsServiceImpl implements SystemClientParamsService {
|
| | |
| | | private SystemHelpListDao systemHelpListDao;
|
| | |
|
| | | @Resource
|
| | | private BusinessSystemService businessSystemService;
|
| | | |
| | | @Resource
|
| | | private SystemSecondProblemDao systemSecondProblemDao;
|
| | | @Cacheable(value = "clientParamCache", key = "#id")
|
| | | public List<SystemClientParams> getSystemClientParamsBySystemId(long id) {
|
| | |
| | | return systemClientParamsDao.list("from SystemClientParams scp where scp.system.id=?",
|
| | | new Serializable[] { id });
|
| | | }
|
| | | |
| | | @Cacheable(value = "clientParamCache", key = "#id+'-'+#version")
|
| | | public List<SystemClientParams> getSystemClientParamsBySystemId(long id,int version) {
|
| | |
|
| | | public List<SystemClientParamsAdmin> getAdminList(System system, String key) {
|
| | | return systemClientParamsDao.list("from SystemClientParams scp where scp.system.id=?",
|
| | | new Serializable[] { id });
|
| | | }
|
| | |
|
| | | public List<SystemClientParamsAdmin> getAdminList(BusinessSystem system, String key) {
|
| | | List<SystemClientParams> list;
|
| | | List<SystemClientParamsAdmin> adminList = new ArrayList<SystemClientParamsAdmin>();
|
| | | if (system == null) {
|
| | |
| | | list = systemClientParamsDao.list(hqlb.toString());
|
| | | }
|
| | | }
|
| | | |
| | | SystemClientParamsAdmin scpa = null;
|
| | | for (SystemClientParams scp : list) {
|
| | | scpa = new SystemClientParamsAdmin(scp);
|
| | |
| | | }
|
| | |
|
| | | @Transactional
|
| | | public void addSystemClientParamsList(SystemClientParams scp, List<System> list) throws Exception {
|
| | | public void addSystemClientParamsList(SystemClientParams scp, List<BusinessSystem> list) throws Exception {
|
| | | SystemClientParams nscp = null;
|
| | | for (System system : list) {
|
| | | for (BusinessSystem system : list) {
|
| | | nscp = new SystemClientParams();
|
| | | nscp.setKey(scp.getKey());
|
| | | nscp.setName(scp.getName());
|
| | |
| | | }
|
| | |
|
| | | @Transactional
|
| | | public void deleteSystemClientParams(final SystemClientParams scp, final System system) {
|
| | | public void deleteSystemClientParams(final SystemClientParams scp, final BusinessSystem system) {
|
| | | systemClientParamsDao.excute(new HibernateCallback() {
|
| | | public Object doInHibernate(Session session) throws HibernateException {
|
| | | Query query = session.createQuery(
|
| | |
| | | });
|
| | | }
|
| | |
|
| | | public void addSystemClientParams(SystemClientParams scp, System system) {
|
| | | public void addSystemClientParams(SystemClientParams scp, BusinessSystem system) {
|
| | | scp.setSystem(system);
|
| | | systemClientParamsDao.create(scp);
|
| | | }
|
| | |
| | | List<SystemClientParams> list = query.list();
|
| | | SystemClientParamsAdmin scpa = new SystemClientParamsAdmin(scp);
|
| | | for (SystemClientParams fscp : list) {
|
| | | System system = fscp.getSystem();
|
| | | BusinessSystem system = fscp.getSystem();
|
| | | if (scpa.getSystemList().contains(system)) {
|
| | | continue;
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public SystemClientParams getSystemClientParamsBySystemAndKey(System system, String key) {
|
| | | public SystemClientParams getSystemClientParamsBySystemAndKey(BusinessSystem system, String key) {
|
| | | List<SystemClientParams> list = systemClientParamsDao.list(
|
| | | "from SystemClientParams scp where scp.system.id=? and scp.key=?",
|
| | | new Serializable[] { system.getId(), key });
|
| | |
| | | return systemClientParamsMapper.contactCustomerService(title);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public List<SystemClientParams> listQuery(int start, int count, String key, Long systemId) {
|
| | | |
| | | List<SystemClientParams> list = null;
|
| | | |
| | | if (systemId == null) {
|
| | | |
| | | if (StringUtil.isNullOrEmpty(key)) {
|
| | | list = systemClientParamsDao.list("from SystemClientParams scp", start, count, null);
|
| | | } else {
|
| | | list = systemClientParamsDao.list("from SystemClientParams scp where (scp.name like ? or scp.key like ?) ",
|
| | | start, count, new Serializable[] { "%" + key + "%" ,"%" + key + "%"});
|
| | | }
|
| | | |
| | | } else {
|
| | | |
| | | if (StringUtil.isNullOrEmpty(key)) {
|
| | | list = systemClientParamsDao.list("from SystemClientParams scp where scp.system.id = ? ",
|
| | | start, count, new Serializable[] {systemId});
|
| | | |
| | | } else {
|
| | | list = systemClientParamsDao.list(
|
| | | "from SystemClientParams scp where scp.system.id = ? and (scp.name like ? or scp.key like ?)",
|
| | | start, count, new Serializable[] {systemId, "%" + key + "%" ,"%" + key + "%"});
|
| | | }
|
| | | }
|
| | | |
| | | return list;
|
| | | }
|
| | |
|
| | |
|
| | | |
| | | @Override
|
| | | public long countQuery(String key, Long systemId) {
|
| | | |
| | | if (systemId == null) {
|
| | | |
| | | if (StringUtil.isNullOrEmpty(key)) {
|
| | | return systemClientParamsDao.getCount(" select count(id) from SystemClientParams scp");
|
| | | } else {
|
| | | return systemClientParamsDao.getCount(" select count(id) from SystemClientParams scp where (scp.name like ? or scp.key like ?) ",
|
| | | new Serializable[] { "%" + key + "%" ,"%" + key + "%"});
|
| | | }
|
| | | |
| | | } else {
|
| | | |
| | | if (StringUtil.isNullOrEmpty(key)) {
|
| | | return systemClientParamsDao.getCount(" select count(id) from SystemClientParams scp where scp.system.id = ? ",
|
| | | new Serializable[] {systemId});
|
| | | |
| | | } else {
|
| | | return systemClientParamsDao.getCount(
|
| | | " select count(id) from SystemClientParams scp where scp.system.id = ? and (scp.name like ? or scp.key like ?)",
|
| | | new Serializable[] {systemId, "%" + key + "%" ,"%" + key + "%"});
|
| | | }
|
| | | }
|
| | | |
| | | }
|
| | | |
| | | |
| | | @Transactional
|
| | | @Override
|
| | | public void saveAdd(SystemClientParams scp, List<Long> listId) throws Exception {
|
| | | |
| | | if (listId == null || listId.size() == 0) {
|
| | | return;
|
| | | }
|
| | | |
| | | SystemClientParams nscp = null;
|
| | | for (Long systemId : listId) {
|
| | | BusinessSystem system = new BusinessSystem(systemId);
|
| | | nscp = new SystemClientParams();
|
| | | nscp.setKey(scp.getKey());
|
| | | nscp.setName(scp.getName());
|
| | | nscp.setValue(scp.getValue());
|
| | | nscp.setSystem(system);
|
| | | nscp.setUpdatetime(java.lang.System.currentTimeMillis());
|
| | | systemClientParamsDao.create(nscp);
|
| | | }
|
| | | }
|
| | | |
| | | @Override
|
| | | public void update(SystemClientParams systemClientParams) {
|
| | | systemClientParamsDao.update(systemClientParams);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<SystemClientParams> getById(long id) {
|
| | | return systemClientParamsDao.list("from SystemClientParams scp where scp.id=?",
|
| | | new Serializable[] { id });
|
| | | }
|
| | | |
| | | @Transactional
|
| | | @Override
|
| | | public void deleteBatchByPrimaryKey(List<Long> ids) {
|
| | | for (Long id: ids) {
|
| | | systemClientParamsDao.excute(new HibernateCallback() {
|
| | | public Object doInHibernate(Session session) throws HibernateException {
|
| | | Query query = session.createQuery("delete from SystemClientParams scp where scp.id= ?");
|
| | | query.setParameter(0, id);
|
| | | return query.executeUpdate();
|
| | | }
|
| | | });
|
| | | }
|
| | | }
|
| | | }
|