Browse Source

修改报表

dev
zxc 3 years ago
parent
commit
7b8d036f6c
  1. 1
      epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/JiMuResult.java
  2. 6
      epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java
  3. 15
      epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java
  4. 2
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java
  5. 28
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java
  6. 3
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml

1
epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/JiMuResult.java

@ -16,4 +16,5 @@ public class JiMuResult<T> {
private String message = ""; private String message = "";
private Integer code = 0; private Integer code = 0;
private T result; private T result;
private T data;
} }

6
epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java

@ -4,10 +4,8 @@ import com.epmet.commons.feignclient.dtos.JiMuPage;
import com.epmet.commons.feignclient.dtos.JiMuResult; import com.epmet.commons.feignclient.dtos.JiMuResult;
import com.epmet.commons.feignclient.dtos.form.JiMuReportFormDTO; import com.epmet.commons.feignclient.dtos.form.JiMuReportFormDTO;
import com.epmet.commons.feignclient.dtos.result.JiMuReportDetailResultDTO; import com.epmet.commons.feignclient.dtos.result.JiMuReportDetailResultDTO;
import com.epmet.commons.feignclient.dtos.result.JiMuReportResultDTO;
import com.epmet.commons.feignclient.feigns.fallback.JiMuReportOpenFeignClientFallbackFactory; import com.epmet.commons.feignclient.feigns.fallback.JiMuReportOpenFeignClientFallbackFactory;
import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -15,6 +13,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import java.util.Map;
/** /**
* @Author zxc * @Author zxc
* @DateTime 2022/8/8 13:52 * @DateTime 2022/8/8 13:52
@ -33,6 +33,6 @@ public interface JiMuReportOpenFeignClient {
@RequestHeader MultiValueMap<String, String> headers); @RequestHeader MultiValueMap<String, String> headers);
@GetMapping("jmreport/show") @GetMapping("jmreport/show")
Result<JiMuReportResultDTO> getReport(@RequestBody JiMuReportFormDTO formDTO); JiMuResult<Map<String,Object>> getReport(@RequestBody JiMuReportFormDTO formDTO);
} }

15
epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java

@ -4,14 +4,10 @@ import com.epmet.commons.feignclient.dtos.JiMuPage;
import com.epmet.commons.feignclient.dtos.JiMuResult; import com.epmet.commons.feignclient.dtos.JiMuResult;
import com.epmet.commons.feignclient.dtos.form.JiMuReportFormDTO; import com.epmet.commons.feignclient.dtos.form.JiMuReportFormDTO;
import com.epmet.commons.feignclient.dtos.result.JiMuReportDetailResultDTO; import com.epmet.commons.feignclient.dtos.result.JiMuReportDetailResultDTO;
import com.epmet.commons.feignclient.dtos.result.JiMuReportResultDTO;
import com.epmet.commons.feignclient.feigns.JiMuReportOpenFeignClient; import com.epmet.commons.feignclient.feigns.JiMuReportOpenFeignClient;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam; import java.util.Map;
/** /**
* @Author zxc * @Author zxc
@ -22,12 +18,13 @@ public class JiMuReportOpenFeignClientFallback implements JiMuReportOpenFeignCli
@Override @Override
public JiMuResult<JiMuPage<JiMuReportDetailResultDTO>> getList(Integer pageNo, Integer pageSize, String name, String reportType, String token, MultiValueMap<String, String> headers) { public JiMuResult<JiMuPage<JiMuReportDetailResultDTO>> getList(Integer pageNo, Integer pageSize, String name, String reportType, String token, MultiValueMap<String, String> headers) {
JiMuResult<JiMuPage<JiMuReportDetailResultDTO>> rst = new JiMuResult<>(false, "请求失败", 200, null); JiMuResult<JiMuPage<JiMuReportDetailResultDTO>> rst = new JiMuResult<>(false, "请求失败", 200, null,null);
return rst; return rst;
} }
@Override @Override
public Result<JiMuReportResultDTO> getReport(JiMuReportFormDTO formDTO) { public JiMuResult<Map<String,Object>> getReport(JiMuReportFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_JM_REPORT, "getReport",formDTO); JiMuResult<Map<String,Object>> rst = new JiMuResult<>(false, "请求失败", 200, null,null);
return rst;
} }
} }

2
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java

@ -33,7 +33,7 @@ public interface IcCustomerReportDao extends BaseDao<IcCustomerReportEntity> {
*/ */
List<String> getIdsByCustomer(@Param("customerIds") List<String> customerIds,@Param("reportId") String reportId); List<String> getIdsByCustomer(@Param("customerIds") List<String> customerIds,@Param("reportId") String reportId);
void delCustomerReport(@Param("customerIds") List<String> customerIds); void delCustomerReport(@Param("customerIds") List<String> customerIds,@Param("reportId")String reportId);
void delCustomerReportFun(@Param("reportIds") List<String> reportIds); void delCustomerReportFun(@Param("reportIds") List<String> reportIds);

28
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java

@ -87,28 +87,19 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl<IcCustomerRepor
*/ */
@Override @Override
public List<ReportResultDTO> reportList() { public List<ReportResultDTO> reportList() {
String authorization = EpmetRequestHolder.getHeader("Authorization"); String authorization = EpmetRequestHolder.getHeader("Authorization");
// 自定义header传递 // 自定义header传递
MultiValueMap<String, String> headers = new HttpHeaders(); MultiValueMap<String, String> headers = new HttpHeaders();
headers.add("token", authorization); headers.add("token", authorization);
JiMuResult<JiMuPage<JiMuReportDetailResultDTO>> result = jiMuReportOpenFeignClient.getList(1, 10000, "", "datainfo", authorization, headers); JiMuResult<JiMuPage<JiMuReportDetailResultDTO>> result = jiMuReportOpenFeignClient.getList(1, 10000, "", "datainfo", authorization, headers);
if (!result.isSuccess()){
// todo 下面的删掉吧
Result<String> url = getUrl(2, null);
log.info("所有jm报表"+url);
Map<String,Object> map = JSON.parseObject(url.getData(), Map.class);
if (!map.containsValue(true)){
throw new EpmetException("获取所有jm报表失败"); throw new EpmetException("获取所有jm报表失败");
} }
Map<String,Object> map2 = (Map<String,Object>)map.get("result"); List<Map<String,Object>> records = (List<Map<String,Object>>)result.getResult().getRecords();
List<Map<String,Object>> map3 = (List<Map<String,Object>>) map2.get("records");
List<JiMuReportResultDTO> allReports = new ArrayList<>(); List<JiMuReportResultDTO> allReports = new ArrayList<>();
map3.forEach(m -> { for (Map<String, Object> record : records) {
allReports.add(ConvertUtils.mapToEntity(m,JiMuReportResultDTO.class)); allReports.add(ConvertUtils.mapToEntity(record,JiMuReportResultDTO.class));
}); }
if (CollectionUtils.isEmpty(allReports)){ if (CollectionUtils.isEmpty(allReports)){
return new ArrayList<>(); return new ArrayList<>();
} }
@ -174,9 +165,9 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl<IcCustomerRepor
} }
if (formDTO.getType().equals(CustomerFunctionConstant.REPORT_EDIT)){ if (formDTO.getType().equals(CustomerFunctionConstant.REPORT_EDIT)){
// 单个编辑 // 单个编辑
baseDao.delCustomerReport(Arrays.asList(formDTO.getCustomerList().get(NumConstant.ZERO).getCustomerId())); baseDao.delCustomerReport(Arrays.asList(formDTO.getCustomerList().get(NumConstant.ZERO).getCustomerId()), formDTO.getReportId());
}else if (formDTO.getType().equals(CustomerFunctionConstant.REPORT_ADD)){ }else if (formDTO.getType().equals(CustomerFunctionConstant.REPORT_ADD)){
baseDao.delCustomerReport(null); baseDao.delCustomerReport(null, formDTO.getReportId());
} }
baseDao.delCustomerReportFun(reportIds); baseDao.delCustomerReportFun(reportIds);
if (CollectionUtils.isNotEmpty(formDTO.getCustomerList())){ if (CollectionUtils.isNotEmpty(formDTO.getCustomerList())){
@ -218,6 +209,7 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl<IcCustomerRepor
recordIds.forEach(r -> { recordIds.forEach(r -> {
JiMuReportFormDTO form = new JiMuReportFormDTO(); JiMuReportFormDTO form = new JiMuReportFormDTO();
form.setId(r); form.setId(r);
JiMuResult<Map<String, Object>> report = jiMuReportOpenFeignClient.getReport(form);
Result<String> url = getUrl(NumConstant.ONE, r); Result<String> url = getUrl(NumConstant.ONE, r);
log.info("模板详情"+url); log.info("模板详情"+url);
Map<String,Object> map = JSON.parseObject(url.getData(), Map.class); Map<String,Object> map = JSON.parseObject(url.getData(), Map.class);
@ -254,8 +246,8 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl<IcCustomerRepor
Result<String> result; Result<String> result;
try { try {
InetAddress localHost = InetAddress.getLocalHost(); InetAddress localHost = InetAddress.getLocalHost();
add = "http://"+localHost.getHostAddress()+":8118"; // add = "http://"+localHost.getHostAddress()+":8118";
System.out.println(add); add = "http://"+"192.168.1.141"+":8118";
}catch (Exception e){ }catch (Exception e){
log.warn("获取url失败"); log.warn("获取url失败");
} }

3
epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml

@ -5,8 +5,9 @@
<delete id="delCustomerReport"> <delete id="delCustomerReport">
DELETE FROM ic_customer_report DELETE FROM ic_customer_report
WHERE REPORT_ID = #{reportId}
<if test="null != customerIds and customerIds.size() > 0"> <if test="null != customerIds and customerIds.size() > 0">
WHERE CUSTOMER_ID IN ( AND CUSTOMER_ID IN (
<foreach collection="customerIds" item="c" separator=","> <foreach collection="customerIds" item="c" separator=",">
#{c} #{c}
</foreach> </foreach>

Loading…
Cancel
Save