package com.uas.account.dao;

import com.alibaba.druid.util.StringUtils;
import com.uas.account.core.Page;
import com.uas.account.core.Status;
import com.uas.account.entity.*;
import com.uas.account.viewmodel.UserSpaceDetailView;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.ResultSetExtractor;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.ui.ModelMap;
import org.springframework.util.CollectionUtils;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

@Repository
public class UserSpaceDaoImpl extends BaseDao implements UserSpaceDao {

	@Override
	public UserSpace save(UserSpace userSpace) {
		if (userSpace.getId() == null && !StringUtils.isEmpty(userSpace.getUid())) {
			Long id = jdbcTemplate.queryForObject("select min(id) from ac$userspaces where appId=? and uid_=?", Long.class,
					userSpace.getAppId(), userSpace.getUid());
			userSpace.setId(id);
		}
		if (userSpace.getId() == null) {
			userSpace.setId(generateId("ac$us_seq"));
			jdbcTemplate.update("insert into ac$userspaces(id,appId,uid_,name,dialectUID,userCount) values (?,?,?,?,?,?)",
					userSpace.getId(), userSpace.getAppId(), userSpace.getUid(), userSpace.getName(), userSpace.getDialectUID(),
					userSpace.getUserCount());
		} else {
			jdbcTemplate.update("update ac$userspaces set appId=?,uid_=?,name=?,dialectUID=?,userCount=? where id=?", userSpace.getAppId(),
					userSpace.getUid(), userSpace.getName(), userSpace.getDialectUID(), userSpace.getUserCount(), userSpace.getId());
		}
		return userSpace;
	}

	@Override
	public UserSpace findOne(String appId, String uid) {
		try {
			List<UserSpace> spaces = jdbcTemplate.query(
					"select appId,id,uid_ as \"UID\",dialectUID,name,userCount from ac$userspaces where appId=? and uid_=?",
					new BeanPropertyRowMapper<UserSpace>(UserSpace.class), appId, uid);
			return CollectionUtils.isEmpty(spaces) ? null : spaces.get(0);
		} catch (EmptyResultDataAccessException e) {
			return null;
		}
	}

	@Override
	public UserSpace findDialectOne(String appId, String dialectUID) {
		try {
			List<UserSpace> spaces = jdbcTemplate.query(
					"select appId,id,uid_ as \"UID\",dialectUID,name,userCount from ac$userspaces where appId=? and dialectUID=?",
					new BeanPropertyRowMapper<UserSpace>(UserSpace.class), appId, dialectUID);
			return CollectionUtils.isEmpty(spaces) ? null : spaces.get(0);
		} catch (EmptyResultDataAccessException e) {
			return null;
		}
	}

	@Override
	public List<UserSpace> findByUID(String uid) {
		try {
			return jdbcTemplate.query(
					"select appId,id,uid_ as \"UID\",dialectUID,name,userCount from ac$userspaces where uid_=? order by appId",
					new BeanPropertyRowMapper<UserSpace>(UserSpace.class), uid);
		} catch (EmptyResultDataAccessException e) {
			return null;
		}
	}

	@Override
	public UserSpace findOne(long id) {
		try {
			return jdbcTemplate.queryForObject("select appId,id,uid_ as \"UID\",dialectUID,name,userCount from ac$userspaces where id=?",
					new BeanPropertyRowMapper<UserSpace>(UserSpace.class), id);
		} catch (EmptyResultDataAccessException e) {
			return null;
		}
	}

	@Override
	public Page<UserSpace> findAll(String appId, int pageNumber, int pageSize) {
		StringBuffer countSql = new StringBuffer("select count(1) from ac$userspaces where 1=1");
		StringBuffer querySql = new StringBuffer(
				"select * from (select t.*,rownum r from (select appId,id,uid_ as \"UID\",dialectUID,name,userCount from ac$userspaces where 1=1");
		Object[] args = new Object[] {};
		if (!StringUtils.isEmpty(appId)) {
			countSql.append(" and appId=?");
			querySql.append(" and appId=?");
			args = Arrays.copyOf(args, args.length + 1);
			args[args.length - 1] = appId;
		}
		int total = count(countSql.toString(), args);

		querySql.append(" order by appId,uid) t where rownum <= ?) where r >= ?");
		args = Arrays.copyOf(args, args.length + 2);
		args[args.length - 2] = pageNumber * pageSize;
		args[args.length - 1] = (pageNumber - 1) * pageSize + 1;
		List<UserSpace> content = null;
		try {
			content = jdbcTemplate.query(querySql.toString(), new BeanPropertyRowMapper<UserSpace>(UserSpace.class), args);
		} catch (EmptyResultDataAccessException e) {

		}
		return new Page<UserSpace>(pageNumber, pageSize, content, total);
	}

	@Override
	public UserSpaceFailed saveFailed(UserSpaceFailed failed) {
		failed.setId(generateId("ac$us$fail_seq"));
		jdbcTemplate.update("insert into ac$us$fail(id,callTime,errMsg,fromId,fromAppId,toAppId) values (?,?,?,?,?,?)", failed.getId(),
				failed.getCallTime(), failed.getErrMsg(), failed.getFromId(), failed.getFromAppId(), failed.getToAppId());
		return failed;
	}

	@Override
	public UserSpaceDetail save(UserSpaceDetail userSpaceDetail) {
		int count = 0;
		if (userSpaceDetail.getId() != null) {
			count = count("from ac$us$detail where id=?", userSpaceDetail.getId());
		} else {
			count = count("from ac$us$detail where businessCode=?", userSpaceDetail.getBusinessCode());
		}
		if (count == 0) {
			// 在这里设置ID，需要返回给后面用到
			userSpaceDetail.setId(generateId("ac$us$detail_seq"));
			jdbcTemplate
					.update("insert into ac$us$detail(id,name,shortName,businessCode,address,corporation,fax,tel,registerDate,type,url,area,industry,domain,adminName,adminTel,adminEmail,status,approve_status,applyApps,businessCodeImage,province,city,district,street,logoImage,contactMan,contactTel,contactEmail,profession,tags) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
							userSpaceDetail.getId(), userSpaceDetail.getName(), userSpaceDetail.getShortName(),
							userSpaceDetail.getBusinessCode(), userSpaceDetail.getAddress(), userSpaceDetail.getCorporation(),
							userSpaceDetail.getFax(), userSpaceDetail.getTel(), new Date(userSpaceDetail.getRegisterDate()),
							userSpaceDetail.getType(), userSpaceDetail.getUrl(), userSpaceDetail.getArea(), userSpaceDetail.getIndustry(),
							userSpaceDetail.getDomain(), userSpaceDetail.getAdminName(), userSpaceDetail.getAdminTel(),
							userSpaceDetail.getAdminEmail(), userSpaceDetail.getStatus(), userSpaceDetail.getApproveStatus(),
							userSpaceDetail.getApplyApps(), userSpaceDetail.getBusinessCodeImage(), userSpaceDetail.getProvince(),
							userSpaceDetail.getCity(), userSpaceDetail.getDistrict(), userSpaceDetail.getStreet(),
							userSpaceDetail.getLogoImage(), userSpaceDetail.getContactMan(), userSpaceDetail.getContactTel(),
                            userSpaceDetail.getContactEmail(), userSpaceDetail.getProfession(), userSpaceDetail.getTags());
		} else {
			jdbcTemplate
					.update("update ac$us$detail set name=?,shortName=?,address=?,corporation=?,fax=?,tel=?,type=?,url=?,area=?,industry=?,domain=?,adminName=?,adminTel=?,adminEmail=?,status=?,approve_status=?,businessCodeImage=?,errMsg=?,province=?,city=?,district=?,street=?,logoImage=?,businessCode=?,contactMan=?,contactTel=?,contactEmail=?,profession=?,tags=? where id=?",
							userSpaceDetail.getName(), userSpaceDetail.getShortName(), userSpaceDetail.getAddress(),
							userSpaceDetail.getCorporation(), userSpaceDetail.getFax(), userSpaceDetail.getTel(),
							userSpaceDetail.getType(), userSpaceDetail.getUrl(), userSpaceDetail.getArea(), userSpaceDetail.getIndustry(),
							userSpaceDetail.getDomain(), userSpaceDetail.getAdminName(), userSpaceDetail.getAdminTel(),
							userSpaceDetail.getAdminEmail(), userSpaceDetail.getStatus(), userSpaceDetail.getApproveStatus(),
							userSpaceDetail.getBusinessCodeImage(), userSpaceDetail.getErrMsg(), userSpaceDetail.getProvince(),
							userSpaceDetail.getCity(), userSpaceDetail.getDistrict(), userSpaceDetail.getStreet(),
							userSpaceDetail.getLogoImage(), userSpaceDetail.getBusinessCode(), userSpaceDetail.getContactMan(),
                            userSpaceDetail.getContactTel(), userSpaceDetail.getContactEmail(), userSpaceDetail.getProfession(),
							userSpaceDetail.getTags(), userSpaceDetail.getId());
		}
		return userSpaceDetail;
	}

	@Override
	public UserSpaceDetail findByBusinessCode(String businessCode) {
		try {
			List<UserSpaceDetail> list = jdbcTemplate
					.query("select * from ac$us$detail where businessCode=?", getRowMapper(), businessCode);
			return CollectionUtils.isEmpty(list) ? null : list.get(0);
		} catch (EmptyResultDataAccessException e) {
			return null;
		}
	}

	@Override
	public UserSpaceDetail findById(Long id) {
		try {
			return jdbcTemplate.queryForObject("select * from ac$us$detail where id=?", getRowMapper(), id);
		} catch (EmptyResultDataAccessException e) {
			return null;
		}
	}

	@Override
	public UserSpaceDetail findByDomain(String domain) {
		try {
			List<UserSpaceDetail> list = jdbcTemplate.query("select * from ac$us$detail where domain=? and businessCode is not null",
					getRowMapper(), domain);
			return CollectionUtils.isEmpty(list) ? null : list.get(0);
		} catch (EmptyResultDataAccessException e) {
			return null;
		}
	}

	private RowMapper<UserSpaceDetail> getRowMapper() {
		return new RowMapper<UserSpaceDetail>() {

			@Override
			public UserSpaceDetail mapRow(ResultSet rs, int rowNum) throws SQLException {
				UserSpaceDetail detail = new UserSpaceDetail();
				detail.setId(rs.getLong("id"));
				detail.setAddress(rs.getString("address"));
				detail.setAdminEmail(rs.getString("adminEmail"));
				detail.setAdminName(rs.getString("adminName"));
				detail.setAdminTel(rs.getString("adminTel"));
				detail.setApplyApps(rs.getString("applyApps"));
				detail.setArea(rs.getString("area"));
				detail.setBusinessCode(rs.getString("businessCode"));
				detail.setBusinessCodeImage(rs.getString("businessCodeImage"));
				detail.setCity(rs.getString("city"));
				detail.setCorporation(rs.getString("corporation"));
				detail.setDistrict(rs.getString("district"));
				detail.setDomain(rs.getString("domain"));
				detail.setErrMsg(rs.getString("errMsg"));
				detail.setFax(rs.getString("fax"));
				detail.setIndustry(rs.getString("industry"));
				detail.setName(rs.getString("name"));
				detail.setProvince(rs.getString("province"));
				Date registerDate = rs.getDate("registerDate");
				if (registerDate != null)
					detail.setRegisterDate(registerDate.getTime());
				detail.setShortName(rs.getString("shortName"));
				detail.setStatus(rs.getInt("status"));
				detail.setStreet(rs.getString("street"));
				detail.setTel(rs.getString("tel"));
				detail.setType(rs.getString("type"));
				detail.setUrl(rs.getString("url"));
				detail.setContactMan(rs.getString("contactMan"));
                detail.setContactEmail(rs.getString("contactEmail"));
                detail.setContactTel(rs.getString("contactTel"));
                detail.setProfession(rs.getString("profession"));
                detail.setTags(rs.getString("tags"));
				if (!StringUtils.isEmpty(rs.getString("uu"))) {
					detail.setUu(Long.valueOf(rs.getString("uu")));
				}
				return detail;
			}

		};
	}

	@Override
	public UserSpaceDetail findByName(String name) {
		try {
			List<UserSpaceDetail> list = jdbcTemplate.query("select * from ac$us$detail where name=? and businessCode is not null",
					getRowMapper(), name);
			return CollectionUtils.isEmpty(list) ? null : list.get(0);
		} catch (EmptyResultDataAccessException e) {
			return null;
		}
	}

	@Override
	public Page<UserSpaceDetail> findAll(int pageNumber, int pageSize, Integer status) {
		StringBuffer countSql = new StringBuffer("select count(1) from ac$us$detail where 1=1");
		StringBuffer querySql = new StringBuffer("select * from (select t.*,rownum r from (select * from ac$us$detail where 1=1");
		Object[] args = new Object[] {};
		if (null != status) {
			countSql.append(" and status=?");
			querySql.append(" and status=?");
			args = Arrays.copyOf(args, args.length + 1);
			args[args.length - 1] = status;
		}
		int total = count(countSql.toString(), args);

		querySql.append(" order by registerDate,name) t where rownum <= ?) where r >= ?");
		args = Arrays.copyOf(args, args.length + 2);
		args[args.length - 2] = pageNumber * pageSize;
		args[args.length - 1] = (pageNumber - 1) * pageSize + 1;
		List<UserSpaceDetail> content = null;
		try {
			content = jdbcTemplate.query(querySql.toString(), getRowMapper(), args);
		} catch (EmptyResultDataAccessException e) {

		}
		return new Page<UserSpaceDetail>(pageNumber, pageSize, content, total);
	}

	@Override
	public void delete(UserSpaceDetail userSpaceDetail) {
		jdbcTemplate.update("delete from ac$us$detail where businessCode=?", userSpaceDetail.getBusinessCode());
	}

	@Override
	public void delete(UserSpace userSpace) {
		jdbcTemplate.update("delete from ac$userspaces where id=?", userSpace.getId());
	}

	@Override
	public Page<UserSpaceDetailView> findAllView(int pageNumber, int pageSize, String name, String businessCode, Integer status) {
		StringBuffer countSql = new StringBuffer("select count(1) from ac$us$detail where 1=1");
		StringBuffer querySql = new StringBuffer(
				"select * from (select t.*,rownum r from (select businessCode,name,registerDate,shortName,id from ac$us$detail where 1=1");
		Object[] args = new Object[] {};
		if (null != status) {
			countSql.append(" and status=?");
			querySql.append(" and status=?");
			args = Arrays.copyOf(args, args.length + 1);
			args[args.length - 1] = status;
		}
		if (!StringUtils.isEmpty(name)) {
			countSql.append(" and name like '%").append(name).append("%'");
			querySql.append(" and name like '%").append(name).append("%'");
		}
		if (!StringUtils.isEmpty(businessCode)) {
			countSql.append(" and businessCode=?");
			querySql.append(" and businessCode=?");
			args = Arrays.copyOf(args, args.length + 1);
			args[args.length - 1] = businessCode;
		}
		int total = count(countSql.toString(), args);

		querySql.append(" order by registerDate desc,name) t where rownum <= ?) where r >= ?");
		args = Arrays.copyOf(args, args.length + 2);
		args[args.length - 2] = pageNumber * pageSize;
		args[args.length - 1] = (pageNumber - 1) * pageSize + 1;
		List<UserSpaceDetailView> content = null;
		try {
			content = jdbcTemplate.query(querySql.toString(), new BeanPropertyRowMapper<UserSpaceDetailView>(UserSpaceDetailView.class),
					args);
		} catch (EmptyResultDataAccessException e) {

		}
		return new Page<UserSpaceDetailView>(pageNumber, pageSize, content, total);
	}

	@Override
	public Page<UserSpaceDetailView> findAllView(int pageNumber, int pageSize, String name, String businessCode, String address) {
		StringBuffer countSql = new StringBuffer("select count(1) from ac$us$detail where 1=1");
		StringBuffer querySql = new StringBuffer(
				"select * from (select t.*,rownum r from (select businessCode,name,registerDate,shortName,id,status from ac$us$detail where 1=1");
		Object[] args = new Object[] {};
		if (!StringUtils.isEmpty(name)) {
			countSql.append(" and upper(name) like upper('%").append(name).append("%')");
			querySql.append(" and upper(name) like upper('%").append(name).append("%')");
		}
		if (!StringUtils.isEmpty(businessCode)) {
			countSql.append(" and businessCode=?");
			querySql.append(" and businessCode=?");
			args = Arrays.copyOf(args, args.length + 1);
			args[args.length - 1] = businessCode;
		}
		if (!StringUtils.isEmpty(address)) {
			countSql.append(" and address like '%").append(address).append("%'");
			querySql.append(" and address like '%").append(address).append("%'");
		}
		int total = count(countSql.toString(), args);

		querySql.append(" order by registerDate desc,name) t where rownum <= ?) where r >= ?");
		args = Arrays.copyOf(args, args.length + 2);
		args[args.length - 2] = pageNumber * pageSize;
		args[args.length - 1] = (pageNumber - 1) * pageSize + 1;
		List<UserSpaceDetailView> content = null;
		try {
			content = jdbcTemplate.query(querySql.toString(), new BeanPropertyRowMapper<UserSpaceDetailView>(UserSpaceDetailView.class),
					args);
		} catch (EmptyResultDataAccessException e) {

		}
		return new Page<UserSpaceDetailView>(pageNumber, pageSize, content, total);
	}

	@Override
	public int getUserSpaceDetailCount() {
		return count("from ac$us$detail where status=?", Status.ENABLED.value());
	}

	@Override
	public ModelMap getUserSpaceAppCount() {
		return jdbcTemplate
				.query("select ac$apps.description,count(1) c from ac$userspaces,ac$apps where ac$userspaces.appId=ac$apps.uid_ group by ac$apps.description order by count(1) desc",
						new ResultSetExtractor<ModelMap>() {

							@Override
							public ModelMap extractData(ResultSet rs) throws SQLException, DataAccessException {
								ModelMap map = new ModelMap();
								while (rs.next()) {
									map.put(rs.getString(1), rs.getInt(2));
								}
								return map;
							}

						});
	}

	@Override
	public Page<UserSpaceDetail> findByKeyword(String keyword, int pageNumber, int pageSize) {
		StringBuffer countSql = new StringBuffer("select count(1) from ac$us$detail where 1=1");
		StringBuffer querySql = new StringBuffer("select * from (select t.*,rownum r from (select * from ac$us$detail where 1=1");
		Object[] args = new Object[] {};
		if (!StringUtils.isEmpty(keyword)) {
			querySql.append(" and upper(name) like upper('%").append(keyword).append("%') or upper(shortname) like upper('%")
					.append(keyword).append("%') or upper(adminname) like upper('%").append(keyword).append("%')");
			countSql.append(" and upper(name) like upper('%").append(keyword).append("%') or upper(shortname) like upper('%")
					.append(keyword).append("%') or upper(adminname) like upper('%").append(keyword).append("%')");
		}
		int total = count(countSql.toString(), args);

		querySql.append(" order by registerDate desc,name) t where rownum <= ?) where r >= ?");
		args = Arrays.copyOf(args, args.length + 2);
		args[args.length - 2] = pageNumber * pageSize;
		args[args.length - 1] = (pageNumber - 1) * pageSize + 1;
		List<UserSpaceDetail> content = null;
		try {
			content = jdbcTemplate.query(querySql.toString(), getRowMapper(), args);
		} catch (EmptyResultDataAccessException e) {

		}
		return new Page<UserSpaceDetail>(pageNumber, pageSize, content, total);
	}

	@Override
	public List<UserSpaceDetail> findAll(List<Long> ids) {
		MapSqlParameterSource parameters = new MapSqlParameterSource("ids", ids);
		// 不要直接拼SQL，防参数过多出错
		NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate);
		return namedParameterJdbcTemplate.query("select * from v$ac$us$detail where id in (:ids)", parameters, getRowMapper());
	}

	@Override
	public List<UserSpaceDetailInfo> findByTel(List<String> tels) {
		MapSqlParameterSource parameters = new MapSqlParameterSource("tels", tels);
		// 不要直接拼SQL，防参数过多出错
		NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate);
		return namedParameterJdbcTemplate.query(
				"select a.name company, a.address address,u.name username,u.uid_ usertel,u.dialectuid imid from ac$us$detail a left join ac$users u on a.admintel = u.uid_ where a.businesscode in (select distinct(spaceuid) from ac$users where uid_ in (:tels) and spaceuid is not null) and u.appid = 'im'",
				parameters, new BeanPropertyRowMapper<UserSpaceDetailInfo>(UserSpaceDetailInfo.class));
	}

	@Override
	public List<UserSpaceDetailInfo> findUserByTel(List<String> tels) {
		List<UserSpaceDetailInfo> spaces = new ArrayList<>();
		for (String tel : tels) {
			String sql = "select a.name company, a.address address,u.name username,u.uid_ usertel,u.dialectuid imid from ac$us$detail a,ac$users u where a.businesscode = (select min(spaceuid) from ac$users a where a.uid_ = ? and a.spaceuid is not null group by (a.uid_)) and u.uid_ = ? and u.appid = 'im'";
			List<UserSpaceDetailInfo> list = jdbcTemplate.query(sql,
					new BeanPropertyRowMapper<UserSpaceDetailInfo>(UserSpaceDetailInfo.class), tel, tel);
			UserSpaceDetailInfo space = CollectionUtils.isEmpty(list) ? null : list.get(0);
			if (space == null) {
				space = new UserSpaceDetailInfo();
				space.setUsertel(tel);
				space.setCompany(" ");
				space.setAddress(" ");
				space.setImid(" ");
				space.setUsername(" ");
			}
			spaces.add(space);
		}
		return spaces;
	}

	@Override
	public List<UserSpaceDetailInfo> findByKeyword(String keyword, Integer pageNumber) {
		Integer pageSize = 30;// 设置默认大小30
		if (pageNumber < 1) {
			pageNumber = 1;
		}
		StringBuffer querySql = new StringBuffer(
				"select * from (select t.*,rownum r from (select  a.name company, a.address address,u.name username,u.uid_ usertel,u.dialectuid imid from ac$us$detail a left join ac$users u on a.admintel = u.uid_ where 1=1");
		Object[] args = new Object[] {};
		if (!StringUtils.isEmpty(keyword)) {
			querySql.append(" and upper(a.name) like upper('%").append(keyword).append("%')");
		}
		querySql.append("and u.appid = 'im') t  where rownum <= ?) where r >= ?");
		args = Arrays.copyOf(args, args.length + 2);
		args[args.length - 2] = pageNumber * pageSize;
		args[args.length - 1] = (pageNumber - 1) * pageSize + 1;
		List<UserSpaceDetailInfo> content = null;
		try {
			content = jdbcTemplate.query(querySql.toString(),
					new BeanPropertyRowMapper<UserSpaceDetailInfo>(UserSpaceDetailInfo.class), args);
		} catch (EmptyResultDataAccessException e) {

		}
		return content;
	}

	@Override
	public void update(UserSpace space, Long id) {
		if (id != null)
			jdbcTemplate.update("update ac$userspaces set appId=?,uid_=?,name=?,dialectUID=?,userCount=? where id=?",
					space.getAppId(), space.getUid(), space.getName(), space.getDialectUID(), space.getUserCount(), id);
	}

	@SuppressWarnings({ "deprecation" })
	@Override
	public Integer findHrAccount(String businessCode) {
		Integer count = 0;
		if (null != businessCode) {
			String sql = "select count(1) from ac$users where spaceuid = '" + businessCode + "' and nvl(hr, 0) = 1";
			count = jdbcTemplate.queryForInt(sql);
		}
		return count;
	}

    @Override
    public void updateInfo(User hrInfo, boolean flag) {
	    Integer status = flag ? 1 : 0;
        jdbcTemplate.update("update ac$users set hr = " + status + "where spaceuid = '" + hrInfo.getSpaceUID() + "' and uid_ = '" + hrInfo.getUid() + "' and appid = 'b2b'");
    }

}
