推送修复
This commit is contained in:
+27
-13
@@ -27,10 +27,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -54,13 +51,23 @@ public class ErpEnterpriseUnitApplicationService {
|
|||||||
erpEnterpriseUnitDO.setTopOrganizationId(topOrganizationId);
|
erpEnterpriseUnitDO.setTopOrganizationId(topOrganizationId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PageHelper.startPage(erpEnterpriseUnitDO.getPageNum(),erpEnterpriseUnitDO.getPageSize());
|
|
||||||
List<ErpEnterpriseUnitPO> list = erpEnterpriseUnitMapper.queryList(erpEnterpriseUnitDO);
|
List<ErpEnterpriseUnitPO> list = erpEnterpriseUnitMapper.queryList(erpEnterpriseUnitDO);
|
||||||
Page<ErpEnterpriseUnitPO> page = (Page<ErpEnterpriseUnitPO>) list;
|
|
||||||
TableDataInfo tableDataInfo = new TableDataInfo();
|
TableDataInfo tableDataInfo = new TableDataInfo();
|
||||||
tableDataInfo.setData(list);
|
|
||||||
tableDataInfo.setTotal(page.getTotal());
|
|
||||||
tableDataInfo.setCode(200);
|
tableDataInfo.setCode(200);
|
||||||
|
|
||||||
|
// 判断是否是分页对象(PageHelper 返回的是 Page 类型)
|
||||||
|
if (list instanceof Page) {
|
||||||
|
Page<ErpEnterpriseUnitPO> page = (Page<ErpEnterpriseUnitPO>) list;
|
||||||
|
tableDataInfo.setData(page.getResult()); // 获取实际数据列表
|
||||||
|
tableDataInfo.setTotal(page.getTotal()); // 获取总记录数
|
||||||
|
} else {
|
||||||
|
// 如果没有分页,返回全部数据
|
||||||
|
tableDataInfo.setData(list);
|
||||||
|
tableDataInfo.setTotal((long) list.size());
|
||||||
|
}
|
||||||
|
|
||||||
return tableDataInfo;
|
return tableDataInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,14 +116,21 @@ public class ErpEnterpriseUnitApplicationService {
|
|||||||
StringBuilder failMsg = new StringBuilder();
|
StringBuilder failMsg = new StringBuilder();
|
||||||
|
|
||||||
for (ErpEnterpriseUnitDTO dto : dtoList) {
|
for (ErpEnterpriseUnitDTO dto : dtoList) {
|
||||||
Map<String, String> body = new HashMap<>();
|
// Map<String, String> body = new HashMap<>();
|
||||||
body.put("erpUnitCode", dto.getErpCode());
|
// body.put("erpUnitCode", dto.getErpCode());
|
||||||
body.put("erpUnitName", dto.getErpName());
|
// body.put("erpUnitName", dto.getErpName());
|
||||||
|
|
||||||
|
Map<String, String> item = new HashMap<>();
|
||||||
|
item.put("erpUnitCode", dto.getErpCode());
|
||||||
|
item.put("erpUnitName", dto.getErpName());
|
||||||
|
List<Map<String,String>> bodyList = new ArrayList<>();
|
||||||
|
bodyList.add(item);
|
||||||
|
|
||||||
|
|
||||||
GwLog gwLog = new GwLog();
|
GwLog gwLog = new GwLog();
|
||||||
gwLog.setType("企业单位");
|
gwLog.setType("企业单位");
|
||||||
gwLog.setBusinessId(Long.valueOf(dto.getId()));
|
gwLog.setBusinessId(Long.valueOf(dto.getId()));
|
||||||
gwLog.setRequestBody(JSONObject.toJSONString(body));
|
gwLog.setRequestBody(JSONObject.toJSONString(bodyList));
|
||||||
gwLog.setResponseBody("");
|
gwLog.setResponseBody("");
|
||||||
gwLog.setStatus(1);
|
gwLog.setStatus(1);
|
||||||
gwLog.setSendTime(new Date());
|
gwLog.setSendTime(new Date());
|
||||||
@@ -132,7 +146,7 @@ public class ErpEnterpriseUnitApplicationService {
|
|||||||
|
|
||||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||||
HttpPost httpPost = new HttpPost(PUSH_API_URL);
|
HttpPost httpPost = new HttpPost(PUSH_API_URL);
|
||||||
StringEntity postingString = new StringEntity(JSONObject.toJSONString(body), "UTF-8");
|
StringEntity postingString = new StringEntity(JSONObject.toJSONString(bodyList), "UTF-8");
|
||||||
httpPost.setEntity(postingString);
|
httpPost.setEntity(postingString);
|
||||||
httpPost.setHeader("Content-type", "application/json");
|
httpPost.setHeader("Content-type", "application/json");
|
||||||
httpPost.setHeader("apiName", API_NAME);
|
httpPost.setHeader("apiName", API_NAME);
|
||||||
|
|||||||
+1
-1
@@ -46,7 +46,7 @@ public class ErpEnterpriseUnitDO extends BaseVOEntity {
|
|||||||
private String createTimeTo;
|
private String createTimeTo;
|
||||||
|
|
||||||
@ApiModelProperty(value = "页码")
|
@ApiModelProperty(value = "页码")
|
||||||
private Integer pageNum = 1;
|
private Integer pageNo = 1;
|
||||||
|
|
||||||
@ApiModelProperty(value = "每页数量")
|
@ApiModelProperty(value = "每页数量")
|
||||||
private Integer pageSize = 10;
|
private Integer pageSize = 10;
|
||||||
|
|||||||
-5
@@ -45,10 +45,5 @@ public class ErpEnterpriseUnitDTO {
|
|||||||
@ApiModelProperty(value = "创建时间止")
|
@ApiModelProperty(value = "创建时间止")
|
||||||
private String createTimeTo;
|
private String createTimeTo;
|
||||||
|
|
||||||
@ApiModelProperty(value = "页码")
|
|
||||||
private Integer pageNum = 1;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "每页数量")
|
|
||||||
private Integer pageSize = 10;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-2
@@ -1,6 +1,7 @@
|
|||||||
package com.mhd.oms.interfaces.facade.erpEnterpriseUnit;
|
package com.mhd.oms.interfaces.facade.erpEnterpriseUnit;
|
||||||
|
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.mhd.common.core.web.controller.BaseController;
|
import com.mhd.common.core.web.controller.BaseController;
|
||||||
import com.mhd.common.core.web.domain.AjaxResult;
|
import com.mhd.common.core.web.domain.AjaxResult;
|
||||||
import com.mhd.common.core.web.page.TableDataInfo;
|
import com.mhd.common.core.web.page.TableDataInfo;
|
||||||
@@ -35,9 +36,11 @@ public class ErpEnterpriseUnitApi extends BaseController {
|
|||||||
|
|
||||||
@ApiOperation("查询企业单位列表")
|
@ApiOperation("查询企业单位列表")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(ErpEnterpriseUnitDTO erpEnterpriseUnitDTO){
|
public TableDataInfo list(ErpEnterpriseUnitDTO erpEnterpriseUnitDTO,
|
||||||
|
@RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo,
|
||||||
|
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize){
|
||||||
ErpEnterpriseUnitDO erpEnterpriseUnitDO = erpEnterpriseUnitAssembler.toDO(erpEnterpriseUnitDTO);
|
ErpEnterpriseUnitDO erpEnterpriseUnitDO = erpEnterpriseUnitAssembler.toDO(erpEnterpriseUnitDTO);
|
||||||
startPage();
|
PageHelper.startPage(pageNo, pageSize);
|
||||||
return erpEnterpriseUnitApplicationService.queryList(erpEnterpriseUnitDO);
|
return erpEnterpriseUnitApplicationService.queryList(erpEnterpriseUnitDO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user