0e74cd087babb88921bb3493607ad5423153fcde.svn-base 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  1. package cn.com.goldenwater.dcproj.service.impl.base;
  2. import cn.com.goldenwater.core.service.AbstractCrudService;
  3. import cn.com.goldenwater.dcproj.dao.AttAdXBaseDao;
  4. import cn.com.goldenwater.dcproj.dao.BisInspSecsurveyVlgDao;
  5. import cn.com.goldenwater.dcproj.dto.AttAdXTownDto;
  6. import cn.com.goldenwater.dcproj.dto.AttAdXVillageDto;
  7. import cn.com.goldenwater.dcproj.dto.BisNewDcuserRelVillDto;
  8. import cn.com.goldenwater.dcproj.model.AttAdXBase;
  9. import cn.com.goldenwater.dcproj.model.AttAdXBaseNode;
  10. import cn.com.goldenwater.dcproj.model.BisZhejiangDcuserRelVill;
  11. import cn.com.goldenwater.dcproj.model.TCListBean;
  12. import cn.com.goldenwater.dcproj.param.AttAdXBaseParam;
  13. import cn.com.goldenwater.dcproj.param.AttCwsBaseListParam;
  14. import cn.com.goldenwater.dcproj.param.AttCwsBaseListParamNew;
  15. import cn.com.goldenwater.dcproj.param.QueryTCListParam;
  16. import cn.com.goldenwater.dcproj.service.AttAdXBaseService;
  17. import cn.com.goldenwater.dcproj.utils.AMapUtil;
  18. import cn.com.goldenwater.dcproj.utils.BeanUtil;
  19. import cn.com.goldenwater.dcproj.utils.DateUtils;
  20. import cn.com.goldenwater.dcproj.utils.GeoUtil;
  21. import cn.com.goldenwater.dcproj.utils.expExcel.ExcelExport;
  22. import cn.com.goldenwater.dcproj.utils.expExcel.ExportAbstract;
  23. import cn.com.goldenwater.id.util.UuidUtil;
  24. import cn.com.goldenwater.util.common.SqlUtils;
  25. import com.github.pagehelper.Page;
  26. import com.github.pagehelper.PageHelper;
  27. import com.github.pagehelper.PageInfo;
  28. import org.apache.commons.lang3.StringUtils;
  29. import org.apache.commons.lang3.math.NumberUtils;
  30. import org.springframework.beans.factory.annotation.Autowired;
  31. import org.springframework.stereotype.Service;
  32. import org.springframework.transaction.annotation.Transactional;
  33. import javax.servlet.http.HttpServletResponse;
  34. import java.io.IOException;
  35. import java.util.ArrayList;
  36. import java.util.List;
  37. import java.util.Map;
  38. /**
  39. * @author zhengdafei
  40. * @date 2019-2-22
  41. */
  42. @Service
  43. @Transactional(rollbackFor = Exception.class)
  44. public class AttAdXBaseServiceImpl extends AbstractCrudService<AttAdXBase, AttAdXBaseParam> implements AttAdXBaseService {
  45. @Autowired
  46. private AttAdXBaseDao attAdXBaseDao;
  47. @Autowired
  48. private BisInspSecsurveyVlgDao bisInspSecsurveyVlgDao;
  49. public AttAdXBaseServiceImpl(AttAdXBaseDao attAdXBaseDao) {
  50. super(attAdXBaseDao);
  51. this.attAdXBaseDao = attAdXBaseDao;
  52. }
  53. @Override
  54. public AttAdXBase add(AttAdXBase p) throws Exception {
  55. String uuid = UuidUtil.uuid();
  56. String now = DateUtils.getTodayYMDHMS();
  57. p.setEffDate(now);
  58. p.setUpdDate(now);
  59. p.setGuid(uuid);
  60. p.setAdSign("1");
  61. p.setIsReport("0");
  62. String type = "village";
  63. if (StringUtils.isNotBlank(p.getAdFcode())) {
  64. String maxAdCode = attAdXBaseDao.getMaxVillageCode(p.getAdFcode()); //根据最大code生成adcode
  65. Long step = 1L;
  66. if (p.getAdFcode().indexOf("000000") > -1) { //新增乡镇
  67. step = 1000L;
  68. type = "town";
  69. }
  70. // if(maxAdCode!=null){
  71. Long mCcode = 0L;
  72. if (maxAdCode == null) {
  73. mCcode = NumberUtils.createLong(p.getAdFcode());
  74. Long cwsCode = mCcode + step;
  75. p.setAdCode(cwsCode + "");
  76. } else {
  77. mCcode = NumberUtils.createLong(maxAdCode);
  78. Long cwsCode = mCcode + step;
  79. p.setAdCode(cwsCode + "");
  80. }
  81. // }
  82. AttAdXBaseParam ap = new AttAdXBaseParam();
  83. ap.setAdCode(p.getAdFcode());
  84. AttAdXBase upAd = attAdXBaseDao.getBy(ap);
  85. if (upAd != null) {
  86. p.setUpAdName(upAd.getAdName());
  87. p.setAdFullName(upAd.getAdFullName() + "-" + p.getAdName());
  88. }
  89. }
  90. if ("village".equals(type)) {
  91. transferGeo(p);
  92. }
  93. attAdXBaseDao.insert(p);
  94. return p;
  95. }
  96. @Override
  97. public int modify(AttAdXBase p) throws Exception {
  98. String now = DateUtils.getTodayYMDHMS();
  99. p.setUpdDate(now);
  100. transferGeo(p);
  101. int ret = attAdXBaseDao.update(p);
  102. return ret;
  103. }
  104. public void transferGeo(AttAdXBase p) {
  105. String src = p.getSrc();
  106. if (StringUtils.isNotBlank(src)) {
  107. if ("PC".equalsIgnoreCase(src)) {
  108. if (p.getLgtdpc() != null && p.getLttdpc() != null) {
  109. Map<String, Double> map = GeoUtil.wgs84togcj02(p.getLgtdpc(), p.getLttdpc());
  110. p.setLgtd(map.get("lon"));
  111. p.setLttd(map.get("lat"));
  112. }
  113. } else if ("MOBILE".equalsIgnoreCase(src)) {
  114. if (p.getLgtd() != null && p.getLttd() != null) {
  115. Map<String, Double> map = GeoUtil.gcj02towgs84(p.getLgtd(), p.getLttd());
  116. p.setLgtdpc(map.get("lon"));
  117. p.setLttdpc(map.get("lat"));
  118. }
  119. }
  120. } else {
  121. if (p.getLgtdpc() != null && p.getLttdpc() != null) {
  122. Map<String, Double> map = GeoUtil.wgs84togcj02(p.getLgtdpc(), p.getLttdpc());
  123. p.setLgtd(map.get("lon"));
  124. p.setLttd(map.get("lat"));
  125. } else if (p.getLgtd() != null && p.getLttd() != null) {
  126. Map<String, Double> map = GeoUtil.gcj02towgs84(p.getLgtd(), p.getLttd());
  127. p.setLgtdpc(map.get("lon"));
  128. p.setLttdpc(map.get("lat"));
  129. }
  130. }
  131. }
  132. @Override
  133. public PageInfo<AttAdXBase> queryListByPage(AttAdXBaseParam p) throws Exception {
  134. PageHelper.startPage(p.getPageNum(), p.getPageSize());
  135. List<AttAdXBase> list = attAdXBaseDao.findList(p);
  136. return new PageInfo<AttAdXBase>(list);
  137. }
  138. @Override
  139. public List<AttAdXBase> queryList(AttAdXBaseParam p) throws Exception {
  140. List<AttAdXBase> list = attAdXBaseDao.findList(p);
  141. return list;
  142. }
  143. @Override
  144. public PageInfo<AttAdXTownDto> queryTCList(AttCwsBaseListParam param) throws Exception {
  145. AttAdXBaseParam p = new AttAdXBaseParam();
  146. p.setAdFcode(param.getObjId());
  147. Page page = PageHelper.startPage(param.getPageNum(), param.getPageSize());
  148. List<AttAdXBase> townList = attAdXBaseDao.findList(p);
  149. List<AttAdXTownDto> townDtoList = new ArrayList<>();
  150. for (AttAdXBase town : townList) {
  151. AttAdXTownDto townDto = new AttAdXTownDto();
  152. townDto.setTownName(town.getAdName());
  153. townDto.setTownCode(town.getAdCode());
  154. townDto.setTownFullName(town.getAdFullName());
  155. townDto.setGuid(town.getGuid());
  156. AttAdXBaseParam p1 = new AttAdXBaseParam();
  157. p1.setAdFcode(town.getAdCode());
  158. p1.setIsPoveryt(param.getIsPoverty());
  159. p1.setAdName(param.getName());
  160. List<AttAdXBase> villList = attAdXBaseDao.findList(p1);
  161. List<AttAdXVillageDto> villDtoList = new ArrayList<>();
  162. for (AttAdXBase vill : villList) {
  163. AttAdXVillageDto villageDto = new AttAdXVillageDto();
  164. villageDto.setVillageCode(vill.getAdCode());
  165. villageDto.setVillageName(vill.getAdName());
  166. villageDto.setVillageFullName(vill.getAdFullName());
  167. villageDto.setLgtd(vill.getLgtd());
  168. villageDto.setLttd(vill.getLttd());
  169. villageDto.setLgtdpc(vill.getLttdpc());
  170. villageDto.setIsPoverty(vill.getIsPoveryt());
  171. villageDto.setLttdpc(vill.getLttdpc());
  172. villageDto.setStatus(checkVillageStatus(param.getEngId(), vill.getAdCode()));
  173. villageDto.setGuid(vill.getGuid());
  174. villDtoList.add(villageDto);
  175. }
  176. townDto.setList(villDtoList);
  177. townDtoList.add(townDto);
  178. }
  179. PageInfo pageInfo = new PageInfo<AttAdXTownDto>(townDtoList);
  180. pageInfo.setTotal(page.getTotal());
  181. pageInfo.setPages(page.getPages());
  182. return pageInfo;
  183. }
  184. @Override
  185. public List<AttAdXTownDto> queryTCListLast(QueryTCListParam param) throws Exception {
  186. List<TCListBean> list = attAdXBaseDao.queryTCListLast(param);
  187. List<AttAdXTownDto> townDtoList = new ArrayList<>();
  188. List<String> townCodes = new ArrayList<>();
  189. for (TCListBean bean : list) {
  190. if (!townCodes.contains(bean.getTownCode())) {
  191. townCodes.add(bean.getTownCode());
  192. AttAdXTownDto dto = new AttAdXTownDto();
  193. dto.setGuid(bean.getTownId());
  194. dto.setTownCode(bean.getTownCode());
  195. dto.setTownName(bean.getTownName());
  196. townDtoList.add(dto);
  197. }
  198. }
  199. for (AttAdXTownDto dto : townDtoList) {
  200. List<AttAdXVillageDto> villDtoList = new ArrayList<>();
  201. for (TCListBean bean : list) {
  202. if (dto.getTownCode().equals(bean.getTownCode())) {
  203. AttAdXVillageDto villDto = new AttAdXVillageDto();
  204. villDto.setIsPoverty(bean.getIsPoveryt());
  205. villDto.setGuid(bean.getVillId());
  206. villDto.setVillageName(bean.getVillName());
  207. villDto.setVillageCode(bean.getVillCode());
  208. villDto.setStatus(bean.getStatus());
  209. villDto.setLgtd(bean.getLgtd());
  210. villDto.setLttd(bean.getLttd());
  211. villDto.setLgtdpc(bean.getLgtdpc());
  212. villDto.setLttdpc(bean.getLttdpc());
  213. villDtoList.add(villDto);
  214. }
  215. }
  216. dto.setList(villDtoList);
  217. }
  218. return townDtoList;
  219. }
  220. @Override
  221. public PageInfo<AttAdXTownDto> queryTCList(AttCwsBaseListParamNew param) throws Exception {
  222. AttAdXBaseParam p = new AttAdXBaseParam();
  223. p.setAdFcode(param.getObjId());
  224. Page page = PageHelper.startPage(param.getPageNum(), param.getPageSize());
  225. List<AttAdXBase> townList = attAdXBaseDao.findList(p);
  226. List<AttAdXTownDto> townDtoList = new ArrayList<>();
  227. for (AttAdXBase town : townList) {
  228. AttAdXTownDto townDto = new AttAdXTownDto();
  229. townDto.setTownName(town.getAdName());
  230. townDto.setTownCode(town.getAdCode());
  231. townDto.setTownFullName(town.getAdFullName());
  232. townDto.setGuid(town.getGuid());
  233. AttAdXBaseParam p1 = new AttAdXBaseParam();
  234. p1.setAdFcode(town.getAdCode());
  235. p1.setIsPoveryt(param.getIsPoverty());
  236. p1.setAdName(param.getName());
  237. List<AttAdXBase> villList = attAdXBaseDao.findList(p1);
  238. List<AttAdXVillageDto> villDtoList = new ArrayList<>();
  239. for (AttAdXBase vill : villList) {
  240. AttAdXVillageDto villageDto = new AttAdXVillageDto();
  241. villageDto.setVillageCode(vill.getAdCode());
  242. villageDto.setVillageName(vill.getAdName());
  243. villageDto.setVillageFullName(vill.getAdFullName());
  244. villageDto.setLgtd(vill.getLgtd());
  245. villageDto.setLttd(vill.getLttd());
  246. villageDto.setLgtdpc(vill.getLttdpc());
  247. villageDto.setIsPoverty(vill.getIsPoveryt());
  248. villageDto.setLttdpc(vill.getLttdpc());
  249. villageDto.setStatus(checkVillageStatus(param.getEngId(), vill.getAdCode()));
  250. villageDto.setGuid(vill.getGuid());
  251. villDtoList.add(villageDto);
  252. }
  253. townDto.setList(villDtoList);
  254. townDtoList.add(townDto);
  255. }
  256. PageInfo pageInfo = new PageInfo<AttAdXTownDto>(townDtoList);
  257. pageInfo.setTotal(page.getTotal());
  258. pageInfo.setPages(page.getPages());
  259. return pageInfo;
  260. }
  261. public int checkVillageStatus(String engId, String villageCode) {
  262. int status = 0;
  263. status = bisInspSecsurveyVlgDao.checkVillageStatus(engId, villageCode);
  264. if (status > 0) {
  265. status = 1;
  266. }
  267. return status;
  268. }
  269. /**
  270. * 获取行政区划数据列表
  271. *
  272. * @param attAdXBaseParam
  273. * @return
  274. */
  275. @Override
  276. public List<AttAdXBase> getTableList(AttAdXBaseParam attAdXBaseParam) throws Exception {
  277. return attAdXBaseDao.getTableList(attAdXBaseParam);
  278. }
  279. @Override
  280. public PageInfo<AttAdXBase> getTableListByPage(AttAdXBaseParam attAdXBaseParam) throws Exception {
  281. PageHelper.startPage(attAdXBaseParam.getPageNum(), attAdXBaseParam.getPageSize());
  282. List<AttAdXBase> list = attAdXBaseDao.getTableList(attAdXBaseParam);
  283. return new PageInfo<AttAdXBase>(list);
  284. }
  285. @Override
  286. public List<AttAdXBase> getTargetAdByNodeId(String nodeIds, String persGuid, String province) {
  287. //按逗号切割字符串
  288. if (StringUtils.isNotBlank(nodeIds)) {
  289. String[] nodes = nodeIds.split(",");
  290. if (null != nodes && 0 < nodes.length) {
  291. //查询
  292. return attAdXBaseDao.getTargetAdByNodeId(nodes, persGuid, SqlUtils.getinIdsSql(persGuid, province));
  293. }
  294. } else {
  295. return attAdXBaseDao.getTargetAdByNodeId(null, persGuid, SqlUtils.getinIdsSql(persGuid, province));
  296. }
  297. return null;
  298. }
  299. @Override
  300. public AttAdXBaseNode getAdTreeByAdCd(String adCd, String level) {
  301. AttAdXBaseNode adXBaseNode = new AttAdXBaseNode();
  302. AttAdXBase attAdXBase = attAdXBaseDao.get(adCd);
  303. if (attAdXBase != null) {
  304. adXBaseNode.setId(adCd);
  305. adXBaseNode.setNm(attAdXBase.getAdName());
  306. adXBaseNode.setPid(attAdXBase.getAdFcode());
  307. String grad = attAdXBase.getAdGrad();
  308. int num = 0;
  309. if (StringUtils.isNotBlank(level)) {
  310. num = Integer.parseInt(level);
  311. }
  312. if (StringUtils.isNotBlank(grad)) {
  313. num += Integer.parseInt(grad);
  314. }
  315. List<AttAdXBaseNode> list = attAdXBaseDao.getAllNodeByPid(adCd, num);
  316. list = packNodes(list, adCd);
  317. adXBaseNode.setChildren(list);
  318. }
  319. return adXBaseNode;
  320. }
  321. @Override
  322. public List<AttAdXBaseNode> getAdTreeByAdCdS(String adCdS, String level) {
  323. List<AttAdXBaseNode> list = attAdXBaseDao.getAllNodeByPids(adCdS, level);
  324. if (list != null && list.size() > 0) {
  325. for (int i = 0; i < list.size(); i++) {
  326. List<AttAdXBaseNode> list1 = attAdXBaseDao.getAllNodeByIds(list.get(i).getId());
  327. list.get(i).setChildren(list1);
  328. }
  329. }
  330. return list;
  331. }
  332. @Override
  333. public void exportAdXBase(AttAdXBaseParam attAdXBaseParam, HttpServletResponse response) {
  334. List<AttAdXBase> list = attAdXBaseDao.findList(attAdXBaseParam);
  335. List<Map<String, Object>> mapList = new ArrayList<>();
  336. for (AttAdXBase attAdXBase : list) {
  337. String isPoveryt = attAdXBase.getIsPoveryt();
  338. String adGrad = attAdXBase.getAdGrad();
  339. if ("1".equals(isPoveryt)) {
  340. attAdXBase.setIsPoveryt("是");
  341. } else {
  342. attAdXBase.setIsPoveryt("否");
  343. }
  344. if ("1".equals(adGrad)) {
  345. attAdXBase.setAdGrad("中国");
  346. } else if ("2".equals(adGrad)) {
  347. attAdXBase.setAdGrad("省级");
  348. } else if ("3".equals(adGrad)) {
  349. attAdXBase.setAdGrad("地市级");
  350. } else if ("4".equals(adGrad)) {
  351. attAdXBase.setAdGrad("县级");
  352. } else if ("5".equals(adGrad)) {
  353. attAdXBase.setAdGrad("乡级");
  354. } else if ("6".equals(adGrad)) {
  355. attAdXBase.setAdGrad("村");
  356. }
  357. mapList.add(BeanUtil.transBean2Map(attAdXBase));
  358. }
  359. ExportAbstract export = new ExcelExport();
  360. export.setFileName("行政区划基础信息");
  361. export.setExport_ps_export(true);
  362. export.setExport_ps_type(ExportAbstract.XLS);
  363. export.setExport_bzip(false);
  364. export.setTitle("行政区划基础信息");
  365. ArrayList<Object> cols = new ArrayList<Object>();
  366. cols.add("adCode[行政区划编码]");
  367. cols.add("adName[行政区划名称]");
  368. cols.add("adGrad[行政区划等级]");
  369. cols.add("adFullName[行政区划全称]");
  370. cols.add("adFcode[上级行政区划编码]");
  371. cols.add("upAdName[上级行政区划名称]");
  372. cols.add("isPoveryt[是否贫困]");
  373. export.setCols(cols);
  374. export.setGroupable(false);
  375. // 设置视图指标
  376. export.setLevel(1);
  377. export.setLocksize(0);
  378. try {
  379. export.Export(response);
  380. export.ExportHeadForCustom(response);//导出表头
  381. export.ContinueExport(mapList);
  382. export.EndExport();
  383. } catch (Exception e) {
  384. e.printStackTrace();
  385. }
  386. }
  387. @Override
  388. public List<BisNewDcuserRelVillDto> findZhenList(String code, String rgstrId, String type) {
  389. List<BisZhejiangDcuserRelVill> AllList = attAdXBaseDao.findCunList(code, rgstrId, type);
  390. List<String> zhenList = new ArrayList<>();
  391. for (BisZhejiangDcuserRelVill bisZhejiangDcuserRelVill : AllList) {
  392. String townName = bisZhejiangDcuserRelVill.getTownName();
  393. if (!zhenList.contains(townName)) {
  394. zhenList.add(townName);
  395. }
  396. }
  397. List<BisNewDcuserRelVillDto> dcuserRelVillDtos = new ArrayList<>();
  398. for (String s : zhenList) {
  399. BisNewDcuserRelVillDto dcuserRelVillDto = new BisNewDcuserRelVillDto();
  400. List<BisZhejiangDcuserRelVill> cunList = new ArrayList<>();
  401. String townCode = "";
  402. for (BisZhejiangDcuserRelVill bisZhejiangDcuserRelVill : AllList) {
  403. if (s.equals(bisZhejiangDcuserRelVill.getTownName())) {
  404. cunList.add(bisZhejiangDcuserRelVill);
  405. townCode = bisZhejiangDcuserRelVill.getAdCode();
  406. townCode = townCode.substring(0, townCode.length() - 3);
  407. if (StringUtils.isBlank(bisZhejiangDcuserRelVill.getVillageNm()) &&
  408. StringUtils.isNotBlank(bisZhejiangDcuserRelVill.getAdName())) {
  409. bisZhejiangDcuserRelVill.setVillageNm(bisZhejiangDcuserRelVill.getAdName());
  410. }
  411. if (StringUtils.isNotBlank(bisZhejiangDcuserRelVill.getRegstrId())) {
  412. bisZhejiangDcuserRelVill.setRgstrId(bisZhejiangDcuserRelVill.getRegstrId());
  413. }
  414. if (StringUtils.isNotBlank(bisZhejiangDcuserRelVill.getRgstrId())) {
  415. bisZhejiangDcuserRelVill.setRegstrId(bisZhejiangDcuserRelVill.getRgstrId());
  416. }
  417. }
  418. }
  419. dcuserRelVillDto.setTownCode(townCode);
  420. dcuserRelVillDto.setTownName(s);
  421. dcuserRelVillDto.setDcuserRelVilles(cunList);
  422. dcuserRelVillDtos.add(dcuserRelVillDto);
  423. }
  424. return dcuserRelVillDtos;
  425. }
  426. /**
  427. * 对查询的所有结果递归遍历
  428. */
  429. private List<AttAdXBaseNode> packNodes(List<AttAdXBaseNode> prefectureAll, String code) {
  430. List<AttAdXBaseNode> nodesList = new ArrayList<>();
  431. for (AttAdXBaseNode prefecture : prefectureAll) {
  432. if (code.equals(prefecture.getPid())) {
  433. AttAdXBaseNode nodes = new AttAdXBaseNode();
  434. nodes.setId(prefecture.getId());
  435. nodes.setNm(prefecture.getNm());
  436. nodes.setPid(prefecture.getPid());
  437. nodes.setLevel(prefecture.getLevel());
  438. nodes.setChildren(this.packNodes(prefectureAll, prefecture.getId()
  439. ));
  440. nodesList.add(nodes);
  441. }
  442. }
  443. return nodesList;
  444. }
  445. /**
  446. * 判断村是否处于督查中状态
  447. *
  448. * @param adCode
  449. * @param engId
  450. * @return
  451. */
  452. private boolean isDC(String adCode, String engId) {
  453. boolean result = false;
  454. int num = 0;
  455. num = attAdXBaseDao.getDcVillNum(engId, adCode);
  456. if (num > 0) {
  457. result = true;
  458. }
  459. return result;
  460. }
  461. @Override
  462. public List<AttAdXBase> getAdData(String adCode) {
  463. return this.attAdXBaseDao.getAdData(adCode);
  464. }
  465. @Override
  466. public List<AttAdXBase> getAdDataXj(String adCode) {
  467. return this.attAdXBaseDao.getAdDataXj(adCode);
  468. }
  469. @Override
  470. public List<AttAdXBase> getAdDataByAdCode(String adCodes) {
  471. return this.attAdXBaseDao.getAdDataByAdCode(adCodes);
  472. }
  473. @Override
  474. public void updateLgtdLttd(String adCode) throws IOException {
  475. List<AttAdXBase> attAdXBases = attAdXBaseDao.getAdChild(adCode);
  476. for (AttAdXBase attAdXBase : attAdXBases) {
  477. String fullName = attAdXBase.getAdFullName();
  478. try {
  479. String[] coordinate = new AMapUtil().getCoordinate(fullName);
  480. System.out.println(coordinate[0] + " " + coordinate[1]);//0:经度 1:纬度
  481. AttAdXBase attAdXBaseTemp = new AttAdXBase();
  482. attAdXBaseTemp.setGuid(attAdXBase.getGuid());
  483. attAdXBaseTemp.setLgtd(Double.parseDouble(coordinate[0]));
  484. attAdXBaseTemp.setLttd(Double.parseDouble(coordinate[1]));
  485. attAdXBaseDao.update(attAdXBaseTemp);
  486. } catch (Exception ex) {
  487. ex.getMessage();
  488. } finally {
  489. continue;
  490. }
  491. }
  492. }
  493. }