|
@ -17,27 +17,33 @@ |
|
|
|
|
|
|
|
|
package com.elink.esua.epdc.modules.share.service.impl; |
|
|
package com.elink.esua.epdc.modules.share.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|
|
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|
|
|
|
|
import com.elink.esua.epdc.commons.tools.constant.NumConstant; |
|
|
|
|
|
import com.elink.esua.epdc.commons.tools.exception.RenException; |
|
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
|
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
|
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
|
|
import com.elink.esua.epdc.constant.EventZwyDataConstant; |
|
|
import com.elink.esua.epdc.dto.share.ShareEnterpriseDTO; |
|
|
import com.elink.esua.epdc.dto.share.ShareEnterpriseDTO; |
|
|
|
|
|
import com.elink.esua.epdc.dto.share.form.PreserVationFormDTO; |
|
|
import com.elink.esua.epdc.dto.share.form.ShareEnterpriseFormDTO; |
|
|
import com.elink.esua.epdc.dto.share.form.ShareEnterpriseFormDTO; |
|
|
import com.elink.esua.epdc.dto.share.result.ShareEnterpriseResultDTO; |
|
|
import com.elink.esua.epdc.dto.share.result.ShareEnterpriseResultDTO; |
|
|
import com.elink.esua.epdc.modules.share.dao.ShareEnterpriseDao; |
|
|
import com.elink.esua.epdc.modules.share.dao.ShareEnterpriseDao; |
|
|
import com.elink.esua.epdc.modules.share.entity.ShareEnterpriseEntity; |
|
|
import com.elink.esua.epdc.modules.share.entity.ShareEnterpriseEntity; |
|
|
import com.elink.esua.epdc.modules.share.service.ShareEnterpriseService; |
|
|
import com.elink.esua.epdc.modules.share.service.ShareEnterpriseService; |
|
|
|
|
|
import com.elink.esua.epdc.modules.share.util.AesUtils; |
|
|
|
|
|
import com.elink.esua.httpclient.HttpClientUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
import java.util.*; |
|
|
import java.util.HashMap; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 政务网企业信息表 |
|
|
* 政务网企业信息表 |
|
@ -48,6 +54,9 @@ import java.util.Map; |
|
|
@Service |
|
|
@Service |
|
|
public class ShareEnterpriseServiceImpl extends BaseServiceImpl<ShareEnterpriseDao, ShareEnterpriseEntity> implements ShareEnterpriseService { |
|
|
public class ShareEnterpriseServiceImpl extends BaseServiceImpl<ShareEnterpriseDao, ShareEnterpriseEntity> implements ShareEnterpriseService { |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private HttpClientUtils httpClientUtils; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PageData<ShareEnterpriseDTO> page(Map<String, Object> params) { |
|
|
public PageData<ShareEnterpriseDTO> page(Map<String, Object> params) { |
|
|
IPage<ShareEnterpriseEntity> page = baseDao.selectPage( |
|
|
IPage<ShareEnterpriseEntity> page = baseDao.selectPage( |
|
@ -82,11 +91,12 @@ public class ShareEnterpriseServiceImpl extends BaseServiceImpl<ShareEnterpriseD |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public List<ShareEnterpriseResultDTO> getCompany(ShareEnterpriseFormDTO formDTO) { |
|
|
public PageData<ShareEnterpriseDTO> getCompany(ShareEnterpriseFormDTO formDTO) { |
|
|
Map<String, Object> params = new HashMap<>(4); |
|
|
Map<String, Object> params = new HashMap<>(4); |
|
|
params.put("entName", formDTO.getEntName()); |
|
|
params.put("entName", formDTO.getEntName()); |
|
|
List<ShareEnterpriseDTO> list = list(params); |
|
|
params.put("page", formDTO.getPage()); |
|
|
return ConvertUtils.sourceToTarget(list, ShareEnterpriseResultDTO.class); |
|
|
params.put("limit", formDTO.getLimit()); |
|
|
|
|
|
return page(params); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -110,4 +120,41 @@ public class ShareEnterpriseServiceImpl extends BaseServiceImpl<ShareEnterpriseD |
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
public void saveCompany() { |
|
|
|
|
|
PreserVationFormDTO dto = new PreserVationFormDTO(); |
|
|
|
|
|
dto.setTableSchema(EventZwyDataConstant.TABLESCHEMA_SHARE); |
|
|
|
|
|
dto.setTableName(EventZwyDataConstant.SHARE_QYDJ_JBXX); |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
String aes = AesUtils.encryptByAES(JSONObject.toJSONString(dto), EventZwyDataConstant.AESKEY); |
|
|
|
|
|
JSONObject obj = new JSONObject(); |
|
|
|
|
|
obj.put(EventZwyDataConstant.SHARE_CONDITION, aes); |
|
|
|
|
|
String data = httpClientUtils.sendPostByJSONAndHeader(EventZwyDataConstant.DATA_URL_COMPANY, obj.toJSONString(), new HashMap<>()).getResult(); |
|
|
|
|
|
if (null == data) { |
|
|
|
|
|
throw new RenException("企业信息请求失败"); |
|
|
|
|
|
} |
|
|
|
|
|
JSONObject toResult = JSON.parseObject(data); |
|
|
|
|
|
if (!toResult.containsKey("data")) { |
|
|
|
|
|
throw new RenException("企业信息拉取失败"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
JSONArray jsonArray = JSON.parseArray(toResult.get("data").toString()); |
|
|
|
|
|
|
|
|
|
|
|
List<ShareEnterpriseEntity> entityList = new ArrayList<>(); |
|
|
|
|
|
if (jsonArray.size() > NumConstant.ZERO) { |
|
|
|
|
|
jsonArray.forEach(item -> entityList.add(JSONObject.parseObject(JSONObject.toJSONString(item), ShareEnterpriseEntity.class))); |
|
|
|
|
|
} |
|
|
|
|
|
// 先清空表
|
|
|
|
|
|
baseDao.deleteAll(); |
|
|
|
|
|
// 批量插入
|
|
|
|
|
|
insertBatch(entityList); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |