47 changed files with 339 additions and 399 deletions
@ -1,94 +0,0 @@ |
|||
package com.epmet.opendata.controller; |
|||
|
|||
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ExcelUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.AssertUtils; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.commons.tools.validator.group.AddGroup; |
|||
import com.epmet.commons.tools.validator.group.DefaultGroup; |
|||
import com.epmet.commons.tools.validator.group.UpdateGroup; |
|||
import com.epmet.opendata.dto.form.PreserVationFormDTO; |
|||
import com.epmet.opendata.dto.wgh.BmGridDTO; |
|||
import com.epmet.opendata.excel.BmGridExcel; |
|||
import com.epmet.opendata.service.BmGridService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-06-14 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("bmGrid") |
|||
public class BmGridController { |
|||
|
|||
@Autowired |
|||
private BmGridService bmGridService; |
|||
|
|||
@RequestMapping("page") |
|||
public Result<PageData<BmGridDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<BmGridDTO> page = bmGridService.page(params); |
|||
return new Result<PageData<BmGridDTO>>().ok(page); |
|||
} |
|||
|
|||
@RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) |
|||
public Result<BmGridDTO> get(@PathVariable("id") String id){ |
|||
BmGridDTO data = bmGridService.get(id); |
|||
return new Result<BmGridDTO>().ok(data); |
|||
} |
|||
|
|||
@NoRepeatSubmit |
|||
@PostMapping("save") |
|||
public Result save(@RequestBody BmGridDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
bmGridService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@NoRepeatSubmit |
|||
@PostMapping("update") |
|||
public Result update(@RequestBody BmGridDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
bmGridService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PostMapping("delete") |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
bmGridService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<BmGridDTO> list = bmGridService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, BmGridExcel.class); |
|||
} |
|||
|
|||
/** |
|||
* 调用ruoyi存储bm_grid数据 |
|||
* |
|||
* @param dto |
|||
* @return com.epmet.commons.tools.utils.Result |
|||
* @author LZN |
|||
* @date 2022/6/14 14:16 |
|||
*/ |
|||
@PostMapping("preserBmGridVation") |
|||
public Result getpreserBmGridVation(@RequestBody PreserVationFormDTO dto) { |
|||
bmGridService.getPreserBmGridVation(dto); |
|||
return new Result(); |
|||
} |
|||
} |
@ -1,87 +0,0 @@ |
|||
package com.epmet.opendata.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.constant.FieldConstant; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.opendata.dao.SubdistrictOfficeDao; |
|||
import com.epmet.opendata.dto.wgh.SubdistrictOfficeDTO; |
|||
import com.epmet.opendata.entity.SubdistrictOfficeEntity; |
|||
import com.epmet.opendata.redis.SubdistrictOfficeRedis; |
|||
import com.epmet.opendata.service.SubdistrictOfficeService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-06-14 |
|||
*/ |
|||
@Service |
|||
public class SubdistrictOfficeServiceImpl extends BaseServiceImpl<SubdistrictOfficeDao, SubdistrictOfficeEntity> implements SubdistrictOfficeService { |
|||
|
|||
@Autowired |
|||
private SubdistrictOfficeRedis subdistrictOfficeRedis; |
|||
|
|||
@Override |
|||
public PageData<SubdistrictOfficeDTO> page(Map<String, Object> params) { |
|||
IPage<SubdistrictOfficeEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, SubdistrictOfficeDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<SubdistrictOfficeDTO> list(Map<String, Object> params) { |
|||
List<SubdistrictOfficeEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, SubdistrictOfficeDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<SubdistrictOfficeEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<SubdistrictOfficeEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public SubdistrictOfficeDTO get(String id) { |
|||
SubdistrictOfficeEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, SubdistrictOfficeDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(SubdistrictOfficeDTO dto) { |
|||
SubdistrictOfficeEntity entity = ConvertUtils.sourceToTarget(dto, SubdistrictOfficeEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(SubdistrictOfficeDTO dto) { |
|||
SubdistrictOfficeEntity entity = ConvertUtils.sourceToTarget(dto, SubdistrictOfficeEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,165 @@ |
|||
package com.epmet.opendata.service.impl; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.constant.FieldConstant; |
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.utils.HttpClientManager; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.opendata.dao.WghSubdistrictOfficeDao; |
|||
import com.epmet.opendata.dto.constant.CaWghDataConstant; |
|||
import com.epmet.opendata.dto.form.PreserVationFormDTO; |
|||
import com.epmet.opendata.dto.wgh.SubdistrictOfficeDTO; |
|||
import com.epmet.opendata.entity.CaLoudongEntity; |
|||
import com.epmet.opendata.entity.WghSubdistrictOfficeEntity; |
|||
import com.epmet.opendata.redis.SubdistrictOfficeRedis; |
|||
import com.epmet.opendata.service.WghSubdistrictOfficeService; |
|||
import com.epmet.opendata.util.AesUtils; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-06-14 |
|||
*/ |
|||
@Service |
|||
public class WghSubdistrictOfficeServiceImpl extends BaseServiceImpl<WghSubdistrictOfficeDao, WghSubdistrictOfficeEntity> implements WghSubdistrictOfficeService { |
|||
|
|||
@Autowired |
|||
private SubdistrictOfficeRedis subdistrictOfficeRedis; |
|||
|
|||
@Override |
|||
public PageData<SubdistrictOfficeDTO> page(Map<String, Object> params) { |
|||
IPage<WghSubdistrictOfficeEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, SubdistrictOfficeDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<SubdistrictOfficeDTO> list(Map<String, Object> params) { |
|||
List<WghSubdistrictOfficeEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, SubdistrictOfficeDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<WghSubdistrictOfficeEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<WghSubdistrictOfficeEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public SubdistrictOfficeDTO get(String id) { |
|||
WghSubdistrictOfficeEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, SubdistrictOfficeDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(SubdistrictOfficeDTO dto) { |
|||
WghSubdistrictOfficeEntity entity = ConvertUtils.sourceToTarget(dto, WghSubdistrictOfficeEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(SubdistrictOfficeDTO dto) { |
|||
WghSubdistrictOfficeEntity entity = ConvertUtils.sourceToTarget(dto, WghSubdistrictOfficeEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
@Override |
|||
public void getpreserSubVation(PreserVationFormDTO dto) { |
|||
int i = baseDao.deleteAll(); |
|||
if (i >= 0) { |
|||
dto.setPageNo(NumConstant.ONE); |
|||
dto.setPageSize(NumConstant.FIFTY); |
|||
dto.setTableSchema(CaWghDataConstant.TABLESCHEMA_SHARE); |
|||
dto.setTableName(CaWghDataConstant.SHARE_WGH_SUB); |
|||
|
|||
dto.setWhereCase("1=1"); |
|||
dto.setOrderBy(""); |
|||
|
|||
int pageNo = 1; |
|||
|
|||
int total = 0; |
|||
|
|||
do { |
|||
try { |
|||
total = listSub(dto); |
|||
pageNo++; |
|||
dto.setPageNo(pageNo); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
} |
|||
} while (total > (pageNo * NumConstant.FIFTY)); |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
private int listSub(PreserVationFormDTO dto) throws Exception { |
|||
String aes = AesUtils.encryptByAES(JSONObject.toJSONString(dto), CaWghDataConstant.AESKEY); |
|||
JSONObject obj = new JSONObject(); |
|||
obj.put(CaWghDataConstant.SHARE_CONDITION, aes); |
|||
String data = HttpClientManager.getInstance().sendPostByJSON(CaWghDataConstant.DATA_URL_SHARE, obj.toJSONString()).getData(); |
|||
JSONObject toResult = JSON.parseObject(data); |
|||
Result result = ConvertUtils.mapToEntity(toResult, Result.class); |
|||
if (!result.success()) { |
|||
return dto.getPageNo() + 1; |
|||
} |
|||
|
|||
ReturnDate returnDate = JSONObject.parseObject(JSONObject.toJSONString(result.getData()), ReturnDate.class); |
|||
this.insertBatch(returnDate.getList()); |
|||
return returnDate.getTotal(); |
|||
} |
|||
|
|||
static class ReturnDate { |
|||
|
|||
private int total; |
|||
private List<WghSubdistrictOfficeEntity> list; |
|||
|
|||
|
|||
public int getTotal() { |
|||
return total; |
|||
} |
|||
|
|||
public void setTotal(int total) { |
|||
this.total = total; |
|||
} |
|||
|
|||
public List<WghSubdistrictOfficeEntity> getList() { |
|||
return list; |
|||
} |
|||
|
|||
public void setList(List<WghSubdistrictOfficeEntity> list) { |
|||
this.list = list; |
|||
} |
|||
} |
|||
|
|||
} |
@ -1,22 +0,0 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.opendata.dao.BasegridDao"> |
|||
|
|||
<resultMap type="com.epmet.opendata.entity.BasegridEntity" id="basegridMap"> |
|||
<result property="coordinateInfo" column="坐标信息"/> |
|||
<result property="gridName" column="网格名称"/> |
|||
<result property="subDistrictOffice" column="所属街道办"/> |
|||
<result property="community" column="所属社区"/> |
|||
<result property="streetCode" column="街道编码"/> |
|||
<result property="gridCode" column="网格编码"/> |
|||
<result property="communityCode" column="社区编码"/> |
|||
<result property="longitude" column="longitude"/> |
|||
<result property="latitude" column="latitude"/> |
|||
</resultMap> |
|||
<delete id="deleteAll"> |
|||
delete from BaseGrid |
|||
</delete> |
|||
|
|||
|
|||
</mapper> |
@ -1,50 +0,0 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.opendata.dao.BmGridDao"> |
|||
|
|||
<resultMap type="com.epmet.opendata.entity.BmGridEntity" id="bmGridMap"> |
|||
<result property="gridId" column="grid_id"/> |
|||
<result property="gridCode" column="grid_code"/> |
|||
<result property="gridName" column="grid_name"/> |
|||
<result property="gbCode" column="gb_code"/> |
|||
<result property="parentId" column="parent_id"/> |
|||
<result property="parentCode" column="parent_code"/> |
|||
<result property="gridClassification" column="grid_classification"/> |
|||
<result property="gridLevel" column="grid_level"/> |
|||
<result property="gridProperty" column="grid_property"/> |
|||
<result property="isEnd" column="is_end"/> |
|||
<result property="gridAddress" column="grid_address"/> |
|||
<result property="gridIntroduce" column="grid_introduce"/> |
|||
<result property="gridPicture" column="grid_picture"/> |
|||
<result property="reginScopeDesc" column="regin_scope_desc"/> |
|||
<result property="gridSort" column="grid_sort"/> |
|||
<result property="pointStatus" column="point_status"/> |
|||
<result property="gridEmCenter" column="grid_em_center"/> |
|||
<result property="gridBeginTime" column="grid_begin_time"/> |
|||
<result property="gridEndTime" column="grid_end_time"/> |
|||
<result property="gridArea" column="grid_area"/> |
|||
<result property="isValid" column="is_valid"/> |
|||
<result property="createBy" column="create_by"/> |
|||
<result property="createDate" column="create_date"/> |
|||
<result property="updateBy" column="update_by"/> |
|||
<result property="updateDate" column="update_date"/> |
|||
<result property="deleteFlag" column="delete_flag"/> |
|||
<result property="versions" column="versions"/> |
|||
<result property="attribute1" column="attribute1"/> |
|||
<result property="attribute2" column="attribute2"/> |
|||
<result property="attribute3" column="attribute3"/> |
|||
<result property="attribute4" column="attribute4"/> |
|||
<result property="attribute5" column="attribute5"/> |
|||
<result property="attribute6" column="attribute6"/> |
|||
<result property="attribute7" column="attribute7"/> |
|||
<result property="attribute8" column="attribute8"/> |
|||
<result property="attribute9" column="attribute9"/> |
|||
<result property="attribute10" column="attribute10"/> |
|||
</resultMap> |
|||
<delete id="deleteAll"> |
|||
delete from bm_grid |
|||
</delete> |
|||
|
|||
|
|||
</mapper> |
@ -1,20 +0,0 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.opendata.dao.CommunityDao"> |
|||
|
|||
<resultMap type="com.epmet.opendata.entity.CommunityEntity" id="communityMap"> |
|||
<result property="coordinateInfo" column="坐标信息"/> |
|||
<result property="streetName" column="街道名称"/> |
|||
<result property="streetCode" column="街道编码"/> |
|||
<result property="communityName" column="社区名称"/> |
|||
<result property="communityCode" column="社区编码"/> |
|||
<result property="longitude" column="longitude"/> |
|||
<result property="latitude" column="latitude"/> |
|||
</resultMap> |
|||
<delete id="deleteAll"> |
|||
delete from community |
|||
</delete> |
|||
|
|||
|
|||
</mapper> |
@ -1,15 +0,0 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.opendata.dao.SubdistrictOfficeDao"> |
|||
|
|||
<resultMap type="com.epmet.opendata.entity.SubdistrictOfficeEntity" id="subdistrictOfficeMap"> |
|||
<result property="coordinateInfo" column="坐标信息"/> |
|||
<result property="streetName" column="街道名称"/> |
|||
<result property="streetCode" column="街道代码"/> |
|||
<result property="longitude" column="longitude"/> |
|||
<result property="latitude" column="latitude"/> |
|||
</resultMap> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,11 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.opendata.dao.WghBaseGridDao"> |
|||
|
|||
<delete id="deleteAll"> |
|||
delete from wgh_base_grid |
|||
</delete> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,12 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.opendata.dao.WghBmGridDao"> |
|||
|
|||
|
|||
<delete id="deleteAll"> |
|||
delete from wgh_bm_grid |
|||
</delete> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,12 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.opendata.dao.WghCommunityDao"> |
|||
|
|||
|
|||
<delete id="deleteAll"> |
|||
delete from wgh_community |
|||
</delete> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,10 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.opendata.dao.WghSubdistrictOfficeDao"> |
|||
|
|||
|
|||
<delete id="deleteAll"> |
|||
delete from wgh_subdistrict_office |
|||
</delete> |
|||
</mapper> |
Loading…
Reference in new issue