|
@ -11,14 +11,16 @@ import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.HttpClientManager; |
|
|
import com.epmet.commons.tools.utils.HttpClientManager; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.opendata.dao.WghBmGridDao; |
|
|
|
|
|
|
|
|
import com.epmet.opendata.dao.caBmGridDao; |
|
|
import com.epmet.opendata.dto.constant.CaWghDataConstant; |
|
|
import com.epmet.opendata.dto.constant.CaWghDataConstant; |
|
|
import com.epmet.opendata.dto.form.PreserVationFormDTO; |
|
|
import com.epmet.opendata.dto.form.PreserVationFormDTO; |
|
|
import com.epmet.opendata.dto.wgh.BmGridDTO; |
|
|
import com.epmet.opendata.dto.wgh.BmGridDTO; |
|
|
import com.epmet.opendata.entity.WghBmGridEntity; |
|
|
|
|
|
|
|
|
import com.epmet.opendata.entity.caBmGridEntity; |
|
|
import com.epmet.opendata.redis.BmGridRedis; |
|
|
import com.epmet.opendata.redis.BmGridRedis; |
|
|
|
|
|
|
|
|
import com.epmet.opendata.service.WghBmGridService; |
|
|
import com.epmet.opendata.service.caBmGridService; |
|
|
import com.epmet.opendata.util.AesUtils; |
|
|
import com.epmet.opendata.util.AesUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
@ -36,14 +38,14 @@ import java.util.Map; |
|
|
* @since v1.0.0 2022-06-14 |
|
|
* @since v1.0.0 2022-06-14 |
|
|
*/ |
|
|
*/ |
|
|
@Service |
|
|
@Service |
|
|
public class WghBmGridServiceImpl extends BaseServiceImpl<WghBmGridDao, WghBmGridEntity> implements WghBmGridService { |
|
|
public class CaBmGridServiceImpl extends BaseServiceImpl<caBmGridDao, caBmGridEntity> implements caBmGridService { |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private BmGridRedis bmGridRedis; |
|
|
private BmGridRedis bmGridRedis; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PageData<BmGridDTO> page(Map<String, Object> params) { |
|
|
public PageData<BmGridDTO> page(Map<String, Object> params) { |
|
|
IPage<WghBmGridEntity> page = baseDao.selectPage( |
|
|
IPage<caBmGridEntity> page = baseDao.selectPage( |
|
|
getPage(params, FieldConstant.CREATED_TIME, false), |
|
|
getPage(params, FieldConstant.CREATED_TIME, false), |
|
|
getWrapper(params) |
|
|
getWrapper(params) |
|
|
); |
|
|
); |
|
@ -52,15 +54,15 @@ public class WghBmGridServiceImpl extends BaseServiceImpl<WghBmGridDao, WghBmGri |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public List<BmGridDTO> list(Map<String, Object> params) { |
|
|
public List<BmGridDTO> list(Map<String, Object> params) { |
|
|
List<WghBmGridEntity> entityList = baseDao.selectList(getWrapper(params)); |
|
|
List<caBmGridEntity> entityList = baseDao.selectList(getWrapper(params)); |
|
|
|
|
|
|
|
|
return ConvertUtils.sourceToTarget(entityList, BmGridDTO.class); |
|
|
return ConvertUtils.sourceToTarget(entityList, BmGridDTO.class); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private QueryWrapper<WghBmGridEntity> getWrapper(Map<String, Object> params){ |
|
|
private QueryWrapper<caBmGridEntity> getWrapper(Map<String, Object> params){ |
|
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
|
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
|
|
|
|
|
|
|
|
QueryWrapper<WghBmGridEntity> wrapper = new QueryWrapper<>(); |
|
|
QueryWrapper<caBmGridEntity> wrapper = new QueryWrapper<>(); |
|
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|
|
|
|
|
|
|
|
return wrapper; |
|
|
return wrapper; |
|
@ -68,21 +70,21 @@ public class WghBmGridServiceImpl extends BaseServiceImpl<WghBmGridDao, WghBmGri |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public BmGridDTO get(String id) { |
|
|
public BmGridDTO get(String id) { |
|
|
WghBmGridEntity entity = baseDao.selectById(id); |
|
|
caBmGridEntity entity = baseDao.selectById(id); |
|
|
return ConvertUtils.sourceToTarget(entity, BmGridDTO.class); |
|
|
return ConvertUtils.sourceToTarget(entity, BmGridDTO.class); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void save(BmGridDTO dto) { |
|
|
public void save(BmGridDTO dto) { |
|
|
WghBmGridEntity entity = ConvertUtils.sourceToTarget(dto, WghBmGridEntity.class); |
|
|
caBmGridEntity entity = ConvertUtils.sourceToTarget(dto, caBmGridEntity.class); |
|
|
insert(entity); |
|
|
insert(entity); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void update(BmGridDTO dto) { |
|
|
public void update(BmGridDTO dto) { |
|
|
WghBmGridEntity entity = ConvertUtils.sourceToTarget(dto, WghBmGridEntity.class); |
|
|
caBmGridEntity entity = ConvertUtils.sourceToTarget(dto, caBmGridEntity.class); |
|
|
updateById(entity); |
|
|
updateById(entity); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -107,11 +109,11 @@ public class WghBmGridServiceImpl extends BaseServiceImpl<WghBmGridDao, WghBmGri |
|
|
if (i >= 0) { |
|
|
if (i >= 0) { |
|
|
dto.setPageNo(NumConstant.ONE); |
|
|
dto.setPageNo(NumConstant.ONE); |
|
|
dto.setPageSize(NumConstant.FIFTY); |
|
|
dto.setPageSize(NumConstant.FIFTY); |
|
|
dto.setTableSchema(CaWghDataConstant.TABLESCHEMA_SHARE); |
|
|
dto.setTableSchema(CaWghDataConstant.TABLESCHEMA_UNICOM); |
|
|
dto.setTableName(CaWghDataConstant.SHARE_BM_GRID); |
|
|
dto.setTableName(CaWghDataConstant.SHARE_BM_GRID); |
|
|
|
|
|
|
|
|
dto.setWhereCase("delete_flag = 'normal'"); |
|
|
dto.setWhereCase("delete_flag = 'normal'"); |
|
|
dto.setOrderBy("grid_id,parent_id,create_date"); |
|
|
dto.setOrderBy("grid_id"); |
|
|
|
|
|
|
|
|
int pageNo = 1; |
|
|
int pageNo = 1; |
|
|
|
|
|
|
|
@ -132,8 +134,8 @@ public class WghBmGridServiceImpl extends BaseServiceImpl<WghBmGridDao, WghBmGri |
|
|
private int listBmGrid(PreserVationFormDTO dto) throws Exception { |
|
|
private int listBmGrid(PreserVationFormDTO dto) throws Exception { |
|
|
String aes = AesUtils.encryptByAES(JSONObject.toJSONString(dto), CaWghDataConstant.AESKEY); |
|
|
String aes = AesUtils.encryptByAES(JSONObject.toJSONString(dto), CaWghDataConstant.AESKEY); |
|
|
JSONObject obj = new JSONObject(); |
|
|
JSONObject obj = new JSONObject(); |
|
|
obj.put(CaWghDataConstant.SHARE_CONDITION, aes); |
|
|
obj.put(CaWghDataConstant.UNICOM_CONDITION, aes); |
|
|
String data = HttpClientManager.getInstance().sendPostByJSON(CaWghDataConstant.DATA_URL_SHARE, obj.toJSONString()).getData(); |
|
|
String data = HttpClientManager.getInstance().sendPostByJSON(CaWghDataConstant.DATA_URL_UNICON, obj.toJSONString()).getData(); |
|
|
JSONObject toResult = JSON.parseObject(data); |
|
|
JSONObject toResult = JSON.parseObject(data); |
|
|
Result result = ConvertUtils.mapToEntity(toResult, Result.class); |
|
|
Result result = ConvertUtils.mapToEntity(toResult, Result.class); |
|
|
if (!result.success()) { |
|
|
if (!result.success()) { |
|
@ -147,7 +149,7 @@ public class WghBmGridServiceImpl extends BaseServiceImpl<WghBmGridDao, WghBmGri |
|
|
|
|
|
|
|
|
static class ReturnDate { |
|
|
static class ReturnDate { |
|
|
private int total; |
|
|
private int total; |
|
|
private List<WghBmGridEntity> list; |
|
|
private List<caBmGridEntity> list; |
|
|
|
|
|
|
|
|
public int getTotal() { |
|
|
public int getTotal() { |
|
|
return total; |
|
|
return total; |
|
@ -157,11 +159,11 @@ public class WghBmGridServiceImpl extends BaseServiceImpl<WghBmGridDao, WghBmGri |
|
|
this.total = total; |
|
|
this.total = total; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public List<WghBmGridEntity> getList() { |
|
|
public List<caBmGridEntity> getList() { |
|
|
return list; |
|
|
return list; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void setList(List<WghBmGridEntity> list) { |
|
|
public void setList(List<caBmGridEntity> list) { |
|
|
this.list = list; |
|
|
this.list = list; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |